hussam.math.operations.extra
Class DynamicFunctionFactory

java.lang.Object
extended by hussam.math.operations.factory.OperatorFactoryImpl<Function>
extended by hussam.math.operations.extra.CustomFunctionFactory
extended by hussam.math.operations.extra.DynamicFunctionFactory
All Implemented Interfaces:
OperatorFactory<Function>, java.io.Serializable, java.lang.Comparable<Operator>

public class DynamicFunctionFactory
extends CustomFunctionFactory

This factory creates CustomFunctions that have thies expression changed. for example, if you create two CustomFunction from this factory, you can change the expression of both functions by called the setExpression of this factory. you can notice that the setExpression(String) used is overriden to be public. This is a very helpful class, to have many created functions to have one expression to be sharred among all.

Author:
Hussam Almulhim حسام الملحم
See Also:
SmartExpressionReader, OperatorFactoryDB, Serialized Form

Nested Class Summary
protected  classDynamicFunctionFactory.DynamicFunction
           
 
Nested classes/interfaces inherited from class hussam.math.operations.extra.CustomFunctionFactory
CustomFunctionFactory.CustomFunction
 
Constructor Summary
DynamicFunctionFactory(OperatorSourceImpl s, java.lang.String name, java.lang.String expression, java.lang.String description)
          Creates a new Dynamic Function Factory.
DynamicFunctionFactory(java.lang.String name, java.lang.String expression)
          Creates a new Dynamic Function Factory.
DynamicFunctionFactory(java.lang.String name, java.lang.String expression, java.lang.String description)
          Creates a new Dynamic Function Factory. with the default DataSource.
 
Method Summary
static java.util.Map<java.lang.String,DynamicFunctionFactory>getDynamicFunctionFactories(java.util.Map<java.lang.String,? extends OperatorFactory<? extends Function>> map)
          This method is used to sort out Dynamic Function Factories from a given list of factories.
 FunctiongetNewOperator()
          Returns a new Operator.
 voidsetExpression(java.lang.String exp)
          Changes the expression used to evaluate all Functions created from this Factory.
 
Methods inherited from class hussam.math.operations.extra.CustomFunctionFactory
createReader, getBasicModel, getDefaultArgumentCount, getExpression, getOperatorSource, getVariable, prepareModel, toString
 
Methods inherited from class hussam.math.operations.factory.OperatorFactoryImpl
compareTo, getDescription, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DynamicFunctionFactory

public DynamicFunctionFactory(OperatorSourceImpl s,
                              java.lang.String name,
                              java.lang.String expression,
                              java.lang.String description)
Creates a new Dynamic Function Factory.

Parameters:
s - The Data source of this factory.
name - The name of this factory.
expression - The expression to be used among all Functions created.
description - The description.

DynamicFunctionFactory

public DynamicFunctionFactory(java.lang.String name,
                              java.lang.String expression,
                              java.lang.String description)
Creates a new Dynamic Function Factory. with the default DataSource.

Parameters:
name - The name of the factory.
expression - The expression used.
description - A description.

DynamicFunctionFactory

public DynamicFunctionFactory(java.lang.String name,
                              java.lang.String expression)
Creates a new Dynamic Function Factory.

Parameters:
name - The name of the function.
expression - The expression
Method Detail

setExpression

public void setExpression(java.lang.String exp)
Changes the expression used to evaluate all Functions created from this Factory.

Overrides:
setExpression in class CustomFunctionFactory
Parameters:
exp - The expression

getDynamicFunctionFactories

public static java.util.Map<java.lang.String,DynamicFunctionFactory> getDynamicFunctionFactories(java.util.Map<java.lang.String,? extends OperatorFactory<? extends Function>> map)
This method is used to sort out Dynamic Function Factories from a given list of factories.

Parameters:
map - a map containg Function Factories.
Returns:
A map containg Dynamic Function Factories.

getNewOperator

public Function getNewOperator()
Description copied from interface: OperatorFactory
Returns a new Operator.

Specified by:
getNewOperator in interface OperatorFactory<Function>
Overrides:
getNewOperator in class CustomFunctionFactory
Returns:
The new Operator.