Package eu.admire.dispel.types

Examples of eu.admire.dispel.types.TupleSType


    // ?TupleElementIn ?TupleTypeIn ?ListTypeIn ?STypeOut ?typeOut ?DTypeOut
    // ?TupleElementOut ?TupleTypeOut ?ListTypeOut

    if (tokens[i + 3] != null) {
      // found ?TupleElementIn tokens[9]
      TupleSType tuple = new TupleSType();
      if (tokens[i + 4] != null) {
        if (tokens[i + 4].equals("rest")) {
          tuple.setRest(true);
        } else {
          SType tupleType = null;
          if (tokens[i + 4].equals("Anyany")) {
            tupleType = new AnySType();
          } else {
            tupleType = new PrimitiveSType(tokens[i + 4]);
          }
          tuple.addElement(tokens[i + 3], tupleType);
        }
      }
      peInputDescriptor.setSType(tuple);
    }
    // checking for ArraySType
    else if (tokens[i + 5] != null) {
      // found ?ListElementIn tokens[9]
      ArraySType array = null;
      // found Tuple element
      if (tokens[i + 7] != null) {
        TupleSType tuple = new TupleSType();
        if (tokens[i + 7].equals("rest")) {
          tuple.setRest(true);
        } else {
          SType tupleType = null;
          if (tokens[i + 8].equals("Anyany")) {
            tupleType = new AnySType();
          } else {
            tupleType = new PrimitiveSType(tokens[i + 8]);
          }
          tuple.addElement(tokens[i + 7], tupleType);
        }
        array = new ArraySType(tuple, Integer.parseInt(tokens[i + 6]));
      } else {
        Integer size = Integer.parseInt(tokens[i + 6]);
        // what is the array Type?
        SType tupleType = null;
        if (tokens[i + 5].equals("Anyany")) {
          tupleType = new AnySType();
        } else {
          tupleType = new PrimitiveSType(tokens[i + 5]);
        }
        array = new ArraySType(tupleType, size);
      }
      peInputDescriptor.setSType(array);
    }
    // checking for ListSType
    else if (tokens[i + 9] != null) {
      // found ?ListElementIn tokens[9]
      ListSType list = null;
      if (tokens[i + 10] != null) {
        TupleSType tuple = new TupleSType();
        if (tokens[i + 10].contains("rest")) {
          tuple.setRest(true);
        } else {
          SType tupleType = null;
          if (tokens[i + 11].equals("Anyany")) {
            tupleType = new AnySType();
          } else {
            tupleType = new PrimitiveSType(tokens[i + 11]);
          }
          tuple.addElement(tokens[i + 10], tupleType);
        }
        list = new ListSType(tuple);
      } else {
        list = new ListSType(new PrimitiveSType(tokens[i + 9]));
      }
View Full Code Here


      if (stype != null) {
        if (((ArraySType) stype).getType() instanceof TupleSType) {
          inputPE.append(DELIMITER + "Array");
          inputPE.append(DELIMITER + ((ArraySType) stype).getSize());
          inputPE.append(DELIMITER + "BEGIN_TUPLE");
          TupleSType tuple = (TupleSType) ((ArraySType) stype)
              .getType();
          for (String tupleKey : tuple.getElements().keySet()) {
            inputPE.append(DELIMITER + "BEGIN_TUPLE_ELEMENT");
            inputPE.append(DELIMITER + tupleKey);
            inputPE.append(DELIMITER + "PrimitiveSType");
            inputPE.append(DELIMITER
                + tuple.getElements().get(tupleKey));
            inputPE.append(DELIMITER + "END_TUPLE_ELEMENT");
          }
          inputPE.append(DELIMITER + tuple.hasRest());
          inputPE.append(DELIMITER + "END_TUPLE");
        } else {
          inputPE.append(DELIMITER + "Array");
          inputPE.append(DELIMITER + ((ArraySType) stype).getSize());
          inputPE.append(DELIMITER + ((ArraySType) stype).getType());
        }
      } else {
        inputPE.append(DELIMITER + "null");
      }
    } else if (stype instanceof AnySType) {
      stype = (AnySType) stype;
      inputPE.append(DELIMITER + "any");
      if (stype != null) {
        inputPE.append(DELIMITER + ((AnySType) stype).getClass());
      } else {
        inputPE.append(DELIMITER + "null");
      }
    } else if (stype instanceof ListSType) {
      stype = (ListSType) stype;
      inputPE.append(DELIMITER + "List");
      if (stype != null) {
        if (((ListSType) stype).getChildType() instanceof TupleSType) {
          inputPE.append(DELIMITER + "BEGIN_TUPLE");
          TupleSType tuple = (TupleSType) ((ListSType) stype)
              .getChildType();
          for (String tupleKey : tuple.getElements().keySet()) {
            inputPE.append(DELIMITER + "BEGIN_TUPLE_ELEMENT");
            inputPE.append(DELIMITER + tupleKey);
            inputPE.append(DELIMITER + "PrimitiveSType");
            inputPE.append(DELIMITER
                + tuple.getElements().get(tupleKey));
            inputPE.append(DELIMITER + "END_TUPLE_ELEMENT");
          }
          inputPE.append(DELIMITER + tuple.hasRest());
          inputPE.append(DELIMITER + "END_TUPLE");
        } else {
          inputPE.append(DELIMITER + "PrimitiveSType");
          inputPE.append(DELIMITER
              + ((ListSType) stype).getChildType());
View Full Code Here

TOP

Related Classes of eu.admire.dispel.types.TupleSType

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.