hussam.math.operations.dataBase
Class OperatorSourceWrapper
java.lang.Object
hussam.math.operations.dataBase.OperatorSourceImpl
hussam.math.operations.dataBase.OperatorSourceWrapper
- All Implemented Interfaces:
- OperatorSource
- Direct Known Subclasses:
- DynamicOperatorSourceWrapper
public class OperatorSourceWrapper
- extends OperatorSourceImpl
This DataSource wrapps a Datasource and gives the user means to access the both sources without changing the content of the base source. Use this whenever you want to have your own Source without having to build everything.
For example,
OperatorSourceImpl mySource=new OperatorSourceWrapper(OperatorFactoryDB.getInstance());
mySOurce.addFunction(..); //adds the function to your source.
mySource.getFunction(..); //gets the function from your source or the inner source OperatorFactory
- Author:
- Hussam Almulhim حسام الملحم
- See Also:
OperatorFactoryDB
, SmartExpressionReader
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
OperatorSourceWrapper
public OperatorSourceWrapper(OperatorSource source)
- Construcs a new OperatorSource with the the given sub source.
- Parameters:
source
- The inner source to be inserted.
getFunctionFactory
public OperatorFactory<Function> getFunctionFactory(java.lang.String name)
- Returns the factory for this Function. First it seraches for the Factory inside this Source. If it does not find it, it will search the sub source inserted in this wrapper.
- Specified by:
getFunctionFactory
in interface OperatorSource
- Overrides:
getFunctionFactory
in class OperatorSourceImpl
- Parameters:
name
- The name of the function. - Returns:
- The function factory.
getOperandFactory
public OperatorFactory<Operand> getOperandFactory(java.lang.String name)
- Returns the Operand factory by this name. First it serachs for the factory inside this source. If it does not find it, it will seach the sub source for it.
- Specified by:
getOperandFactory
in interface OperatorSource
- Overrides:
getOperandFactory
in class OperatorSourceImpl
- Parameters:
name
- The name of the operand. - Returns:
- the operand factory.
getGlobalVariable
public Variable getGlobalVariable(java.lang.String name)
- Returns the Global Variable by this name. First it searchs this source. if it does not find it, it will search the sub source inserted in the constructor.
- Specified by:
getGlobalVariable
in interface OperatorSource
- Overrides:
getGlobalVariable
in class OperatorSourceImpl
- Parameters:
name
- the name of the Global Variable. - Returns:
- The variable.
getFunctionFactories
public java.util.Map<java.lang.String,OperatorFactory<Function>> getFunctionFactories()
- Returns all Factories in both this source and the sub source. First it adds all the inner source factories, Then it adds this function factories. If there is a sharred function name in both inner and this source, The function factory from this source will be added.
- Specified by:
getFunctionFactories
in interface OperatorSource
- Overrides:
getFunctionFactories
in class OperatorSourceImpl
- Returns:
- a map of all factories.
getGlobalVariables
public java.util.Map<java.lang.String,Variable> getGlobalVariables()
- Returns all Global Variable in this source, and inside the sub source. First it adds all the inner source global variables, Then it adds this source's global variables. If there is a sharred variable name in both inner and this source, The global variable from this source will be added.
- Specified by:
getGlobalVariables
in interface OperatorSource
- Overrides:
getGlobalVariables
in class OperatorSourceImpl
- Returns:
- a map of all Global Variables.
getOperandFactories
public java.util.Map<java.lang.String,OperatorFactory<Operand>> getOperandFactories()
- Returns all Factories in this source and in the sub source. First it adds all the inner source factories, Then it adds this operand factories. If there is a sharred operand name in both inner and this source, The operand factory from this source will be added.
- Specified by:
getOperandFactories
in interface OperatorSource
- Overrides:
getOperandFactories
in class OperatorSourceImpl
- Returns:
- a map of all Factories.
toString
public java.lang.String toString()
- Overrides:
toString
in class OperatorSourceImpl
getInnerSource
public OperatorSource getInnerSource()