public abstract class HMArrayList extends AbstractAST implements java.util.List<IExpr>, java.lang.Cloneable, java.io.Serializable, java.util.RandomAccess
List, backed by an array. All
optional operations adding, removing, and replacing are supported. The
elements can be any objects.
Copied and modified from the Apache Harmony project.AbstractAST.ASTIteratorIAST.PROPERTY| Modifier and Type | Field and Description |
|---|---|
protected IExpr[] |
array |
protected int |
lastIndex |
fEvalFlags, hashValueCONTAINS_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_FLAGASTID, BLANKID, COMPLEXID, DOUBLECOMPLEXID, DOUBLEID, FRACTIONID, INTEGERID, METHODSYMBOLID, PATTERNID, STRINGID, SYMBOLID| Modifier | Constructor and Description |
|---|---|
|
HMArrayList()
Constructs a new instance of
ArrayList with ten capacity. |
|
HMArrayList(java.util.Collection<? extends E> collection)
Constructs a new instance of
ArrayList containing the elements of
the specified collection. |
protected |
HMArrayList(IExpr[] array) |
|
HMArrayList(IExpr ex,
IExpr... es) |
|
HMArrayList(int capacity)
Constructs a new instance of
ArrayList with the specified
capacity. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(IExpr object)
Adds the specified object at the end of this
ArrayList. |
void |
add(int location,
IExpr object)
Inserts the specified object into this
ArrayList at the specified
location. |
boolean |
addAll(java.util.Collection<? extends IExpr> collection)
Adds the objects in the specified collection to this
ArrayList. |
boolean |
addAll(int location,
java.util.Collection<? extends IExpr> collection)
Inserts the objects in the specified collection at the specified location
in this List.
|
IExpr |
arg1()
Get the first argument (i.e. the second element of the underlying list
structure) of the
AST function (i.e. get(1) ). |
IExpr |
arg2()
Get the second argument (i.e. the third element of the underlying list
structure) of the
AST function (i.e. get(2) ). |
IExpr |
arg3()
Get the third argument (i.e. the fourth element of the underlying list
structure) of the
AST function (i.e. get(3) ). |
IExpr |
arg4()
Get the fourth argument (i.e. the fifth element of the underlying list
structure) of the
AST function (i.e. get(4) ). |
IExpr |
arg5()
Get the fifth argument (i.e. the sixth element of the underlying list
structure) of the
AST function (i.e. get(5) ). |
java.util.Set<IExpr> |
asSet()
Collect all arguments of this AST in a new set.
|
void |
clear()
Removes all elements from this
ArrayList, leaving it empty. |
IAST |
clone()
Returns a new
HMArrayList with the same elements, the same size
and the same capacity as this HMArrayList. |
void |
ensureCapacity(int minimumCapacity)
Ensures that after this operation the
ArrayList can hold the
specified number of elements without further growing. |
boolean |
equals(java.lang.Object obj)
Test if this is equal to b.
|
IExpr |
get(int location) |
IExpr |
head()
If this object is an instance of
IAST get the first element
(offset 0) of the IAST list (i.e. get(0) ). |
protected void |
init(IExpr[] array) |
IExpr |
remove(int location)
Removes the object at the specified location from this list.
|
boolean |
remove(java.lang.Object object) |
protected void |
removeRange(int start,
int end)
Removes the objects in the specified range from the start to the end, but
not including the end index.
|
IExpr |
set(int location,
IExpr object)
Replaces the element at the specified location in this
ArrayList
with the specified object. |
int |
size()
Returns the number of elements in this
ArrayList. |
java.lang.Object[] |
toArray()
Returns a new array containing all elements contained in this
ArrayList. |
<T> T[] |
toArray(T[] contents)
Returns an array containing all elements contained in this
ArrayList. |
void |
trimToSize()
Sets the capacity of this
ArrayList to be the same as the current
size. |
$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, hashCode, 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, variables2Slotsfinalize, getClass, notify, notifyAll, wait, wait, waitcontains, containsAll, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeAll, replaceAll, retainAll, sort, spliterator, subListaddAll, addAll, addOneIdentity, setAtCopyevaluateHead, 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, reciprocalprotected transient IExpr[] array
protected transient int lastIndex
public HMArrayList()
ArrayList with ten capacity.public HMArrayList(java.util.Collection<? extends E> collection)
ArrayList containing the elements of
the specified collection. The initial size of the ArrayList will
be 10% higher than the size of the specified collection.collection - the collection of elements to add.protected HMArrayList(IExpr[] array)
public HMArrayList(int capacity)
ArrayList with the specified
capacity.capacity - the initial capacity of this ArrayList.public final IExpr arg1()
AST function (i.e. get(1) ). Sin(x), arg1() returns x.arg1 in interface IASTAST.IExpr.head()public final IExpr arg2()
AST function (i.e. get(2) ). x^y
(i.e. Power(x, y)), arg2() returns
y.arg2 in interface IASTAST.IExpr.head()public final IExpr arg3()
AST function (i.e. get(3) ).f(a, b, c), arg3() returns c.arg3 in interface IASTAST.IExpr.head()public final IExpr arg4()
AST function (i.e. get(4) ).f(a, b ,c, d), arg4() returns d.arg4 in interface IASTAST.IExpr.head()public final IExpr arg5()
AST function (i.e. get(5) ).f(a, b ,c, d, e), arg5() returns e
.arg5 in interface IASTAST.IExpr.head()public java.util.Set<IExpr> asSet()
IASTpublic boolean add(IExpr object)
ArrayList.public void add(int location,
IExpr object)
ArrayList at the specified
location. The object is inserted before any previous element at the
specified location. If the location is equal to the size of this
ArrayList, the object is added at the end.public boolean addAll(java.util.Collection<? extends IExpr> collection)
ArrayList.public boolean addAll(int location,
java.util.Collection<? extends IExpr> collection)
addAll in interface java.util.List<IExpr>addAll in class java.util.AbstractList<IExpr>location - the index at which to insert.collection - the collection of objects.true if this ArrayList is modified, false
otherwise.java.lang.IndexOutOfBoundsException - when location < 0 || > size()public void clear()
ArrayList, leaving it empty.clear in interface java.util.Collection<IExpr>clear in interface java.util.List<IExpr>clear in class java.util.AbstractList<IExpr>AbstractAST.isEmpty(),
size()public IAST clone()
HMArrayList with the same elements, the same size
and the same capacity as this HMArrayList.clone in interface IASTclone in class AbstractASTArrayListCloneablepublic boolean equals(java.lang.Object obj)
edu.jas.structure.Elementequals in interface edu.jas.structure.Element<IExpr>equals in interface java.util.Collection<IExpr>equals in interface java.util.List<IExpr>equals in class AbstractASTpublic void ensureCapacity(int minimumCapacity)
ArrayList can hold the
specified number of elements without further growing.minimumCapacity - the minimum capacity asked for.public IExpr get(int location)
get in interface java.util.List<IExpr>get in class AbstractASTpublic final IExpr head()
IExprIAST get the first element
(offset 0) of the IAST list (i.e. get(0) ).protected final void init(IExpr[] array)
public IExpr remove(int location)
public boolean remove(java.lang.Object object)
protected void removeRange(int start,
int end)
removeRange in class java.util.AbstractList<IExpr>start - the index at which to start removing.end - the index one after the end of the range to remove.java.lang.IndexOutOfBoundsException - when start < 0, start > end or end > size()public IExpr set(int location, IExpr object)
ArrayList
with the specified object.set in interface java.util.List<IExpr>set in class java.util.AbstractList<IExpr>location - the index at which to put the specified object.object - the object to add.java.lang.IndexOutOfBoundsException - when location < 0 || >= size()public int size()
ArrayList.size in interface java.util.Collection<IExpr>size in interface java.util.List<IExpr>size in class AbstractASTArrayList.public java.lang.Object[] toArray()
ArrayList.public <T> T[] toArray(T[] contents)
ArrayList. If the specified array is large enough to hold the
elements, the specified array is used, otherwise an array of the same
type is created. If the specified array is used and is larger than this
ArrayList, the array element following the collection elements is
set to null.toArray in interface java.util.Collection<IExpr>toArray in interface java.util.List<IExpr>toArray in class java.util.AbstractCollection<IExpr>contents - the array.ArrayList.java.lang.ArrayStoreException - when the type of an element in this ArrayList cannot
be stored in the type of the specified array.public void trimToSize()
ArrayList to be the same as the current
size.size()