Package org.geotools.graph.structure

Examples of org.geotools.graph.structure.GraphVisitor


      builder().getGraph(), walker, iterator
    );
    traversal.init();
    traversal.traverse();
   
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        assertTrue(component.isVisited());
        assertTrue(iterator.getCost(component) == (double)component.getID());
        if (component.getID() == 0) assertNull(iterator.getParent(component));
        else assertTrue(
View Full Code Here


      builder().getGraph(), walker, iterator
    );
    traversal.init();
    traversal.traverse();
   
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        if (component.getID() <= suspend) assertTrue(component.isVisited());
        else assertTrue(!component.isVisited());
        return 0;
      }
    };
    builder().getGraph().visitNodes(visitor);
    assertTrue(walker.getCount() == nnodes-suspend+1);
   
    //resume
    traversal.traverse();
   
    visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        assertTrue(component.isVisited());
        assertTrue(iterator.getCost(component) == (double)component.getID());
        if (component.getID() == 0) assertNull(iterator.getParent(component));
        else assertTrue(
View Full Code Here

      builder().getGraph(), walker, iterator
    );
    traversal.init();
    traversal.traverse();
   
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        if (component.getID() <= kill) assertTrue(component.isVisited());
        else assertTrue(!component.isVisited());
       
        return 0;
View Full Code Here

      builder().getGraph(), walker, iterator
    );
    traversal.init();
    traversal.traverse();
   
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        assertTrue(component.isVisited());
        String id = component.getObject().toString();
        StringTokenizer st = new StringTokenizer(id, ".");
       
View Full Code Here

      builder().getGraph(), walker, iterator
    );
    traversal.init();
    traversal.traverse();
   
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        if (component != root && component != lc && component != rc)
          assertTrue(!component.isVisited());
       
        return 0;
      }
    };
    builder().getGraph().visitNodes(visitor);
   
    //resume
    traversal.traverse();
   
    visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        assertTrue(component.isVisited());
        return(0)
     
    };
View Full Code Here

      builder().getGraph(), walker, iterator
    );
    traversal.init();
    traversal.traverse();
   
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        if (component == root || component == lc || component == rc)
          assertTrue(component.isVisited());
        else {
          String id = component.getObject().toString();
View Full Code Here

      builder().getGraph(), walker, iterator
    );
    traversal.init();
    traversal.traverse();
   
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        Graphable parent = iterator.getParent(component);
        if (component.getID() < 50 && component.getID() > 0) {
          assertTrue(iterator.getCost(component) == (double)component.getID());
          assertTrue(parent.getID() == component.getID() - 1);
View Full Code Here

   
    assertTrue(built.getNodesOfDegree(1).size() == 2);
    assertTrue(built.getNodesOfDegree(2).size() == n-1);
   
    //ensure coordinates
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        Edge e = (Edge)component;
        XYNode a = (XYNode)e.getNodeA();
        XYNode b = (XYNode)e.getNodeB();
       
View Full Code Here

    assertTrue(
      built.getNodesOfDegree(2).size() == built.getNodes().size()
    );
   
    //ensure coordinates
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        Edge e = (Edge)component;
        XYNode a = (XYNode)e.getNodeA();
        XYNode b = (XYNode)e.getNodeB();
       
View Full Code Here

      //ensure same number of nodes and edges
      assertTrue(before.getNodes().size() == after.getNodes().size());
      assertTrue(before.getEdges().size() == after.getEdges().size());
     
      //ensure same graph structure
      GraphVisitor visitor = new GraphVisitor() {
        public int visit(Graphable component) {
          DirectedEdge e = (DirectedEdge)component;
         
          assertTrue(e.getInNode().getID() == e.getID());
          assertTrue(e.getOutNode().getID() == e.getID()+1);
         
          return(0);
        }
      };
      after.visitEdges(visitor);
     
      visitor = new GraphVisitor() {
        public int visit(Graphable component) {
          DirectedNode n = (DirectedNode)component;
         
          if (n.getDegree() == 1) {
            assertTrue(n.getID() == 0 || n.getID() == nnodes-1)
View Full Code Here

TOP

Related Classes of org.geotools.graph.structure.GraphVisitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.