public class AST extends HMArrayList implements java.io.Externalizable
(A)bstract (S)yntax (T)ree of a given function.
In Symja, an abstract syntax tree (AST), is a tree representation of the
abstract syntactic structure of the Symja source code. Each node of the tree
denotes a construct occurring in the source code. The syntax is 'abstract' in
the sense that it does not represent every detail that appears in the real
syntax. For instance, grouping parentheses are implicit in the tree
structure, and a syntactic construct such as a Sin[x]
expression
will be denoted by an AST with 2 nodes. One node for the header
Sin
and one node for the argument x
.
java.util.List
which
contains
0
andn
arguments of a function in the index
1 to n
AbstractAST.ASTIterator
IAST.PROPERTY
Modifier and Type | Field and Description |
---|---|
protected java.util.EnumMap<IAST.PROPERTY,java.lang.Object> |
fProperties
The enumeration map which possibly maps the properties (keys) to a user
defined object.
|
array, lastIndex
fEvalFlags, hashValue
CONTAINS_DEFAULT_PATTERN, CONTAINS_NO_DEFAULT_PATTERN_MASK, CONTAINS_NO_PATTERN, CONTAINS_PATTERN, CONTAINS_PATTERN_EXPR, CONTAINS_PATTERN_SEQUENCE, IS_ALL_EXPANDED, IS_DECOMPOSED_PARTIAL_FRACTION, IS_EXPANDED, IS_FLAT_ORDERLESS_EVALED, IS_FLATTENED, IS_FLATTENED_OR_SORTED_MASK, IS_LISTABLE_THREADED, IS_MATRIX, IS_MATRIX_OR_VECTOR, IS_SORTED, IS_VECTOR, NO_FLAG
ASTID, BLANKID, COMPLEXID, DOUBLECOMPLEXID, DOUBLEID, FRACTIONID, INTEGERID, METHODSYMBOLID, PATTERNID, STRINGID, SYMBOLID
Modifier | Constructor and Description |
---|---|
|
AST()
Public no-arg constructor only needed for serialization
|
|
AST(IExpr head,
IExpr... es) |
protected |
AST(int initialCapacity,
boolean setLength)
Constructs an empty list with the specified initial capacity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(java.util.List<? extends IExpr> ast)
Appends all of the arguments (starting from offset
1 ) in the
specified AST to the end of this AST. |
boolean |
addAll(java.util.List<? extends IExpr> ast,
int startPosition,
int endPosition)
Appends all elements from offset
startPosition to
endPosition in the specified AST to the end of this AST. |
IAST |
addOneIdentity(IAST value)
Add an
subAST with attribute OneIdentity for
example Plus[] or Times[]. |
AST |
clone()
Returns a shallow copy of this AST instance.
|
java.lang.Object |
getProperty(IAST.PROPERTY key)
Returns the value to which the specified property is mapped, or
null if this map contains no mapping for the property. |
int |
hashCode()
Hashcode of this Element.
|
static AST |
newInstance(IExpr head) |
protected static AST |
newInstance(int intialCapacity,
IAST ast,
int endPosition) |
static AST |
newInstance(int intialCapacity,
IExpr head) |
static AST |
newInstance(ISymbol symbol,
org.apache.commons.math4.complex.Complex... arr) |
static AST |
newInstance(ISymbol symbol,
double... arr)
Constructs a list with header symbol and the arguments containing
the given DoubleImpl values.
|
static AST |
newInstance(ISymbol symbol,
double[][] matrix)
Constructs a list with header symbol and the arguments containing
the given DoubleImpl matrix values as List rows
|
static AST |
newInstance(ISymbol symbol,
int... arr) |
static IAST |
parse(java.lang.String inputString)
simple parser to simplify unit tests.
|
java.lang.Object |
putProperty(IAST.PROPERTY key,
java.lang.Object value)
Associates the specified value with the specified property in the
associated
EnumMap map. |
void |
readExternal(java.io.ObjectInput objectInput) |
void |
writeExternal(java.io.ObjectOutput objectOutput) |
add, add, addAll, addAll, arg1, arg2, arg3, arg4, arg5, asSet, clear, ensureCapacity, equals, get, head, init, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
$div, $minus, $plus, $times, $up, abs, accept, accept, accept, accept, addAtClone, addEvalFlags, and, appendClone, apply, apply, apply, apply, apply, args, asType, clearHashCache, compareTo, contains, copy, copyFrom, copyHead, copyUntil, copyUntil, dec, divide, egcd, equalsAt, equalsFromPosition, evalComplex, evalDouble, evalNumber, evalSignedNumber, evaluate, factory, filter, filter, filter, filter, filter, filter, filter, findFirstEquals, forEach, fullFormString, gcd, getAST, getAt, getEvalFlags, getHashCache, getInt, getList, getNumber, getOneIdentity, getPart, getPart, hierarchy, inc, indexOf, internalFormString, internalJavaString, internalScalaString, inverse, isAllExpanded, isAnd, isArcCos, isArcCosh, isArcSin, isArcSinh, isArcTan, isArcTanh, isAST, isAST, isAST, isAST, isAST, isAST, isAST, isASTSizeGE, isAtom, isComplex, isComplexInfinity, isComplexNumeric, isCondition, isCos, isCosh, isDerivative, isDirectedInfinity, isEmpty, isEvalFlagOff, isEvalFlagOn, isExpanded, isFlatAST, isFraction, isFree, isFree, isFree, isFreeAST, isFreeAST, isFreeAt, isFreeOfPatterns, isFunction, isGEOrdered, isGTOrdered, isInfinity, isInteger, isIntegerResult, isList, isListOfLists, isLog, isMatrix, isMember, isModule, isNegative, isNegativeInfinity, isNegativeResult, isNonNegativeResult, isNot, isNumber, isNumeric, isNumericFunction, isNumericMode, isOr, isOrderlessAST, isPatternExpr, isPlus, isPlusTimesPower, isPolynomial, isPolynomial, isPolynomialOfMaxDegree, isPolynomialOfMaxDegree, isPositive, isPositiveResult, isPower, isRationalResult, isRealResult, isRuleAST, isSame, isSame, isSameHead, isSameHead, isSameHead, isSameHeadSizeGE, isSequence, isSignedNumber, isSin, isSinh, isSlot, isSlotSequence, isSpan, isTan, isTanh, isTimes, isUnit, isValue, isVector, iterator, iterator0, last, lastIndexOf, leafCount, leaves, map, map, map, map, mapAt, mapAt, minus, mod, multiply, negate, negative, opposite, optional, or, patternHashCode, plus, power, power, prependClone, range, range, range, remainder, removeAtClone, replaceAll, replaceAll, replacePart, replaceRepeated, replaceRepeated, replaceSlots, setAtClone, setEvalFlags, signum, subtract, sum, times, timesDistributed, topHead, toScript, toScriptFactory, toString, variables2Slots
finalize, getClass, notify, notifyAll, wait, wait, wait
contains, containsAll, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeAll, replaceAll, retainAll, sort, spliterator, subList
evaluateHead, getField, ifPresent, isBlank, isConstant, isE, isFalse, isIndeterminate, isLEOrdered, isLTOrdered, isMember, isMinusOne, isNumEqualInteger, isNumEqualRational, isNumIntValue, isOne, isONE, isPattern, isPatternDefault, isPatternSequence, isPi, isPresent, isRational, isRationalValue, isSymbol, isTrue, isVariable, isZero, isZERO, multiply, ofNullable, orElse, orElseGet, orElseThrow, reciprocal
protected transient java.util.EnumMap<IAST.PROPERTY,java.lang.Object> fProperties
protected AST(int initialCapacity, boolean setLength)
initialCapacity
- the initial capacity (i.e. number of arguments without the
header element) of the list.setLength
- if true
, sets the array's size to
initialCapacity.public AST()
public java.lang.Object getProperty(IAST.PROPERTY key)
null
if this map contains no mapping for the property.property
- #putProperty(PROPERTY, Object)
public int hashCode()
edu.jas.structure.Element
hashCode
in interface edu.jas.structure.Element<IExpr>
hashCode
in interface java.util.Collection<IExpr>
hashCode
in interface java.util.List<IExpr>
hashCode
in class AbstractAST
public java.lang.Object putProperty(IAST.PROPERTY key, java.lang.Object value)
EnumMap
map. If the map
previously contained a mapping for this key, the old value is replaced.key
- value
- #getProperty(PROPERTY)
public static IAST parse(java.lang.String inputString)
public AST clone()
clone
in interface IAST
clone
in class HMArrayList
Cloneable
public IAST addOneIdentity(IAST value)
subAST
with attribute OneIdentity
for
example Plus[] or Times[].addOneIdentity
in interface IAST
value
- an ast with attribute OneIdentity
.this
ast after adding the subASTpublic final boolean addAll(java.util.List<? extends IExpr> ast)
1
) in the
specified AST to the end of this AST.public boolean addAll(java.util.List<? extends IExpr> ast, int startPosition, int endPosition)
startPosition
to
endPosition
in the specified AST to the end of this AST.public static AST newInstance(int intialCapacity, IExpr head)
intialCapacity
- the initial capacity (i.e. number of arguments without the
header element) of the list.head
- public static AST newInstance(ISymbol symbol, double... arr)
Num
public static AST newInstance(ISymbol symbol, org.apache.commons.math4.complex.Complex... arr)
public static AST newInstance(ISymbol symbol, double[][] matrix)
Num
public void writeExternal(java.io.ObjectOutput objectOutput) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput objectInput) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException