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

            {
              CmpVertex redVertex = null;
              if (listOfPairsToWrite != null)
              {
                redVertex = tentativeRedNodes.iterator().next();
                listOfPairsToWrite.add(new PairOfPaths(coregraph, new PairScore(null, redVertex, 0, 0)));
              }
             
              if(listOfPairsToCheckAgainstIterator != null)
              {
                PairOfPaths pair = listOfPairsToCheckAgainstIterator.next();
                Assert.assertNull(pair.getQ());
                redVertex = coregraph.getVertex(pair.getR());
              }
              return redVertex;
            }});
          if (!outcome.isEmpty())
          {
            if (listOfPairsToWrite != null)
            {
              //System.out.println("Optimized: "+useOptimizedMerge+", matrix: "+graph.config.getTransitionMatrixImplType()+", pair : "+outcome.peek());
              listOfPairsToWrite.add(new PairOfPaths(graph, outcome.peek()));
            }
           
            if(listOfPairsToCheckAgainstIterator != null)
            {
              PairOfPaths pair = listOfPairsToCheckAgainstIterator.next();
              //System.out.println("chosen "+outcome.peek()+", expected "+new PairScore(graph.getVertex(pair.getQ()),graph.getVertex(pair.getR()),0,0));
              pair.rebuildStack(graph, outcome);
            }
          }
         
          return outcome;
        }
View Full Code Here

  @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

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.