pascalinterpreter.operators
Class Add

java.lang.Object
  extended bypascalinterpreter.Operator
      extended bypascalinterpreter.BinaryOperator
          extended bypascalinterpreter.operators.Arithmetic
              extended bypascalinterpreter.operators.Add

public class Add
extends Arithmetic

Represents a singleton.


Field Summary
private static Add instance
          Holds singleton instance
 
Fields inherited from class pascalinterpreter.Operator
OP_REG_VAR_NAME
 
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 pascalinterpreter.BinaryOperator
execInitialize, isPossible, makeConversion, parseDouble
 
Methods inherited from class pascalinterpreter.Operator
getRegistry, setRegistry, setRegistry, setRegistry, setRegistry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static Add instance
Holds singleton instance

Constructor Detail

Add

private Add()
prevents instantiation

Method Detail

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 operand
opR - - prawy operand
Returns:
Wartość wyrażenia, w postaci liczby double.