Package statechum.analysis.learning

Examples of statechum.analysis.learning.PairOfPaths


  @Test
  public void testWritePairsToXMLFail1()
  {
    final LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C\nD-a->D", "testWritePairsToXMLFail1",mainConfiguration,converter);
    Helper.checkForCorrectException(new whatToRun() { @SuppressWarnings("unused") public @Override void run() {
      new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("D")), gr.findVertex(VertexID.parseID("C")),1,2));
    }},IllegalArgumentException.class,"failed to find paths");
  }
View Full Code Here


  @Test
  public void testWritePairsToXML1a()
  {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    PairOfPaths pair = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    List<PairOfPaths> list = new LinkedList<PairOfPaths>();list.add(pair);
    PairOfPaths.writePairs(list, mainConfiguration, outputStream);
   
    // Now load this.
    List<PairOfPaths> loaded = PairOfPaths.readPairs(new StringReader(outputStream.toString()), mainConfiguration,converter);
    Assert.assertEquals(1,loaded.size());
   
    PairOfPaths r=loaded.get(0);
    Assert.assertEquals("A",gr.getVertex(r.getQ()).getStringId());Assert.assertEquals("C",gr.getVertex(r.getR()).getStringId());
  }
View Full Code Here

  @Test
  public void testWritePairsToXML1b()
  {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    PairOfPaths pair = new PairOfPaths(gr,new PairScore(null, gr.findVertex(VertexID.parseID("C")),1,2));
    List<PairOfPaths> list = new LinkedList<PairOfPaths>();list.add(pair);
    PairOfPaths.writePairs(list, mainConfiguration, outputStream);
   
    // Now load this.
    List<PairOfPaths> loaded = PairOfPaths.readPairs(new StringReader(outputStream.toString()), mainConfiguration,converter);
    Assert.assertEquals(1,loaded.size());
   
    PairOfPaths r=loaded.get(0);
    Assert.assertNull(r.getQ());Assert.assertEquals("C",gr.getVertex(r.getR()).getStringId());
  }
View Full Code Here

   
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    List<PairOfPaths> loaded = PairOfPaths.readPairs(new StringReader(xmlString), mainConfiguration,converter);
    Assert.assertEquals(1,loaded.size());
   
    PairOfPaths r=loaded.get(0);
    Assert.assertEquals("A",gr.getVertex(r.getQ()).getStringId());Assert.assertEquals("C",gr.getVertex(r.getR()).getStringId());
  }
View Full Code Here

   
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    List<PairOfPaths> loaded = PairOfPaths.readPairs(new StringReader(xmlString), mainConfiguration,converter);
    Assert.assertEquals(1,loaded.size());
   
    PairOfPaths r=loaded.get(0);
    Assert.assertNull(r.getQ());Assert.assertEquals("C",gr.getVertex(r.getR()).getStringId());
  }
View Full Code Here

  @Test
  public void testWritePairsToXML2()
  {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    PairOfPaths pair1 = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2)),
        pair2 = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("B")), gr.findVertex(VertexID.parseID("C")),1,2));
    List<PairOfPaths> list = new LinkedList<PairOfPaths>();list.add(pair1);list.add(pair2);
    PairOfPaths.writePairs(list, mainConfiguration, outputStream);
   
    // Now load this.
    List<PairOfPaths> loaded = PairOfPaths.readPairs(new StringReader(outputStream.toString()), mainConfiguration,converter);
    Assert.assertEquals(2,loaded.size());
   
    PairOfPaths r=loaded.get(0);
    Assert.assertEquals("A",gr.getVertex(r.getQ()).getStringId());Assert.assertEquals("C",gr.getVertex(r.getR()).getStringId());
    r=loaded.get(1);
    Assert.assertEquals("B",gr.getVertex(r.getQ()).getStringId());Assert.assertEquals("C",gr.getVertex(r.getR()).getStringId());
  }
View Full Code Here

  @Test
  public void testWritePairsToXML3()
  {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    PairOfPaths pair1 = new PairOfPaths(gr,new PairScore(null, gr.findVertex(VertexID.parseID("C")),1,2)),
        pair2 = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("B")), gr.findVertex(VertexID.parseID("C")),1,2));
    List<PairOfPaths> list = new LinkedList<PairOfPaths>();list.add(pair1);list.add(pair2);
    PairOfPaths.writePairs(list, mainConfiguration, outputStream);
   
    // Now load this.
    List<PairOfPaths> loaded = PairOfPaths.readPairs(new StringReader(outputStream.toString()), mainConfiguration,converter);
    Assert.assertEquals(2,loaded.size());
   
    PairOfPaths r=loaded.get(0);
    Assert.assertNull(r.getQ());Assert.assertEquals("C",gr.getVertex(r.getR()).getStringId());
    r=loaded.get(1);
    Assert.assertEquals("B",gr.getVertex(r.getQ()).getStringId());Assert.assertEquals("C",gr.getVertex(r.getR()).getStringId());
  }
View Full Code Here

 
  @Test
  public void testRebuildStack1()
  {
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    PairOfPaths pair1 = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    Stack<PairScore> stack=new Stack<PairScore>();
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    pair1.rebuildStack(gr, stack);
    Assert.assertEquals(1,stack.size());
    PairScore r = stack.pop();
    Assert.assertEquals("A",r.getQ().getStringId());Assert.assertEquals("C",r.getR().getStringId());
 
View Full Code Here

 
  @Test
  public void testRebuildStack2()
  {
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    PairOfPaths pair1 = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    Stack<PairScore> stack=new Stack<PairScore>();
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("A")),1,2));
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("C")), gr.findVertex(VertexID.parseID("C")),1,2));
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    pair1.rebuildStack(gr, stack);
    Assert.assertEquals(1,stack.size());
    PairScore r = stack.pop();
    Assert.assertEquals("A",r.getQ().getStringId());Assert.assertEquals("C",r.getR().getStringId());
  }
View Full Code Here

 
  @Test
  public void testRebuildStack3()
  {
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    PairOfPaths pair1 = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    Stack<PairScore> stack=new Stack<PairScore>();
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("C")), gr.findVertex(VertexID.parseID("C")),1,2));
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("A")),1,2));
    pair1.rebuildStack(gr, stack);
    Assert.assertEquals(1,stack.size());
    PairScore r = stack.pop();
    Assert.assertEquals("A",r.getQ().getStringId());Assert.assertEquals("C",r.getR().getStringId());
 
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.PairOfPaths

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.