Package com.ericsson.otp.erlang

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


            {
              //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

      name = nameTag.atomValue();
        fields = new TreeMap<String, Signature>();
        for(OtpErlangObject obj:fieldDetails)
        {
          OtpErlangTuple nameValue = (OtpErlangTuple)obj;
          if (nameValue.arity() != 2) throw new IllegalArgumentException("Invalid name-type field "+obj+" passed to RecordSignature");
          Signature sig = Signature.buildFromType(config, nameValue.elementAt(1));
          orderedSignatures.add(sig);
          fields.put(((OtpErlangAtom)nameValue.elementAt(0)).atomValue(),sig);
        }
        erlangTermForThisType = erlangTypeToString(attributes,fieldDetails);
View Full Code Here

  public boolean typeCompatible(OtpErlangObject term)
  {
    if (!(term instanceof OtpErlangTuple)) return false;
    OtpErlangTuple tuple = (OtpErlangTuple)term;
   
    if (tuple.arity() != orderedSignatures.size()) return false;
   
    Iterator<Signature> sigIterator = orderedSignatures.iterator();
    for(int i=0;i<orderedSignatures.size();++i)
      if (!sigIterator.next().typeCompatible(tuple.elementAt(i)))
        return false;
View Full Code Here

   * @param value scores reported by GD.
   */
  public void check(String name, OtpErlangTuple value)
  {
    OtpErlangTuple knownScores = scoresMap.get(name);Assert.assertNotNull("unknown entry "+name,knownScores);
    Assert.assertEquals(knownScores.arity(),value.arity());
    for(int i=0;i<knownScores.arity();++i)
    {
      OtpErlangList listA=(OtpErlangList)knownScores.elementAt(i), listB= (OtpErlangList)value.elementAt(i);
      Assert.assertEquals(listA.arity(),listB.arity());
      for(int elem=0;elem<listA.arity();++elem)
View Full Code Here

   */
  public void check(String name, OtpErlangTuple value)
  {
    OtpErlangTuple knownScores = scoresMap.get(name);Assert.assertNotNull("unknown entry "+name,knownScores);
    Assert.assertEquals(knownScores.arity(),value.arity());
    for(int i=0;i<knownScores.arity();++i)
    {
      OtpErlangList listA=(OtpErlangList)knownScores.elementAt(i), listB= (OtpErlangList)value.elementAt(i);
      Assert.assertEquals(listA.arity(),listB.arity());
      for(int elem=0;elem<listA.arity();++elem)
        Assert.assertEquals(((OtpErlangDouble)listA.elementAt(elem)).doubleValue(),((OtpErlangDouble)listB.elementAt(elem)).doubleValue(),Configuration.fpAccuracy);
View Full Code Here

    try {
      if (elementAt instanceof OtpErlangTuple) {
        // multi-arg constructor, turn elements of the
        // tuple into arguments for the constructor.
        OtpErlangTuple argTuple = (OtpErlangTuple) elementAt;
        if (argTuple.arity() < 2)
          throw new IllegalArgumentException(
              "invalid type argument: a list with arity of less than two");
        if (argTuple.arity() > 3)
          throw new IllegalArgumentException(
              "invalid type argument: a list with arity of over three");
View Full Code Here

        // tuple into arguments for the constructor.
        OtpErlangTuple argTuple = (OtpErlangTuple) elementAt;
        if (argTuple.arity() < 2)
          throw new IllegalArgumentException(
              "invalid type argument: a list with arity of less than two");
        if (argTuple.arity() > 3)
          throw new IllegalArgumentException(
              "invalid type argument: a list with arity of over three");
        final int argumentNumber = argTuple.arity() - 1;
       
        // We create an array with argumentNumber+1 values reflecting that
View Full Code Here

          throw new IllegalArgumentException(
              "invalid type argument: a list with arity of less than two");
        if (argTuple.arity() > 3)
          throw new IllegalArgumentException(
              "invalid type argument: a list with arity of over three");
        final int argumentNumber = argTuple.arity() - 1;
       
        // We create an array with argumentNumber+1 values reflecting that
        // the first argument is a Configuration.
        Class<? extends Object>[] argTypes = new Class[argumentNumber+1];
        argTypes[0]=Configuration.class;
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.