pascalinterpreter.operators
Class Add
java.lang.Object
pascalinterpreter.Operator
pascalinterpreter.BinaryOperator
pascalinterpreter.operators.Arithmetic
pascalinterpreter.operators.Add
- public class Add
- extends Arithmetic
Represents a singleton.
Field Summary |
private static Add |
instance
Holds singleton instance |
Constructor Summary |
private |
Add()
prevents instantiation |
Method Summary |
protected double |
compute(double opL,
double opR)
Metoda oblicza wartosc wyrazenia.
|
protected java.lang.String |
compute(java.lang.String opL,
java.lang.String opR)
Metoda wykonuje operację konkatencaji łańcuchów String |
void |
execute(Variable operandL,
Variable operandR)
|
static Add |
getInstance()
Returns the singleton instance. |
Methods inherited from class pascalinterpreter.operators.Arithmetic |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
instance
private static Add instance
- Holds singleton instance
Add
private Add()
- prevents instantiation
getInstance
public static Add getInstance()
- Returns the singleton instance.
- Returns:
- the singleton instance
execute
public void execute(Variable operandL,
Variable operandR)
throws InternalException,
RuntimeException
- Overrides:
execute
in class Arithmetic
- Throws:
InternalException
RuntimeException
compute
protected java.lang.String compute(java.lang.String opL,
java.lang.String opR)
- Metoda wykonuje operację konkatencaji łańcuchów String
- Parameters:
opL
- - łańcuch pierwszy.opR
- - łańcuch drugi.
- Returns:
- Połączone łańcuchy, przekazane jako parametry.
compute
protected double compute(double opL,
double opR)
- Description copied from class:
Arithmetic
- Metoda oblicza wartosc wyrazenia.
Wszystkie operacje, z wyjatkiem dodawania wykonywane sa na zmiennych typu double.
- Specified by:
compute
in class Arithmetic
- Parameters:
opL
- - lewy operandopR
- - prawy operand
- Returns:
- Wartość wyrażenia, w postaci liczby double.