Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangTuple.arity()


    }
    OtpErlangList trace = (OtpErlangList) result.elementAt(2);
    ErlangLabel[] answerDetails = new ErlangLabel[trace.arity()];
    for (int i = 0; i < trace.arity(); ++i) {
      OtpErlangTuple elemAti = (OtpErlangTuple) trace.elementAt(i);
      if (elemAti.arity() < 2 || elemAti.arity() > 3)
        throw new IllegalArgumentException("received tuple " + elemAti
            + " of invalid arity");
      if (elemAti.arity() == 3) {
        if (config.getUseErlangOutputs()) {
          answerDetails[i] = new ErlangLabel(
View Full Code Here


    }
    OtpErlangList trace = (OtpErlangList) result.elementAt(2);
    ErlangLabel[] answerDetails = new ErlangLabel[trace.arity()];
    for (int i = 0; i < trace.arity(); ++i) {
      OtpErlangTuple elemAti = (OtpErlangTuple) trace.elementAt(i);
      if (elemAti.arity() < 2 || elemAti.arity() > 3)
        throw new IllegalArgumentException("received tuple " + elemAti
            + " of invalid arity");
      if (elemAti.arity() == 3) {
        if (config.getUseErlangOutputs()) {
          answerDetails[i] = new ErlangLabel(
View Full Code Here

    for (int i = 0; i < trace.arity(); ++i) {
      OtpErlangTuple elemAti = (OtpErlangTuple) trace.elementAt(i);
      if (elemAti.arity() < 2 || elemAti.arity() > 3)
        throw new IllegalArgumentException("received tuple " + elemAti
            + " of invalid arity");
      if (elemAti.arity() == 3) {
        if (config.getUseErlangOutputs()) {
          answerDetails[i] = new ErlangLabel(
              questionDetails[i].function,
              questionDetails[i].callName,
              questionDetails[i].input, elemAti.elementAt(2));
View Full Code Here

     */
    public static ChangesToGraph load(OtpErlangObject obj)
    {
      ChangesToGraph recorder = new ChangesToGraph();
      OtpErlangTuple difference = (OtpErlangTuple)obj;
      if (difference.arity() != 7)
        throw new IllegalArgumentException("expected 7 components in diff");
      if (!((OtpErlangAtom)difference.elementAt(0)).atomValue().equals("statemachinedifference"))
        throw new IllegalArgumentException("first element of a record should be \"statemachinedifference\"");
      OtpErlangList addedTransitions = (OtpErlangList)difference.elementAt(1),removedTransitions = (OtpErlangList)difference.elementAt(2),addedStates = (OtpErlangList)difference.elementAt(3);
      OtpErlangAtom initial_state = (OtpErlangAtom)difference.elementAt(6);     
View Full Code Here

    {
      OtpErlangList listOfTraces = (OtpErlangList)traces;
      for(OtpErlangObject entryObj:listOfTraces)
      {
        OtpErlangTuple entry = (OtpErlangTuple)entryObj;
        if (entry.arity() != 2)
          throw new IllegalArgumentException("invalid trace: more than a pair of pos/neg and data");
       
        boolean positive = false;
        OtpErlangAtom traceType = (OtpErlangAtom)entry.elementAt(0);
        if (traceType.atomValue().equals("pos"))
View Full Code Here

    {
      OtpErlangList map = (OtpErlangList)obj;
      for(OtpErlangObject entry:map)
      {
        OtpErlangTuple entryTuple = (OtpErlangTuple)entry;
        if (entryTuple.arity() != 2)
          throw new IllegalArgumentException("invalid tuple "+entryTuple);
       
        String stateA = ((OtpErlangAtom)entryTuple.elementAt(0)).atomValue();if (stateA.isEmpty()) throw new IllegalArgumentException("empty first state name");
        String stateB = ((OtpErlangAtom)entryTuple.elementAt(1)).atomValue();if (stateB.isEmpty()) throw new IllegalArgumentException("empty second state name");
        outcome.put(VertexID.parseID( stateA ),VertexID.parseID( stateB ) );
View Full Code Here

//    1    states :: list(state()),
//    2    transitions :: list(transition()),
//    3    initial_state :: state(),
//    4    alphabet :: list(event())
      OtpErlangTuple machine = (OtpErlangTuple)obj;
      if (machine.arity() != 5)
        throw new IllegalArgumentException("expected 5 components in FSM");
      if (!((OtpErlangAtom)machine.elementAt(0)).atomValue().equals("statemachine"))
        throw new IllegalArgumentException("first element of a record should be \"statemachine\"");
      OtpErlangList states = (OtpErlangList)machine.elementAt(1),transitions = (OtpErlangList)machine.elementAt(2),alphabet = (OtpErlangList)machine.elementAt(4);
      OtpErlangAtom initial_state = (OtpErlangAtom)machine.elementAt(3);
View Full Code Here

        objectToLabel.put(l,AbstractLearnerGraph.generateNewLabel( label,gr.config,converter));
      }
      for(OtpErlangObject transitionObj:transitions)
      {
        OtpErlangTuple transition = (OtpErlangTuple) transitionObj;
        if (transition.arity() != 3)
          throw new IllegalArgumentException("expected 3 components in transition "+transition);
        OtpErlangAtom from = (OtpErlangAtom)transition.elementAt(0),label = (OtpErlangAtom)transition.elementAt(1),to = (OtpErlangAtom)transition.elementAt(2);
        CmpVertex fromState = gr.findVertex(VertexID.parseID(from.atomValue())), toState = gr.findVertex(VertexID.parseID(to.atomValue()));
        if (fromState == null)
          if (!checkStates)
View Full Code Here

      for(OtpErlangObject obj:list.elements())
      {
        if (!(obj instanceof OtpErlangTuple))
          throw new IllegalArgumentException("element of a list should be a tuple");
        OtpErlangTuple t=(OtpErlangTuple)obj;
        if (t.arity() != 2)
          throw new IllegalArgumentException("tuple should contain exactly two elements");
       
        if (!(t.elementAt(0) instanceof OtpErlangAtom))
          throw new IllegalArgumentException("type name should be an atom");
        if (!(t.elementAt(1) instanceof OtpErlangTuple))
View Full Code Here

        {
            OtpErlangObject msg=mbox.receive();
            if (!(msg instanceof OtpErlangTuple))
              System.out.println("invalid message received by worker, expected tuple, got "+msg);
            final OtpErlangTuple message = (OtpErlangTuple)msg;
            if (message.arity() < 2)
              System.out.println("invalid tuple received by worker, expected at least two elements, got "+msg);
           
            if (!(message.elementAt(1) instanceof OtpErlangAtom))
              System.out.println("invalid request received by worker, expected an atom, got "+message.elementAt(1));
            OtpErlangAtom command = (OtpErlangAtom) message.elementAt(1);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.