Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ComponentsRuleEngine

A helper class that runs a decision engine that decides what is the correct distribution of UI components given the information about proxemics, device capabilities, and whether the user has selected to use automatic or manual distribution of the components.

Hierarchy

  • ComponentsRuleEngine

Index

Constructors

constructor

  • new ComponentsRuleEngine(localInstanceUuid: string, localDeviceUuid: string, restrictions?: any, proxemics?: {}, instances?: any[]): ComponentsRuleEngine
  • Constructor that creates a ComponentsRuleEngine instance.

    todo

    Define a somewhat formal specification of the structure of this object.

    todo

    Formalize the device capabilities object structure.

    Parameters

    • localInstanceUuid: string

      The UUID of the locally running Instance.

    • localDeviceUuid: string

      The UUID of the local device Device.

    • restrictions: any = {}

      An object with the set of restrictions that must met when ditributing the UI components automatically. If no restrictions are provided, an empty restrictions object is assumed.

    • proxemics: {} = {}

      The proxemic information and capabilities of a device, i.e., if a device is present in the environment this object should contain a key with its UUID that points to an object that represents the device capabilities. If no proxemics are provided, an empty proxemics object is assumed.

      • [deviceUuid: string]: any
    • instances: any[] = []

      An array of the instances that the user currently has access to. If no instance are provided, an empty array of instances is assumed.

    Returns ComponentsRuleEngine

Properties

Private _R

_R: any
todo

Document private property.

Private _currentComponentsDistribution

_currentComponentsDistribution: {}
todo

Document private property.

Type declaration

  • [key: string]: boolean

Private _instances

_instances: any[]
todo

Document private property.

Private _localDeviceUuid

_localDeviceUuid: string
todo

Document private property.

Private _localInstanceUuid

_localInstanceUuid: string
todo

Document private property.

Private _proxemics

_proxemics: any
todo

Document private property.

Private _restrictions

_restrictions: any
todo

Document private property.

Static Private expandDeviceCapabilities

expandDeviceCapabilities: Function = ...

Infer additional device capabilities from the ones that are known.

Static Private matchComponentAndRestrictions

matchComponentAndRestrictions: Function = ...

Matches a certain components agains all the information about devices, restrictions and proxemics to determine whether it should be shown (true) or not (false).

Accessors

Private R

  • get R(): any
  • set R(R: any): void

currentComponentsDistribution

  • get currentComponentsDistribution(): {}
  • set currentComponentsDistribution(currentComponentsDistribution: {}): void
  • "Getter" and "setter" of an object representing the distribution of components of the local instance where the keys represent the name of the components and the boolean values represent whether the components is shown (true) or not (false).

    Returns {}

    • [key: string]: boolean
  • "Getter" and "setter" of an object representing the distribution of components of the local instance where the keys represent the name of the components and the boolean values represent whether the components is shown (true) or not (false).

    Parameters

    • currentComponentsDistribution: {}
      • [key: string]: boolean

    Returns void

instances

  • get instances(): any[]
  • set instances(instance: any[]): void
  • "Getter" and "setter" of the array of instances that the user currently has access to.

    Returns any[]

  • "Getter" and "setter" of the array of instances that the user currently has access to.

    Parameters

    • instance: any[]

    Returns void

localDeviceUuid

  • get localDeviceUuid(): string
  • set localDeviceUuid(localDeviceUuid: string): void

localInstanceUuid

  • get localInstanceUuid(): string
  • set localInstanceUuid(instanceUuid: string): void

proxemics

  • get proxemics(): any
  • set proxemics(proxemics: any): void
  • "Getter" and "setter" of the proxemic information and capabilities of a device, i.e., if a device is present in the environment this object should contain a key with its UUID that points to an object that represents the device capabilities.

    Returns any

  • "Getter" and "setter" of the proxemic information and capabilities of a device, i.e., if a device is present in the environment this object should contain a key with its UUID that points to an object that represents the device capabilities.

    Parameters

    • proxemics: any

    Returns void

restrictions

  • get restrictions(): any
  • set restrictions(restrictions: any): void
  • "Getter" and "setter" of the object with the set of restrictions that must met when ditributing the UI components automatically.

    Returns any

  • "Getter" and "setter" of the object with the set of restrictions that must met when ditributing the UI components automatically.

    Parameters

    • restrictions: any

    Returns void

Methods

Private initRuleEngine

  • initRuleEngine(): void

run

  • run(ignoreManual?: boolean): Promise<any>
  • Runs the distribution algorithm using the information currently stored on the ComponentsRuleEngine properties.

    Parameters

    • ignoreManual: boolean = false

      Whether it shoud ignore the manual distribution, forcing automatic distribtution to be performed anyway (true). By default the indication whether the current distribution is ignored is false.

    Returns Promise<any>

    A Promise that once resolved contains information about the facts and inference steps that were taken to reach a result. The value that a developer should most likely be interested in is data of componentsConfig which contain a { [component: string]: boolean } object with information whether a component with a certain key should be shown (true) or hidden (false). If an error occurs the Promise will be rejected.

Static Private __expandDeviceCapabilities

  • __expandDeviceCapabilities(deviceUuid: string, capabilities: any): any[]

Static Private __matchComponentAndRestrictions

  • __matchComponentAndRestrictions(component: string, componentRestrictions: any, localDeviceUuid: string, localDeviceCapabilities: any, capabilities: any, strictMatching?: boolean): boolean
  • Matches a certain components agains all the information about devices, restrictions and proxemics to determine whether it should be shown (true) or not (false). Unmemorized version of ComponentsRuleEngine.matchComponentAndRestrictions

    todo

    Document the method parameters.

    Parameters

    • component: string
    • componentRestrictions: any
    • localDeviceUuid: string
    • localDeviceCapabilities: any
    • capabilities: any
    • strictMatching: boolean = true

    Returns boolean

    true if the component should be shown, false otherwise.

Generated using TypeDoc