net.sf.magicproject.operation
Class Add

java.lang.Object
  extended by net.sf.magicproject.operation.Operation
      extended by net.sf.magicproject.operation.BinaryOperation
          extended by net.sf.magicproject.operation.Add

public final class Add
extends BinaryOperation

Reprsents the PLUS operation. This operation is optimzed since it is not executed is is useless.

Since:
0.71
Author:
Fabrice Daugan

Method Summary
static Operation getInstance()
          Return the unique instance of this operation.
 java.lang.String getOperator()
          Return operator name
 boolean isUselessWith(int leftValue, int rightValue)
          Is this operation is useless or not
 int process(int leftValue, int rightValue)
          Process a binary operation with two values and return the result.
 
Methods inherited from class net.sf.magicproject.operation.BinaryOperation
readNextExpression
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

process

public int process(int leftValue,
                   int rightValue)
Description copied from class: Operation
Process a binary operation with two values and return the result.

Specified by:
process in class BinaryOperation
Parameters:
leftValue - the left value of binary operation
rightValue - the right value of binary operation
Returns:
the result

isUselessWith

public boolean isUselessWith(int leftValue,
                             int rightValue)
Description copied from class: Operation
Is this operation is useless or not

Overrides:
isUselessWith in class Operation
Parameters:
leftValue - the left value
rightValue - the right value
Returns:
true if this operation will not modify the given left value considering the right value.

getOperator

public java.lang.String getOperator()
Description copied from class: Operation
Return operator name

Specified by:
getOperator in class BinaryOperation
Returns:
the operator name

getInstance

public static Operation getInstance()
Return the unique instance of this operation.

Returns:
the unique instance of this operation.


Copyright © 2003-2007 Magic-Project. All Rights Reserved.