Package org.geotools.graph.structure

Examples of org.geotools.graph.structure.GraphVisitor


   
    iterator.setSource(ends[1]);
    traversal.traverse();
   
    //ensure only last node visited
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        if (component == ends[1]) 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());
        return 0;
      }
    };
View Full Code Here

    );
    traversal.init();
    traversal.traverse();
   
    //stopping node should be visited and nodes with greater id should not
    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);
   
    traversal.traverse();
   
    //every node should now be visited
    visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        assertTrue(component.isVisited());  
        return(0);
      }
    };
View Full Code Here

    );
    traversal.init();
    traversal.traverse();
   
    //kill node should be visited and nodes with greater id should not
    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) {
        if (component.getID() < bif) {
          assertTrue(component.isVisited())
       
        else if (component.getID() >= bif) {
View Full Code Here

    * Expected: 1. All nodes visited.
    */
   public void test_4() {
     int nnodes = 100;
     GraphTestUtil.buildCircular(builder(), nnodes);
     GraphVisitor visitor = new GraphVisitor() {
        public int visit(Graphable component) {
          if (component.getID() == 50) return(Graph.PASS_AND_CONTINUE);
          return(Graph.FAIL_QUERY)
        }
     };
     Node source = (Node)builder().getGraph().queryNodes(visitor).get(0);
    
     CountingWalker walker = new CountingWalker();
     NoBifurcationIterator iterator = createIterator();
     iterator.setSource(source);
    
     BasicGraphTraversal traversal = new BasicGraphTraversal(
       builder().getGraph(), walker, iterator
     );
     traversal.init();
     traversal.traverse();
    
     //ensure all nodes visisited
     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) {
          assertTrue(component.isVisited());
            if (component.getID() == 0) assertNull(iterator.getParent((Node) component));
            else assertTrue(component.getID() == iterator.getParent((Node)component).getID() + 1);
            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.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());
          if (component.getID() == 0) assertNull(iterator.getParent((Node)component));
          else assertTrue(
            iterator.getParent((Node)component).getID() == component.getID() - 1
View Full Code Here

    );
    traversal.init();
    traversal.traverse();
   
    //ensure that each node in lower level visited before node in higher level
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        String id = component.getObject().toString();
       
        for(
          Iterator itr = builder().getGraph().getNodes().iterator();
View Full Code Here

      builder().getGraph(), walker, iterator
    )
    traversal.init();
    traversal.traverse();
   
    GraphVisitor visitor = new GraphVisitor() {
      public int visit(Graphable component) {
        assertTrue(!component.isVisited());
        return 0;
      }
    };
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.