Class NetworkLinkCollection

    • Method Detail

      • getNetwork

        public Network getNetwork()
        Gets the Network the collection belongs to.
      • get

        public Link get​(int index)
        Gets the Link object at the specified index.
        Specified by:
        get in interface List<Link>
        Specified by:
        get in class AbstractList<Link>
        Parameters:
        index - The zero-based index of the Link to find.
        Returns:
        A Link.
        Throws:
        NullPointerException - Raised when value being set is null.
        IllegalStateException - Raised if the value being set already belongs to a network, an equivalent link already exists, or the link nodes do not belong to the Network.
        IllegalArgumentException - index is less than 0.-or-index is equal to or greater than the collection count.
      • contains

        public boolean contains​(Object o)
        Determines whether a Link is in the collection. The operation is O(1).
        Specified by:
        contains in interface Collection<Link>
        Specified by:
        contains in interface List<Link>
        Overrides:
        contains in class AbstractCollection<Link>
        Parameters:
        o - The Link to locate in the collection. The value can be null.
        Returns:
        true if [o] is found in the collection; otherwise, false.
      • find

        public Link find​(Node from,
                         Node to)
        Finds a link from one node to another if it exists, otherwise returns null.
        Parameters:
        from - The from (parent) node.
        to - The to (child) node.
        Returns:
        The link if found, otherwise null.
      • find

        public Link find​(Node from,
                         Node to,
                         int temporalOrder)
        Finds a link from one node to another if it exists, otherwise returns null.
        Parameters:
        from - The from (parent) node.
        to - The to (child) node.
        temporalOrder - The temporal order of the link. Will be null unless the nodes are temporal nodes.
        Returns:
        The link if found, otherwise null.
      • indexOf

        public int indexOf​(Object o)
        Determines the index of a specific Link in the collection. This operation is O(1).
        Specified by:
        indexOf in interface List<Link>
        Overrides:
        indexOf in class AbstractList<Link>
        Parameters:
        o - The link. The value can be null.
        Returns:
        The index of the link or -1 if not found.
      • add

        public void add​(int index,
                        Link item)
        Inserts an element into the collection at the specified index.
        Specified by:
        add in interface List<Link>
        Overrides:
        add in class AbstractList<Link>
        Parameters:
        index - The zero based index at which to add the element.
        item - The item to insert. Cannot be null.
        Throws:
        NullPointerException - Raised if [item] is null.
        IllegalStateException - Raised if the new link already belongs to a network, an equivalent link already exists, or the link nodes do not belong to the Network.
        IllegalArgumentException - index is less than 0.-or-index is equal to or greater than the collection count.
      • remove

        public boolean remove​(Link item)
        Removes the Link from the collection.
        Parameters:
        item - The Link to be removed from the collection.
        Returns:
        true if item was successfully removed from the collection; otherwise, false. This method also returns false if item is not found in the collection.
        Throws:
        NullPointerException - Raised if [item] is null.
      • remove

        public Link remove​(int index)
        Removes an element from the collection at the specified index.
        Specified by:
        remove in interface List<Link>
        Overrides:
        remove in class AbstractList<Link>
        Parameters:
        index - The zero based index at which to remove the element.
        Throws:
        IllegalArgumentException - index is less than 0.-or-index is equal to or greater than the collection count.