Package statechum

Examples of statechum.StringVertex


  /** test for correct data being added when an empty collection is passed. */
  @Test
  public final void testCreateLabelToStateMap6()
  {
    Map<Label,List<CmpVertex>> trans = new HashMap<Label,List<CmpVertex>>();
    List<CmpVertex> A=Arrays.asList(new CmpVertex[]{new StringVertex("A")});
    Map<Label,List<CmpVertex>> expected = new HashMap<Label,List<CmpVertex>>();expected.put(lb("e"),A);expected.put(lb("b"),A);
    assertSame(trans,createLabelToStateMap(labelList(new String[] {"b","e"}), new StringVertex("A"),trans));
    assertEquals(expected,trans);
  }
View Full Code Here


  /** test for correct data being added when null is passed. */
  @Test
  public final void testCreateLabelToStateMap7()
  {
    List<CmpVertex> A=Arrays.asList(new CmpVertex[]{new StringVertex("A")});
    Map<Label,List<CmpVertex>> expected = new HashMap<Label,List<CmpVertex>>();expected.put(lb("e"),A);expected.put(lb("b"),A);
    assertEquals(expected,createLabelToStateMap(labelList(new String[] {"b","e"}), new StringVertex("A"),null));
  }
View Full Code Here

 
  private int stateNumber = 1;
 
  protected CmpVertex inventNameForNextState()
  {
    return new StringVertex("S" + stateNumber++);
  }
View Full Code Here

  }
 
  public AngluinLearner(Configuration config)
  {
    fsm = new LearnerGraph(config);
    fsm.init = new StringVertex("INIT");coreStates.add(fsm.init);
  }
View Full Code Here

     // support multi-core (internal vertex ID generation of Jung is not synchronized).
     
      labelmap = new HashMap<VertID,CmpVertex>();
      for(int i=0;i<size-1;i++)
      {
        CmpVertex v=new StringVertex(new VertexID(VertexID.VertKind.NEUTRAL,i+1));
        annotateVertex(v);
        machine.getTransitionMatrix().put(v, machine.createNewRow());
        vertices.add(v);// permits v to be chosen as a target, creating self-loops
        this.labelmap.put(v, v);
        CmpVertex random = selectRandomVertex();
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);
    Label inputName[] = new Label[alphabetSize];for(int i=0;i < alphabetSize;++i) inputName[i]=new StringLabel("i"+i);
    LearnerGraph fsm = new LearnerGraph(config);fsm.initEmpty();
    fsm.setInit(stateName[vFrom[0]]);
    Set<CmpVertex> statesUsed = new HashSet<CmpVertex>();
    for(int i=0;i<vFrom.length;++i)
View Full Code Here

     // support multi-core (internal vertex ID generation of Jung is not synchronized).
     
      labelmap = new HashMap<VertexID,CmpVertex>();
      for(int i=0;i<size-1;i++)
      {
        CmpVertex v=new StringVertex(new VertexID(VertexID.VertKind.NEUTRAL,i+1));
        annotateVertex(v);
        machine.getTransitionMatrix().put(v, machine.createNewRow());
        vertices.add(v);// permits v to be chosen as a target, creating self-loops
        this.labelmap.put(v.getID(), v);
        CmpVertex random = selectRandomVertex();

        machine.addTransition(machine.getTransitionMatrix().get(random), AbstractLearnerGraph.generateNewLabel(randomInt(alphabet-1),machine.config), v);
        //Visualiser.updateFrame(machine, null);
        if (Distributions.nextGeometric(1-selfLoop,generator)>0)
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

 
  /** 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

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.