Package com.ericsson.otp.erlang

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


  public OtpErlangList listProcesses() {
    OtpErlangList outcome = null;
    OtpErlangTuple tup = call(new OtpErlangObject[] { new OtpErlangAtom(
        "processes") }, "Failed to get process list.");
    if ((tup.arity() == 2) && (tup.elementAt(0).equals(okAtom))) {
      outcome = (OtpErlangList) tup.elementAt(1);
    } else
      throw new RuntimeException("Er, why did I get this?: "
          + tup.elementAt(0) + "(" + tup.arity() + ")");
   
View Full Code Here


        "processes") }, "Failed to get process list.");
    if ((tup.arity() == 2) && (tup.elementAt(0).equals(okAtom))) {
      outcome = (OtpErlangList) tup.elementAt(1);
    } else
      throw new RuntimeException("Er, why did I get this?: "
          + tup.elementAt(0) + "(" + tup.arity() + ")");
   
    return outcome;
  }

  public OtpErlangTuple killProcesses() {
View Full Code Here

    OtpErlangTuple fileDetails = (OtpErlangTuple) analysisResults.elementAt(0);
    OtpErlangList typeInformation = (OtpErlangList) fileDetails.elementAt(3);
    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
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

  public boolean typeCompatible(OtpErlangObject term)
  {
    if (!(term instanceof OtpErlangTuple)) return false;
    OtpErlangTuple tuple = (OtpErlangTuple)term;
   
    if (tuple.arity() != elems.size()) return false;
   
    Iterator<Signature> sigIterator = elems.iterator();
    for(int i=0;i<elems.size();++i)
    {
      Signature sig = sigIterator.next();
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.