Class NodeList

java.lang.Object
QueueNet.NodeList

public class NodeList extends Object
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 Details

    • NodeList

      public NodeList()
      Creates a new instance of NodeList class.
  • Method Details

    • add

      public void add(NetNode node)
      Adds a new node to the list.
      Parameters:
      node - Reference to the node.
    • remove

      public void remove(NetNode node)
      Removes a node from the list.
      Parameters:
      node - Reference to the node.
    • getFirst

      public NetNode getFirst()
      Gets the first node in the list.
      Returns:
      Reference to the first node.
    • getLast

      public NetNode getLast()
      Gets the last node in the list.
      Returns:
      Reference to the last node.
    • get

      public NetNode get(int index)
      Gets the i-th node in the list.
      Parameters:
      index - Index of the node.
      Returns:
      Reference to the i-th node.
    • get

      public NetNode get(String name)
      Gets the node with a specific name in the list.
      Parameters:
      name - Name of the node.
      Returns:
      Reference to the node.
    • size

      public int size()
      Gets the size of the list.
      Returns:
      Size of the list.
    • listIterator

      public ListIterator<NetNode> listIterator()
      Gets an iterator of the list.
      Returns:
      Iterator of the list.
    • toArray

      public NetNode[] toArray()
      Converts the list into an array of nodes.
      Returns:
      Array of nodes in the list.
    • indexOf

      public int indexOf(NetNode node)
      Gets the index of a node.
      Parameters:
      node - Reference to the node.
      Returns:
      Index of the node.
    • contains

      public boolean contains(NetNode node)
      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.