org.eclipse.emf.compare.graph

## Interface IGraphView<E>

Type Parameters:
  `E` - Kind of elements used as this graph's nodes.

All Known Implementing Classes:
  ReadOnlyGraph

    public interface IGraphView<E>

Read-only view of a `Graph`.

Since:
  3.3

### Method Summary

All Methods Instance Methods Abstract Methods
`PruningIterator<E>` `breadthFirstIterator()` Returns a breadth-first iterator over this whole graph.
`boolean` `contains(E element)` Checks whether this graph already contains the given element.
`com.google.common.collect.ImmutableSet<E>` `getDirectParents(E element)` Returns the direct parents of the given `element`.
`E` `getParentData(E element)` Get the parent data of the given element.
`com.google.common.collect.ImmutableSet<E>` `getSubgraphContaining(E element)` Returns the set of all elements of the subgraph containing the given element.
`com.google.common.collect.ImmutableSet<E>` `getSubgraphContaining(E element, com.google.common.collect.ImmutableSet<E> endPoints)` Returns the set of all elements of the subgraph containing the given element and ending at the given boundaries.
`com.google.common.collect.ImmutableSet<E>` `getTreeFrom(E root)` Returns the tree starting from the given root element if it is contained in the graph.
`com.google.common.collect.ImmutableSet<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.

### Method Detail

#### contains

    boolean contains(E element)

Checks whether this graph already contains the given element.

Parameters:
  `element` - Element we need to check.
Returns:
  `true` if this graph already contains the given elment, `false` otherwise.

#### hasChild

    boolean hasChild(E parent,
                     E potentialChild)

Checks if the given element is a parent of the given potential child, directly or not.

Parameters:
  `parent` - Element that could be a parent of `potentialChild`.
  `potentialChild` - The potential child of `parent`.
Returns:
  `true` if `parent` is an ancestor of `potentialChild`.

#### getDirectParents

    com.google.common.collect.ImmutableSet<E> getDirectParents(E element)

Returns the direct parents of the given `element`.

Note that the returned set is an immutable view over a sub-graph of this graph.

Parameters:
  `element` - The element which parents we seek.
Returns:
  An immutable set of direct parents for the given `element`.

#### getParentData

    E getParentData(E element)

Get the parent data of the given element. If the given element has several parents, then this method will return `null`. If the given element has no parents, then then this method will return `null`

Parameters:
  `element` - Element we need the parent data of.
Returns:
  A parent data of type `E` if this element has a parent data, `null` otherwise.

#### getSubgraphContaining

    com.google.common.collect.ImmutableSet<E> getSubgraphContaining(E element)

Returns the set of all elements of the subgraph containing the given element.

Note that the returned set is an immutable view over a sub-graph of this graph.

Parameters:
  `element` - Element we need the subgraph of.
Returns:
  An immutable set of all elements of the subgraph containing the given element, an empty immutable set if that element is not present in this graph.

#### getSubgraphContaining

    com.google.common.collect.ImmutableSet<E> getSubgraphContaining(E element,
                                                                    com.google.common.collect.ImmutableSet<E> endPoints)

Returns the set of all elements of the subgraph containing the given element and ending at the given boundaries.

Note that the returned set is an immutable view over a sub-graph of this graph.

Parameters:
  `element` - Element we need the subgraph of.
  `endPoints` - Boundaries of the needed subgraph.
Returns:
  An immutable set over all elements of the subgraph containing the given element, an immutable empty set if that element is not present in this graph.

#### getTreeFrom

    com.google.common.collect.ImmutableSet<E> getTreeFrom(E root)

Returns the tree starting from the given root element if it is contained in the graph.

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 an immutable view over a sub-graph of this graph.

Parameters:
  `root` - The element we are to consider as the root of a tree.
Returns:
  The immutable tree starting from the given root element if it is contained in this graph, and immutable empty set otherwise.

#### getTreeFrom

    com.google.common.collect.ImmutableSet<E> getTreeFrom(E root,
                                                          Set<E> endPoints)

Returns the tree starting from the given root element and ending at the given boundaries..

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 an immutable view over a sub-graph of this graph.

Parameters:
  `root` - The element we are to consider as the root of a tree.
  `endPoints` - Boundaries of the tree.
Returns:
  The immutable tree starting from the given root element if it is contained in this graph, and immutable empty set otherwise.

#### breadthFirstIterator

    PruningIterator<E> breadthFirstIterator()

Returns a breadth-first iterator over this whole graph. This will begin iteration on this graph's roots (whether they are linked together (directly or indirectly) or not), then carry on over each depth level. This will never visit the same element twice, nor will it ever visit an element which parents haven't all been iterated over yet.

The returned iterator does not support removal, and will fail or returned undefined results if this graph is modified after the iterator's creation.

Returns:
  A breadth-first iterator over this whole graph.