Package org.xcsp.common
Enum Types.TypeExpr
- java.lang.Object
-
- java.lang.Enum<Types.TypeExpr>
-
- org.xcsp.common.Types.TypeExpr
-
- All Implemented Interfaces:
Serializable
,Comparable<Types.TypeExpr>
- Enclosing class:
- Types
public static enum Types.TypeExpr extends Enum<Types.TypeExpr>
The enum type specifying the different types of nodes that can be found in syntactic trees (built for intensional expressions).
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ABS
ACOS
ADD
AND
ASIN
ATAN
CARD
CONVEX
COS
COSH
DECIMAL
DIFF
DIST
DIV
DJOINT
EQ
EXP
FDIV
FMOD
GE
GT
HULL
IF
IFF
IMP
IN
INTER
LE
LN
LOG
LONG
LT
MAX
MIN
MOD
MUL
NE
NEG
NOT
NOTIN
NROOT
OR
PAR
POW
RATIONAL
SDIFF
SET
SIN
SINH
SPECIAL
SQR
SQRT
SUB
SUBSEQ
SUBSET
SUPSEQ
SUPSET
SYMBOL
TAN
TANH
UNION
VAR
XOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Types.TypeExpr
arithmeticInversion()
Returns the type denoting the arithmetic inversion of this type, if this type denotes a relational operator,null
otherwise.boolean
isArithmeticOperator()
Returnstrue
iff this type denotes a (non-unary) arithmetic operator (i.e.,ADD, SUB, MUL, DIV, MOD, POW and DIST
).boolean
isIdentityWhenOneOperand()
Returnstrue
iff this type denotes an operator that behaves like identity if only one operand was given.boolean
isLogicallyInvertible()
Returnstrue
iff this type denotes an operator that can be logically inverted,null
otherwise.boolean
isLogicalOperator()
Returnstrue
iff this type denotes a (non-unary) logical operator (i.e.,AND, OR, XOR, IFF, and IMP
).boolean
isPredicateOperator()
Returnstrue
iff this type denotes an operator that evaluates to 0/1 (false/true).boolean
isRelationalOperator()
Returnstrue
iff this type denotes a relational operator (i.e.,LT, LE, GE, GT, EQ and NE
).boolean
isSymmetricOperator()
Returnstrue
iff this type denotes an operator that is commutative (and also associative when it is a non-binary operator).boolean
isUnaryArithmeticOrLogicOperator()
Returnstrue
iff this type denotes a unary arithmetic or logic operator (i.e.,ABS, NEG, SQR, and NOT
).boolean
isUnsymmetricRelationalOperator()
Returnstrue
iff this type denotes a binary non-symmetric relational operator (i.e.,LT, LE, GE and GT
).Types.TypeExpr
logicalInversion()
Returns the type denoting the logical inversion of this type, if this type denotes a a Boolean operator (that can be inverted when considering the current pool of constants),null
otherwise.boolean
notOneOf(Types.TypeExpr... types)
Returnstrue
iff this type is not one of the specified types.boolean
oneOf(Types.TypeExpr... types)
Returnstrue
iff this type is one of the specified types.Types.TypeArithmeticOperator
toAriop()
The type fromTypeArithmeticOperator
with the same name as this type, if it exists,null
otherwise.Types.TypeLogicalOperator
toLogop()
The type fromTypeLogicalOperator
with the same name as this type, if it exists,null
otherwise.Types.TypeConditionOperatorRel
toRelop()
The type fromTypeConditionOperatorRel
with the same name as this type, if it exists,null
otherwise.Types.TypeConditionOperatorSet
toSetop()
The type fromTypeConditionOperatorSet
with the same name as this type, if it exists,null
otherwise.Types.TypeUnaryArithmeticOperator
toUnalop()
The type fromTypeUnaryArithmeticOperator
with the same name as this type, if it exists,null
otherwise.static Types.TypeExpr
valueOf(String name)
Returns the enum constant of this type with the specified name.static Types.TypeExpr[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NEG
public static final Types.TypeExpr NEG
-
ABS
public static final Types.TypeExpr ABS
-
SQR
public static final Types.TypeExpr SQR
-
ADD
public static final Types.TypeExpr ADD
-
SUB
public static final Types.TypeExpr SUB
-
MUL
public static final Types.TypeExpr MUL
-
DIV
public static final Types.TypeExpr DIV
-
MOD
public static final Types.TypeExpr MOD
-
POW
public static final Types.TypeExpr POW
-
DIST
public static final Types.TypeExpr DIST
-
MIN
public static final Types.TypeExpr MIN
-
MAX
public static final Types.TypeExpr MAX
-
LT
public static final Types.TypeExpr LT
-
LE
public static final Types.TypeExpr LE
-
GE
public static final Types.TypeExpr GE
-
GT
public static final Types.TypeExpr GT
-
NE
public static final Types.TypeExpr NE
-
EQ
public static final Types.TypeExpr EQ
-
SET
public static final Types.TypeExpr SET
-
IN
public static final Types.TypeExpr IN
-
NOTIN
public static final Types.TypeExpr NOTIN
-
NOT
public static final Types.TypeExpr NOT
-
AND
public static final Types.TypeExpr AND
-
OR
public static final Types.TypeExpr OR
-
XOR
public static final Types.TypeExpr XOR
-
IFF
public static final Types.TypeExpr IFF
-
IMP
public static final Types.TypeExpr IMP
-
IF
public static final Types.TypeExpr IF
-
CARD
public static final Types.TypeExpr CARD
-
UNION
public static final Types.TypeExpr UNION
-
INTER
public static final Types.TypeExpr INTER
-
DIFF
public static final Types.TypeExpr DIFF
-
SDIFF
public static final Types.TypeExpr SDIFF
-
HULL
public static final Types.TypeExpr HULL
-
DJOINT
public static final Types.TypeExpr DJOINT
-
SUBSET
public static final Types.TypeExpr SUBSET
-
SUBSEQ
public static final Types.TypeExpr SUBSEQ
-
SUPSEQ
public static final Types.TypeExpr SUPSEQ
-
SUPSET
public static final Types.TypeExpr SUPSET
-
CONVEX
public static final Types.TypeExpr CONVEX
-
FDIV
public static final Types.TypeExpr FDIV
-
FMOD
public static final Types.TypeExpr FMOD
-
SQRT
public static final Types.TypeExpr SQRT
-
NROOT
public static final Types.TypeExpr NROOT
-
EXP
public static final Types.TypeExpr EXP
-
LN
public static final Types.TypeExpr LN
-
LOG
public static final Types.TypeExpr LOG
-
SIN
public static final Types.TypeExpr SIN
-
COS
public static final Types.TypeExpr COS
-
TAN
public static final Types.TypeExpr TAN
-
ASIN
public static final Types.TypeExpr ASIN
-
ACOS
public static final Types.TypeExpr ACOS
-
ATAN
public static final Types.TypeExpr ATAN
-
SINH
public static final Types.TypeExpr SINH
-
COSH
public static final Types.TypeExpr COSH
-
TANH
public static final Types.TypeExpr TANH
-
VAR
public static final Types.TypeExpr VAR
-
PAR
public static final Types.TypeExpr PAR
-
LONG
public static final Types.TypeExpr LONG
-
RATIONAL
public static final Types.TypeExpr RATIONAL
-
DECIMAL
public static final Types.TypeExpr DECIMAL
-
SYMBOL
public static final Types.TypeExpr SYMBOL
-
SPECIAL
public static final Types.TypeExpr SPECIAL
-
-
Field Detail
-
lcname
public final String lcname
The name of this type in lower-case.
-
arityMin
public final int arityMin
The minimum arity (number of sons) for a node of this type.
-
arityMax
public final int arityMax
The maximum arity (number of sons) for a node of this type.
-
-
Method Detail
-
values
public static Types.TypeExpr[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Types.TypeExpr c : Types.TypeExpr.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Types.TypeExpr valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
oneOf
public boolean oneOf(Types.TypeExpr... types)
Returnstrue
iff this type is one of the specified types.- Parameters:
types
- a sequence of types- Returns:
true
iff this type is one of the specified types
-
notOneOf
public boolean notOneOf(Types.TypeExpr... types)
Returnstrue
iff this type is not one of the specified types.- Parameters:
types
- a sequence of types- Returns:
true
iff this type is not one of the specified types
-
isSymmetricOperator
public boolean isSymmetricOperator()
Returnstrue
iff this type denotes an operator that is commutative (and also associative when it is a non-binary operator).- Returns:
true
iff this type denotes an operator that is symmetric
-
isUnsymmetricRelationalOperator
public boolean isUnsymmetricRelationalOperator()
Returnstrue
iff this type denotes a binary non-symmetric relational operator (i.e.,LT, LE, GE and GT
).- Returns:
true
iff this type denotes a binary non-symmetric relational
-
isRelationalOperator
public boolean isRelationalOperator()
Returnstrue
iff this type denotes a relational operator (i.e.,LT, LE, GE, GT, EQ and NE
).- Returns:
true
iff this type denotes a relational operator
-
isUnaryArithmeticOrLogicOperator
public boolean isUnaryArithmeticOrLogicOperator()
Returnstrue
iff this type denotes a unary arithmetic or logic operator (i.e.,ABS, NEG, SQR, and NOT
).- Returns:
true
iff this type denotes a unary arithmetic or logic operator
-
isArithmeticOperator
public boolean isArithmeticOperator()
Returnstrue
iff this type denotes a (non-unary) arithmetic operator (i.e.,ADD, SUB, MUL, DIV, MOD, POW and DIST
).- Returns:
true
iff this type denotes a (non-unary) arithmetic operator
-
isLogicalOperator
public boolean isLogicalOperator()
Returnstrue
iff this type denotes a (non-unary) logical operator (i.e.,AND, OR, XOR, IFF, and IMP
).- Returns:
true
iff this type denotes a (non-unary) logical operator
-
isPredicateOperator
public boolean isPredicateOperator()
Returnstrue
iff this type denotes an operator that evaluates to 0/1 (false/true).- Returns:
true
iff this type denotes an operator that evaluates to 0/1 (false/true)
-
isIdentityWhenOneOperand
public boolean isIdentityWhenOneOperand()
Returnstrue
iff this type denotes an operator that behaves like identity if only one operand was given.- Returns:
-
arithmeticInversion
public Types.TypeExpr arithmeticInversion()
Returns the type denoting the arithmetic inversion of this type, if this type denotes a relational operator,null
otherwise. The arithmetic inversion is not obtained by applying a logical negation but a multiplication by -1. For example, the arithmetic inversion ofLT
isGT
(and notGE
). Also, the arithmetic inversion ofEQ
isEQ
.- Returns:
- the type denoting the arithmetic inversion of this type, if this type denotes a relational operator,
null
otherwise
-
logicalInversion
public Types.TypeExpr logicalInversion()
Returns the type denoting the logical inversion of this type, if this type denotes a a Boolean operator (that can be inverted when considering the current pool of constants),null
otherwise. The logical inversion is different from the arithmetic inversion. For example, the logical inversion ofLT
isGE
(and notGT
). Also, the logical inversion ofEQ
isNE
.- Returns:
- the type denoting the logical inversion of this type, if this type denotes a a Boolean operator that can be inverted,
null
otherwise
-
isLogicallyInvertible
public boolean isLogicallyInvertible()
Returnstrue
iff this type denotes an operator that can be logically inverted,null
otherwise.- Returns:
true
iff this type denotes an operator that can be logically inverted,null
otherwise
-
toRelop
public Types.TypeConditionOperatorRel toRelop()
The type fromTypeConditionOperatorRel
with the same name as this type, if it exists,null
otherwise.- Returns:
- The type from
TypeConditionOperatorRel
with the same name as this type, if it exists,null
otherwise
-
toSetop
public Types.TypeConditionOperatorSet toSetop()
The type fromTypeConditionOperatorSet
with the same name as this type, if it exists,null
otherwise.- Returns:
- The type from
TypeConditionOperatorSet
with the same name as this type, if it exists,null
otherwise
-
toAriop
public Types.TypeArithmeticOperator toAriop()
The type fromTypeArithmeticOperator
with the same name as this type, if it exists,null
otherwise.- Returns:
- The type from
TypeArithmeticOperator
with the same name as this type, if it exists,null
otherwise
-
toUnalop
public Types.TypeUnaryArithmeticOperator toUnalop()
The type fromTypeUnaryArithmeticOperator
with the same name as this type, if it exists,null
otherwise.- Returns:
- The type from
TypeUnaryArithmeticOperator
with the same name as this type, if it exists,null
otherwise
-
toLogop
public Types.TypeLogicalOperator toLogop()
The type fromTypeLogicalOperator
with the same name as this type, if it exists,null
otherwise.- Returns:
- The type from
TypeLogicalOperator
with the same name as this type, if it exists,null
otherwise
-
-