Package tilda.utils
Class Graph<T>
- java.lang.Object
-
- tilda.utils.Graph<T>
-
public class Graph<T> extends java.lang.Object
- Author:
- ldh
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Graph.Node<T>
static interface
Graph.Visitor<T>
-
Field Summary
Fields Modifier and Type Field Description protected Graph.Node<T>
_Root
protected static org.apache.logging.log4j.Logger
LOG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(T t)
protected boolean
contains(T t, Graph.Node<T> N)
java.util.Set<T>
getLeaves(boolean Remove)
protected void
getLeaves(boolean Remove, java.util.Set<T> Leaves, Graph.Node<T> N)
Graph.Node<T>
getRoot()
boolean
remove(T t)
protected boolean
remove(T t, Graph.Node<T> N)
void
traverse(Graph.Visitor<T> V, boolean pre)
Given a visitor V, traverses the graph depth firstprotected static <T> void
traverse(Graph.Visitor<T> V, int Level, int FirstMiddleLast, Graph.Node<T> N, java.util.List<T> Path, boolean pre)
-
-
-
Field Detail
-
LOG
protected static final org.apache.logging.log4j.Logger LOG
-
_Root
protected Graph.Node<T> _Root
-
-
Constructor Detail
-
Graph
public Graph(T v)
-
-
Method Detail
-
getRoot
public Graph.Node<T> getRoot()
-
getLeaves
public java.util.Set<T> getLeaves(boolean Remove)
-
getLeaves
protected void getLeaves(boolean Remove, java.util.Set<T> Leaves, Graph.Node<T> N)
-
contains
public boolean contains(T t)
-
contains
protected boolean contains(T t, Graph.Node<T> N)
-
remove
public boolean remove(T t)
-
remove
protected boolean remove(T t, Graph.Node<T> N)
-
traverse
protected static <T> void traverse(Graph.Visitor<T> V, int Level, int FirstMiddleLast, Graph.Node<T> N, java.util.List<T> Path, boolean pre) throws java.lang.Exception
- Throws:
java.lang.Exception
-
traverse
public void traverse(Graph.Visitor<T> V, boolean pre) throws java.lang.Exception
Given a visitor V, traverses the graph depth first- Parameters:
V
-pre
- Whether the visitor should be called on node entry (pre-processing), or node exit (post-processing).- Throws:
java.lang.Exception
-
-