Package statechum

Examples of statechum.StringVertex


  public static CmpVertex generateNewCmpVertex(VertID name,Configuration conf)
  {
    synchronized(syncObj)
    {
      return conf.isLearnerUseStrings()?
          new StringVertex(name):
          new DeterministicVertex(name);     
    }   
  }
View Full Code Here


  public static CmpVertex generateNewCmpVertex(VertexID name,Configuration conf)
  {
    synchronized(syncObj)
    {
      return conf.isLearnerUseStrings()?
          new StringVertex(name):
          new DeterministicVertex(name);     
    }   
  }
View Full Code Here

  public static LearnerGraph convertTableToFSMStructure(final int [][]tTable, final int []vFrom, int rejectNumber, Configuration config)
  {
    if (vFrom.length == 0 || tTable.length == 0) throw new IllegalArgumentException("array is zero-sized");
    int alphabetSize = tTable[vFrom[0]].length;
    if (alphabetSize == 0) throw new IllegalArgumentException("alphabet is zero-sized");
    CmpVertex stateName[] = new CmpVertex[tTable.length];for(int i=0;i < tTable.length;++i) stateName[i]=new StringVertex("S"+i);
    String inputName[] = new String[alphabetSize];for(int i=0;i < alphabetSize;++i) inputName[i]="i"+i;
    LearnerGraph fsm = new LearnerGraph(config);fsm.initEmpty();
    fsm.init = stateName[vFrom[0]];
    Set<CmpVertex> statesUsed = new HashSet<CmpVertex>();
    for(int i=0;i<vFrom.length;++i)
View Full Code Here

  public final void testFSMStructureEquals5()
  {
    LearnerGraph a=buildLearnerGraph("A-a->A-b->B\nB-b->B", "testFSMStructureEquals6",config,converter);
    LearnerGraph b=buildLearnerGraph("A-a->A-b->B\nB-b->B", "testFSMStructureEquals6",config,converter);
   
    b.setInit(new StringVertex("B"));
    equalityTestingHelper(a,a,b,differentB, true);
  }
View Full Code Here

  public final void testFSMStructureEquals5()
  {
    LearnerGraph a=new LearnerGraph(buildGraph("A-a->A-b->B\nB-b->B", "testFSMStructureEquals6"),config);
    LearnerGraph b=new LearnerGraph(buildGraph("A-a->A-b->B\nB-b->B", "testFSMStructureEquals6"),config);
   
    b.init=new StringVertex("B");
    TestFSMAlgo.equalityTestingHelper(a,a,b,differentB);
  }
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.