Package org.apache.uima.ruta.ide.parser.ast

Examples of org.apache.uima.ruta.ide.parser.ast.RutaStructureAction


   * structure actions like CREATE, FILL with assignments.
   *
   * @param a
   */
  private void printStructureAction(RutaAction a) {
    RutaStructureAction tmca = (RutaStructureAction) a;
    // structure
    if (tmca.getStructure() != null) {
      append(tmca.getStructure());
    }
    append(COMMA);
    append(" ");
    // number expressions
    List<Expression> indices = tmca.getExpressions();
    if (indices != null) {
      traverseAstNodes(indices);
      if (!indices.isEmpty()) {
        append(COMMA);
        append(" ");
      }
    }
    // assignments
    Map<Expression, Expression> assignments = tmca.getAssignments();
    Iterator it = assignments.entrySet().iterator();
    while (it.hasNext()) {
      if (assignments.size() > 3) {
        appendNewLineAndIndent();
      }
View Full Code Here


      }
    }
  }

  private void printStructureAction2(RutaAction a) {
    RutaStructureAction tmca = (RutaStructureAction) a;

    Map<Expression, Expression> assignments = tmca.getAssignments();
    Iterator it = assignments.entrySet().iterator();
    while (it.hasNext()) {
      if (assignments.size() > 3) {
        appendNewLineAndIndent();
      }
      Map.Entry pairs = (Map.Entry) it.next();
      try {
        ((Expression) pairs.getKey()).traverse(this);
      } catch (Exception e) {
        e.printStackTrace();
      }
      append(EQUALS);
      try {
        ((Expression) pairs.getValue()).traverse(this);
      } catch (Exception e) {
        e.printStackTrace();
      }
      output.append(COMMA);
      append(" ");
    }
    // structure
    if (tmca.getStructure() != null) {
      append(tmca.getStructure());
    }
    append(COMMA);
    append(" ");
    // number expressions
    List<Expression> indices = tmca.getExpressions();
    if (indices != null) {
      traverseAstNodes(indices);
    }
    // assignments
View Full Code Here

          return false;
        }
      }

      if (s instanceof RutaStructureAction) {
        RutaStructureAction sa = (RutaStructureAction) s;
        Expression struct = sa.getStructure();
        String structure = null;
        if (struct != null) {
          structure = sourceModule.getSource().substring(struct.sourceStart(), struct.sourceEnd());
          structure = expand(structure);
        }
        Map<Expression, Expression> assignments = sa.getAssignments();
        // hotfix... correct name in ast
        String action = sourceModule.getSource().substring(sa.getNameStart(), sa.getNameEnd());
        if (assignments != null && !action.equals("TRIE")) {
          for (Expression each : assignments.keySet()) {
            // TODO refactor to visitor?
            String feat = each.toString();
            // List<?> childs = each.getChilds();
View Full Code Here

            // parser
            return false;
          }
        }
        if (s instanceof RutaStructureAction) {
          RutaStructureAction sa = (RutaStructureAction) s;
          Expression struct = sa.getStructure();
          String structure = null;
          if (struct != null) {
            structure = currentFile.getSource().substring(struct.sourceStart(), struct.sourceEnd());
          }
          Map<Expression, Expression> assignments = sa.getAssignments();
          // hotfix... correct name in ast
          String action = currentFile.getSource().substring(sa.getNameStart(), sa.getNameEnd());
          if (assignments != null && !action.equals("TRIE")) {
            for (Expression each : assignments.keySet()) {
              // TODO refactor to visitor?
              String feat = each.toString();
              // List<?> childs = each.getChilds();
View Full Code Here

   * structure actions like CREATE, FILL with assignments.
   *
   * @param a
   */
  private void printStructureAction(RutaAction a) {
    RutaStructureAction tmca = (RutaStructureAction) a;
    // structure
    if (tmca.getStructure() != null) {
      append(tmca.getStructure());
    }
    append(COMMA);
    append(" ");
    // number expressions
    List<Expression> indices = tmca.getExpressions();
    if (indices != null) {
      traverseAstNodes(indices);
    }
    if (!indices.isEmpty()) {
      append(COMMA);
      append(" ");
    }
    // assignments
    Map<Expression, Expression> assignments = tmca.getAssignments();
    Iterator it = assignments.entrySet().iterator();
    while (it.hasNext()) {
      if (assignments.size() > 3) {
        appendNewLineAndIndent();
      }
View Full Code Here

      }
    }
  }

  private void printStructureAction2(RutaAction a) {
    RutaStructureAction tmca = (RutaStructureAction) a;

    Map<Expression, Expression> assignments = tmca.getAssignments();
    Iterator it = assignments.entrySet().iterator();
    while (it.hasNext()) {
      if (assignments.size() > 3) {
        appendNewLineAndIndent();
      }
      Map.Entry pairs = (Map.Entry) it.next();
      try {
        ((Expression) pairs.getKey()).traverse(this);
      } catch (Exception e) {
        e.printStackTrace();
      }
      append(EQUALS);
      try {
        ((Expression) pairs.getValue()).traverse(this);
      } catch (Exception e) {
        e.printStackTrace();
      }
      output.append(COMMA);
      append(" ");
    }
    // structure
    if (tmca.getStructure() != null) {
      append(tmca.getStructure());
    }
    append(COMMA);
    append(" ");
    // number expressions
    List<Expression> indices = tmca.getExpressions();
    if (indices != null) {
      traverseAstNodes(indices);
    }
    // assignments
View Full Code Here

TOP

Related Classes of org.apache.uima.ruta.ide.parser.ast.RutaStructureAction

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.