Home   :   Matrix Language   :   Primitive Action Statements   :   Context Test Statements

Context Test Statements

 

Statements

 

ContextOr

ContextAnd

ContextNor

ContextNand

 

 

General

 

Matrix relational operators allowed:

 

==  - Equal To

!=  - Not Equal To

 

The "..." symbol below equates to a single test, for example:

 

Floor == Floor^1

 

The context statements enable the same entity object in different contexts to be compared for equivalence.

 

The Current Context is built up by navigating through entities.  If the navigation encounters a previously navigated entity then the Surface Context no longer includes the earlier entity context.

 

The hat "^" notation or modifier allows access to the Hidden Context entity.  The number to the right hand side of the hat symbol indicates how many context entity levels are to be skipped to target the required entity context.

 

The entity signifier Entity is shorthand for Entity^0.  The appropriate form should be used where a consistent look is required.  For example:

 

Robot^0 == Robot^1

Shelf^2 != Shelf^4

Order^0 == Order^5

 

Context Test statements should always appear after Test statements and Boolean Test statements.  This is not currently enforced by the Model Compiler but will be at some point in the future.

 

 

Permitted Data Field Formats

 

Left hand side:

 

Entity

Entity^0

Entity^1

Entity^2

Entity^3

...

 

Right hand side:

 

Entity^1

Entity^2

Entity^3

...

 

The same entity must be specified on both side of a context comparison. 

 

The context specified by the right hand side must always be older than that of the left hand side (the access number must be greater).  They must not be the same.

 

 

ContextOr Statement

 

ContextOr

Robot^0 == Robot^1

Shelf^2 != Shelf^4

Order^0 == Order^5

 

ANSI C Code Generation:

 

| (... || ... || ...)

|

\ContextOr         (

...              ...

|                ||

...              ...

|                ||

...              ...

/ContextOr         )

 

 

ContextAnd Statement

 

ContextAnd

Robot^0 == Robot^1

Shelf^2 != Shelf^4

Order^0 == Order^5

 

ANSI C Code Generation:

 

| (... && ... && ...)

|

\ContextAnd        (

...              ...

|                &&

...              ...

|                &&

...              ...

/ContextAnd        )

 

 

ContextNor Statement

 

ContextNor

Robot^0 == Robot^1

Shelf^2 != Shelf^4

Order^0 == Order^5

 

ANSI C Code Generation:

 

| !(... || ... || ...)

|

\ContextNor        !(

...              ...

|                ||

...              ...

|                ||

...              ...

/ContextNor        )

 

 

ContextNand Statement

 

ContextNand

Robot^0 == Robot^1

Shelf^2 != Shelf^4

Order^0 == Order^5

 

ANSI C Code Generation:

 

| !(... && ... && ...)

|

\ContextNand       !(

...              ...

|                &&

...              ...

|                &&

...              ...

/ContextNand       )

 

 

Example

 

Traverse

Navigation

Car : Currently_at : Floor

TraverseSelection

Traverse

Navigation

Car : Scheduled_to_move_to : Floor

TraverseSelection

CaseSelection

WhenCase

ConditionAnd

ContextAnd

Floor == Floor^1

WhenCaseSelection

GenerateEvent

Car : Service_current_floor

Copyright © 2017 Dark Matter Systems Ltd. All Rights Reserved.