hussam.math.operations.parser
Class ExpressionReader
java.lang.Object
hussam.math.operations.parser.ExpressionReader
- All Implemented Interfaces:
- OperationReader
- Direct Known Subclasses:
- DynamicExpressionReader, HussamExpressionReader, SmartExpressionReader
public abstract class ExpressionReader
- extends java.lang.Object
- implements OperationReader
an Abstract class, This class is used to refference the most advanced OperationReader. Currently the getInstance()
method returns a new SmartExpressionReader
Most classes in operations packages use this method to get an instance of an OperationReader
. You should always use This class's getInstance()
to get the best ExpressionReader. This will help you to have a one point access for readers. It is always better not to use MyReader, MyExpressionReader, or SmartExpressionReader directly. Use this class Better.
The Current implementation returns an OperationReader
that will automatically read new Variables.
However, if it reads a new Function, it will throw
an UnknownExpressionArgumentException.
Before you read an operation, make sure that all functions
used are in the OperatorSource
of the ExpressionReader.
Use the DynamicExpressionReader
if you needed to create
Functions dynamically.
- See Also:
DynamicExpressionReader
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExpressionReader
protected ExpressionReader()
getInstance
public static ExpressionReader getInstance()
- Returns a new instance of an OperationReader. The returned OperationReader should have the default features.
- Returns:
- an OperationReader.
getInstance
public static ExpressionReader getInstance(OperationsParser parser,
OperatorSource source)
- Returns a new instance of an OperationReader.
- Parameters:
parser
- the parser, can be null.source
- the source can be null. - Returns:
- an OperationReader.
getInstance
public static ExpressionReader getInstance(OperationsParser parser,
OperatorSource source,
boolean autoCreateVariables,
boolean autoOptimize)
- Returns a new ExpressionReader with the added attribute of creating variables when needed.
- Parameters:
autoOptimize
- if true, the expression reader will optimize the operation before returning it.parser
- the parser can be null.source
- the source, can be null.autoCreateVariables
- if true, variables are created automatically. - Returns:
- the reader.
- Since:
- Version 3