public class ListOfNodes extends Node
Node.Operations
Modifier and Type | Field and Description |
---|---|
protected LinkedList |
_nodesList |
static Integer |
ID
This field represent the static ID of the class Node.
|
_nodes, _observers, _operations, _thisoperations
Constructor and Description |
---|
ListOfNodes()
Constructor.
|
ListOfNodes(ListOfNodes nodes)
Constructor.
|
ListOfNodes(Node[] nodes)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor)
This method is part of the implementation of the visitor design pattern.
|
void |
add(int index,
Node node)
This method add a node within the list at a particular position.
|
void |
add(Node node)
This method add a node within the list.
|
void |
addAll(int index,
ListOfNodes nodes)
This method add several nodes within the list, starting at the index position.
|
void |
addAll(ListOfNodes nodes)
This method add several nodes within the list.
|
void |
addAll(Node[] nodes)
This method add several nodes within the list.
|
Collection |
asACollection()
This method returns the list as a collection.
|
List |
asAList()
This method returns the list of nodes as a list.
|
Node[] |
children()
This method returns the nodes contained within the list.
|
void |
childrenAccept(Visitor v)
This method is part of the implementation of the visitor design pattern.
|
boolean |
childrenOfKind(Class[] nodeClasses,
ListOfNodes result)
This method fills the result list with all nodes of the graph
instance of the nodeClass.
|
boolean |
contains(Node node)
This method returns true if the node is already in the list.
|
void |
copyValueOf(Node n,
HashMap clones)
This method replace the list entirely with the other list.
|
protected void |
dofind(Class[] nodeClasses,
int attribut,
Object value,
ListOfNodes result,
boolean all) |
void |
dump(String tab)
This method dumps the graph this node of which is the root.
|
Vector |
find(NodeFinder finder)
This method returns a vector containing nodes ok for the given finder.
|
Node |
get(int index)
This method returns the node at a particular position.
|
int |
getClassID()
This method return the dynamic class ID of the node.
|
Node |
getClone(HashMap clones)
This method return a clone of the list.
|
Node |
getFirst()
This method returns the first node of the list.
|
Node |
getLast()
This method returns the last node of the list.
|
boolean |
isEmpty()
This method returns if the list is empty.
|
Iterator |
iterator()
This method returns an iterator object to iterate on the list nodes.
|
Node |
remove(int index)
This method remove a node from the list.
|
void |
remove(Node node)
This method remove a node from the list.
|
void |
removeAll()
This method remove all nodes from the list.
|
void |
replace(int index,
Node node)
This method replace the node at the index position by a nea one.
|
void |
replaceAll(ListOfNodes nodes)
This method replace all the nodes contained by the list by new nodes.
|
void |
replaceAll(Node[] nodes)
This method replace all the nodes contained by the list by new nodes.
|
int |
size()
This method returns the size of the list.
|
void |
sort(Comparator comparator)
This method sort the list with respect to a comparator,
or to the typographical order of the strings representing the nodes.
|
String |
toString()
This method return a string representing the list.
|
addObserver, addOperations, childrenOfKind, childrenOfKind, compare, compareTo, copyValueOf, equals, find, find, find, find, getAttribute, getAttribute, getClone, getOperations, hasAttribute, hasAttribute, initNode, installOperations, notifyChanges, removeObserver, setAttribute, setAttribute
protected LinkedList _nodesList
public static Integer ID
public ListOfNodes()
public ListOfNodes(Node[] nodes)
nodes
- an array of nodes to insert in the list.public ListOfNodes(ListOfNodes nodes)
nodes
- a list of nodes to insert in the list.public int getClassID()
getClassID
in class Node
public void add(Node node)
node
- node to be added.public void addAll(Node[] nodes)
nodes
- array of nodes to be added.public void addAll(ListOfNodes nodes)
nodes
- list of nodes to be added.public void addAll(int index, ListOfNodes nodes)
index
- the index of the start position.nodes
- list of nodes to be added.public void add(int index, Node node)
index
- position where tu add the node.node
- the node to be added.public void remove(Node node)
node
- the node to be removed.public Node remove(int index)
index
- the index of the node to be removed.public void removeAll()
public void replace(int index, Node node)
public void replaceAll(Node[] nodes)
nodes
- an array containing the new nodes to be added.public void replaceAll(ListOfNodes nodes)
nodes
- a list containing the new nodes to be added.public boolean contains(Node node)
node
- the node to check if it is present in the list.public Node get(int index)
index
- the index of the node to be returned.public Node getLast()
public Node getFirst()
public int size()
public boolean isEmpty()
public void sort(Comparator comparator)
comparator
- the comparator to use to sort the list.public Collection asACollection()
public List asAList()
public Node[] children()
public Vector find(NodeFinder finder)
finder
- the finder to operate on each node of the list.public void dump(String tab)
public void accept(Visitor visitor)
public void childrenAccept(Visitor v)
childrenAccept
in class Node
v
- the visitor to apply on each node of the list.public void copyValueOf(Node n, HashMap clones)
copyValueOf
in class Node
n
- the new list of nodes.protected void dofind(Class[] nodeClasses, int attribut, Object value, ListOfNodes result, boolean all)
public boolean childrenOfKind(Class[] nodeClasses, ListOfNodes result)
childrenOfKind
in class Node
nodeClass
- the class the return nodes must be instance of.result
- the result list.public String toString()
public Iterator iterator()