public final class NetworkLinkCollection extends AbstractList<Link>
Network
class. See Network.getLinks()
. Duplicates and null values are not allowed.
This collection contains all links in a network. To find links specific to a particular node, see LinksIn
and LinksOut
.Node.getLinksIn()
,
Node.getLinksOut()
modCount
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Link item)
Inserts an element into the collection at the specified index.
|
void |
clear()
Removes all elements from the collection.
|
boolean |
contains(Object o)
Determines whether a
Link is in the collection. |
Link |
find(Node from,
Node to)
Finds a link from one node to another if it exists, otherwise returns null.
|
Link |
find(Node from,
Node to,
int temporalOrder)
Finds a link from one node to another if it exists, otherwise returns null.
|
Link |
get(int index)
Gets the
Link object at the specified index. |
Network |
getNetwork()
Gets the
Network the collection belongs to. |
int |
indexOf(Object o)
Determines the index of a specific
Link in the collection. |
Link |
remove(int index)
Removes an element from the collection at the specified index.
|
boolean |
remove(Link item)
Removes the
Link from the collection. |
Link |
set(int index,
Link value)
Sets the
Link object at the specified index. |
int |
size() |
add, addAll, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public Link get(int index)
Link
object at the specified index.get
in interface List<Link>
get
in class AbstractList<Link>
index
- The zero-based index of the Link
to find.Link
.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.public Link set(int index, Link value)
Link
object at the specified index.set
in interface List<Link>
set
in class AbstractList<Link>
index
- The zero-based index of the Link
to find.Link
.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.public void clear()
clear
in interface Collection<Link>
clear
in interface List<Link>
clear
in class AbstractList<Link>
public boolean contains(Object o)
Link
is in the collection. The operation is O(1).contains
in interface Collection<Link>
contains
in interface List<Link>
contains
in class AbstractCollection<Link>
o
- The Link
to locate in the collection. The value can be null.public Link find(Node from, Node to)
from
- The from (parent) node.to
- The to (child) node.public Link find(Node from, Node to, int temporalOrder)
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.public int indexOf(Object o)
Link
in the collection. This operation is O(1).public void add(int index, Link item)
add
in interface List<Link>
add
in class AbstractList<Link>
index
- The zero based index at which to add the element.item
- The item to insert. Cannot be null.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.public boolean remove(Link item)
Link
from the collection.item
- The Link
to be removed from the collection.NullPointerException
- Raised if [item] is null.public Link remove(int index)
remove
in interface List<Link>
remove
in class AbstractList<Link>
index
- The zero based index at which to remove the element.IllegalArgumentException
- index is less than 0.-or-index is equal to or greater than the collection count.public int size()
size
in interface Collection<Link>
size
in interface List<Link>
size
in class AbstractCollection<Link>
Copyright © 2021. All rights reserved.