Module org.jgrapht.core
Package org.jgrapht.traverse
Class LexBreadthFirstIterator.BucketList.Bucket
- java.lang.Object
-
- org.jgrapht.traverse.LexBreadthFirstIterator.BucketList.Bucket
-
- Enclosing class:
- LexBreadthFirstIterator.BucketList
private class LexBreadthFirstIterator.BucketList.Bucket extends java.lang.ObjectPlays the role of the container of vertices. All vertices stored in a bucket have identical label. Labels aren't used explicitly.Encapsulates operations of addition and removal of vertices from the bucket and removal of a bucket from the data structure.
-
-
Field Summary
Fields Modifier and Type Field Description private LexBreadthFirstIterator.BucketList.BucketnextReference of the bucket with lexicographically smaller label.private LexBreadthFirstIterator.BucketList.BucketprevReference of the bucket with lexicographically larger label.private java.util.Set<V>verticesSet of vertices currently stored in this bucket.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddVertex(V vertex)Adds thevertexto this bucket.(package private) voidinsertBefore(LexBreadthFirstIterator.BucketList.Bucket bucket)Inserts this bucket in the data structure before thebucket.(package private) booleanisEmpty()Checks whether this bucket is empty.(package private) Vpoll()Retrieves one vertex from this bucket.(package private) voidremoveSelf()Removes this bucket from the data structure.(package private) voidremoveVertex(V vertex)Removes thevertexfrom this bucket.
-
-
-
Field Detail
-
next
private LexBreadthFirstIterator.BucketList.Bucket next
Reference of the bucket with lexicographically smaller label.
-
prev
private LexBreadthFirstIterator.BucketList.Bucket prev
Reference of the bucket with lexicographically larger label.
-
vertices
private java.util.Set<V> vertices
Set of vertices currently stored in this bucket.
-
-
Constructor Detail
-
Bucket
Bucket(java.util.Collection<V> vertices)
Creates a new bucket with allverticesstored in it.- Parameters:
vertices- vertices to store in this bucket.
-
Bucket
Bucket(V vertex)
Creates a new Bucket with a singlevertexin it.- Parameters:
vertex- the vertex to store in this bucket.
-
-
Method Detail
-
removeVertex
void removeVertex(V vertex)
Removes thevertexfrom this bucket.- Parameters:
vertex- the vertex to remove.
-
removeSelf
void removeSelf()
Removes this bucket from the data structure.
-
insertBefore
void insertBefore(LexBreadthFirstIterator.BucketList.Bucket bucket)
Inserts this bucket in the data structure before thebucket.- Parameters:
bucket- the bucket, that will be the next to this bucket.
-
addVertex
void addVertex(V vertex)
Adds thevertexto this bucket.- Parameters:
vertex- the vertex to add.
-
poll
V poll()
Retrieves one vertex from this bucket.- Returns:
- vertex, that was removed from this bucket, null if the bucket was empty.
-
isEmpty
boolean isEmpty()
Checks whether this bucket is empty.- Returns:
- true if this bucket doesn't contain any elements, otherwise false.
-
-