public class ExpressionCollection extends Object implements Cloneable, Serializable
Constructor and Description |
---|
ExpressionCollection()
Creates a new expression collection (initially empty).
|
ExpressionCollection(Collection expressions)
Creates a new expression collection, populated with the supplied expressions.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Expression e)
Adds an expression to the collection.
|
void |
add(int index,
Expression e) |
void |
addAll(Collection expressions)
Adds all expressions contained in the given collection to this expression collection.
|
ExpressionCollection |
clone()
Clones this expression collection and all expressions contained in the collection.
|
boolean |
contains(Expression expression) |
Expression |
get(String name)
Returns the
Expression with the specified name (or null ). |
Expression |
getExpression(int pos)
Returns the expression on the given position in the list.
|
Expression[] |
getExpressions()
Return all expressions contained in this collection as array.
|
int |
indexOf(Expression element) |
boolean |
removeExpression(Expression e)
Removes an expression from the collection.
|
void |
removeExpression(int index)
Removes an expression from the collection.
|
Expression |
set(int index,
Expression element) |
int |
size()
Returns the number of active expressions in this collection.
|
public ExpressionCollection()
public ExpressionCollection(Collection expressions)
expressions
- a collection of expressions.ClassCastException
- if the collection does not contain Expressionspublic void addAll(Collection expressions)
expressions
- the expressions to be added.ClassCastException
- if the collection does not contain expressionspublic Expression get(String name)
Expression
with the specified name (or null
).name
- the expression name (null
not permitted).public void add(Expression e)
e
- the expression.public void add(int index, Expression e)
public boolean removeExpression(Expression e)
e
- the expression.NullPointerException
- if the given Expression is null.public void removeExpression(int index)
index
- the index of the expression ro removepublic int size()
public Expression getExpression(int pos)
pos
- the position in the list.IndexOutOfBoundsException
- if the given position is invalidpublic int indexOf(Expression element)
public Expression set(int index, Expression element)
public ExpressionCollection clone()
public Expression[] getExpressions()
public boolean contains(Expression expression)