E - The type of the graph nodespublic interface IGraph<E>
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E element)
Adds a new element to this graph, if it does not exists yet.
|
void |
addChildren(E element,
Set<E> newChildren)
Connects the given set of elements to a given parent.
|
void |
addParentData(E element,
E parentData)
Set the parent data for the given element.
|
PruningIterator<E> |
breadthFirstIterator()
Returns a breadth-first iterator over this whole graph.
|
void |
clear()
Clears this graph and goes back to a pristine state.
|
boolean |
contains(E element)
Checks whether this graph already contains the given element.
|
Iterator<E> |
depthFirstIterator(E root)
Returns a depth first iterator created with the given element as root.
|
Set<E> |
getDirectParents(E element)
Returns the direct parents of the given
element. |
E |
getParentData(E element)
Get the parent data of the given element.
|
Set<E> |
getSubgraphContaining(E element)
Returns the set of all elements of the subgraph containing the given element.
|
Set<E> |
getSubgraphContaining(E element,
Set<E> endPoints)
Returns the set of all elements of the subgraph containing the given element and ending at the given
boundaries.
|
Set<E> |
getTreeFrom(E root)
Returns the tree starting from the given root element if it is contained in the graph.
|
Set<E> |
getTreeFrom(E root,
Set<E> endPoints)
Returns the tree starting from the given root element and ending at the given boundaries..
|
boolean |
hasChild(E parent,
E potentialChild)
Checks if the given element is a parent of the given potential child, directly or not.
|
void |
remove(E element)
Removes the given element's node from this graph.
|
void |
removeAll(Collection<E> elements)
Removes the given elements' nodes from this graph.
|
boolean contains(E element)
element - Element we need to check.true if this graph already contains the given elment, false
otherwise.void clear()
boolean add(E element)
element - The element to add as a new root to this graph.true if this element did not previously exist in the graph.void remove(E element)
element - The element which is to be removed from this graph.void removeAll(Collection<E> elements)
elements - The elements which are to be removed from this graph.void addChildren(E element, Set<E> newChildren)
element - The element that is to be connected with new children.newChildren - The set of elements to connect to the given parent.boolean hasChild(E parent, E potentialChild)
parent - Element that could be a parent of potentialChild.potentialChild - The potential child of parent.true if parent is an ancestor of potentialChild.Set<E> getDirectParents(E element)
element.
Note that the returned set is a view over a sub-graph of this graph, and that changes to it will not be reflected within the graph itself.
element - The element which parents we seek.element.Set<E> getTreeFrom(E root)
Contrarily to getSubgraphContaining(Object), this will only iterate over the children (and
recursively) of the given node, without ever "going up" to parents of these children.
Note that the returned set is a view over a sub-graph of this graph, and that changes to it will not be reflected within the graph itself.
root - The element we are to consider as the root of a tree.Set<E> getTreeFrom(E root, Set<E> endPoints)
Contrarily to getSubgraphContaining(Object, Set), this will only iterate over the children
(and recursively) of the given node, without ever "going up" to parents of these children.
Note that the returned set is a view over a sub-graph of this graph, and that changes to it will not be reflected within the graph itself.
root - The element we are to consider as the root of a tree.endPoints - Boundaries of the tree.Set<E> getSubgraphContaining(E element)
Note that the returned set is a view over a sub-graph of this graph, and that changes to it will not be reflected within the graph itself.
element - Element we need the subgraph of.Set<E> getSubgraphContaining(E element, Set<E> endPoints)
Note that the returned set is a view over a sub-graph of this graph, and that changes to it will not be reflected within the graph itself.
element - Element we need the subgraph of.endPoints - Boundaries of the needed subgraph.PruningIterator<E> breadthFirstIterator()
The returned iterator does not support removal, and will fail or return undefined results if this graph is modified after the iterator's creation.
Iterator<E> depthFirstIterator(E root)
The root will be returned first, then the left-most child of that root, then the left-most child of that child if any, or the closest sibling to the right of the current element. For example, with the following tree:
A
/ \
B C
/ / \
D E F
The iteration order will be : A, B, D, C, E, F.
The returned iterator does not support removal, and will fail or return undefined results if this graph is modified after the iterator's creation.
root - The root of the tree over which we need to iterate.E getParentData(E element)
The parent data, is the URI of the parent resource's object in case of a containment relationship between the given element and its parent.
element - Element we need the parent data of.E if this element has a parent data, null
otherwise.void addParentData(E element, E parentData)
The parent data, is the URI of the parent resource's object in case of a containment relationship between the given element and its parent.
If the given element has several parents, then the addition of a new parent data results in delete the parent data. If the given element has no parents, then the addition of a new parent data results in delete the parent data.element - Element for which we need to set the parent data.parentData - The parent data to set.
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.