Package statechum

Examples of statechum.Label


   * specific input.
   */
  protected Map<Label, Set<Label>> inputToPossibleOutputs = new TreeMap<Label, Set<Label>>();

  protected void updateInputToPossibleOutputs(Label label) {
    Label inputPortionOfLabel = stripOutput((ErlangLabel) label);
    Set<Label> outputsSeenForThisInput = inputToPossibleOutputs
        .get(inputPortionOfLabel);
    if (outputsSeenForThisInput == null) {
      outputsSeenForThisInput = new TreeSet<Label>();
      inputToPossibleOutputs.put(inputPortionOfLabel,
View Full Code Here


      // generate a collection of traces corresponding to failures
      response = new StringBuffer();
      // Erlang provides the failing element AS WELL!
      int prefixLen = outcome.answerDetails.length - 1;
      List<Label> prefix = question.subList(0, prefixLen);
      Label failedLabel = question.get(prefixLen);
      response.append("- [");
      boolean first = true;
      ErlangLabel noop = stripOutput((ErlangLabel) failedLabel);

      //assert noop.function != null : "questions do not contain function details";
View Full Code Here

      assert input instanceof ErlangLabel;
      ErlangState state = (ErlangState) currentState;

      // First of all, we check if we already have a wildcard-transition
      // recorded from this state,
      Label inputPortionOfLabel = stripOutput((ErlangLabel) input);
      if (state.rejects.contains(inputPortionOfLabel))
        return null;// failed

      // now normal input
      if (state.rejects.contains(input))
View Full Code Here

     * @param lbl label to intern.
     */
    @Override
    public synchronized Label convertLabelToLabel(Label label)
    {
      Label outcome = labelDatabase.get(label);
      if (outcome == null)
      {
        outcome = new StringLabelInt(label.toErlangTerm(), nextID++);labelDatabase.put(outcome,outcome);
      }
      return outcome;
View Full Code Here

    InitialConfigurationAndData initialConfigurationData = PairQualityLearner.loadInitialAndPopulateInitialConfiguration(PairQualityLearner.veryLargePTAFileName, configToLoadWith, labelConverter);
    LearnerGraph hugeGraph = new LearnerGraph(initialConfigurationData.initial.graph,mainConfiguration);LearnerGraph smallGraph = new LearnerGraph(initialConfigurationData.learnerInitConfiguration.graph,mainConfiguration);
   
    System.out.println("Huge: "+hugeGraph.getStateNumber()+" states, "+(hugeGraph.getStateNumber()-hugeGraph.getAcceptStateNumber())+" reject states");
    System.out.println("Small: "+smallGraph.getStateNumber()+" states, "+(smallGraph.getStateNumber()-smallGraph.getAcceptStateNumber())+" reject states");
    Label labelToMerge = AbstractLearnerGraph.generateNewLabel("Waypoint_Selected",mainConfiguration,converter);
    LearnerGraph mergedHuge = PairQualityLearner.mergeStatesForUnique(hugeGraph, labelToMerge);
    DifferentFSMException diffFSM = WMethod.checkM(smallGraph, mergedHuge);
    if (diffFSM != null)
      throw diffFSM;
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,converter);
      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,converter);
      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,converter);
      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 (source == null)
              throw new IllegalArgumentException("loadGraph: unknown source state");
            if (target == null)
              throw new IllegalArgumentException("loadGraph: unknown target state");
            Label label = AbstractLearnerGraph.generateNewLabel(nodeElement.getAttribute("EDGE"), result.config,conv);
            if (conv == null)
              result.addTransition(result.transitionMatrix.get(source),label,target);
            else
              //for(Label l:conv.convertLabel(label))
                result.addTransition(result.transitionMatrix.get(source),conv.convertLabelToLabel(label),target);
View Full Code Here

  }
 
  /** Given a string representation of a label, this one generates an instance of a specific label. */
  public static Label generateNewLabel(String label, Configuration config)
  {
    Label result = null;
    switch(config.getLabelKind())
    {
    case LABEL_STRING:
      result = new StringLabel(label);
      break;
View Full Code Here

   * this one generates an instance of a specific label.
   * Could be more elaborate than just a number: for Erlang, this could generated trees.
   */
  public static Label generateNewLabel(int number, Configuration config)
  {
    Label result = null;
    switch(config.getLabelKind())
    {
    case LABEL_STRING:
      result = new StringLabel(Integer.toString(number));
      break;
View Full Code Here

      vertexAlphabet.addAll(labels);
    }
    Set<Label> possibles = new TreeSet<Label>();
    possibles.addAll(alphabet);
    possibles.removeAll(vertexAlphabet);
    Label label = null;
    if(possibles.isEmpty())
      return false;// failure to add an edge since all possible letters of an alphabet have already been used
    Label possiblesArray [] = new Label[possibles.size()];possibles.toArray(possiblesArray);
    label = possiblesArray[randomInt(possiblesArray.length)];
    if (existingEdge != null)
    {// a parallel edge
      ((Set<Label>)existingEdge.getUserDatum(JUConstants.LABEL)).add(label);
    }
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.