Package it.unive.lisa.symbolic.value
Enum BinaryOperator
- java.lang.Object
-
- java.lang.Enum<BinaryOperator>
-
- it.unive.lisa.symbolic.value.BinaryOperator
-
- All Implemented Interfaces:
Operator,java.io.Serializable,java.lang.Comparable<BinaryOperator>
public enum BinaryOperator extends java.lang.Enum<BinaryOperator> implements Operator
A binary operator that can be applied to a pair ofSymbolicExpressions.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description COMPARISON_EQGiven two values, check whether they have same values and same type.COMPARISON_GEGiven two numeric valuesn1andn2of typeNumericType, this operator checks ifn1is in relation through the "greater or equal than" relation withn2.COMPARISON_GTGiven two numeric valuesn1andn2, this operator checks ifn1is in relation through the "greater than" relation withn2.COMPARISON_LEGiven two numeric valuesn1andn2, this operator checks ifn1is in relation through the "less or equal than" relation withn2.COMPARISON_LTGiven two numeric valuesn1andn2, this operator checks ifn1is in relation through the "less than" relation withn2.COMPARISON_NEGiven two values, check whether they have different values or different type.LOGICAL_ANDGiven two Boolean valuesb1andb2of typeBooleanType, this operator returns the logical and betweenb1andb2.LOGICAL_ORGiven two Boolean valuesb1andb2of typeBooleanType, this operator returns the logical or betweenb1andb2.NUMERIC_ADDGiven two integers valuesn1andn2of typeNumericType, this operator returns the addition ofn1withn2.NUMERIC_DIVGiven two integers valuesn1andn2, withn2not equal to zero, of typeNumericType, this operator returns the division ofi1withn2.NUMERIC_MODGiven two integers valuesn1andn2of typeNumericType, this operator returns the modulo ofn1withn2.NUMERIC_MULGiven two integers valuesn1andn2of typeNumericType, this operator returns the multiplication ofi1withn2.NUMERIC_SUBGiven two integers valuesn1andn2of typeNumericType, this operator returns the subtraction ofn1withn2.STRING_CONCATGiven two string valuess1ands2of typeStringType, this operator return the concatenation ofs1withs2.STRING_CONTAINSSTRING_ENDS_WITHGiven two string valuess1ands2of typeStringType, this operator checks whethers1ends withs2, namely ifs2is the suffix ofs1.STRING_EQUALSGiven two string valuess1ands2of typeStringType, this operator checks if the two strings are equals.STRING_INDEX_OFGiven two string valuess1ands2of typeStringType, this operator return the position of the first occurrence ofs1ins2.STRING_STARTS_WITHGiven two string valuess1ands2of typeStringType, this operator checks whethers1starts withs2, namely ifs2is the prefix ofs1.TYPE_CASTCasts the type of the left-hand side of this expression to the type of the right-hand side.TYPE_CHECKTests if the type of the left-hand side of this expression is the same as, or a subtype of, the type of the right-hand side.TYPE_CONVConverts the type of the left-hand side of this expression to the type of the right-hand side.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetStringRepresentation()Yields the string representation of the operator.java.lang.StringtoString()static BinaryOperatorvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static BinaryOperator[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NUMERIC_SUB
public static final BinaryOperator NUMERIC_SUB
Given two integers valuesn1andn2of typeNumericType, this operator returns the subtraction ofn1withn2. The return type of this operator isNumericType.
-
NUMERIC_ADD
public static final BinaryOperator NUMERIC_ADD
Given two integers valuesn1andn2of typeNumericType, this operator returns the addition ofn1withn2. The return type of this operator isNumericType.
-
NUMERIC_DIV
public static final BinaryOperator NUMERIC_DIV
Given two integers valuesn1andn2, withn2not equal to zero, of typeNumericType, this operator returns the division ofi1withn2. The return type of this operator isNumericType. Ifn1is divisible byn2, the return type is theType.commonSupertype(it.unive.lisa.type.Type)between the types ofn1andn2.
-
NUMERIC_MUL
public static final BinaryOperator NUMERIC_MUL
Given two integers valuesn1andn2of typeNumericType, this operator returns the multiplication ofi1withn2. The return type of this operator isNumericType.
-
NUMERIC_MOD
public static final BinaryOperator NUMERIC_MOD
Given two integers valuesn1andn2of typeNumericType, this operator returns the modulo ofn1withn2. The return type of this operator is a 32 bit unsigned integerNumericType.
-
LOGICAL_OR
public static final BinaryOperator LOGICAL_OR
Given two Boolean valuesb1andb2of typeBooleanType, this operator returns the logical or betweenb1andb2. No short-circuit mechanism is provided, hence bothb1andb2are evaluated The return type of this operator isBooleanType.
-
LOGICAL_AND
public static final BinaryOperator LOGICAL_AND
Given two Boolean valuesb1andb2of typeBooleanType, this operator returns the logical and betweenb1andb2. No short-circuit mechanism is provided, hence bothb1andb2are evaluated The return type of this operator isBooleanType.
-
COMPARISON_NE
public static final BinaryOperator COMPARISON_NE
Given two values, check whether they have different values or different type. If so, true value is returned, false otherwise. This operator corresponds to the logical negation ofCOMPARISON_EQ. The return type of this operator isBooleanType.
-
COMPARISON_EQ
public static final BinaryOperator COMPARISON_EQ
Given two values, check whether they have same values and same type. If so, true value is returned, false otherwise. This operator corresponds to the logical negation ofCOMPARISON_NE. The return type of this operator isBooleanType.
-
COMPARISON_GE
public static final BinaryOperator COMPARISON_GE
Given two numeric valuesn1andn2of typeNumericType, this operator checks ifn1is in relation through the "greater or equal than" relation withn2. If so, true value is returned, false otherwise. The return type of this operator isBooleanType.
-
COMPARISON_GT
public static final BinaryOperator COMPARISON_GT
Given two numeric valuesn1andn2, this operator checks ifn1is in relation through the "greater than" relation withn2. If so, true value is returned, false otherwise. The return type of this operator isBooleanType.
-
COMPARISON_LE
public static final BinaryOperator COMPARISON_LE
Given two numeric valuesn1andn2, this operator checks ifn1is in relation through the "less or equal than" relation withn2. If so, true value is returned, false otherwise. The return type of this operator isBooleanType.
-
COMPARISON_LT
public static final BinaryOperator COMPARISON_LT
Given two numeric valuesn1andn2, this operator checks ifn1is in relation through the "less than" relation withn2. If so, true value is returned, false otherwise. The return type of this operator isBooleanType.
-
STRING_CONCAT
public static final BinaryOperator STRING_CONCAT
Given two string valuess1ands2of typeStringType, this operator return the concatenation ofs1withs2. The neutral element is the empty string. The return type of this operator isStringType.
-
STRING_CONTAINS
public static final BinaryOperator STRING_CONTAINS
Given two string valuess1ands2of typeStringType, this operator checks whethers1containss2. Ifs2is the empty string, then true is returned. The return type of this operator isBooleanType.
-
STRING_STARTS_WITH
public static final BinaryOperator STRING_STARTS_WITH
Given two string valuess1ands2of typeStringType, this operator checks whethers1starts withs2, namely ifs2is the prefix ofs1. The empty string is the prefix of any string, hence ifs2is the empty string, true is returned. The return type of this operator isBooleanType.
-
STRING_ENDS_WITH
public static final BinaryOperator STRING_ENDS_WITH
Given two string valuess1ands2of typeStringType, this operator checks whethers1ends withs2, namely ifs2is the suffix ofs1. The empty string is the suffix of any string, hence ifs2is the empty string, true is returned. The return type of this operator isBooleanType.
-
STRING_INDEX_OF
public static final BinaryOperator STRING_INDEX_OF
Given two string valuess1ands2of typeStringType, this operator return the position of the first occurrence ofs1ins2. Ifs1does not containss2, then -1 is returned. The return type of this operator is a 32 bit signedNumericType.
-
STRING_EQUALS
public static final BinaryOperator STRING_EQUALS
Given two string valuess1ands2of typeStringType, this operator checks if the two strings are equals. The return type of this operator isStringType.
-
TYPE_CAST
public static final BinaryOperator TYPE_CAST
Casts the type of the left-hand side of this expression to the type of the right-hand side. The returned value is exactly the left-hand side, but with its runtime types filtered to be instances of the right-hand side type. Indeed, this operation on types is a narrowing operator, namely the destination type is smaller than the source type.
-
TYPE_CONV
public static final BinaryOperator TYPE_CONV
Converts the type of the left-hand side of this expression to the type of the right-hand side. The returned value is exactly the right-hand side, if the left-hand side type an be converted to the right-hand side one. Indeed, this operation on types is a widening operator, namely the destination type is greater than the source type.
-
TYPE_CHECK
public static final BinaryOperator TYPE_CHECK
Tests if the type of the left-hand side of this expression is the same as, or a subtype of, the type of the right-hand side. The returned value is a boolean of typeBooleanTypeexpressing this relation.
-
-
Method Detail
-
values
public static BinaryOperator[] 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 (BinaryOperator c : BinaryOperator.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BinaryOperator valueOf(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getStringRepresentation
public java.lang.String getStringRepresentation()
Description copied from interface:OperatorYields the string representation of the operator.- Specified by:
getStringRepresentationin interfaceOperator- Returns:
- the string representation
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Enum<BinaryOperator>
-
-