Difference between revisions of "Core.Terms.LogicOperations"

From emotive
Jump to navigation Jump to search
m (Nb moved page LogicOperatios to LogicOperations)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Core]]
+
{{DISPLAYTITLE:OTX '''LogicOperations'''}}[[Category:Core]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | LogicOperatios | Basic logical operations with Boolean expressions | [[Term]] | [[Core|OTX Core library]] | [[Operations]] | - | - }}
+
{{ClassificationActivity | LogicOperations | Basic logical operations with Boolean expressions | [[Term]] | [[Core|OTX Core library]] | [[Operations]] | - | - }}
  
== Pseudo-Code Syntax ==
+
== OTL Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
BooleanValue = BooleanTerm1 operator BooleanTerm2
 
BooleanValue = BooleanTerm1 operator BooleanTerm2
Line 19: Line 19:
 
*: Logical XOR (exclusive disjunction)
 
*: Logical XOR (exclusive disjunction)
 
* '''!'''
 
* '''!'''
*: Logical emergency (negation)
+
*: Logical NOT (negation)
  
{{TermReturnValue| [[Boolean]] | Return value from the logical operation}}
+
{{TermReturnValue| [[Core.DataTypes.SimpleDataType.Boolean|Boolean]] | Return value from the logical operation}}
  
 
== Properties ==
 
== Properties ==
 +
 +
'''LogicAnd, LogicOr, LogiXor:'''
 +
 +
{| {{TableHeader}}
 +
{{TableRowPropertiesHeader}}
 +
{{TableRowPropertie2| Terms | [[Boolean]] | [[Term]] | - | [2..*] | Represents the list of BooleanTerm operands of the disjunction. Terms will be evaluated in the order of appearance in the OTX document.}}
 +
|}
 +
 +
'''LogicNot:'''
 +
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| BooleanTerm1 | [[Boolean]] | [[Term]] | - | [1] | Left operand}}
+
{{TableRowPropertie2| Term | [[Boolean]] | [[Term]] | - | [1] | Represents the BooleanTerm operand of the negation.}}
{{TableRowPropertie2| BooleanTerm2 | [[Boolean]] | [[Term]] | - | [1] | Right operand}}
 
 
|}
 
|}
  
== Examples ==
+
== OTL Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
* MyValueOfBool1 & & MyValueOfBool2
+
Boolean MyValueOfBool1;
* MyValueOfBool1 | MyValueOfBool2
+
Boolean MyValueOfBool2;
* MyValueOfBool1 ^ MyValueOfBool2
+
Boolean MyValueOfBool3;
* ! MyValueOfBool1
+
Boolean MyValueOfBool4;
 +
Boolean MyValueOfBool5;
 +
Boolean result;
 +
 
 +
result = MyValueOfBool1 && MyValueOfBool2 && MyValueOfBool3;
 +
result = MyValueOfBool1 || MyValueOfBool2 || MyValueOfBool3 || MyValueOfBool4;
 +
result = MyValueOfBool1 ^ MyValueOfBool2 ^ MyValueOfBool3 ^ MyValueOfBool4 ^ MyValueOfBool5;
 +
result = !MyValueOfBool1;
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== See also ==
 
== See also ==
[[ComparativeOperations]] <br/>
+
[[Core.Terms.ComparativeOperations|ComparativeOperations]] <br/>
[[MathematicalOperations]]
+
[[Core.Terms.MathematicalOperations|MathematicalOperations]]

Latest revision as of 08:36, 26 April 2019

Classification

Name LogicOperations
Short Description Basic logical operations with Boolean expressions
Class Term
Extension OTX Core library
Group Operations
Exceptions -
Checker Rules -
Standard Compliant Yes

OTL Syntax

BooleanValue = BooleanTerm1 operator BooleanTerm2
BooleanValue = !BooleanTerm1

Description

Logical operators are used according to the C# notation for logical operations in the formulation of conditions etc. The following operators can be used:

  • &&
    Logical AND (conjunction)
  • ||
    Logical OR (disjunction)
  • ^
    Logical XOR (exclusive disjunction)
  • !
    Logical NOT (negation)

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
Boolean Return value from the logical operation

Properties

LogicAnd, LogicOr, LogiXor:

Name Data Type Class Default Cardinality Description
Terms Boolean Term - [2..*] Represents the list of BooleanTerm operands of the disjunction. Terms will be evaluated in the order of appearance in the OTX document.

LogicNot:

Name Data Type Class Default Cardinality Description
Term Boolean Term - [1] Represents the BooleanTerm operand of the negation.

OTL Examples

Boolean MyValueOfBool1;
Boolean MyValueOfBool2;
Boolean MyValueOfBool3;
Boolean MyValueOfBool4;
Boolean MyValueOfBool5;
Boolean result;

result = MyValueOfBool1 && MyValueOfBool2 && MyValueOfBool3;
result = MyValueOfBool1 || MyValueOfBool2 || MyValueOfBool3 || MyValueOfBool4;
result = MyValueOfBool1 ^ MyValueOfBool2 ^ MyValueOfBool3 ^ MyValueOfBool4 ^ MyValueOfBool5;
result = !MyValueOfBool1;

See also

ComparativeOperations
MathematicalOperations