Enum UnaryOperator
- java.lang.Object
-
- java.lang.Enum<UnaryOperator>
-
- com.tonic.analysis.source.ast.expr.UnaryOperator
-
- All Implemented Interfaces:
Serializable,Comparable<UnaryOperator>
public enum UnaryOperator extends Enum<UnaryOperator>
Unary operators for expressions.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BNOTBitwise complement,~, flipping every bit of an integral operand.NEGArithmetic negation,-, applied to a single numeric operand.NOTLogical negation,!, applying to a boolean operand.POSUnary plus,+, which leaves the value alone but still promotes a narrower operand to int.POST_DECPostfix decrement,x--, which yields the operand's value from before the decrement.POST_INCPostfix increment,x++, which yields the operand's value from before the increment.PRE_DECPrefix decrement,--x, which yields the already-decremented value.PRE_INCPrefix increment,++x, which yields the already-incremented value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetSymbol()booleanisIncDec()booleanisPostfix()booleanisPrefix()StringtoString()static UnaryOperatorvalueOf(String name)Returns the enum constant of this type with the specified name.static UnaryOperator[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NEG
public static final UnaryOperator NEG
Arithmetic negation,-, applied to a single numeric operand.
-
POS
public static final UnaryOperator POS
Unary plus,+, which leaves the value alone but still promotes a narrower operand to int.
-
BNOT
public static final UnaryOperator BNOT
Bitwise complement,~, flipping every bit of an integral operand.
-
NOT
public static final UnaryOperator NOT
Logical negation,!, applying to a boolean operand.
-
PRE_INC
public static final UnaryOperator PRE_INC
Prefix increment,++x, which yields the already-incremented value.
-
PRE_DEC
public static final UnaryOperator PRE_DEC
Prefix decrement,--x, which yields the already-decremented value.
-
POST_INC
public static final UnaryOperator POST_INC
Postfix increment,x++, which yields the operand's value from before the increment.
-
POST_DEC
public static final UnaryOperator POST_DEC
Postfix decrement,x--, which yields the operand's value from before the decrement.
-
-
Method Detail
-
values
public static UnaryOperator[] 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 (UnaryOperator c : UnaryOperator.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static UnaryOperator 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
-
isPrefix
public boolean isPrefix()
- Returns:
- true if the symbol is written before its operand
-
isPostfix
public boolean isPostfix()
- Returns:
- true if the symbol is written after its operand
-
isIncDec
public boolean isIncDec()
- Returns:
- true for the four increment and decrement operators
-
toString
public String toString()
- Overrides:
toStringin classEnum<UnaryOperator>
-
-