Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangInt


          partA = partA.substring(1);
        long outcome = Long.parseLong(partA);
        if (outcome > Integer.MAX_VALUE || outcome < Integer.MIN_VALUE)
          result = new OtpErlangLong(outcome);
        else
          result = new OtpErlangInt((int) outcome);
      } else {// floating - point number.
        String textToParse = partA + "."
            + (partB == null ? "0" : partB)
            + (partExp == null ? "" : ("e" + partExp));
        if (partExp != null) {
View Full Code Here


      return singleton;
    }

    @Override
    public void dump(OtpErlangObject arg, StringBuffer resultHolder) {
      OtpErlangInt longValue = (OtpErlangInt) arg;
      resultHolder.append(longValue.longValue());
    }
View Full Code Here

      // The above loads a module, this one gets that module and subsequently updates its alphabet.
      ErlangModule mod = ErlangModule.findModule(evalConf.config.getErlangModuleName());
     
      final ErlangLabel initLabel = mod.behaviour.convertErlToMod(AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",'init','AnyWibble','ok'}", evalConf.config,evalConf.getLabelConverter())),
      labelLock = mod.behaviour.convertErlToMod(AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",'call','lock',{'ok','locked'}}", evalConf.config,evalConf.getLabelConverter()));
    final ErlangLabel labelInvalidRead = new ErlangLabel(labelLock.function,labelLock.callName,labelLock.input,new OtpErlangInt(88));
    statechum.Helper.checkForCorrectException(new statechum.Helper.whatToRun() {
      public @Override void run() {
        learner.askErlang(Arrays.asList(new Label[]{initLabel,labelLock,labelInvalidRead}));
      }},IllegalArgumentException.class,"does not belong");
    }
View Full Code Here

      // The above loads a module, this one gets that module and subsequently updates its alphabet.
      ErlangModule mod = ErlangModule.findModule(evalConf.config.getErlangModuleName());
     
      final ErlangLabel initLabel = mod.behaviour.convertErlToMod(AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",'init','AnyWibble','ok'}", evalConf.config,evalConf.getLabelConverter())),
      labelLock = mod.behaviour.convertErlToMod(AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",'call','lock',{'ok','locked'}}", evalConf.config,evalConf.getLabelConverter()));
    final ErlangLabel labelInvalidRead = new ErlangLabel(labelLock.function,labelLock.callName,labelLock.input,new OtpErlangInt(88));
    statechum.Helper.checkForCorrectException(new statechum.Helper.whatToRun() {
      public @Override void run() {
        learner.askErlang(Arrays.asList(new Label[]{initLabel,labelLock,labelInvalidRead}));
      }},IllegalArgumentException.class,"does not belong");
    }
View Full Code Here

   
    List<OtpErlangObject> result = new ArrayList<OtpErlangObject>();
    switch(config.getErlangAlphabetAnyElements())
    {
    case ANY_INT:
      result.add(new OtpErlangInt(10));
      result.add(new OtpErlangInt(11));
      result.add(new OtpErlangInt(12));
      break;
    case ANY_WIBBLE:
      result.add(new OtpErlangAtom("AnyWibble"));
      break;
    case ANY_WITHLIST:
View Full Code Here

            value = new OtpErlangDouble(
                ((Double) outcome).doubleValue());
          else if (outcome.getClass().equals(String.class))
            value = new OtpErlangAtom((String) outcome);
          else if (outcome.getClass().equals(Integer.class))
            value = new OtpErlangInt(((Integer) outcome).intValue());
          else if (outcome.getClass().equals(Long.class))
            value = new OtpErlangLong(((Long) outcome).longValue());
          else
            value = new OtpErlangAtom(outcome.toString());
View Full Code Here

          partA = partA.substring(1);
        long outcome = Long.parseLong(partA);
        if (outcome > Integer.MAX_VALUE || outcome < Integer.MIN_VALUE)
          result = new OtpErlangLong(outcome);
        else
          result = new OtpErlangInt((int) outcome);
      } else {// floating - point number.
        String textToParse = partA + "."
            + (partB == null ? "0" : partB)
            + (partExp == null ? "" : ("e" + partExp));
        if (partExp != null) {
View Full Code Here

      return singleton;
    }

    @Override
    public void dump(OtpErlangObject arg, StringBuffer resultHolder) {
      OtpErlangInt longValue = (OtpErlangInt) arg;
      resultHolder.append(longValue.longValue());
    }
View Full Code Here

      // The above loads a module, this one gets that module and subsequently updates its alphabet.
      ErlangModule mod = ErlangModule.findModule(evalConf.config.getErlangModuleName());
     
      final ErlangLabel initLabel = mod.behaviour.convertErlToMod(AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",'init','AnyWibble','ok'}", evalConf.config)),
      labelLock = mod.behaviour.convertErlToMod(AbstractLearnerGraph.generateNewLabel("{"+ErlangLabel.missingFunction+",'call','lock',{'ok','locked'}}", evalConf.config));
    final ErlangLabel labelInvalidRead = new ErlangLabel(labelLock.function,labelLock.callName,labelLock.input,new OtpErlangInt(88));
    statechum.Helper.checkForCorrectException(new statechum.Helper.whatToRun() {
      public @Override void run() {
        learner.askErlang(Arrays.asList(new Label[]{initLabel,labelLock,labelInvalidRead}));
      }},IllegalArgumentException.class,"does not belong");
    }
View Full Code Here

      ErlangRunner r = runners[runnerNumber];
      if (rnd.nextInt(100) > 1)
      {
        int numA = rnd.nextInt(10000)-5000, numB=rnd.nextInt(10000)-5000;
        OtpErlangTuple response = (OtpErlangTuple)r.call(new OtpErlangObject[]{new OtpErlangAtom("echo"),
            new OtpErlangList(new OtpErlangObject[]{ new OtpErlangAtom(dataHead), new OtpErlangInt(numA), new OtpErlangInt(numB),new OtpErlangAtom(dataC)})},
            0);

        Assert.assertEquals(dataHead,((OtpErlangAtom)response.elementAt(0)).atomValue());
        Assert.assertEquals(processNames[runnerNumber],((OtpErlangAtom)response.elementAt(1)).atomValue());
        OtpErlangObject [] list = ((OtpErlangList)response.elementAt(2)).elements();
View Full Code Here

TOP

Related Classes of com.ericsson.otp.erlang.OtpErlangInt

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.