Package statechum

Examples of statechum.Trace


  {
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B-b->C / B-u-#D / A-c->E-u->F / E-c->G","testUpdateMarkovSideways3",config, converter);
    MarkovModel m = new MarkovModel(3,false,true);
    new MarkovClassifier(m,graph).updateMarkov(true);
    Assert.assertEquals(6,m.predictionsMatrix.size());
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblA,lblB,lblC}),true)));
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblA,lblB,lblA}),true)));
   
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblC,lblU,lblC}),true)));
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblC,lblU,lblA}),true)));
   
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblC,lblC,lblC}),true)));
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblC,lblC,lblA}),true)));
  }
View Full Code Here


    MarkovModel m = new MarkovModel(2,false,true);
    new MarkovClassifier(m,graph).updateMarkov(true);
   
    Assert.assertEquals(8,m.predictionsMatrix.size());
   
    Assert.assertEquals(MarkovOutcome.failure,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblB,lblU}),true)));
   
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblA,lblA}),true)));
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblC,lblA}),true)));
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblA,lblC}),true)));
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblC,lblC}),true)));
   
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblU,lblB}),true)));
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblB,lblB}),true)));
    Assert.assertEquals(MarkovOutcome.positive,m.predictionsMatrix.get(new Trace(Arrays.asList(new Label[]{lblU,lblU}),true)));
  }
View Full Code Here

   
    // going through all positive traces
    //and partitioning each positive traces into a list of events ( a list of labels based on the chunk length)
    for(List<Label> positive_trace:pos)
    {
      Trace current_positive_trace=new Trace(positive_trace, true);
      for(int i=onlyLongest?chunk_Length-1:0;i<chunk_Length;i++)
      {
        List<Trace> List_traces=splitTrace(current_positive_trace,i+1);
        for (Trace tracePos:List_traces)
          updateOccurrenceMatrix(tracePos,true);
      }
    }
   
    // from negative traces initialize the Markov matrix
    for(List<Label> negative_trace:neg)
    {
      for(int i=onlyLongest?chunk_Length-1:0; i<chunk_Length; i++)
      {
        Trace trace=new Trace(negative_trace,true);
        List<Trace> List_traces=splitTrace(trace,i+1);
        int chunkNumber = List_traces.size();
        if (chunkNumber >= 1)
        {
          Trace traceNeg=List_traces.get(chunkNumber-1);
          updateOccurrenceMatrix(traceNeg,false);
          for (Trace tracePos:List_traces)
            if (tracePos != traceNeg)
              updateOccurrenceMatrix(tracePos,true);
        }
View Full Code Here

    List<Trace> chunks=new ArrayList<Trace>();
       for(int f=0; f < t.size(); f++)
      {
         if(f < (t.size()-chunkLen+1))
         {
           Trace traceToMarkov=new Trace(t.getList().subList(f, f+chunkLen), true); // get trace from the path
           chunks.add(traceToMarkov);
         }
      }
       return chunks;
  }
View Full Code Here

            String line;
            while ((line = input.readLine()) != null) {
                // This assumes a format of [Trace] => [Coverage map]
                String[] toks = line.split("=>");

                Pair<Trace, Trace> index = new Pair<Trace, Trace>(new Trace(), new Trace(toks[0].trim()));
                String map = toks[1].trim();
                map = map.substring(1, map.length() - 1);

                CodeCoverageMap mapObject = new CodeCoverageMap();
                if (map.length() > 0) {
View Full Code Here

      String line;
      while ((line = input.readLine()) != null) {
        // This assumes a format of [Trace] => [Coverage map]
        String[] toks = line.split("=>");

        Pair<Trace, Trace> index = new Pair<Trace, Trace>(new Trace(),
            Trace.fromString(toks[0].trim()));
        String map = toks[1].trim();
        map = map.substring(1, map.length() - 1);

        CodeCoverageMap mapObject = new CodeCoverageMap();
View Full Code Here

   
    // going through all positive traces
    //and partitioning each positive traces into a list of events ( a list of labels based on the chunk length)
    for(List<Label> positive_trace:pos)
    {
      Trace current_positive_trace=new Trace(positive_trace, true);
      for(int i=onlyLongest?chunk_Length-1:0;i<chunk_Length;i++)
      {
        List<Trace> List_traces=splitTrace(current_positive_trace,i+1);
        for (Trace tracePos:List_traces)
          updateOccurrenceMatrix(tracePos,true);
      }
    }
   
    // from negative traces initialize the Markov matrix
    for(List<Label> negative_trace:neg)
    {
      for(int i=onlyLongest?chunk_Length-1:0; i<chunk_Length; i++)
      {
        Trace trace=new Trace(negative_trace,true);
        List<Trace> List_traces=splitTrace(trace,i+1);
        int chunkNumber = List_traces.size();
        if (chunkNumber >= 1)
        {
          Trace traceNeg=List_traces.get(chunkNumber-1);
          updateOccurrenceMatrix(traceNeg,false);
          for (Trace tracePos:List_traces)
            if (tracePos != traceNeg)
              updateOccurrenceMatrix(tracePos,true);
        }
View Full Code Here

    List<Trace> chunks=new ArrayList<Trace>();
       for(int f=0; f < t.size(); f++)
      {
         if(f < (t.size()-chunkLen+1))
         {
           Trace traceToMarkov=new Trace(t.getList().subList(f, f+chunkLen), true); // get trace from the path
           chunks.add(traceToMarkov);
         }
      }
       return chunks;
  }
View Full Code Here

      String line;
      while ((line = input.readLine()) != null) {
        // This assumes a format of [Trace] => [Coverage map]
        String[] toks = line.split("=>");

        Pair<Trace, Trace> index = new Pair<Trace, Trace>(new Trace(),
            Trace.fromString(toks[0].trim()));
        String map = toks[1].trim();
        map = map.substring(1, map.length() - 1);

        CodeCoverageMap mapObject = new CodeCoverageMap();
View Full Code Here

            previousPicked.setUserDatum(JUConstants.COLOUR, JUConstants.BLUE, UserData.CLONE);
            picked.setUserDatum(JUConstants.COLOUR, JUConstants.AMBER, UserData.CLONE);
            Vertex start = previousPicked;
            Vertex end = picked;
            Pair<Trace, Trace> tracePair = getPrefixSuffixPair(start, end);
            Trace startTrace = tracePair.firstElem;
            Trace endTrace = tracePair.secondElem;
            if ((startTrace == null) || (endTrace == null)) {
                System.out.println("No traces found for these endpoints");
            } else {
                lastTrace = startTrace.toString() + "-" + endTrace.toString();
                lastmap = getCoverageMap(startTrace, endTrace);
                System.out.println("Trace suffix coverage map: " + lastmap.toString());
            }
            previousSelected.add(previousPicked);previousSelected.add(picked);
            ErlangOracleVisualiser.previousPicked = null;
View Full Code Here

TOP

Related Classes of statechum.Trace

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.