diff --git a/src/java/org/apache/commons/graph/dependency/Dependency.java b/src/java/org/apache/commons/graph/dependency/Dependency.java deleted file mode 100644 index 8f5e9d9..0000000 --- a/src/java/org/apache/commons/graph/dependency/Dependency.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.apache.commons.graph.dependency; - -import org.apache.commons.graph.*; - -/** - * Description of the Class - */ -public class Dependency implements Edge -{ - private Object head = null; - private Object dep = null; - - /** - * Constructor for the Dependency object - * - * @param head - * @param dep - */ - public Dependency(Object head, - Object dep) - { - this.head = head; - this.dep = dep; - } - - /** - * Description of the Method - */ - public String description() - { - return head + " depends on " + dep; - } -} diff --git a/src/java/org/apache/commons/graph/dependency/DependencyGraph.java b/src/java/org/apache/commons/graph/dependency/DependencyGraph.java deleted file mode 100644 index 2a49bd6..0000000 --- a/src/java/org/apache/commons/graph/dependency/DependencyGraph.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.apache.commons.graph.dependency; - -import org.apache.commons.graph.*; -import org.apache.commons.graph.impl.*; -import org.apache.commons.graph.contract.*; -import org.apache.commons.graph.exception.*; -import org.apache.commons.graph.dependency.exception.*; - -import java.util.Map; -import java.util.List; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Collection; - -/** - * Description of the Class - */ -public class DependencyGraph - extends DirectedGraphWrapper -{ - private GraphFactory factory = new GraphFactory(); - private AcyclicContract acyclic = new AcyclicContract(); - private DependencyVisitor visitor = new DependencyVisitor(); - - private Map vertices = new HashMap(); - - private MutableDirectedGraph DAG = null; - - /** - * Constructor for the DependencyGraph object - */ - public DependencyGraph() - { - super(); - init(); - } - - /** - * Description of the Method - */ - private void init() - { - Contract[] dagContracts = new Contract[1]; - dagContracts[0] = acyclic; - DAG = factory.makeMutableDirectedGraph(dagContracts, - false, - null); - setDirGraph(DAG); - } - - /** - * Adds a feature to the Dependencies attribute of the DependencyGraph - * object - */ - public void addDependencies(Object head, - Collection deps) - throws GraphException, - CircularDependencyException - { - DependencyVertex vHead = findVertex(head); - - if (!getVertices().contains(vHead)) - { - DAG.addVertex(vHead); - } - - try - { - Iterator v = deps.iterator(); - - while (v.hasNext()) - { - DependencyVertex vDep = findVertex(v.next()); - - if (!getVertices().contains(vDep)) - { - DAG.addVertex(vDep); - } - - DAG.addEdge(new Dependency(vHead.getValue(), - vDep.getValue()), - vHead, vDep); - } - } - catch (CycleException ex) - { - throw new CircularDependencyException(ex); - } - } - - /** - * Description of the Method - */ - public DependencyVertex findVertex(Object o) - { - if (vertices.containsKey(o)) - { - return (DependencyVertex) vertices.get(o); - } - else - { - DependencyVertex RC = new DependencyVertex(o); - vertices.put(o, RC); - return RC; - } - } - - /** - * Gets the sortedDependencies attribute of the DependencyGraph object - */ - public List getSortedDependencies(Object head) - { - return visitor.getSortedDependencies(this, findVertex(head)); - } -} diff --git a/src/java/org/apache/commons/graph/dependency/DependencyVertex.java b/src/java/org/apache/commons/graph/dependency/DependencyVertex.java deleted file mode 100644 index facfdc5..0000000 --- a/src/java/org/apache/commons/graph/dependency/DependencyVertex.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.apache.commons.graph.dependency; - -import org.apache.commons.graph.*; - -/** - * Description of the Class - */ -public class DependencyVertex - implements Vertex -{ - private Object value; - - /** - * Constructor for the DependencyVertex object - * - * @param value - */ - public DependencyVertex(Object value) - { - this.value = value; - } - - /** - * Gets the value attribute of the DependencyVertex object - */ - public Object getValue() - { - return value; - } -} diff --git a/src/java/org/apache/commons/graph/dependency/DependencyVisitor.java b/src/java/org/apache/commons/graph/dependency/DependencyVisitor.java deleted file mode 100644 index 86f6d46..0000000 --- a/src/java/org/apache/commons/graph/dependency/DependencyVisitor.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.apache.commons.graph.dependency; - -import java.util.List; -import java.util.LinkedList; - -import org.apache.commons.graph.*; -import org.apache.commons.graph.search.*; - -/** - * Description of the Class - */ -public class DependencyVisitor - implements Visitor -{ - private List deps = null; - private DFS dfs = new DFS(); - - - /** - * Constructor for the DependencyVisitor object - */ - public DependencyVisitor() { } - - /** - * Description of the Method - */ - public void discoverGraph(Graph g) { } - - /** - * Description of the Method - */ - public void discoverVertex(Vertex v) { } - - /** - * Description of the Method - */ - public void discoverEdge(Edge e) { } - - /** - * Description of the Method - */ - public void finishGraph(Graph g) { } - - /** - * Description of the Method - */ - public void finishVertex(Vertex v) - { - if (v instanceof DependencyVertex) - { - deps.add(((DependencyVertex) v).getValue()); - } - else - { - deps.add(v); - } - } - - /** - * Description of the Method - */ - public void finishEdge(Edge e) { } - - /** - * Gets the sortedDependencies attribute of the DependencyVisitor object - */ - public synchronized List - getSortedDependencies(DependencyGraph dg, - Vertex root) - { - deps = new LinkedList(); - dfs.visit(dg, root, this); - return deps; - } -} - diff --git a/src/java/org/apache/commons/graph/dependency/exception/CircularDependencyException.java b/src/java/org/apache/commons/graph/dependency/exception/CircularDependencyException.java deleted file mode 100644 index 78a870a..0000000 --- a/src/java/org/apache/commons/graph/dependency/exception/CircularDependencyException.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.commons.graph.dependency.exception; - -import org.apache.commons.graph.exception.*; - -/** - * Description of the Class - */ -public class CircularDependencyException - extends CycleException -{ - /** - * Constructor for the CircularDependencyException object - */ - public CircularDependencyException() - { - super(); - } - - /** - * Constructor for the CircularDependencyException object - * - * @param msg - */ - public CircularDependencyException(String msg) - { - super(msg); - } - - /** - * Constructor for the CircularDependencyException object - * - * @param cause - */ - public CircularDependencyException(Throwable cause) - { - super(cause); - } -}