Package statechum

Examples of statechum.Label


       return trace;
    
     List<Label> outcome = new LinkedList<Label>();
     for(Label l:trace)
     {
       Label interned = alphabet.get(l);
       if (interned == null)
       {
         alphabet.put(l,l);interned = l;
       }
       outcome.add(interned);
View Full Code Here


              if (positive)
              {// The last element should be the same as the starting element in the positive trace, if there is one.
                int traceLen = trace.size();
                if (traceLen < 2)
                  throw new IllegalArgumentException("traces are expected to loop in the initial state, hence they should contain at least two elements");
                Label lastElement = trace.get(traceLen-1);
                if (!lastElement.equals(trace.get(0)))
                  throw new IllegalArgumentException("the last element of each positive trace is not the same as the starting element of a the same trace for trace "+trace);
                if (!lastPositiveTrace.isEmpty() && !lastPositiveTrace.get(0).equals(lastElement))
                  throw new IllegalArgumentException("the first element of the last positive trace ("+lastPositiveTrace.get(0)+") is not the same as the starting element of the current trace "+trace);
               
                lastPositiveTrace.addAll(trace.subList(0, traceLen-1));// we do not append it to a collection of traces here because it will be done when we hit a new frame
View Full Code Here

   */
  public LearnerGraph augmentPTA(List<Label> sequence, boolean accepted, boolean maximalAutomaton, JUConstants newColour)
  {
    CmpVertex currentState = coregraph.getInit(), prevState = null;
    Iterator<Label> inputIt = sequence.iterator();
    Label lastInput = null;
    int position = 0;
    while(inputIt.hasNext() && currentState != null)
    {
      if (!currentState.isAccept())
      {// not the last state and the already-reached state is not accept, while all prefixes of reject sequences should be accept ones.
View Full Code Here

        // which is used by the merging algorithm and dumping the results.
        CmpVertex v = pair.getR();
        Iterator<Label> seqIt = seq.iterator();
        while(seqIt.hasNext() && v != null)
        {
          Label input = seqIt.next();
          System.out.print(v.toString()+" "+original.transitionMatrix.get(v).keySet()+" input "+input+" ");
          List<CmpVertex> extra = mergedVertices.get(v);
          if (extra != null)
            for(CmpVertex ev:extra)
              System.out.print(" "+ev.toString()+" : "+original.transitionMatrix.get(ev).keySet());
          System.out.println();
          CmpVertex newV = original.transitionMatrix.get(v).get(input);
          if (newV != null) v=newV;
          else v=original.pairscores.findNextRed(mergedVertices,v,input);
        }
        System.out.println("final state is "+v);

        v=pair.getR();
        seqIt = seq.iterator();
        while(seqIt.hasNext() && v != null)
        {
          Label input = seqIt.next();
          System.out.println(v.toString()+" "+mergeResult.transitionMatrix.get(v).keySet()+" input "+input+" ");
          v = mergeResult.transitionMatrix.get(v).get(input);
        }
        System.out.println("final state is "+v);
       
View Full Code Here

    {
      rowsProcessed.add(entry.getKey());
      for(Entry<CmpVertex,PAIRCOMPATIBILITY> associations:entry.getValue().entrySet())
        if (!rowsProcessed.contains(associations.getKey()))
        {
          Label label = new StringLabel(associationPrefix+associations.getValue().name());
          if (alphabet.contains(label))
            throw new IllegalArgumentException("cannot use label "+label);

          result.addTransition(result.transitionMatrix.get(entry.getKey()), label, associations.getKey());
          result.addTransition(result.transitionMatrix.get(associations.getKey()), label, entry.getKey());
View Full Code Here

   * @param config determines which label to generate.
   * @param conv converter to intern labels, ignored if null.
   */
  public static Label generateNewLabel(String label, Configuration config, ConvertALabel conv)
  {
    Label result = null;
    switch(config.getLabelKind())
    {
    case LABEL_STRING:
      result = new StringLabel(label);
      break;
View Full Code Here

   * Could be more elaborate than just a number: for Erlang, this could generated trees. In addition, this one does not
   * really assign numbers to labels, hence the outcome cannot be used where {@link ConvertibleToInt#toInt()} is used.
   */
  public static Label generateNewLabel(int number, Configuration config, ConvertALabel conv)
  {
    Label result = null;
    switch(config.getLabelKind())
    {
    case LABEL_STRING:
      result = new StringLabel("L"+Integer.toString(number));// this is necessary if I subsequently choose to use these labels in regular expressions, in which case I would not know whether "1" means "anything" or "label 1".
      break;
View Full Code Here

    lbls.parseLabel("A"+" "+SmtLabelRepresentation.OP_DATA.POST.name()+"     details of postcondition     of A     ");
    lbls.parseLabel("B"+" "+SmtLabelRepresentation.OP_DATA.PRE.name()+" value of precondition of B ");
    Assert.assertEquals(3,lbls.labelMapConstructionOfOperations.size());

    {
      Label initmem = AbstractLearnerGraph.generateNewLabel(INITMEM, config);
      SMTLabel l = lbls.labelMapConstructionOfOperations.get(initmem);
      Assert.assertEquals(initmem,l.getName());
      Assert.assertNull(l.post.text);
      Assert.assertEquals("varDecl",l.pre.text);
    }

    {
      Label labelA = AbstractLearnerGraph.generateNewLabel("A", config);
      SMTLabel l = lbls.labelMapConstructionOfOperations.get(labelA);
      Assert.assertEquals(labelA,l.getName());
      Assert.assertNull(l.pre.text);
      Assert.assertEquals("postA and more\ndetails of postcondition of A",l.post.text);
    }

    {
      Label labelB = AbstractLearnerGraph.generateNewLabel("B", config);
      SMTLabel l = lbls.labelMapConstructionOfOperations.get(labelB);
      Assert.assertEquals(labelB,l.getName());
      Assert.assertNull(l.post.text);
      Assert.assertEquals("value of precondition of B",l.pre.text);
    }
View Full Code Here

   
    if (stringLabel.equals("1"))
      result.addAll(alphabet);
    else
    {
      Label label=AbstractLearnerGraph.generateNewLabel(stringLabel,config);
      if (!alphabet.contains(label))
        throw new IllegalArgumentException("unrecognised label "+stringLabel);
      result.add(label);
    }
    return result;
View Full Code Here

    if (!tokenizer.hasMoreTokens()) return;// ignore empty input
    String labelNameToken = tokenizer.nextToken();
    String labelNameString = appendToString(labelNameToken, null);
    if (labelNameString == null)
      throw new IllegalArgumentException("invalid label name "+labelNameToken);
    Label labelName = AbstractLearnerGraph.generateNewLabel(labelNameString, config);
   
    if (!tokenizer.hasMoreTokens()) throw new IllegalArgumentException("expected details for label "+labelName);
    OP_DATA kind = null;String prepost = tokenizer.nextToken();
    try
    {
View Full Code Here

TOP

Related Classes of statechum.Label

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.