Package statechum

Examples of statechum.StringVertex


  public final void testGraphConstruction2()
  {
    confString.setUseOrderedEntrySet(true);config.setUseOrderedEntrySet(true);
    LearnerGraph expected = new LearnerGraph(confString);expected.initEmpty();
    LearnerGraph graph = buildLearnerGraph("A--a-->B-b->C-c->A-b->B-a-#D","testConstruction2",config,converter);
    CmpVertex A = new StringVertex("A"), B = new StringVertex("B"), C = new StringVertex("C");
    CmpVertex D = new StringVertex("D");D.setAccept(false);
    expected.transitionMatrix.put(A, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"a","b"}),
        new StringVertex("B"),null), null, A));
    expected.transitionMatrix.put(B, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"b"}),
        new StringVertex("C"),createLabelToStateMap(labelList(new String[] {"a"}),D,null)), null, B));
    expected.transitionMatrix.put(C, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"c"}),
        new StringVertex("A"),null), null, C));
    expected.transitionMatrix.put(D, convertRowToDet(expected,createLabelToStateMap(emptyCollectionOfLabels,null,null), null, D));
    expected.setInit(expected.findVertex("A"));
   
    assertEquals("A", graph.getInit().getStringId());
    assertEquals("incorrect transition set",true,expected.transitionMatrix.equals(graph.transitionMatrix));
View Full Code Here


  public final void testGraphConstruction3()
  {
    confString.setUseOrderedEntrySet(true);config.setUseOrderedEntrySet(true);
    LearnerGraph expected = new LearnerGraph(confString);expected.initEmpty();
    LearnerGraph graph = buildLearnerGraph("A--a-->B<-b--C-c->A-b->A-c->A\nB-d->B-p->C\nB-q->C\nB-r->C\n","testConstruction3",config,converter);
    CmpVertex A = new StringVertex("A"), B = new StringVertex("B"), C = new StringVertex("C");
    expected.transitionMatrix.put(A, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"b","c"}),
        new StringVertex("A"),createLabelToStateMap(labelList(new String[] {"a"}),B,null)), null, A));
    expected.transitionMatrix.put(B, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"d"}),B,
        createLabelToStateMap(labelList(new String[] {"r","p","q"}),C,null)), null, B));
    expected.transitionMatrix.put(C, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"b"}),B,
        createLabelToStateMap(labelList(new String[] {"c"}),A,null)), null, C));
    expected.setInit(expected.findVertex("A"));
View Full Code Here

  public final void testGraphConstruction4()
  {
    confString.setUseOrderedEntrySet(true);config.setUseOrderedEntrySet(true);
    LearnerGraph expected = new LearnerGraph(confString);expected.initEmpty();
    LearnerGraph graph = buildLearnerGraph("A--a-->B<-b--D-c->A-b->A-c->A\nB-d->B-p-#C\nB-q-#C\nB-r-#C\n","testConstruction4",config,converter);
    CmpVertex A = new StringVertex("A"), B = new StringVertex("B"), C = new StringVertex("C"),D = new StringVertex("D");
    C.setAccept(false);
    expected.transitionMatrix.put(A, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"b","c"}),
        new StringVertex("A"),createLabelToStateMap(labelList(new String[] {"a"}),B,null)), null, A));
    expected.transitionMatrix.put(B, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"d"}),B,
        createLabelToStateMap(labelList(new String[] {"r","p","q"}),C,null)), null, B));
    expected.transitionMatrix.put(D, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"b"}),B,
        createLabelToStateMap(labelList(new String[] {"c"}),A,null)), null, D));
    expected.transitionMatrix.put(C, convertRowToDet(expected,createLabelToStateMap(emptyCollectionOfLabels,null,null), null, C));
View Full Code Here

  public final void testGraphConstruction5()
  {
    confString.setUseOrderedEntrySet(true);config.setUseOrderedEntrySet(true);
    LearnerGraph expected = new LearnerGraph(confString);expected.initEmpty();
    LearnerGraph graph = buildLearnerGraph("A--a-->B-b-#C\nA-b->A-c->A\nB-d->B-p-#C\nB-q-#C\nB-r-#C\n","testConstruction5",config,converter);
    CmpVertex A = new StringVertex("A"), B = new StringVertex("B"), C = new StringVertex("C");
    C.setAccept(false);
    expected.transitionMatrix.put(A, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"b","c"}),A,
        createLabelToStateMap(labelList(new String[] {"a"}),B,null)), null, A));
    expected.transitionMatrix.put(B, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"d"}),B,
        createLabelToStateMap(labelList(new String[] {"b","r","p","q"}),C,null)), null, B));
    expected.transitionMatrix.put(C, convertRowToDet(expected,createLabelToStateMap(emptyCollectionOfLabels,null,null), null, C));
