public class ConstraintList
extends java.lang.Object
implements java.lang.Iterable<net.ssehub.easy.varModel.model.Constraint>
LinkedList to fix types and to allow access from subclasses.| Modifier and Type | Class and Description |
|---|---|
protected static interface |
ConstraintList.IModificationListener
A listener to be informed if the underlying list changes.
|
protected static class |
ConstraintList.Node
The node type in a linked constraint base.
|
| Modifier and Type | Field and Description |
|---|---|
private ConstraintList.Node |
first |
private ConstraintList.Node |
last |
private ConstraintList.IModificationListener |
listener |
protected int |
modCount |
private int |
size |
| Modifier | Constructor and Description |
|---|---|
|
ConstraintList()
Constructs an empty constraint base.
|
protected |
ConstraintList(ConstraintList.IModificationListener listener)
Constructs an empty constraint base.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(net.ssehub.easy.varModel.model.Constraint constraint)
Appends the specified constraint to the end of this constraint base.
|
boolean |
addAll(java.util.Collection<? extends net.ssehub.easy.varModel.model.Constraint> constraints)
Appends all of the constraints in the specified collection to the end of
this list, in the order that they are returned by the specified
collection's iterator.
|
boolean |
addAll(ConstraintList constraints)
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the specified
collection's iterator.
|
boolean |
addAll(ConstraintList constraints,
boolean clear)
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the specified
collection's iterator.
|
boolean |
addAll(int index,
java.util.Collection<? extends net.ssehub.easy.varModel.model.Constraint> constraints)
Inserts all of the constraints in the specified collection into this
list, starting at the specified position.
|
private void |
addAll(int index,
net.ssehub.easy.varModel.model.Constraint[] cArray)
Adds all constraints from
cArray to this collection at position index. |
boolean |
addAll(int index,
ConstraintList constraints)
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the specified
collection's iterator.
|
boolean |
addAll(int index,
ConstraintList constraints,
boolean clear)
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the specified
collection's iterator.
|
void |
addFirst(net.ssehub.easy.varModel.model.Constraint constraint)
Inserts the specified
constraint at the beginning of this constraint base. |
void |
addLast(net.ssehub.easy.varModel.model.Constraint constraint)
Appends the specified
constraint to the end of this constraint base. |
private void |
checkPositionIndex(int index)
Checks
index to be a valid position. |
void |
clear()
Removes all of the elements from this list.
|
boolean |
contains(net.ssehub.easy.varModel.model.Constraint constraint)
Returns
true if this list contains the specified constraint. |
net.ssehub.easy.varModel.model.Constraint |
getFirst()
Returns the first constraint in this list.
|
net.ssehub.easy.varModel.model.Constraint |
getLast()
Returns the last constraint in this list.
|
int |
indexOf(net.ssehub.easy.varModel.model.Constraint constraint)
Returns the index of the first occurrence of the specified
constraint
in this list, or -1 if this list does not contain the element. |
boolean |
isEmpty()
Returns
true if this list contains no constraints. |
private boolean |
isPositionIndex(int index)
Tells if the argument is the index of a valid position for an
iterator or an add operation.
|
java.util.Iterator<net.ssehub.easy.varModel.model.Constraint> |
iterator()
Returns an iterator over the elements in this list (in proper
sequence).
|
private void |
linkFirst(net.ssehub.easy.varModel.model.Constraint constraint)
Links
constraint as first constraint. |
private void |
linkLast(net.ssehub.easy.varModel.model.Constraint constraint)
Links
constraint as last constraint. |
private ConstraintList.Node |
node(int index)
Returns the (non-null) Node at the specified element index.
|
private java.lang.String |
outOfBoundsMsg(int index)
Constructs an IndexOutOfBoundsException detail message.
|
net.ssehub.easy.varModel.model.Constraint |
pop()
Pops an element from the stack represented by this list.
|
boolean |
removeAll(java.util.Collection<? extends net.ssehub.easy.varModel.model.Constraint> constraints)
Removes all elements from this list, which are also in
constraints. |
net.ssehub.easy.varModel.model.Constraint |
removeFirst()
Removes and returns the first constraint from this list.
|
net.ssehub.easy.varModel.model.Constraint |
removeLast()
Removes and returns the last constraint from this list.
|
protected void |
setModificationListener(ConstraintList.IModificationListener listener)
Changes the modification listener.
|
int |
size()
Returns the number of constraints in this constraint base.
|
net.ssehub.easy.varModel.model.Constraint[] |
toArray()
Turns this list into an array containing all constraints.
|
void |
toCollection(java.util.Collection<net.ssehub.easy.varModel.model.Constraint> collection)
Adds all elements in this list to a
collection of constraints. |
java.lang.String |
toString()
Turns the list into its string representation.
|
(package private) net.ssehub.easy.varModel.model.Constraint |
unlink(ConstraintList.Node node)
Unlinks non-null node x.
|
private net.ssehub.easy.varModel.model.Constraint |
unlinkFirst(ConstraintList.Node node)
Unlinks non-null first node
node. |
private net.ssehub.easy.varModel.model.Constraint |
unlinkLast(ConstraintList.Node node)
Unlinks non-null last node
node. |
protected transient int modCount
private int size
private ConstraintList.Node first
private ConstraintList.Node last
private transient ConstraintList.IModificationListener listener
public ConstraintList()
protected ConstraintList(ConstraintList.IModificationListener listener)
listener - the modification listener (null for none)protected void setModificationListener(ConstraintList.IModificationListener listener)
listener - the modification listener (null for none)public boolean contains(net.ssehub.easy.varModel.model.Constraint constraint)
true if this list contains the specified constraint.
More formally, returns true if and only if this list contains
at least one constraint constraint such that
o == constraint.constraint - the constraint whose presence in this list is to be testedtrue if this list contains the specified elementpublic int indexOf(net.ssehub.easy.varModel.model.Constraint constraint)
constraint
in this list, or -1 if this list does not contain the element.
More formally, returns the lowest index i such that
o == get(i),
or -1 if there is no such index.constraint - constraint to search forpublic net.ssehub.easy.varModel.model.Constraint getFirst()
java.util.NoSuchElementException - if this list is emptypublic net.ssehub.easy.varModel.model.Constraint getLast()
java.util.NoSuchElementException - if this list is emptypublic int size()
public boolean isEmpty()
true if this list contains no constraints.true if this list contains no constraintspublic void add(net.ssehub.easy.varModel.model.Constraint constraint)
constraint - constraint to be appendedpublic void addFirst(net.ssehub.easy.varModel.model.Constraint constraint)
constraint at the beginning of this constraint base.constraint - the constraint to addpublic void addLast(net.ssehub.easy.varModel.model.Constraint constraint)
constraint to the end of this constraint base.constraint - the constraint to addpublic void clear()
public boolean addAll(java.util.Collection<? extends net.ssehub.easy.varModel.model.Constraint> constraints)
constraints - collection containing constraints to be added to this listtrue if this list changed as a result of the calljava.lang.NullPointerException - if the specified collection is nullpublic boolean addAll(int index,
java.util.Collection<? extends net.ssehub.easy.varModel.model.Constraint> constraints)
index - index at which to insert the first element
from the specified collectionconstraints - collection containing constraints to be added to this listtrue if this list changed as a result of the calljava.lang.IndexOutOfBoundsExceptionjava.lang.NullPointerException - if the specified collection is nullprivate void addAll(int index,
net.ssehub.easy.varModel.model.Constraint[] cArray)
cArray to this collection at position index.index - index at which to insert the first element
from the specified collectioncArray - the constraints as arraypublic boolean addAll(ConstraintList constraints)
constraints - collection containing constraints to be added to this listtrue if this list changed as a result of the calljava.lang.NullPointerException - if the specified collection is nullpublic boolean addAll(ConstraintList constraints, boolean clear)
constraints - collection containing constraints to be added to this listclear - clears constraints by taking over all internal nodestrue if this list changed as a result of the calljava.lang.NullPointerException - if the specified collection is nullpublic boolean addAll(int index,
ConstraintList constraints)
index - index at which to insert the first element
from the specified collectionconstraints - collection containing constraints to be added to this listtrue if this list changed as a result of the calljava.lang.NullPointerException - if the specified collection is nullpublic boolean addAll(int index,
ConstraintList constraints,
boolean clear)
index - index at which to insert the first element
from the specified collectionconstraints - collection containing constraints to be added to this listclear - clears constraints by taking over all internal nodestrue if this list changed as a result of the calljava.lang.NullPointerException - if the specified collection is nullpublic net.ssehub.easy.varModel.model.Constraint[] toArray()
public void toCollection(java.util.Collection<net.ssehub.easy.varModel.model.Constraint> collection)
collection of constraints.collection - the collection to add topublic net.ssehub.easy.varModel.model.Constraint pop()
This method is equivalent to removeFirst().
java.util.NoSuchElementException - if this list is emptypublic net.ssehub.easy.varModel.model.Constraint removeFirst()
java.util.NoSuchElementException - if this list is emptypublic net.ssehub.easy.varModel.model.Constraint removeLast()
java.util.NoSuchElementException - if this list is emptypublic java.util.Iterator<net.ssehub.easy.varModel.model.Constraint> iterator()
This implementation merely returns a list iterator over the list.
iterator in interface java.lang.Iterable<net.ssehub.easy.varModel.model.Constraint>public boolean removeAll(java.util.Collection<? extends net.ssehub.easy.varModel.model.Constraint> constraints)
constraints.constraints - the elements to removejava.lang.NullPointerException - if null == constraintsprivate void linkFirst(net.ssehub.easy.varModel.model.Constraint constraint)
constraint as first constraint.constraint - the constraint to be linked#notifyNodeAdded(Constraint, Node)private void linkLast(net.ssehub.easy.varModel.model.Constraint constraint)
constraint as last constraint.constraint - the constraint to be linked#notifyNodeAdded(Constraint, Node)private net.ssehub.easy.varModel.model.Constraint unlinkFirst(ConstraintList.Node node)
node.node - the node to unlinkprivate net.ssehub.easy.varModel.model.Constraint unlinkLast(ConstraintList.Node node)
node.node - the node to unlinknet.ssehub.easy.varModel.model.Constraint unlink(ConstraintList.Node node)
node - the node to unlinkprivate java.lang.String outOfBoundsMsg(int index)
index - the failing indexprivate boolean isPositionIndex(int index)
index - the index to checkindex is a valid positionprivate void checkPositionIndex(int index)
index to be a valid position. If not, throws an
IndexOutOfBoundsException.index - the index to checkprivate ConstraintList.Node node(int index)
index - the indexpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2009 - 2018 SSE. All Rights Reserved.