for information about XES schema see these
pages.
UnaryOperation
The unaryOp node is used to represent an operation with one operand, this may
be an interger, floating point , boolean or string.
An operation with one input and one output such as 'not'. The operation is
represented by a simple type. In addition any number of comments can be added.
Attributes used
- operator must be set to one of ++ , -- , ! , ~ , + , -
- postOp the operators ++ or -- can be applied before the operand if postOp
is set to true.
Child Elements
There must be exactly one child element which represents the operand (in addition
there can be any number of comment nodes).
The operand can be either:
Schema entry
<xs:complexType name="unaryOpType">
<xs:sequence maxOccurs="unbounded">
<xs:element name="variable" type="variableType"/>
<xs:element name="array" type="arrayType"/>
<xs:element name="constant" type="constantType"/>
<xs:element name="call" type="callType"/>
<xs:element name="binaryOp" type="binaryOpType"/>
<xs:element name="unaryOp" type="unaryOpType"/>
<xs:element name="comment" type="commentType"/>
</xs:sequence>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="operator" type="unaryOperatorType"/>
</xs:complexType>
<xs:simpleType name="unaryOperatorType">
<xs:restriction base="xs:string">
<xs:enumeration value="++"/>
<xs:enumeration value="--"/>
<xs:enumeration value="pre++"/>
<xs:enumeration value="pre--"/>
<xs:enumeration value="!"/>
<xs:enumeration value="~"/>
<xs:enumeration value="+"/>
<xs:enumeration value="-"/>
</xs:restriction>
</xs:simpleType>
Translation to other languages
In XES the precedence of operations is determined by the way that the unaryOp
nodes are nested, so there is no need for explicit coding of brackets. However
when converting from XES to java we have to use brackets when required, this
is determined by the rules of precedence. Since this would be complicated to
implement, as a first stage it is good enough to always wrap inner operations
in brackets even though this may not always be necessary. Athough we should
not wrap the outer most operation in brackets.
Possible Improvements
Examples of usage
usage |
java example |
XES example |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<xs:complexType name="unaryOpType">
<xs:sequence maxOccurs="unbounded">
<xs:element name="variable" type="variableType"/>
<xs:element name="array" type="arrayType"/>
<xs:element name="constant" type="constantType"/>
<xs:element name="call" type="callType"/>
<xs:element name="binaryOp" type="binaryOpType"/>
<xs:element name="unaryOp" type="unaryOpType"/>
<xs:element name="comment" type="commentType"/>
</xs:sequence>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="operator" type="unaryOperatorType"/>
</xs:complexType>
<xs:simpleType name="unaryOperatorType">
<xs:restriction base="xs:string">
<xs:enumeration value="++"/>
<xs:enumeration value="--"/>
<xs:enumeration value="pre++"/>
<xs:enumeration value="pre--"/>
<xs:enumeration value="!"/>
<xs:enumeration value="~"/>
<xs:enumeration value="+"/>
<xs:enumeration value="-"/>
</xs:restriction>
</xs:simpleType>
Java
a = -b;
Scala
This site may have errors. Don't use for critical systems.