Examples of GraphListener


Examples of com.hp.hpl.jena.graph.GraphListener

        fm.addLocatorClassLoader(ExampleTDB_04.class.getClassLoader());
        InputStream in = fm.open("data/data.nt");

        DatasetGraphTDB dsg =  TDBInternal.getBaseDatasetGraphTDB(TDBFactory.createDatasetGraph());

        GraphListener listener = new MyListener();
        dsg.getDefaultGraph().getEventManager().register(listener);
        Iterator<Node> iter = dsg.listGraphNodes();
        while ( iter.hasNext() ) {
          Graph graph = dsg.getGraph(iter.next());
          graph.getEventManager().register(listener);
View Full Code Here

Examples of com.sun.sgs.impl.service.nodemap.affinity.graph.GraphListener

            UndirectedGraph<LabelVertex, WeightedEdge> graphModel =
                    new ZachBuilder().getAffinityGraph();
            System.out.println("MODEL GRAPH IS " + graphModel);
            LPADriver driver = (LPADriver)
                finderField.get(serverNode.getNodeMappingService());
            GraphListener serverListener = driver.getGraphListener();
            AffinityGraphBuilder builder = driver.getGraphBuilder();
            // The graph can only be found on the server side.  Let's make
            // sure it looks like the expected Zachary graph.
            // The core server graph listener builds a DistGraphBuilder,
            // which (on the core node) creates the DistGraphBuilderServerImpl.
View Full Code Here

Examples of com.sun.sgs.impl.service.nodemap.affinity.graph.GraphListener

        // Add the self as listener if there is a builder and we are
        // not a core server node.
        if (graphBuilder != null && type != NodeType.coreServerNode) {
            ProfileCollector col =
                systemRegistry.getComponent(ProfileCollector.class);
            graphListener = new GraphListener(graphBuilder);
            col.addListener(graphListener, false);
        } else {
            graphListener = null;
        }
        logger.log(Level.CONFIG,
View Full Code Here

Examples of diva.graph.GraphListener

     * Dispatch the edgeHeadChanged() event to the
     * listeners.
     */
    public void edgeHeadChanged(GraphEvent e) {
        for (Iterator i = listeners(); i.hasNext();) {
            GraphListener l = (GraphListener) i.next();
            l.edgeHeadChanged(e);
        }
    }
View Full Code Here

Examples of diva.graph.GraphListener

     * Dispatch the edgeTailChanged() event to the
     * listeners.
     */
    public void edgeTailChanged(GraphEvent e) {
        for (Iterator i = listeners(); i.hasNext();) {
            GraphListener l = (GraphListener) i.next();
            l.edgeTailChanged(e);
        }
    }
View Full Code Here

Examples of diva.graph.GraphListener

    /**
     * Dispatch the nodeAdded() event to each of the listeners.
     */
    public void nodeAdded(GraphEvent e) {
        for (Iterator i = listeners(); i.hasNext();) {
            GraphListener l = (GraphListener) i.next();
            l.nodeAdded(e);
        }
    }
View Full Code Here

Examples of diva.graph.GraphListener

    /**
     * Dispatch the nodeRemoved() event to each of the listeners.
     */
    public void nodeRemoved(GraphEvent e) {
        for (Iterator i = listeners(); i.hasNext();) {
            GraphListener l = (GraphListener) i.next();
            l.nodeRemoved(e);
        }
    }
View Full Code Here

Examples of diva.graph.GraphListener

    /**
     * Dispatch the structureChanged() event to each of the listeners.
     */
    public void structureChanged(GraphEvent e) {
        for (Iterator i = listeners(); i.hasNext();) {
            GraphListener l = (GraphListener) i.next();
            l.structureChanged(e);
        }
    }
View Full Code Here

Examples of nz.ac.waikato.modeljunit.GraphListener

    if(false) {

    Random old = rand_;
    rand_ = new Random(FIXEDSEED);
    // make sure there is a graph listener
    GraphListener graph = (GraphListener) model_.addListener("graph");
    boolean wasTesting = model_.setTesting(false);
    model_.doReset("Buildgraph");
    do {
      generate(10);
      maxSteps -= 10;
    }
    while (graph.numTodo() > 0 && maxSteps > 0);

    int todo = graph.numTodo();
    if (todo > 0) {
      model_.printWarning("buildgraph stopped with "
          + graph.getGraph().numEdges() + " transitions and "
          + graph.getGraph().numVertices() + " states, but "
          + todo + " unexplored branches.");
    }
    model_.setTesting(wasTesting);
    model_.doReset("Buildgraph");
    if (clear) {
      graph.clearDoneTodo();
    }

    // restore the original random number generator.
    rand_ = old;
    return graph;
View Full Code Here

Examples of nz.ac.waikato.modeljunit.GraphListener

  public GraphListener buildGraphBreadthFirst(int maxDepth, boolean clear)
  {
    System.out.println("Called new buildgraph");
    Random old = rand_;
    rand_ = new Random(FIXEDSEED);
    GraphListener graph = (GraphListener) model_.addListener("graph");
    boolean wasTesting = model_.setTesting(false);

    // Build graph logic
    Set<String> seenActions = new HashSet<String>();
    Set<Object> seenStates = new HashSet<Object>();
    Set<List<Integer>> visitedPaths = new HashSet<List<Integer>>();
    Queue<List<Integer>> highPriority = new LinkedList<List<Integer>>();
    Queue<List<Integer>> lowPriority = new LinkedList<List<Integer>>();

    BitSet enabled = model_.enabledGuards();
 
    //seenStates.put(model_.getState());

    // Initially populate the queues and then proceed
    for(int i = 0; i<enabled.cardinality(); i++) {
           List<Integer> path = new LinkedList<Integer>();
           if(enabled.get(i))
              path.add(i);
           highPriority.offer(path);
           System.out.println("Populated buildgraph");
    }

    while(true) {
       System.out.println("Called new buildgraph main loop");
       List<Integer> path = highPriority.poll();
       if(path == null) path = lowPriority.poll();
       if(path == null) break; // No work left to do - exit
       model_.doReset("Buildgraph");

       // Exit condition
       if(path.size() > maxDepth) break;

       for(Integer p : path) {
          String actionName = model_.getActionName(p);
          model_.doAction(p);
          seenActions.add(actionName);
         // seenStates.add(model_.getState());

          BitSet nenabled = model_.enabledGuards();
          for(int i = 0; i<nenabled.cardinality(); i++) {
             if(nenabled.get(i)) {
                if(!seenActions.contains(model_.getActionName(i))) {
                   // High priority - not seen before
                   List<Integer> newPath = (List<Integer>) ((LinkedList<Integer>) path).clone();
                   newPath.add(i);
                   highPriority.offer(newPath);
                } else {
                   // Low priority
                   List<Integer> newPath = (List<Integer>) ((LinkedList<Integer>) path).clone();
                   newPath.add(i);
                   //TODO: Need to make this a proper equality test - will fail at the moment
                   // because it is checking references.  Should be equivalent to checking
                   // if we have taken the current path + the action under consideration before.
                   if(!visitedPaths.contains(newPath)) {
                      lowPriority.offer(newPath);
                   }
                }

             }
          }
       }

       visitedPaths.add(path);
    }
    model_.setTesting(wasTesting);
    model_.doReset("Buildgraph");
    if (clear) {
      graph.clearDoneTodo();
    }

    // restore the original random number generator.
    rand_ = old;
    return graph;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.