Package statechum.analysis.Erlang.Signatures

Examples of statechum.analysis.Erlang.Signatures.FuncSignature


   
    Iterator<Label> lblIter = gr.pathroutines.computeAlphabet().iterator();
    ErlangLabel lbl1 = (ErlangLabel)lblIter.next(),lbl2 = (ErlangLabel)lblIter.next();
   
    // now mess up the name of the function,
    FuncSignature fun2 = mod.sigs.get(lbl2.callName);
    mod.sigs.put(lbl1.callName,fun2);// mess up behaviour
    final LearnerGraph outcome = new LearnerGraph(gr.config);
    checkForCorrectException(new whatToRun() { public @Override void run() {
      AbstractLearnerGraph.interpretLabelsOnGraph(gr,outcome,mod.behaviour.new ConverterErlToMod());
    }},IllegalArgumentException.class,"label already has a function assigned");
View Full Code Here


   
    Iterator<Label> lblIter = gr.pathroutines.computeAlphabet().iterator();
    ErlangLabel lbl1 = (ErlangLabel)lblIter.next(),lbl2 = (ErlangLabel)lblIter.next();
   
    // now mess up the name of the function,
    FuncSignature fun2 = mod.sigs.get(lbl2.callName);
    mod.sigs.put(lbl1.callName,fun2);// mess up behaviour
    final LearnerGraph outcome = new LearnerGraph(gr.config);
    checkForCorrectException(new whatToRun() { public @Override void run() {
      AbstractLearnerGraph.interpretLabelsOnGraph(gr,outcome,mod.behaviour.new ConverterErlToMod());
    }},IllegalArgumentException.class,"label already has a function assigned");
View Full Code Here

    for (int i = 0; i < typeInformation.arity(); ++i) {
      //System.out.print("\n" + typeInformation.elementAt(i).toString());
      OtpErlangTuple functionDescr = (OtpErlangTuple) typeInformation.elementAt(i);
      if (functionDescr.arity() > 3)
      {
        FuncSignature s = new FuncSignature(config,typeInformation.elementAt(i), null);
        sigs.put(s.getQualifiedName(), s);
      }
      else
      {// if not a function signature, it is an error message. The first two elements are function name and arity, we add this module name.
        String fullName = FuncSignature.qualifiedNameFromFunction(getName(),
            ((OtpErlangAtom)functionDescr.elementAt(0)).atomValue(),
View Full Code Here

      ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(file));
      Assert.assertTrue(mod.behaviour instanceof OTPGenServerBehaviour);
      Assert.assertTrue(mod.behaviour.dependencies.isEmpty());
      for(FuncSignature s:mod.sigs.values())
      {
           FuncSignature newSig = new FuncSignature(defaultConfig, ErlangLabel.parseText(s.toErlangTerm()),null);
           Assert.assertEquals(s, newSig);
           Assert.assertEquals(s, new FuncSignature(defaultConfig, ErlangLabel.parseText(newSig.toErlangTerm()),null));
      }
    }
View Full Code Here

      ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(file));
      Assert.assertTrue(mod.behaviour instanceof OTPGenServerBehaviour);
      Assert.assertTrue(mod.behaviour.dependencies.isEmpty());
      for(FuncSignature s:mod.sigs.values())
      {
           FuncSignature newSig = new FuncSignature(defaultConfig, ErlangLabel.parseText(s.toErlangTerm()),null);
           Assert.assertEquals(s, newSig);
           Assert.assertEquals(s, new FuncSignature(defaultConfig, ErlangLabel.parseText(newSig.toErlangTerm()),null));
      }
    }
View Full Code Here

        } else {
          String otpName = pattern.getValue().getOtpName();
          if (parent.sigs.containsKey(otpName))
            throw new IllegalArgumentException("there is already a function defined with name "
                + otpName + " in module " + parent.getName());
          FuncSignature
            origFunction = parent.sigs.get(pattern.getKey()),
            otpFunction = new FuncSignature(config, ErlangLabel.parseText(origFunction.toErlangTerm()),
                pattern.getValue());

          parent.sigs.put(otpName, otpFunction);
          addFunctionToAlphabet(otpName, otpFunction, config);
        }
View Full Code Here

  public ErlangLabel convertErlToMod(Label lbl) {
    if (!(lbl instanceof ErlangLabel))
      throw new IllegalArgumentException("cannot convert non-erlang labels");
    ErlangLabel label = (ErlangLabel) lbl;

    FuncSignature origFunc = parent.sigs.get(label.callName);
    if (origFunc == null)
      throw new IllegalArgumentException("unknown function \"" + label.callName + "\" in module "
          + parent.getName());

    // At this point, we know which function should correspond to this label,
    // it is worth checking whether the function already associated with the label
    // is the correct function,
    if (label.function != null) {
      if (!label.function.toErlangTerm().equals(origFunc.toErlangTerm()))
        throw new IllegalArgumentException(
            "label already has a function assigned and it is a different function, " + "was : "
                + label.function + ", now: " + origFunc);
    }
    return new ErlangLabel(origFunc, label.callName, label.input, label.expectedOutput);
View Full Code Here

   * because all function take single arguments.
   */
  public abstract List<OtpErlangObject> functionArgumentsToListOfArgs(OtpErlangObject arg);

  public List<List<OtpErlangObject>> getInitArgs() {
    FuncSignature init = parent.sigs.get(parent.getName() + ":init/1");
    if(init != null) {
      return init.instantiateAllArgs();
    } else {
      return new LinkedList<List<OtpErlangObject>>();
    }
  }
View Full Code Here

        } else {
          String otpName = pattern.getValue().getOtpName();
          if (parent.sigs.containsKey(otpName))
            throw new IllegalArgumentException("there is already a function defined with name "
                + otpName + " in module " + parent.getName());
          FuncSignature
            origFunction = parent.sigs.get(pattern.getKey()),
            otpFunction = new FuncSignature(config, ErlangLabel.parseText(origFunction.toErlangTerm()),
                pattern.getValue());

          parent.sigs.put(otpName, otpFunction);
          addFunctionToAlphabet(otpName, otpFunction, config);
        }
View Full Code Here

  public ErlangLabel convertErlToMod(Label lbl) {
    if (!(lbl instanceof ErlangLabel))
      throw new IllegalArgumentException("cannot convert non-erlang labels");
    ErlangLabel label = (ErlangLabel) lbl;

    FuncSignature origFunc = parent.sigs.get(label.callName);
    if (origFunc == null)
      throw new IllegalArgumentException("unknown function \"" + label.callName + "\" in module "
          + parent.getName());

    // At this point, we know which function should correspond to this label,
    // it is worth checking whether the function already associated with the label
    // is the correct function,
    if (label.function != null) {
      if (!label.function.toErlangTerm().equals(origFunc.toErlangTerm()))
        throw new IllegalArgumentException(
            "label already has a function assigned and it is a different function, " + "was : "
                + label.function + ", now: " + origFunc);
    }
    return new ErlangLabel(origFunc, label.callName, label.input, label.expectedOutput);
View Full Code Here

TOP

Related Classes of statechum.analysis.Erlang.Signatures.FuncSignature

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.