Enum BinaryOperator
- java.lang.Object
-
- java.lang.Enum<BinaryOperator>
-
- com.tonic.analysis.source.ast.expr.BinaryOperator
-
- All Implemented Interfaces:
Serializable,Comparable<BinaryOperator>
public enum BinaryOperator extends Enum<BinaryOperator>
Binary operators for expressions.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ADDAddition,+; also string concatenation when either operand is a string.ADD_ASSIGNAdd and assign,+=; also string append-assign.ANDShort-circuiting logical and,&&; the right operand is skipped when the left is false.ASSIGNPlain assignment,=; the lowest-precedence operator and the only non-compound one that groups right to left.BANDBitwise and,&; on boolean operands a logical and that always evaluates both sides.BAND_ASSIGNBitwise and and assign,&=; also non-short-circuiting and-assign on booleans.BORBitwise or,|; on boolean operands a logical or that always evaluates both sides.BOR_ASSIGNBitwise or and assign,|=; also non-short-circuiting or-assign on booleans.BXORBitwise exclusive or,^; logical xor on boolean operands.BXOR_ASSIGNBitwise exclusive-or and assign,^=; also logical xor-assign on booleans.DIVDivision,/, truncating toward zero on integral operands.DIV_ASSIGNDivide and assign,/=.EQEquality test,==; reference identity when the operands are references.GEGreater-than-or-equal relational test,>=.GTGreater-than relational test,>.LELess-than-or-equal relational test,<=.LTLess-than relational test,<.MODRemainder,%, which takes the sign of the dividend.MOD_ASSIGNRemainder and assign,%=.MULMultiplication,*.MUL_ASSIGNMultiply and assign,*=.NEInequality test,!=; reference identity when the operands are references.ORShort-circuiting logical or,||; the right operand is skipped when the left is true.SHLLeft shift,<<.SHL_ASSIGNLeft shift and assign,<<=.SHRSigned right shift,>>, which preserves the sign bit.SHR_ASSIGNSigned right shift and assign,>>=.SUBSubtraction,-.SUB_ASSIGNSubtract and assign,-=.USHRUnsigned right shift,>>>, which fills the vacated high bits with zeroes regardless of sign.USHR_ASSIGNUnsigned right shift and assign,>>>=.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetPrecedence()StringgetSymbol()booleanisAssignment()booleanisBitwise()booleanisComparison()booleanisLeftAssociative()booleanisLogical()StringtoString()static BinaryOperatorvalueOf(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
-
ADD
public static final BinaryOperator ADD
Addition,+; also string concatenation when either operand is a string.
-
SUB
public static final BinaryOperator SUB
Subtraction,-.
-
MUL
public static final BinaryOperator MUL
Multiplication,*.
-
DIV
public static final BinaryOperator DIV
Division,/, truncating toward zero on integral operands.
-
MOD
public static final BinaryOperator MOD
Remainder,%, which takes the sign of the dividend.
-
BAND
public static final BinaryOperator BAND
Bitwise and,&; on boolean operands a logical and that always evaluates both sides.
-
BOR
public static final BinaryOperator BOR
Bitwise or,|; on boolean operands a logical or that always evaluates both sides.
-
BXOR
public static final BinaryOperator BXOR
Bitwise exclusive or,^; logical xor on boolean operands.
-
SHL
public static final BinaryOperator SHL
Left shift,<<.
-
SHR
public static final BinaryOperator SHR
Signed right shift,>>, which preserves the sign bit.
-
USHR
public static final BinaryOperator USHR
Unsigned right shift,>>>, which fills the vacated high bits with zeroes regardless of sign.
-
EQ
public static final BinaryOperator EQ
Equality test,==; reference identity when the operands are references.
-
NE
public static final BinaryOperator NE
Inequality test,!=; reference identity when the operands are references.
-
LT
public static final BinaryOperator LT
Less-than relational test,<.
-
LE
public static final BinaryOperator LE
Less-than-or-equal relational test,<=.
-
GT
public static final BinaryOperator GT
Greater-than relational test,>.
-
GE
public static final BinaryOperator GE
Greater-than-or-equal relational test,>=.
-
AND
public static final BinaryOperator AND
Short-circuiting logical and,&&; the right operand is skipped when the left is false.
-
OR
public static final BinaryOperator OR
Short-circuiting logical or,||; the right operand is skipped when the left is true.
-
ASSIGN
public static final BinaryOperator ASSIGN
Plain assignment,=; the lowest-precedence operator and the only non-compound one that groups right to left.
-
ADD_ASSIGN
public static final BinaryOperator ADD_ASSIGN
Add and assign,+=; also string append-assign.
-
SUB_ASSIGN
public static final BinaryOperator SUB_ASSIGN
Subtract and assign,-=.
-
MUL_ASSIGN
public static final BinaryOperator MUL_ASSIGN
Multiply and assign,*=.
-
DIV_ASSIGN
public static final BinaryOperator DIV_ASSIGN
Divide and assign,/=.
-
MOD_ASSIGN
public static final BinaryOperator MOD_ASSIGN
Remainder and assign,%=.
-
BAND_ASSIGN
public static final BinaryOperator BAND_ASSIGN
Bitwise and and assign,&=; also non-short-circuiting and-assign on booleans.
-
BOR_ASSIGN
public static final BinaryOperator BOR_ASSIGN
Bitwise or and assign,|=; also non-short-circuiting or-assign on booleans.
-
BXOR_ASSIGN
public static final BinaryOperator BXOR_ASSIGN
Bitwise exclusive-or and assign,^=; also logical xor-assign on booleans.
-
SHL_ASSIGN
public static final BinaryOperator SHL_ASSIGN
Left shift and assign,<<=.
-
SHR_ASSIGN
public static final BinaryOperator SHR_ASSIGN
Signed right shift and assign,>>=.
-
USHR_ASSIGN
public static final BinaryOperator USHR_ASSIGN
Unsigned right shift and assign,>>>=.
-
-
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(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
-
getSymbol
public String getSymbol()
- Returns:
- the symbol
-
getPrecedence
public int getPrecedence()
- Returns:
- the binding strength, where a higher value binds tighter
-
isLeftAssociative
public boolean isLeftAssociative()
- Returns:
- true if operands group left to right
-
isAssignment
public boolean isAssignment()
- Returns:
- true for plain assignment and every compound assignment
-
isComparison
public boolean isComparison()
- Returns:
- true for the equality and relational operators
-
isLogical
public boolean isLogical()
- Returns:
- true for the short-circuiting && and || operators
-
isBitwise
public boolean isBitwise()
- Returns:
- true for the and, or, xor and shift operators
-
toString
public String toString()
- Overrides:
toStringin classEnum<BinaryOperator>
-
-