public class SparseDirectedTypedEdgeSet<T> extends AbstractSet<DirectedTypedEdge<T>> implements EdgeSet<DirectedTypedEdge<T>>, Serializable
EdgeSet
implementation that stores DirectedTypedEdge
instances for a vertex. This class provides additional methods beyond the
EdgeSet
interface for interacting with edges on the basis of their
type and their orientation.Constructor and Description |
---|
SparseDirectedTypedEdgeSet(int rootVertex)
Creates a new
SparseDirectedTypedEdgeSet for the specfied vertex. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(DirectedTypedEdge<T> 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.
|
void |
clear() |
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 |
connects(int vertex,
T type) |
boolean |
contains(Object o) |
SparseDirectedTypedEdgeSet<T> |
copy(IntSet vertices)
Copies the edges in this set that are connected to any of the vertices in
the provided set.
|
int |
disconnect(int v)
Removes all edges instances that connect to the specified vertex,
returning the number of edges that were removed, if any.
|
Set<DirectedTypedEdge<T>> |
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. |
Set<DirectedTypedEdge<T>> |
getEdges(int vertex,
Set<T> types) |
Set<DirectedTypedEdge<T>> |
getEdges(T type) |
int |
getRoot()
Returns the vertex to which all edges in this set are connected.
|
Set<DirectedTypedEdge<T>> |
incoming()
Returns the set of edges that point to the vertex associated with this
edge set.
|
boolean |
isEmpty() |
Iterator<DirectedTypedEdge<T>> |
iterator() |
Set<DirectedTypedEdge<T>> |
outgoing()
Returns the set of edges that originate from the vertex associated with
this edge set.
|
IntSet |
predecessors() |
boolean |
remove(Object o) |
int |
size() |
IntSet |
successors() |
Set<T> |
types()
Returns the set of types contained within this set
|
Iterator<DirectedTypedEdge<T>> |
uniqueIterator() |
equals, hashCode, removeAll
addAll, containsAll, retainAll, toArray, toArray, toString
public SparseDirectedTypedEdgeSet(int rootVertex)
SparseDirectedTypedEdgeSet
for the specfied vertex.public boolean add(DirectedTypedEdge<T> e)
add
in interface EdgeSet<DirectedTypedEdge<T>>
add
in interface Collection<DirectedTypedEdge<T>>
add
in interface Set<DirectedTypedEdge<T>>
add
in class AbstractCollection<DirectedTypedEdge<T>>
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 void clear()
clear
in interface Collection<DirectedTypedEdge<T>>
clear
in interface Set<DirectedTypedEdge<T>>
clear
in class AbstractCollection<DirectedTypedEdge<T>>
public IntSet connected()
connected
in interface EdgeSet<DirectedTypedEdge<T>>
public boolean connects(int vertex)
connects
in interface EdgeSet<DirectedTypedEdge<T>>
public boolean connects(int vertex, T type)
public boolean contains(Object o)
contains
in interface Collection<DirectedTypedEdge<T>>
contains
in interface Set<DirectedTypedEdge<T>>
contains
in class AbstractCollection<DirectedTypedEdge<T>>
public SparseDirectedTypedEdgeSet<T> copy(IntSet vertices)
copy
in interface EdgeSet<DirectedTypedEdge<T>>
public int disconnect(int v)
disconnect
in interface EdgeSet<DirectedTypedEdge<T>>
public Set<DirectedTypedEdge<T>> getEdges(T type)
public Set<DirectedTypedEdge<T>> 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<DirectedTypedEdge<T>>
public Set<DirectedTypedEdge<T>> getEdges(int vertex, Set<T> types)
public int getRoot()
getRoot
in interface EdgeSet<DirectedTypedEdge<T>>
public Set<DirectedTypedEdge<T>> incoming()
public boolean isEmpty()
isEmpty
in interface Collection<DirectedTypedEdge<T>>
isEmpty
in interface Set<DirectedTypedEdge<T>>
isEmpty
in class AbstractCollection<DirectedTypedEdge<T>>
public Iterator<DirectedTypedEdge<T>> iterator()
iterator
in interface Iterable<DirectedTypedEdge<T>>
iterator
in interface Collection<DirectedTypedEdge<T>>
iterator
in interface Set<DirectedTypedEdge<T>>
iterator
in class AbstractCollection<DirectedTypedEdge<T>>
public Set<DirectedTypedEdge<T>> outgoing()
public IntSet predecessors()
public IntSet successors()
public boolean remove(Object o)
remove
in interface Collection<DirectedTypedEdge<T>>
remove
in interface Set<DirectedTypedEdge<T>>
remove
in class AbstractCollection<DirectedTypedEdge<T>>
public int size()
size
in interface Collection<DirectedTypedEdge<T>>
size
in interface Set<DirectedTypedEdge<T>>
size
in class AbstractCollection<DirectedTypedEdge<T>>
public Iterator<DirectedTypedEdge<T>> uniqueIterator()
Copyright © 2012. All Rights Reserved.