Class DirectedGraph<E>
- java.lang.Object
-
- org.eclipse.emf.edapt.history.recorder.DirectedGraph<E>
-
public class DirectedGraph<E> extends Object
Directed graph with elements of a certain type as nodes- Version:
- $Rev$
- Author:
- herrmama, $Author$
-
-
Constructor Summary
Constructors Constructor Description DirectedGraph()
Default constructorDirectedGraph(Collection<E> elements)
Constructor that adds a number of elements as initial nodes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(E element)
Add an element as nodevoid
addOrder(E source, E target)
Add an edge between two elementsboolean
contains(E element)
Determine whether an element in contained in the directed graphSet<E>
getElements()
Getter for elementsSet<E>
getIncoming(E element)
Get the elements which are source of incoming edgesE
getNoIncomingElement()
Return all elements which do not have incoming edgesList<E>
getOrdering()
Calculate a topological sorting of the elements in the directed graph.Set<E>
getOutgoing(E element)
Get the elements which are target of outgoing edgesboolean
isEmpty()
Return whether the graph is emptyvoid
remove(E element)
Remove an element as nodevoid
removeOrder(E source, E target)
Remove an edge between two elements
-
-
-
Constructor Detail
-
DirectedGraph
public DirectedGraph()
Default constructor
-
DirectedGraph
public DirectedGraph(Collection<E> elements)
Constructor that adds a number of elements as initial nodes- Parameters:
elements
- Initial nodes
-
-
Method Detail
-
add
public void add(E element)
Add an element as node- Parameters:
element
- Element
-
remove
public void remove(E element)
Remove an element as node- Parameters:
element
- Element
-
addOrder
public void addOrder(E source, E target)
Add an edge between two elements- Parameters:
source
- Source elementtarget
- Target element
-
removeOrder
public void removeOrder(E source, E target)
Remove an edge between two elements- Parameters:
source
- Source elementtarget
- Target element
-
getIncoming
public Set<E> getIncoming(E element)
Get the elements which are source of incoming edges- Parameters:
element
- Element- Returns:
- Elements
-
getOutgoing
public Set<E> getOutgoing(E element)
Get the elements which are target of outgoing edges- Parameters:
element
-- Returns:
- Elements
-
isEmpty
public boolean isEmpty()
Return whether the graph is empty- Returns:
- empty or not?
-
getNoIncomingElement
public E getNoIncomingElement()
Return all elements which do not have incoming edges- Returns:
- Elements
-
contains
public boolean contains(E element)
Determine whether an element in contained in the directed graph- Parameters:
element
-- Returns:
- true if contained, false otherwise
-
-