net.sf.magicproject.operation
Class Operation

java.lang.Object
  extended by net.sf.magicproject.operation.Operation
Direct Known Subclasses:
Any, BinaryOperation, Clear, Dummy, IntList, IntValue, TargetList, UnaryOperation

public abstract class Operation
extends java.lang.Object

Reprsent an operation.

Author:
Fabrice Daugan

Method Summary
abstract  java.lang.String getOperator()
          Return operator name
 boolean isUselessWith(int leftValue, int rightValue)
          Is this operation is useless or not
abstract  int process(int leftValue, int rightValue)
          Process a binary operation with two values and return the result.
abstract  Expression readNextExpression(java.io.InputStream inputFile)
          return the next Expression read from the current offset
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readNextExpression

public abstract Expression readNextExpression(java.io.InputStream inputFile)
                                       throws java.io.IOException
return the next Expression read from the current offset

Parameters:
inputFile - is the file containing this expression
Returns:
the next Expression read from the current offset
Throws:
java.io.IOException - if error occured during the reading process from the specified input stream

process

public abstract int process(int leftValue,
                            int rightValue)
Process a binary operation with two values and return the result.

Parameters:
leftValue - the left value of binary operation
rightValue - the right value of binary operation
Returns:
the result

getOperator

public abstract java.lang.String getOperator()
Return operator name

Returns:
the operator name

isUselessWith

public boolean isUselessWith(int leftValue,
                             int rightValue)
Is this operation is useless or not

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.


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