Package com.ericsson.otp.erlang

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


      try {
        OtpErlangObject msg=thisMbox.receive();
        if (!(msg instanceof OtpErlangTuple))
          System.out.println("invalid message received, expected tuple, got "+msg);
        OtpErlangTuple message = (OtpErlangTuple)msg;
        if (message.arity() != 3)
          System.out.println("invalid tuple received, expected three elements, got "+msg);
       
        if (!(message.elementAt(2) instanceof OtpErlangAtom))
          System.out.println("invalid request received, expected an atom, got "+message.elementAt(2));
        OtpErlangAtom command = (OtpErlangAtom) message.elementAt(2);
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

            {
              //System.out.println("worker terminated");
              break;
            }
            else
              if (command.equals(msgUpdateConfiguration) && message.arity() == 3)
              {
                String outcome = ErlangRunner.updateConfiguration(learnerInitConfiguration.config, message.elementAt(2));
                if (outcome == null)
                  mbox.send(erlangPartner,new OtpErlangTuple(new OtpErlangObject[]{ref,msgOk}));
                else
View Full Code Here

                  mbox.send(erlangPartner,new OtpErlangTuple(new OtpErlangObject[]{ref,msgOk}));
                else
                  mbox.send(erlangPartner,new OtpErlangTuple(new OtpErlangObject[]{ref,msgFailure,new OtpErlangList(outcome)}));// report an error.
              }
              else
                if (command.equals(msgLine) && message.arity() == 3)
                {
                  process(message.elementAt(2).toString());
                }
                else
                  if (command.equals(msgTraces) && message.arity() == 3)
View Full Code Here

                if (command.equals(msgLine) && message.arity() == 3)
                {
                  process(message.elementAt(2).toString());
                }
                else
                  if (command.equals(msgTraces) && message.arity() == 3)
                  {
                    OtpErlangObject outcome = new OtpErlangTuple(new OtpErlangObject[]{ref,msgOk});
                    try
                    {
                      parseTraces(message.elementAt(2));
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.