Package statechum.analysis.Erlang

Examples of statechum.analysis.Erlang.ErlangModule


      if (f.getName().endsWith(".erl")) {
        // load the module
        try {
          System.out.println("Loading " + f.getName());
          Configuration config = Configuration.getDefaultConfiguration().copy();ErlangModule.setupErlangConfiguration(config,f);
          ErlangModule mod = ErlangModule.loadModule(config);
          DirectedSparseVertex myVertex = getVertex(mod.name);
          myVertex.setUserDatum(JUConstants.COLOUR, JUConstants.RED, UserData.SHARED);

          for (String d : mod.behaviour.getDependencies()) {
            DirectedSparseVertex v = getVertex(d);
View Full Code Here


  public void testLearningFromErlangTraceFile2() throws IOException
  {
    ErlangModule.setupErlangConfiguration(config,new File(lockerFile));
        config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);
        config.setErlangCompileIntoBeamDirectory(true);
    ErlangModule mod = ErlangModule.loadModule(config);
    Set<ErlangLabel> alphabetA = new TreeSet<ErlangLabel>();alphabetA.addAll(mod.behaviour.getAlphabet());
    ErlangModule.flushRegistry();

    ErlangModule.setupErlangConfiguration(config,new File(lockerFile));
    config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);config.setErlangCompileIntoBeamDirectory(true);
    ErlangModule modSame = ErlangModule.loadModule(config);
    Assert.assertTrue(alphabetA.equals(modSame.behaviour.getAlphabet()));// check that the same alphabet will be loaded second time.
    ErlangModule.flushRegistry();
   
    createLogFileFromExistingLog("earlier_failure2.txt");
    ErlangOracleLearner learner = ErlangQSMOracle.createLearner(null,modifiedLogFile);
View Full Code Here

    ErlangModule.setupErlangConfiguration(learnerConfig.config,new File(ErlangExamples+"/frequency/frequencyBroken.erl"));
    learnerConfig.config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);learnerConfig.config.setTransitionMatrixImplType(STATETREE.STATETREE_SLOWTREE);
    learnerConfig.config.setErlangInitialTraceLength(3);
    learnerConfig.config.setErlangStripModuleNamesFromFunctionsInNonGenModules(true);
   
    ErlangModule mod = ErlangModule.loadModule(learnerConfig.config);
    OtpErlangTuple startFunType=mod.sigTypes.get("frequencyBroken:start/0");
    Map<String,OtpErlangTuple> override = new TreeMap<String,OtpErlangTuple>();
    override.put("frequencyBroken:start/0", new OtpErlangTuple(new OtpErlangObject[]{startFunType.elementAt(0),startFunType.elementAt(1),startFunType.elementAt(2),startFunType.elementAt(3),
        ErlangLabel.parseText("{'Func',[],[],{'Any',[]}}")}));
    mod.rebuildSigs(learnerConfig.config, override);
    mod.behaviour.generateAlphabet(config);
    ErlangOracleLearner learner = new ErlangOracleLearner(null,learnerConfig);
    LearnerGraph frequencyE = new LearnerGraph(learnerConfig.config);
    learner.init(learner.GenerateInitialTraces(learnerConfig.config.getErlangInitialTraceLength()),0,0);
   
View Full Code Here

   * @param traces traces to convert
   * @return outcome of conversion
   */
  public static Set<List<Label>> convertTracesToErl(Set<List<Label>> traces, Configuration config)
  {
    ErlangModule mod = ErlangModule.findModule(config.getErlangModuleName());
    Set<List<Label>> convertedTraces = null;
    ConvertALabel converter = mod.behaviour.new ConverterErlToMod();
    convertedTraces = new HashSet<List<Label>>();
    for(List<Label> list:traces) convertedTraces.add(OTPBehaviour.convertTrace(list, converter));
    return convertedTraces;
View Full Code Here

                if (ErlangRunner.validName(f.getName()))
                    ErlangRunner.compileErl(f,ErlangRunner.getRunner());

            for (Object s : modules.getSelectedValues())
            {
                ErlangModule m = (ErlangModule) s;
                // Create an Erlang QSM jobby for the selected behaviours...
                ErlangOracleRunner runner = new ErlangOracleRunner(m, app.modules);
                Thread t = new Thread(runner);t.setPriority(Thread.MIN_PRIORITY);
                t.start();
            }
View Full Code Here

       * ErlangRunner.getRunner());
       */
      for (Object s : app.modules) {
        try {
          // Load the module
          ErlangModule m = (ErlangModule) s;

          int len = Integer.parseInt(lenField.getText());
          boolean exhaustAlphabet = exhaustAlphabetBox.isSelected();
          boolean useOutputMatching = outputMatchingBox.isSelected();
          EXPANSIONOFANY expansion = ((InnerAlphabetModel)anyAlphabet.getModel()).getSelectedExpansion();
View Full Code Here

   * @param traces traces to convert
   * @return outcome of conversion
   */
  public static Set<List<Label>> convertTracesToErl(Set<List<Label>> traces, Configuration config)
  {
    ErlangModule mod = ErlangModule.findModule(config.getErlangModuleName());
    Set<List<Label>> convertedTraces = null;
    ConvertALabel converter = mod.behaviour.new ConverterErlToMod();
    convertedTraces = new HashSet<List<Label>>();
    for(List<Label> list:traces) convertedTraces.add(OTPBehaviour.convertTrace(list, converter));
    return convertedTraces;
View Full Code Here

  /* The two arguments to this one are the graph to load and the .erl source of the module it corresponds to. The graphs should be saved via the "save" entry in the pop-up menu of ErlangOracleVisualiser. */
  public static void main(String[] args) throws IOException
  {
    File file = new File(args[1]);
    Configuration cnf = Configuration.getDefaultConfiguration().copy();ErlangModule.setupErlangConfiguration(cnf,file);
    ErlangModule mod = ErlangModule.loadModule(cnf);

    LearnerGraphND grOrig = new LearnerGraphND(cnf);
    AbstractPersistence.loadGraph(args[0], grOrig,null);

    final LearnerGraph erlangGraph = new LearnerGraph(grOrig.config);
View Full Code Here

   * @param traces traces to convert
   * @return outcome of conversion
   */
  public static Set<List<Label>> convertTracesToErl(Set<List<Label>> traces, Configuration config)
  {
    ErlangModule mod = ErlangModule.findModule(config.getErlangModuleName());
    Set<List<Label>> convertedTraces = null;
    ConvertALabel converter = mod.behaviour.new ConverterErlToMod();
    convertedTraces = new HashSet<List<Label>>();
    for(List<Label> list:traces) convertedTraces.add(OTPBehaviour.convertTrace(list, converter));
    return convertedTraces;
View Full Code Here

    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");
    wr.write("handle_call("+1+",_,_)->{reply,ok,5};\n");
    wr.write("handle_call("+256+",_,_)->{reply,ok,5}.\n");
    wr.write(otherMethods);wr.close();
    ErlangModule.setupErlangConfiguration(config,new File(erlangFile));
    ErlangModule mod = ErlangModule.loadModule(config);
/*    OtpErlangObject funcDescr = ErlangLabel.parseText(mod.sigs.get("call").toErlangTerm().replace("boundaries", "positive"));
    System.out.println(funcDescr);*/
    mod.sigs.put("funcPositive", new FuncSignature(defaultConfig,
        ErlangLabel.parseText("{\"testFile.erl\",3,handle_call,1,"+
        "{'Func',[],[{'Int',[positive]}],{'Atom',[],[ok]}}}"),
View Full Code Here

TOP

Related Classes of statechum.analysis.Erlang.ErlangModule

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.