fr.expression4j.basic.impl
Class OperatorManagerImpl

java.lang.Object
  extended by fr.expression4j.basic.impl.OperatorManagerImpl
All Implemented Interfaces:
OperatorManager

public class OperatorManagerImpl
extends java.lang.Object
implements OperatorManager


Constructor Summary
OperatorManagerImpl(java.lang.String name)
           
 
Method Summary
 void addOperatorImpl(OperatorImpl operatorImpl)
          Add an operator implementation to the manager.
 MathematicalElement computeValue(java.lang.String operatorName, MathematicalElement element)
          Eval an unary operator on given value.
 MathematicalElement computeValue(java.lang.String operatorName, MathematicalElement leftElement, MathematicalElement rightElement)
          Eval a binary operator on given values.
 java.lang.String getName()
          get operator manager name
 OperatorImpl getOperatorImpl(java.lang.String name)
          Get an operator impl.
 java.util.List getOperatorImplList()
          Get the list of operator impl.
 void removeOperatorImpl(OperatorImpl operatorImpl)
          Remove an operator implementation to the manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperatorManagerImpl

public OperatorManagerImpl(java.lang.String name)
Method Detail

addOperatorImpl

public void addOperatorImpl(OperatorImpl operatorImpl)
Description copied from interface: OperatorManager
Add an operator implementation to the manager.

Specified by:
addOperatorImpl in interface OperatorManager
Parameters:
operatorImpl - operator to add.

removeOperatorImpl

public void removeOperatorImpl(OperatorImpl operatorImpl)
Description copied from interface: OperatorManager
Remove an operator implementation to the manager.

Specified by:
removeOperatorImpl in interface OperatorManager
Parameters:
operatorImpl - operator to remove.

computeValue

public MathematicalElement computeValue(java.lang.String operatorName,
                                        MathematicalElement element)
                                 throws EvalException
Description copied from interface: OperatorManager
Eval an unary operator on given value.

Specified by:
computeValue in interface OperatorManager
Parameters:
operatorName - operator to apply
element - value on wich apply the operator
Returns:
the evalued value.
Throws:
EvalException - if an error occurd (operator not define for the given element ...)

computeValue

public MathematicalElement computeValue(java.lang.String operatorName,
                                        MathematicalElement leftElement,
                                        MathematicalElement rightElement)
                                 throws EvalException
Description copied from interface: OperatorManager
Eval a binary operator on given values.

Specified by:
computeValue in interface OperatorManager
Parameters:
operatorName - operator to apply
leftElement - left value of operator
rightElement - right value of operator
Returns:
the evalued value
Throws:
EvalException - EvalException if an error occurd (operator not define for the given element ...)

getName

public java.lang.String getName()
Description copied from interface: OperatorManager
get operator manager name

Specified by:
getName in interface OperatorManager
Returns:
operator manager name

getOperatorImpl

public OperatorImpl getOperatorImpl(java.lang.String name)
Description copied from interface: OperatorManager
Get an operator impl.

Specified by:
getOperatorImpl in interface OperatorManager
Parameters:
name - operator impl to get.
Returns:
the operator impl if found. null otherwise.

getOperatorImplList

public java.util.List getOperatorImplList()
Description copied from interface: OperatorManager
Get the list of operator impl.

Specified by:
getOperatorImplList in interface OperatorManager
Returns:
list of operator impl as Sting.