pascalinterpreter.operators
Class Equal
java.lang.Object
pascalinterpreter.Operator
pascalinterpreter.BinaryOperator
pascalinterpreter.operators.Relational
pascalinterpreter.operators.Equal
- public class Equal
- extends Relational
Represents a singleton.
Field Summary |
private static Equal |
instance
Holds singleton instance |
Constructor Summary |
private |
Equal()
prevents instantiation |
Method Summary |
void |
execute(Variable operandL,
Variable operandR)
|
static Equal |
getInstance()
Returns the singleton instance. |
protected boolean |
isTrue(double opL,
double opR)
Metoda dokonuje sprawdzenia prawdziwości operatora, na parametrach typu double.
|
protected boolean |
isTrue(java.lang.String opL,
java.lang.String opR)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
instance
private static Equal instance
- Holds singleton instance
Equal
private Equal()
- prevents instantiation
getInstance
public static Equal getInstance()
- Returns the singleton instance.
- Returns:
- the singleton instance
execute
public void execute(Variable operandL,
Variable operandR)
throws RuntimeException,
InternalException
- Overrides:
execute
in class Relational
- Throws:
RuntimeException
InternalException
isTrue
protected boolean isTrue(java.lang.String opL,
java.lang.String opR)
isTrue
protected boolean isTrue(double opL,
double opR)
- Description copied from class:
Relational
- Metoda dokonuje sprawdzenia prawdziwości operatora, na parametrach typu double.
Ponieważ założono, że za wyjątkiem operatorów Equal i NotEqual, porównywane mogą być tylko liczby, to typ double jest wystarczającym.
- Specified by:
isTrue
in class Relational
- Parameters:
opL
- - operand lewy.opR
- - operand prawy.
- Returns:
- True, jeżeli prawda - jeśli nie, to false.