View Full Code Here

  public final void testGraphConstruction6()
  {
    confString.setUseOrderedEntrySet(true);config.setUseOrderedEntrySet(true);
    LearnerGraph expected = new LearnerGraph(confString);expected.initEmpty();
    LearnerGraph graph = buildLearnerGraph("P-c->P<-b-Q_St<-a-P-b->P\nQ_St-a->Q_St","testConstruction6",config,converter);
    CmpVertex P = new StringVertex("P"), Q_State = new StringVertex("Q_St");
    expected.transitionMatrix.put(P, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"b","c"}),P,
        createLabelToStateMap(labelList(new String[] {"a"}),Q_State,null)), null, P));
    expected.transitionMatrix.put(Q_State, convertRowToDet(expected,createLabelToStateMap(labelList(new String[] {"a"}),Q_State,
        createLabelToStateMap(labelList(new String[] {"b"}),P,null)), null, Q_State));
    expected.setInit(expected.findVertex("P"));
View Full Code Here

 
  /** test with empty data. */
  @Test
  public final void testCreateLabelToStateMap1()
  {
    assertTrue(createLabelToStateMap(new LinkedList<Label>(), new StringVertex("junk"), null).isEmpty());
    Map<Label,List<CmpVertex>> map = new HashMap<Label,List<CmpVertex>>();
    assertSame(map,createLabelToStateMap(new LinkedList<Label>(), new StringVertex("junk"), map));assertTrue(map.isEmpty());
  }
View Full Code Here

  /** test for no changes when nothing is to be added. */
  @Test
  public final void testCreateLabelToStateMap2()
  {
    Map<Label,List<CmpVertex>> trans = new HashMap<Label,List<CmpVertex>>();
    List<CmpVertex> A=Arrays.asList(new CmpVertex[]{new StringVertex("A")}),B=Arrays.asList(new CmpVertex[]{new StringVertex("B")});
    trans.put(lb("a"), A);trans.put(lb("b"), A);trans.put(lb("c"), B);
    Map<Label,List<CmpVertex>> expected = new HashMap<Label,List<CmpVertex>>();expected.putAll(trans);
    assertSame(trans,createLabelToStateMap(new LinkedList<Label>(), new StringVertex("junk"),trans));
    assertEquals(expected,trans);
  }
View Full Code Here

  /** test for correct data being added when two transitions lead to the same state as one of the existing states. */
  @Test
  public final void testCreateLabelToStateMap3()
  {
    Map<Label,List<CmpVertex>> trans = new HashMap<Label,List<CmpVertex>>();
    List<CmpVertex> A=Arrays.asList(new CmpVertex[]{new StringVertex("A")}),B=Arrays.asList(new CmpVertex[]{new StringVertex("B")});
    trans.put(lb("a"), A);trans.put(lb("b"), A);trans.put(lb("c"), B);
    Map<Label,List<CmpVertex>> expected = new HashMap<Label,List<CmpVertex>>();expected.putAll(trans);expected.put(lb("e"), A);expected.put(lb("g"), A);
    assertSame(trans,createLabelToStateMap(labelList(new String[] {"g","e"}), new StringVertex("A"),trans));
    assertEquals(expected,trans);
  }
View Full Code Here

  /** test for correct data being added when two transitions lead to a new state. */
  @Test
  public final void testCreateLabelToStateMap4()
  {
    Map<Label,List<CmpVertex>> trans = new HashMap<Label,List<CmpVertex>>();
    List<CmpVertex> A=Arrays.asList(new CmpVertex[]{new StringVertex("A")}),
      B=Arrays.asList(new CmpVertex[]{new StringVertex("B")}),
      D=Arrays.asList(new CmpVertex[]{new StringVertex("D")});
    trans.put(lb("a"), A);trans.put(lb("b"), A);trans.put(lb("c"), B);
    Map<Label,List<CmpVertex>> expected = new HashMap<Label,List<CmpVertex>>();expected.putAll(trans);expected.put(lb("e"),D);expected.put(lb("f"), D);
    assertSame(trans,createLabelToStateMap(labelList(new String[] {"f","e"}), new StringVertex("D"),trans));
    assertEquals(expected,trans);
  }
View Full Code Here

  /** test for correct data being added when two transitions lead to the same state as one of the existing states. */
  @Test
  public final void testCreateLabelToStateMap5()
  {
    Map<Label,List<CmpVertex>> trans = new HashMap<Label,List<CmpVertex>>();
    List<CmpVertex> A=Arrays.asList(new CmpVertex[]{new StringVertex("A")}),
      B=Arrays.asList(new CmpVertex[]{new StringVertex("B")});
    trans.put(lb("a"), A);trans.put(lb("b"), A);trans.put(lb("c"), B);
    Map<Label,List<CmpVertex>> expected = new HashMap<Label,List<CmpVertex>>();expected.putAll(trans);expected.put(lb("e"), B);expected.put(lb("g"), B);
    assertSame(trans,createLabelToStateMap(labelList(new String[] {"g","e"}), new StringVertex("B"),trans));
    assertEquals(expected,trans);
  }
View Full Code Here

TOP

Related Classes of statechum.StringVertex

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.