Class NodeList
java.lang.Object
QueueNet.NodeList
This class implements a list of nodes. Note that only classes of QueueNet
package can add or remove objects to/from the list.
- Author:
- Francesco Radaelli
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new node to the list.booleanUsed to know if a node is in the list.get(int index) Gets the i-th node in the list.Gets the node with a specific name in the list.getFirst()Gets the first node in the list.getLast()Gets the last node in the list.intGets the index of a node.Gets an iterator of the list.voidRemoves a node from the list.intsize()Gets the size of the list.NetNode[]toArray()Converts the list into an array of nodes.
-
Constructor Details
-
NodeList
public NodeList()Creates a new instance of NodeList class.
-
-
Method Details
-
add
Adds a new node to the list.- Parameters:
node- Reference to the node.
-
remove
Removes a node from the list.- Parameters:
node- Reference to the node.
-
getFirst
-
getLast
-
get
Gets the i-th node in the list.- Parameters:
index- Index of the node.- Returns:
- Reference to the i-th node.
-
get
-
size
public int size()Gets the size of the list.- Returns:
- Size of the list.
-
listIterator
Gets an iterator of the list.- Returns:
- Iterator of the list.
-
toArray
Converts the list into an array of nodes.- Returns:
- Array of nodes in the list.
-
indexOf
Gets the index of a node.- Parameters:
node- Reference to the node.- Returns:
- Index of the node.
-
contains
Used to know if a node is in the list.- Parameters:
node- Reference to the node.- Returns:
- true if the node is in the list.
-