Package statechum.analysis.learning

Examples of statechum.analysis.learning.PairOfPaths


 
  @Test
  public void testRebuildStackFail1()
  {
    final LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    final PairOfPaths pair1 = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    final Stack<PairScore> stack=new Stack<PairScore>();
    Helper.checkForCorrectException(new whatToRun() { public @Override void run() {
      pair1.rebuildStack(gr, stack);
    }},IllegalArgumentException.class,"pair not found");
  }
View Full Code Here


 
  @Test
  public void testRebuildStackFail2()
  {
    final LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    final PairOfPaths pair1 = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    final Stack<PairScore> stack=new Stack<PairScore>();
    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")),2,2));
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("C")), gr.findVertex(VertexID.parseID("C")),2,2));
    Helper.checkForCorrectException(new whatToRun() { public @Override void run() {
      pair1.rebuildStack(gr, stack);
    }},IllegalArgumentException.class,"pair not found");
  }
View Full Code Here

 
  @Test
  public void testRebuildStackFail3()
  {
    final LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    final PairOfPaths pair1 = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    final Stack<PairScore> stack=new Stack<PairScore>();
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("B")), gr.findVertex(VertexID.parseID("C")),1,2));
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("B")),1,2));
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("A")),2,2));
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("C")), gr.findVertex(VertexID.parseID("C")),2,2));
    Helper.checkForCorrectException(new whatToRun() { public @Override void run() {
      pair1.rebuildStack(gr, stack);
    }},IllegalArgumentException.class,"pair not found");
  }
View Full Code Here

 
  @Test
  public void testRebuildStackFail4()
  {
    final LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",mainConfiguration,converter);
    final PairOfPaths pair1 = new PairOfPaths(gr,new PairScore(gr.findVertex(VertexID.parseID("A")), gr.findVertex(VertexID.parseID("C")),1,2));
    final Stack<PairScore> stack=new Stack<PairScore>();
    stack.push(new PairScore(gr.findVertex(VertexID.parseID("C")), gr.findVertex(VertexID.parseID("C")),2,2));
    Helper.checkForCorrectException(new whatToRun() { public @Override void run() {
      pair1.rebuildStack(gr, stack);
    }},IllegalArgumentException.class,"pair not found");
  }
View Full Code Here

          Stack<PairScore> outcome = decoratedLearner.ChooseStatePairs(graph);
          if (!outcome.isEmpty())
          {
            if (listOfPairsToWrite != null)
            {
              listOfPairsToWrite.add(new PairOfPaths(graph, outcome.peek()));
            }
           
            if(listOfPairsToCheckAgainstIterator != null)
            {
              listOfPairsToCheckAgainstIterator.next().rebuildStack(graph, outcome);
View Full Code Here

  @Test
  public void testWritePairsToXMLFail1()
  {
    final LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C\nD-a->D", "testWritePairsToXMLFail1",config);
    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 testWritePairsToXML1()
  {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",config);
    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, config, outputStream);
   
    // Now load this.
    System.out.println(outputStream);
    List<PairOfPaths> loaded = PairOfPaths.readPairs(new StringReader(outputStream.toString()), config);
    Assert.assertEquals(1,loaded.size());
   
    PairOfPaths r=loaded.get(0);
    Assert.assertEquals("A",gr.getVertex(r.getQ()).getID().toString());Assert.assertEquals("C",gr.getVertex(r.getR()).getID().toString());
  }
View Full Code Here

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

  @Test
  public void testWritePairsToXML2()
  {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",config);
    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, config, outputStream);
   
    // Now load this.
    System.out.println(outputStream);
    List<PairOfPaths> loaded = PairOfPaths.readPairs(new StringReader(outputStream.toString()), config);
    Assert.assertEquals(2,loaded.size());
   
    PairOfPaths r=loaded.get(0);
    Assert.assertEquals("A",gr.getVertex(r.getQ()).getID().toString());Assert.assertEquals("C",gr.getVertex(r.getR()).getID().toString());
    r=loaded.get(1);
    Assert.assertEquals("B",gr.getVertex(r.getQ()).getID().toString());Assert.assertEquals("C",gr.getVertex(r.getR()).getID().toString());
  }
View Full Code Here

 
  @Test
  public void testRebuildStack1()
  {
    LearnerGraph gr = buildLearnerGraph("A-a->A-b->B-c->C", "testWritePairsToXML1",config);
    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().getID().toString());Assert.assertEquals("C",r.getR().getID().toString());
 
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.