| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthussam.math.operations.parser.ExpressionReader
hussam.math.operations.parser.HussamExpressionReader
public class HussamExpressionReader
This class is Version 6 of all previously created readers. I need people to test this class with different expressions. Extra notes using this class: The default reader creates cariables as needed. you can change the implemetation to throw an UnknownExpressionArgumentException if it encountered a new variable while reading! Of course, the default implementation is set to create variables when necessary.
Operation| Constructor Summary | |
|---|---|
HussamExpressionReader() Creates a new ExpressionReader. | |
HussamExpressionReader(OperationsParser parser) Creates a new ExpressionReader given this spicific parser. | |
HussamExpressionReader(OperationsParser parser, OperatorSource source) Creates a new ExpressionReader given this spicific operator source and parser. | |
HussamExpressionReader(OperationsParser parser, OperatorSource source, boolean autoCreateVariables, boolean autoOptimize) Creates a new ExpressionReader given this spicific operator source and parser and the auto create variable flag. | |
HussamExpressionReader(OperatorSource source) Creates a new ExpressionReader given this spicific operator source. | |
| Method Summary | |
|---|---|
java.util.List<Operation> | getExpressionOperations() This will return a list of all read operations. |
java.util.List<java.lang.String> | getExpressionPartitioned() This will return a list of all symbols, numbers, words(variables or function names) and Baraks. |
OperatorSourceImpl | getOperatorSource() gets the OperatorSource for all expressions read! |
static void | main(java.lang.String[] args) A test method. |
OperationGroup | readOperation(java.lang.String operationString) Reads an expression |
| Methods inherited from class hussam.math.operations.parser.ExpressionReader |
|---|
getInstance, getInstance, getInstance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HussamExpressionReader()
public HussamExpressionReader(OperationsParser parser)
parser - the parser used to parse expressions.public HussamExpressionReader(OperatorSource source)
source - the source used to evaluate expressions.public HussamExpressionReader(OperationsParser parser, OperatorSource source)
parser - The parser used, can be null.source - The source used to find resources. can be null.
public HussamExpressionReader(OperationsParser parser,
OperatorSource source,
boolean autoCreateVariables,
boolean autoOptimize)autoOptimize - if true, returns an optimized operation.parser - the parser to be used. can be null.source - the operatorsource, can be null.autoCreateVariables - if true, indicates that the parser should create variables whenever needed. If false, the reader will not create variables, variables should be added by the user.| Method Detail |
|---|
public OperatorSourceImpl getOperatorSource()
OperationReaderOperatorSource for all expressions read.public java.util.List<Operation> getExpressionOperations()
[ConstantNumber, Operand, ConstantNumber]you will notice that (,) commas are treated as null;
public java.util.List<java.lang.String> getExpressionPartitioned()
public OperationGroup readOperation(java.lang.String operationString)
throws MathExceptionOperationReaderoperationString - the expression to be evaluated. MathException - Thrown if the expression has a problemSyntaxErrorException MathLogicException
public static void main(java.lang.String[] args)
throws java.lang.Exceptionjava.lang.Exception
| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||