Package nz.ac.waikato.jdsl.graph.api

Examples of nz.ac.waikato.jdsl.graph.api.Vertex$NONEVertex


    model.buildGraph();
    InspectableGraph graph = model.getGraph();
    // now check that the correct graph has been built.
    Assert.assertEquals(3, graph.numVertices());
    Assert.assertEquals(5, graph.numEdges());
    Vertex s0 = model.getVertex("0");
    Vertex s1 = model.getVertex("1");
    Vertex s2 = model.getVertex("2");
    Assert.assertNotNull(s0);
    Assert.assertNotNull(s1);
    Assert.assertNotNull(s2);
    Assert.assertEquals("0", s0.element());
    Assert.assertEquals("1", s1.element());
    Assert.assertEquals("2", s2.element());
    // we must iterate through the edges, because graph.aConnectingEdge
    // does not respect the direction of the edge!
    EdgeIterator iter = graph.edges();
    while (iter.hasNext()) {
      Edge e = iter.nextEdge();
View Full Code Here


    InspectableGraph graph = listen.getGraph();
    // now check that the correct graph has been built.
    assertEquals(3, graph.numVertices());
    assertEquals(5, graph.numEdges());

    Vertex s0 = listen.getVertex("0");
    Vertex s1 = listen.getVertex("1");
    Vertex s2 = listen.getVertex("2");
    assertNotNull(s0);
    assertNotNull(s1);
    assertNotNull(s2);
    assertEquals("0", s0.element());
    assertEquals("1", s1.element());
    assertEquals("2", s2.element());
    assertEquals(3, listen.getVertexMap().size());
    // we must iterate through the edges, because graph.aConnectingEdge
    // does not respect the direction of the edge!
    EdgeIterator iter = graph.edges();
    while (iter.hasNext()) {
View Full Code Here

    fsmGraph = new IncidenceListGraph();
    fsmVertex = new HashMap<Object,Vertex>();
    fsmDone = new HashMap<Object,BitSet>();
    fsmTodo = new HashMap<Object,BitSet>();
    // set up the initial state
    Vertex initial = fsmGraph.insertVertex(fsmState);
    assert initial != null;
    printProgress(3, "buildgraph: start with vertex for initial state "+fsmState);
    fsmVertex.put(fsmState, initial);
    fsmDone.put(fsmState, new BitSet());
    BitSet enabled = currentEnabledActions();
View Full Code Here

   * @param tr  A possibly new transition (and state).
   */
  protected void continueBuildGraph(Transition tr, int action)
  {
    Object oldState = tr.getStartState();
    Vertex oldVertex = fsmVertex.get(oldState);
    assert oldVertex != null// we must have already visited it.
    String actionName = tr.getAction();
    Object newState = tr.getEndState();
    assert newState == fsmState;  // we should still be inside doAction.
    BitSet enabled = currentEnabledActions();
    // see if this newState is an unknown one.
    Vertex newVertex = fsmVertex.get(newState);
    if (newVertex == null) {
      // we have reached a new state, so add & analyze it.
      newVertex = fsmGraph.insertVertex(newState);
      fsmVertex.put(newState, newVertex);
      fsmDone.put(newState, new BitSet());
View Full Code Here

  //get the vertex of the given state.
  public Vertex getVertex(InspectableGraph graph, Object state)
  {
    VertexIterator itr = graph.vertices();
    while (itr.hasNext()) {
      Vertex v = itr.nextVertex();
      if (v.element().equals(state))
        return v;
    }
    return null;
  }
View Full Code Here

    clearDoneTodo();
    Object curr = model_.getCurrentState(); //the initial state
    // set up the initial state
    fsmGraph_ = new IncidenceListGraph();
    fsmVertex_ = new HashMap<Object,Vertex>();
    Vertex initial = fsmGraph_.insertVertex(curr);
    assert initial != null;
    printProgress(3, "buildgraph: start with vertex for initial state "+curr);
    fsmVertex_.put(curr, initial);
  }
View Full Code Here

   */
  @Override
  public void doneTransition(int action, Transition tr)
  {
    Object oldState = tr.getStartState();
    Vertex oldVertex = fsmVertex_.get(oldState);
    assert oldVertex != null// we must have already visited it.
    String actionName = tr.getAction();
    Object newState = tr.getEndState();
    assert newState == model_.getCurrentState();
    // see if this newState is an unknown one.
    Vertex newVertex = fsmVertex_.get(newState);
    if (newVertex == null) {
      // we have reached a new state, so add & analyze it.
      newVertex = fsmGraph_.insertVertex(newState);
      fsmVertex_.put(newState, newVertex);
      printProgress(3, "buildgraph: Added vertex for state "+newState);
View Full Code Here

    }

    @Override
    public void setGraph(InspectableGraph model, Map<Object, Vertex> state2vertex) {
        for (VertexIterator iter = model.vertices(); iter.hasNext();) {
            Vertex v = iter.nextVertex();
            addItem(v.element()); // get the FSM state object.
        }
        maxCoverage_ = coverage_.size();
    }
View Full Code Here

    }

    @Override
    public void setGraph(InspectableGraph model, Map<Object, Vertex> state2vertex) {
        for (VertexIterator iter = model.vertices(); iter.hasNext();) {
            Vertex v = iter.nextVertex();
            for (EdgeIterator incoming = model.incidentEdges(v, EdgeDirection.IN); incoming.hasNext();) {
                Edge in = incoming.nextEdge();
                Transition inTrans = transition(in, model);
                for (EdgeIterator outgoing = model.incidentEdges(v, EdgeDirection.OUT); outgoing.hasNext();) {
                    Edge out = outgoing.nextEdge();
View Full Code Here

TOP

Related Classes of nz.ac.waikato.jdsl.graph.api.Vertex$NONEVertex

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.