public static class Operand.LeftOperand<T> extends Operand<T>
Expression
. A left operand is a single literal.Operand.LeftOperand<T>, Operand.RightOperand<T>
Constructor and Description |
---|
LeftOperand()
Default constructor does not instantiate any fields.
|
LeftOperand(Operand.LeftOperand<T> source)
Copy constructor builds a new instance from the source.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compares the specified object with this left operand for equality.
|
T |
get()
Returns the literal in the operand.
|
int |
hashCode()
Returns the hash code value for this left operand.
|
void |
set(T literal)
Sets the literal into the operand.
|
String |
toString()
Returns a string representation of this left operand.
|
getLiteral, setLiteral
public LeftOperand()
public LeftOperand(Operand.LeftOperand<T> source)
source
- the source instance from which the state is replicated in the new instance.public T get()
public void set(T literal)
literal
- literal for this operand.public String toString()
The string representation is the list of all literals in this left operand.
toString
in class Object
Object.toString()
public boolean equals(Object obj)
Returns true
if the given object is also a left operand and the two operands represent the same left operand. Two left operands o1
and o2
represent the same left operand if o1.getLiteral().equals(o2.getLiteral())
is true
.
This implementation first checks if the specified object is this left operand; if so it returns true
. Then, it checks if the specified object is a left operand whose literal is also equal.
equals
in class Object
obj
- object to be compared for equality with this left operandtrue
if the specified object is equal to this left operandObject.equals(java.lang.Object)
public int hashCode()
The hash code of a left operand is defined to be the sum of the hash codes of its literals. This ensures that o1.equals(o2)
implies that o1.hashCode() == o2.hashCode()
for any two left operands o1
and o2
, as required by the general contract of Object.hashCode()
.
hashCode
in class Object
Object.hashCode()