public class SparseDirectedEdgeSet extends AbstractSet<DirectedEdge> implements EdgeSet<DirectedEdge>, Serializable
EdgeSet implementation that stores DirectedEdge instances
for a vertex.| Constructor and Description |
|---|
SparseDirectedEdgeSet(int rootVertex)
Creates a new
SparseDirectedEdgeSet for the specfied vertex. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(DirectedEdge e)
Adds the edge to this set if one of the vertices is the root vertex and
if the non-root vertex has a greater index that this vertex.
|
IntSet |
connected()
Returns the set of vertices connected to the root edges.
|
boolean |
connects(int vertex)
Returns true if the root vertex is connected to the provided vertex.
|
boolean |
contains(Object o) |
SparseDirectedEdgeSet |
copy(IntSet vertices)
Copies the edges in this set that are connected to any of the vertices in
the provided set.
|
int |
disconnect(int vertex)
Removes all edges instances that connect to the specified vertex,
returning the number of edges that were removed, if any.
|
Set<DirectedEdge> |
getEdges(int vertex)
Returns the set of
Edge instances that connect the root vertex
with this vertex or an empty set if no such edges exist. |
int |
getRoot()
Returns the vertex to which all edges in this set are connected.
|
Set<DirectedEdge> |
inEdges()
Returns the set of
DirectedEdge instances that point to the root
vertex. |
boolean |
isEmpty() |
Iterator<DirectedEdge> |
iterator() |
Set<DirectedEdge> |
outEdges()
Returns the set of
DirectedEdge instances that originate from the
root vertex. |
boolean |
remove(Object o) |
int |
size() |
equals, hashCode, removeAlladdAll, clear, containsAll, retainAll, toArray, toArray, toStringpublic SparseDirectedEdgeSet(int rootVertex)
SparseDirectedEdgeSet for the specfied vertex.public boolean add(DirectedEdge e)
add in interface EdgeSet<DirectedEdge>add in interface Collection<DirectedEdge>add in interface Set<DirectedEdge>add in class AbstractCollection<DirectedEdge>true if the edge was added, false if the edge was
already present, or if it could not be added to this edge set due
to the root vertex not being connected to the edgepublic IntSet connected()
connected in interface EdgeSet<DirectedEdge>public boolean connects(int vertex)
connects in interface EdgeSet<DirectedEdge>public boolean contains(Object o)
contains in interface Collection<DirectedEdge>contains in interface Set<DirectedEdge>contains in class AbstractCollection<DirectedEdge>public SparseDirectedEdgeSet copy(IntSet vertices)
copy in interface EdgeSet<DirectedEdge>public int disconnect(int vertex)
disconnect in interface EdgeSet<DirectedEdge>public Set<DirectedEdge> getEdges(int vertex)
Edge instances that connect the root vertex
with this vertex or an empty set if no such edges exist.getEdges in interface EdgeSet<DirectedEdge>public int getRoot()
getRoot in interface EdgeSet<DirectedEdge>public Set<DirectedEdge> inEdges()
DirectedEdge instances that point to the root
vertex. Changes to this set will be reflected in this EdgeSet
and vice versa.public boolean isEmpty()
isEmpty in interface Collection<DirectedEdge>isEmpty in interface Set<DirectedEdge>isEmpty in class AbstractCollection<DirectedEdge>public Iterator<DirectedEdge> iterator()
iterator in interface Iterable<DirectedEdge>iterator in interface Collection<DirectedEdge>iterator in interface Set<DirectedEdge>iterator in class AbstractCollection<DirectedEdge>public Set<DirectedEdge> outEdges()
DirectedEdge instances that originate from the
root vertex. Changes to this set will be reflected in this EdgeSet and vice versa.public boolean remove(Object o)
remove in interface Collection<DirectedEdge>remove in interface Set<DirectedEdge>remove in class AbstractCollection<DirectedEdge>public int size()
size in interface Collection<DirectedEdge>size in interface Set<DirectedEdge>size in class AbstractCollection<DirectedEdge>Copyright © 2012. All Rights Reserved.