Examples of RutaStatement


Examples of org.apache.uima.ruta.RutaStatement

    }
    dra.setRules(UIMAUtils.toFSArray(cas, ruleMatches));
    RutaElement element = ruleApply.getElement();
    String namespace = "";
    if(element instanceof RutaStatement) {
      RutaStatement rs = (RutaStatement) element;
      namespace = rs.getParent().getScript().getRootBlock().getNamespace();
    } else if(element instanceof AbstractRuleElement) {
      AbstractRuleElement are = (AbstractRuleElement) element;
      are.getRule().getParent().getScript().getRootBlock().getNamespace();
    }
    dra.setElement(verbalizer.verbalize(element));
View Full Code Here

Examples of org.apache.uima.ruta.RutaStatement

  }

  public void beginVisit(RutaElement element, ScriptApply result) {
    if (element instanceof RutaStatement) {
      callStack.push(element);
      RutaStatement stmt = (RutaStatement) element;
      Stack<ScriptApply> stack = applies.get(stmt);
      if (stack == null) {
        stack = new Stack<ScriptApply>();
        applies.put(stmt, stack);
      }
View Full Code Here

Examples of org.apache.uima.ruta.RutaStatement

  }

  public void endVisit(RutaElement element, ScriptApply result) {
    // TODO create UIMA stuff here not later -> save memory!
    if (element instanceof RutaStatement) {
      RutaStatement stmt = (RutaStatement) element;
      RutaBlock parent = stmt.getParent();
      Stack<ScriptApply> stack = applies.get(stmt);
      if (stack == null) {
        stack = new Stack<ScriptApply>();
        applies.put(stmt, stack);
      }
View Full Code Here

Examples of org.apache.uima.ruta.RutaStatement

  }

  public void beginVisit(RutaElement element, ScriptApply result) {
    if (element instanceof RutaStatement) {
      callStack.push(element);
      RutaStatement stmt = (RutaStatement) element;
      Stack<ScriptApply> stack = applies.get(stmt);
      if (stack == null) {
        stack = new Stack<ScriptApply>();
        applies.put(stmt, stack);
      }
View Full Code Here

Examples of org.apache.uima.ruta.RutaStatement

  }

  public void endVisit(RutaElement element, ScriptApply result) {
    // TODO create UIMA stuff here not later -> save memory!
    if (element instanceof RutaStatement) {
      RutaStatement stmt = (RutaStatement) element;
      RutaBlock parent = stmt.getParent();
      Stack<ScriptApply> stack = applies.get(stmt);
      if (stack == null) {
        stack = new Stack<ScriptApply>();
        applies.put(stmt, stack);
      }
View Full Code Here

Examples of org.apache.uima.ruta.RutaStatement

  @SuppressWarnings({ "rawtypes" })
  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream,
          InferenceCrowd crowd) {
    RutaStatement parent = element.getParent();
    List list = parent.getEnvironment().getVariableValue(var, List.class);
    List<Object> toRemove = new ArrayList<Object>();
    for (Object entry : list) {
      Object value1 = getValue(entry, parent);
      for (RutaExpression arg : elements) {
        if(arg instanceof ListExpression) {
          ListExpression l = (ListExpression) arg;
          List list2 = l.getList(parent);
          for (Object object : list2) {
            Object value2 = getValue(object, parent);
            if(value1.equals(value2)) {
              toRemove.add(entry);
            }
          }
        } else {
          Object value2 = getValue(arg, parent);
          if(value1.equals(value2)) {
            toRemove.add(entry);
          }
        }
      }
    }
    for (Object object : toRemove) {
      list.remove(object);
    }
    parent.getEnvironment().setVariableValue(var, list);
  }
View Full Code Here

Examples of org.apache.uima.ruta.RutaStatement

    }
    dra.setRules(UIMAUtils.toFSArray(cas, ruleMatches));
    RutaElement element = ruleApply.getElement();
    String namespace = "";
    if(element instanceof RutaStatement) {
      RutaStatement rs = (RutaStatement) element;
      namespace = rs.getParent().getScript().getRootBlock().getNamespace();
    } else if(element instanceof AbstractRuleElement) {
      AbstractRuleElement are = (AbstractRuleElement) element;
      are.getRule().getParent().getScript().getRootBlock().getNamespace();
    }
    dra.setElement(verbalizer.verbalize(element));
View Full Code Here

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

    return (CodeBlock[]) result.toArray(new CodeBlock[result.size()]);
  }

  private void checkStatement(String code, int offset, List result, Statement sst) {
    if (sst instanceof RutaStatement) {
      RutaStatement statement = (RutaStatement) sst;
      result.add(new CodeBlock(statement, new Region(offset + statement.sourceStart(), statement
              .sourceEnd() - statement.sourceStart())));

      Iterator si = statement.getExpressions().iterator();
      // while (si.hasNext()) {
      // Expression ex = (Expression) si.next();
      // if (ex instanceof BlockDeclaration) {
      // BlockDeclaration be = (BlockDeclaration) ex;
      // try {
View Full Code Here

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

  }

  @Override
  protected boolean initiallyCollapse(ASTNode s, FoldingStructureComputationContext ctx) {
    if (s instanceof RutaStatement) {
      RutaStatement statement = (RutaStatement) s;
      if (!(statement.getAt(0) instanceof SimpleReference)) {
        return false;
      }

      String name = null;
      name = ((SimpleReference) statement.getAt(0)).getName();
      if (name.equals("namespace")) {
        return ctx.allowCollapsing() && fInitCollapseNamespaces;
      }

      return ctx.allowCollapsing() && fInitCollapseBlocks;
View Full Code Here

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

    if (s instanceof TypeDeclaration) {
      return canFold("namespace");
    } else if (s instanceof MethodDeclaration) {
      return canFold("proc");
    } else if (s instanceof RutaStatement) {
      RutaStatement statement = (RutaStatement) s;
      if (!(statement.getAt(0) instanceof SimpleReference)) {
        return false;
      }

      String name = null;
      name = ((SimpleReference) statement.getAt(0)).getName();
      return canFold(name);
    }

    return false;
  }
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.