hussam.math.operations.dataBase
Class OperatorSourceImpl

java.lang.Object
extended by hussam.math.operations.dataBase.OperatorSourceImpl
All Implemented Interfaces:
OperatorSource
Direct Known Subclasses:
OperatorFactoryDB, OperatorSourceWrapper

public class OperatorSourceImpl
extends java.lang.Object
implements OperatorSource

This is the default implemetation of the OperatorSource interface. This is the most used implementation through out the package. This Source of data is stored in memmory.

Author:
Hussam AlMulhim حسام الملحم

Constructor Summary
OperatorSourceImpl()
          Constructs a New Operator Source.
 
Method Summary
 voidaddFunction(OperatorFactory<Function> fac)
          add the specified factory to this source.
 voidaddFunctions(java.util.Map<java.lang.String,? extends OperatorFactory<Function>> funcitons)
          adds all Function Factories to this source.
 voidaddGlobalVariable(Variable v)
          add a global Variable to the Data Source.
 voidaddGlobalVariables(java.util.Map<java.lang.String,? extends Variable> v)
          adds all Global Variables.
 voidaddLocalVariable(Variable v)
          adds a local variable to this source.
 voidaddLocalVariables(java.util.Map<java.lang.String,? extends Variable> v)
          adds all local variables.
 voidaddOperand(OperatorFactory<Operand> fac)
          adds the specified factory to this source.
 voidaddOperands(java.util.Map<java.lang.String,? extends OperatorFactory<Operand>> ops)
          adds all Operand factories to this source.
 java.util.Map<java.lang.String,OperatorFactory<Function>>getFunctionFactories()
          Returns all Function factories.
 OperatorFactory<Function>getFunctionFactory(java.lang.String name)
          Returns the FunctionFactory for the given Function name.
 VariablegetGlobalVariable(java.lang.String name)
          Returns the Global Variable.
 java.util.Map<java.lang.String,Variable>getGlobalVariables()
          Returns all Global Variables.
 VariablegetLocalVariable(java.lang.String name)
          Returns the Local Variable.
 java.util.Map<java.lang.String,Variable>getLocalVariables()
          Returns all local Variables.
 java.util.Map<java.lang.String,OperatorFactory<Operand>>getOperandFactories()
          Returns all Operand Factories.
 OperatorFactory<Operand>getOperandFactory(java.lang.String name)
          Returns the factory for the given Operand.
 java.lang.StringtoString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OperatorSourceImpl

public OperatorSourceImpl()
Constructs a New Operator Source.

Method Detail

getFunctionFactory

public OperatorFactory<Function> getFunctionFactory(java.lang.String name)
Description copied from interface: OperatorSource
Returns the FunctionFactory for the given Function name.

Specified by:
getFunctionFactory in interface OperatorSource
Parameters:
name - The name of the Function
Returns:
Operator Factory.

getOperandFactory

public OperatorFactory<Operand> getOperandFactory(java.lang.String name)
Description copied from interface: OperatorSource
Returns the factory for the given Operand.

Specified by:
getOperandFactory in interface OperatorSource
Parameters:
name - The name of the operand.
Returns:
The factory for that Operand.

getGlobalVariable

public Variable getGlobalVariable(java.lang.String name)
Description copied from interface: OperatorSource
Returns the Global Variable.
Gloval Variables are variables accessed by all Expressions.

 For example, Constants such as E, of PI.

Specified by:
getGlobalVariable in interface OperatorSource
Parameters:
name - The name of the variable.
Returns:
The Global Variable.

getLocalVariable

public Variable getLocalVariable(java.lang.String name)
Description copied from interface: OperatorSource
Returns the Local Variable.

Specified by:
getLocalVariable in interface OperatorSource
Parameters:
name - The name of the variable.
Returns:
The Local Variable.

addGlobalVariable

public void addGlobalVariable(Variable v)
add a global Variable to the Data Source.

Parameters:
v - The variable to be added.

addLocalVariable

public void addLocalVariable(Variable v)
adds a local variable to this source.

Parameters:
v - The variable to be added.

addFunction

public void addFunction(OperatorFactory<Function> fac)
add the specified factory to this source.

Parameters:
fac - the factory to be added.

addOperand

public void addOperand(OperatorFactory<Operand> fac)
adds the specified factory to this source.

Parameters:
fac - the factory to be added.

addOperands

public void addOperands(java.util.Map<java.lang.String,? extends OperatorFactory<Operand>> ops)
adds all Operand factories to this source.

Parameters:
ops - the list of factories.

addFunctions

public void addFunctions(java.util.Map<java.lang.String,? extends OperatorFactory<Function>> funcitons)
adds all Function Factories to this source.

Parameters:
funcitons - The factory functions.

addGlobalVariables

public void addGlobalVariables(java.util.Map<java.lang.String,? extends Variable> v)
adds all Global Variables.

Parameters:
v - the gloval variables to be added.

addLocalVariables

public void addLocalVariables(java.util.Map<java.lang.String,? extends Variable> v)
adds all local variables.

Parameters:
v - the variables to be added.

getFunctionFactories

public java.util.Map<java.lang.String,OperatorFactory<Function>> getFunctionFactories()
Returns all Function factories.

Specified by:
getFunctionFactories in interface OperatorSource
Returns:
a map of all factories.

getGlobalVariables

public java.util.Map<java.lang.String,Variable> getGlobalVariables()
Returns all Global Variables.

Specified by:
getGlobalVariables in interface OperatorSource
Returns:
a map of all Global Variables.

getLocalVariables

public java.util.Map<java.lang.String,Variable> getLocalVariables()
Returns all local Variables.

Specified by:
getLocalVariables in interface OperatorSource
Returns:
a map of all local variables.

getOperandFactories

public java.util.Map<java.lang.String,OperatorFactory<Operand>> getOperandFactories()
Returns all Operand Factories.

Specified by:
getOperandFactories in interface OperatorSource
Returns:
a map of all factories.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object