public class IdGraphClass<Id> extends ValueMixin implements IdGraph<Id>
| Constructor and Description |
|---|
IdGraphClass(com.google.common.collect.ImmutableSet<Id> idSet,
com.google.common.collect.ImmutableSetMultimap<Id,Id> id__parentIds) |
| Modifier and Type | Method and Description |
|---|---|
IdGraph<Id> |
ancestorIdGraph(Id id,
boolean inclusive)
Getting an id's ancestor id graph (its, parents' parents, and so on).
|
IdGraph<Id> |
ancestorIdGraph(Set<Id> ids,
boolean inclusive)
Getting an id set's ancestor id graph (their parents, parents' parents, and so on).
|
Iterable<Id> |
ancestorIdIterable(Id id,
boolean inclusive)
Getting an id's ancestor id iterable (its parents, parents' parents, and so on).
|
Iterable<Id> |
ancestorIdIterable(Set<Id> ids,
boolean inclusive)
Getting an id set's ancestor id iterable (their parents, parents' parents, and so on).
|
com.google.common.collect.ImmutableSet<Id> |
ancestorIdSet(Id id,
boolean inclusive)
Getting an id's ancestor id set (its parents, parents' parents, and so on).
|
com.google.common.collect.ImmutableSet<Id> |
ancestorIdSet(Set<Id> ids,
boolean inclusive)
Getting an id set's ancestor id set (their parents, parents' parents, and so on).
|
void |
assertIdsEqual(Id[] ids)
Assert that a graph contains exactly these ids.
|
void |
assertIdsEqual(com.google.common.collect.ImmutableSet<Id> ids)
Assert that a graph contains exactly these ids.
|
protected LambdaLib.Fn1<Id,List<Id>> |
childIdListLambda() |
com.google.common.collect.ImmutableSet<Id> |
childIdSet(Id id)
Getting an id's child ids.
|
boolean |
containsCycle()
Whether the digraph contains a cycle.
|
IdGraph<Id> |
descendantIdGraph(Id id,
boolean inclusive)
Getting an id's descendant id graph (its children, childrens' children, and so on).
|
IdGraph<Id> |
descendantIdGraph(Set<Id> ids,
boolean inclusive)
Getting an id set's descendant id graph (their children, childrens' children, and so on).
|
Iterable<Id> |
descendantIdIterable(Id id,
boolean inclusive)
Getting an id's descendant id iterable (its children, childrens' children, and so on).
|
Iterable<Id> |
descendantIdIterable(Set<Id> ids,
boolean inclusive)
Getting an id set's descendant id iterable (their children, childrens' children, and so on).
|
com.google.common.collect.ImmutableSet<Id> |
descendantIdSet(Id id,
boolean inclusive)
Getting an id's descendant id set (its children, childrens' children, and so on).
|
com.google.common.collect.ImmutableSet<Id> |
descendantIdSet(Set<Id> ids,
boolean inclusive)
Getting an id set's descendant id set (their children, childrens' children, and so on).
|
Object[] |
fields()
An array of alternating field names and field values.
|
IdGraph<Id> |
filterIdGraph(Set<Id> ids)
Filter a graph by only keep the specified ids and arcs between these ids.
|
protected com.google.common.collect.SetMultimap<Id,Id> |
filterParentMap(Set<Id> ids) |
com.google.common.collect.ImmutableSetMultimap<Id,Id> |
id__childIds()
The mapping from id to child ids.
|
com.google.common.collect.ImmutableSetMultimap<Id,Id> |
id__parentIds()
The mapping from id to parent ids.
|
com.google.common.collect.ImmutableSet<Id> |
idSet()
The set of ids.
|
int |
idSize()
The number of ids.
|
boolean |
isAncestorOf(Id id,
Id potentialDescendant,
boolean inclusive)
Whether an id is a ancestor of another id.
|
boolean |
isChildOf(Id id,
Id potentialParent)
Whether an id is a child of another id.
|
boolean |
isDescendantOf(Id id,
Id potentialAncestor,
boolean inclusive)
Whether an id is a descendant of another id.
|
boolean |
isLeaf(Id id)
Is an id a leaf?
|
boolean |
isParentOf(Id id,
Id potentialChild)
Whether an id is a parent of another id.
|
boolean |
isRoot(Id id)
Is an id a root?
|
com.google.common.collect.ImmutableSet<Id> |
leafIdSet()
The digraph's leaf (sink) ids, so the ids without children.
|
com.google.common.base.Optional<com.google.common.collect.ImmutableList<Id>> |
optionalTopsortIdList()
A topologically sorted list of ids, with roots (sources) first (will be absent if the digraph
is cyclic).
|
protected LambdaLib.Fn1<Id,List<Id>> |
parentIdListLambda() |
com.google.common.collect.ImmutableSet<Id> |
parentIdSet(Id id)
Getting an id's parent ids.
|
com.google.common.collect.ImmutableSet<Id> |
rootIdSet()
The digraph's root (source) ids, so the ids without parents.
|
Iterable<Id> |
traverseIdIterable(boolean depthFirst,
boolean inclusive,
Id startId,
LambdaLib.Fn1<Id,List<Id>> expand)
Generic id traversal as an iterable.
|
Iterable<Id> |
traverseIdIterable(boolean depthFirst,
boolean inclusive,
com.google.common.collect.ImmutableList<Id> startIds,
LambdaLib.Fn1<Id,List<Id>> expand)
Generic id traversal as an iterable.
|
com.google.common.collect.ImmutableList<Id> |
traverseIdList(boolean depthFirst,
boolean inclusive,
Id startId,
LambdaLib.Fn1<Id,List<Id>> expand)
Generic id traversal copied into a list.
|
com.google.common.collect.ImmutableList<Id> |
traverseIdList(boolean depthFirst,
boolean inclusive,
com.google.common.collect.ImmutableList<Id> startIds,
LambdaLib.Fn1<Id,List<Id>> expand)
Generic id traversal copied into a list.
|
equals, hashCode, isEntityarray, objectHelper, toStringpublic Object[] fields()
ObjectMixinfields in class ObjectMixinpublic com.google.common.collect.ImmutableSet<Id> idSet()
IdGraphpublic int idSize()
IdGraphpublic void assertIdsEqual(com.google.common.collect.ImmutableSet<Id> ids)
IdGraphassertIdsEqual in interface IdGraph<Id>public void assertIdsEqual(Id[] ids)
IdGraphassertIdsEqual in interface IdGraph<Id>public IdGraph<Id> filterIdGraph(Set<Id> ids)
IdGraphfilterIdGraph in interface IdGraph<Id>public boolean isParentOf(Id id, Id potentialChild)
IdGraphisParentOf in interface IdGraph<Id>public com.google.common.collect.ImmutableSetMultimap<Id,Id> id__parentIds()
IdGraphid__parentIds in interface IdGraph<Id>public com.google.common.collect.ImmutableSet<Id> parentIdSet(Id id)
IdGraphparentIdSet in interface IdGraph<Id>protected LambdaLib.Fn1<Id,List<Id>> parentIdListLambda()
public boolean isChildOf(Id id, Id potentialParent)
IdGraphpublic com.google.common.collect.ImmutableSetMultimap<Id,Id> id__childIds()
IdGraphid__childIds in interface IdGraph<Id>public com.google.common.collect.ImmutableSet<Id> childIdSet(Id id)
IdGraphchildIdSet in interface IdGraph<Id>protected LambdaLib.Fn1<Id,List<Id>> childIdListLambda()
public boolean isAncestorOf(Id id, Id potentialDescendant, boolean inclusive)
IdGraphisAncestorOf in interface IdGraph<Id>public Iterable<Id> ancestorIdIterable(Id id, boolean inclusive)
IdGraphancestorIdIterable in interface IdGraph<Id>public Iterable<Id> ancestorIdIterable(Set<Id> ids, boolean inclusive)
IdGraphancestorIdIterable in interface IdGraph<Id>public com.google.common.collect.ImmutableSet<Id> ancestorIdSet(Id id, boolean inclusive)
IdGraphancestorIdSet in interface IdGraph<Id>public com.google.common.collect.ImmutableSet<Id> ancestorIdSet(Set<Id> ids, boolean inclusive)
IdGraphancestorIdSet in interface IdGraph<Id>public IdGraph<Id> ancestorIdGraph(Id id, boolean inclusive)
IdGraphancestorIdGraph in interface IdGraph<Id>public IdGraph<Id> ancestorIdGraph(Set<Id> ids, boolean inclusive)
IdGraphancestorIdGraph in interface IdGraph<Id>public boolean isDescendantOf(Id id, Id potentialAncestor, boolean inclusive)
IdGraphisDescendantOf in interface IdGraph<Id>public Iterable<Id> descendantIdIterable(Id id, boolean inclusive)
IdGraphdescendantIdIterable in interface IdGraph<Id>public Iterable<Id> descendantIdIterable(Set<Id> ids, boolean inclusive)
IdGraphdescendantIdIterable in interface IdGraph<Id>public com.google.common.collect.ImmutableSet<Id> descendantIdSet(Id id, boolean inclusive)
IdGraphdescendantIdSet in interface IdGraph<Id>public com.google.common.collect.ImmutableSet<Id> descendantIdSet(Set<Id> ids, boolean inclusive)
IdGraphdescendantIdSet in interface IdGraph<Id>public IdGraph<Id> descendantIdGraph(Id id, boolean inclusive)
IdGraphdescendantIdGraph in interface IdGraph<Id>public IdGraph<Id> descendantIdGraph(Set<Id> ids, boolean inclusive)
IdGraphdescendantIdGraph in interface IdGraph<Id>public com.google.common.collect.ImmutableSet<Id> rootIdSet()
IdGraphpublic com.google.common.collect.ImmutableSet<Id> leafIdSet()
IdGraphpublic com.google.common.base.Optional<com.google.common.collect.ImmutableList<Id>> optionalTopsortIdList()
IdGraphoptionalTopsortIdList in interface IdGraph<Id>public boolean containsCycle()
IdGraphcontainsCycle in interface IdGraph<Id>public Iterable<Id> traverseIdIterable(boolean depthFirst, boolean inclusive, Id startId, LambdaLib.Fn1<Id,List<Id>> expand)
IdGraphtraverseIdIterable in interface IdGraph<Id>depthFirst - Whether to traverse depth first or breadth first.inclusive - Whether to include the start ids in the traversal.startId - The initial id.expand - A function mapping an id to the next ids.public Iterable<Id> traverseIdIterable(boolean depthFirst, boolean inclusive, com.google.common.collect.ImmutableList<Id> startIds, LambdaLib.Fn1<Id,List<Id>> expand)
IdGraphtraverseIdIterable in interface IdGraph<Id>depthFirst - Whether to traverse depth first or breadth first.inclusive - Whether to include the start ids in the traversal.startIds - The initial id list.expand - A function mapping an id to the next ids.public com.google.common.collect.ImmutableList<Id> traverseIdList(boolean depthFirst, boolean inclusive, Id startId, LambdaLib.Fn1<Id,List<Id>> expand)
IdGraphtraverseIdList in interface IdGraph<Id>depthFirst - Whether to traverse depth first or breadth first.inclusive - Whether to include the start ids in the traversal.expand - A function mapping an id to the next ids.public com.google.common.collect.ImmutableList<Id> traverseIdList(boolean depthFirst, boolean inclusive, com.google.common.collect.ImmutableList<Id> startIds, LambdaLib.Fn1<Id,List<Id>> expand)
IdGraphtraverseIdList in interface IdGraph<Id>depthFirst - Whether to traverse depth first or breadth first.inclusive - Whether to include the start ids in the traversal.startIds - The initial id list.expand - A function mapping an id to the next ids.Copyright © 2014. All rights reserved.