public class List extends Expression
List
is an Expression
which represents a list of
other Expressions
.
For example, such Lists
can represent mathematical vectors or
matrices.List
represents the expected form you should use
the class ListFormChecker
which provides certain static methods.List
will be createt by a Parser
whenever the
delimiter ',' will be found in the String
to be parsed, e.g.:
{3, 4, 5} or f(3, 4, 5). See documentation of Parser
for details.Constructor and Description |
---|
List()
Creates a new
List with 0 entries (an empty
List ). |
Modifier and Type | Method and Description |
---|---|
void |
addEntry(Expression newEntry)
Adds the specified
Expression at the end of this
List . |
Expression |
differentiate(Symbol s)
Returns a new List with this List entries differentiated.
|
Expression |
dissolveFunctionCalls()
Inserts the arguments of any FunctionCall in the expression-tree-hierarchy
into the appropriate function definitions and replaces the FunctionCalls
by that new Expressions.
|
boolean |
equals(Object o)
Returns
true if the specified Object is also a
List , the number of entries is equal and all entries are equal to
this List entries, false otherwise. |
Expression[] |
getEntries()
Returns all
Expression which are entries of this
List . |
Expression |
getEntry(int index)
Returns the
Expression which is located at the
index' position of this List . |
int |
getEntryCount()
Returns the number of entries this
List is containing. |
void |
getEssentialVariables(Collection c)
Adds the names of the
Variables which are essential for
evaluation into the specified Collection . |
Evaluator |
getEvaluator(Type defaultType,
Context context)
Returns the
Evaluator for this List . |
protected int |
getPriority()
Returns a constant value, because a
List must not have a
priority. |
boolean |
isComplete()
Returns
true if this List is empty or all entries
are complete, false otherwise. |
boolean |
isConstant()
Returns
true if this List is empty or all entries
are constant, false otherwise. |
Expression |
replaceSymbol(Symbol s,
Expression expr)
Replaces all Symbols equal to s in this List
with the specified Expression.
|
Expression |
simplify()
Returns a new List with this List's entries simplified.
|
String |
toString()
Returns a
String representing this
List . |
differentiate, getEssentialVariables
public void addEntry(Expression newEntry)
Expression
at the end of this
List
.newEntry
- the Expression
to be added as a new entry
of this List
.public Expression differentiate(Symbol s)
differentiate
in class Expression
public Expression dissolveFunctionCalls()
Expression
dissolveFunctionCalls
in class Expression
Function.insertArguments(Expression)
public boolean equals(Object o)
true
if the specified Object
is also a
List
, the number of entries is equal and all entries are equal to
this List
entries, false
otherwise.equals
in class Object
o
- the object to compare this List
against.true
if the specified Object
is also a
List
, the number of entries is equal and all entries are equal to
this List
entries, false
otherwise.getEntryCount()
public Expression[] getEntries()
Expression
which are entries of this
List
.Expression
array of all entries of this
List
.public Expression getEntry(int index)
Expression
which is located at the
index'
position of this List
.index
- the position in this List
.Expression
which is located at the specified
index
of this List
.public int getEntryCount()
List
is containing.List
is containing.public void getEssentialVariables(Collection c)
Variables
which are essential for
evaluation into the specified Collection
. Therefor it gets the
essential Variables
of all entries of this
List
.getEssentialVariables
in class Expression
c
- the Collection
the Variable
names
will be added to.public Evaluator getEvaluator(Type defaultType, Context context)
Evaluator
for this List
.
Type defaultType
specifies, how to deal with
Symbols
in the expression-tree-hirarchy (evaluate any
Symbol
as a Complex
or a Real
or
whatever?).getEvaluator
in class Expression
defaultType
- the Type
any Symbol
will be
evaluated to.context
- the Context
, the Evaluators for
the Symbols
are getting from.
Evaluator
for this List
.WrongListFormException
- if this List
does not represent
a Vector or a Matrix.Evaluator.getReturnType()
,
Context.getEvaluator(Symbol)
protected int getPriority()
List
must not have a
priority. A List
can only be operand of operations, like a
Symbol
.getPriority
in class Expression
-1
.Parser.parse()
,
Expression.getEvaluator(Type,Context)
public boolean isComplete()
true
if this List
is empty or all entries
are complete, false
otherwise.isComplete
in class Expression
true
if this List
is empty or all entries
are complete, false
otherwise.public boolean isConstant()
true
if this List
is empty or all entries
are constant, false
otherwise.isConstant
in class Expression
true
if this List
is empty or all entries
are constant, false
otherwise.public Expression replaceSymbol(Symbol s, Expression expr)
replaceSymbol
in class Expression
s
- the Symbol to be replace.expr
- the Expression for replacement.Symbol.replaceSymbol(Symbol,Expression)
public Expression simplify()
simplify
in class Expression