Package com.caucho.xpath.pattern

Examples of com.caucho.xpath.pattern.AbstractPattern


      }
    }

    boolean oldCacheable = _isCacheable;
    boolean oldDefaultCacheable = _defaultCacheable;
    AbstractPattern oldNodeListContext = _nodeListContext;
    if (! patternString.equals(""))
      _nodeListContext = parseMatch(patternString);

    _isCacheable = true;
    printTemplate(element, name, patternString, mode, dPriority);
View Full Code Here


    throws Exception
  {
    QElement element = (QElement) node;
    String select = element.getAttribute("select");
    String mode = element.getAttribute("mode");
    AbstractPattern selectPattern = null;
    if (! select.equals(""))
      selectPattern = parseSelect(select, node);

    Sort []sort = generateSort(node);
View Full Code Here

    boolean isAlphabetic = true;
    if (! letter.equals("alphabetic"))
      isAlphabetic = false;

    AbstractPattern countPattern = null;
    if (! count.equals(""))
      countPattern = parseMatch(count);

    AbstractPattern fromPattern = null;
    if (! from.equals(""))
      fromPattern = parseMatch(from);

    if (level.equals("") || level.equals("single"))
      level = "single";
View Full Code Here

    }
   
    out.println("{");
    out.pushDepth();

    AbstractPattern select = parseSelect(_select);
   
    boolean hasExprEnv = ! allowJavaSelect(select);

    int id = _gen.generateId();
   
    String sel = "_xsl_sel" + id;
    String oldCxt = "_xsl_cxt" + id;
    String oldCur = "_xsl_cur" + id;
    String oldSel = "_xsl_old_sel" + id;
    String oldEnv = "_xsl_env" + id;
    String oldSize = "_xsl_old_size" + id;

    out.println("com.caucho.xpath.pattern.AbstractPattern " + sel + ";");
    out.print(sel + " = _select_patterns[");
    out.print(_gen.addSelect(select));
    out.println("];");
    out.println("Node " + oldCxt + " = env.getContextNode();");
    out.println("Node " + oldCur + " = env.getCurrentNode();");
   
    if (! hasExprEnv) {
      out.println("AbstractPattern " + oldSel + " = env.setSelect(node, " + sel + ");");
      out.println("int " + oldSize + " = env.setContextSize(0);");
    }
   
   
    // String pos = "_xsl_pos" + unique++;
    String iter = "_xsl_iter" + _gen.generateId();

    int oldSelectDepth = _gen.getSelectDepth();
   
    // println("int " + pos + " = 0;");

    boolean hasEnv = false;
   
    if (allowJavaSelect(select)) {
      out.println("ExprEnvironment " + oldEnv + " = env.setExprEnv(null);");
     
      String ptr = printSelectBegin(out, select, true, null);

      _gen.pushLoop();
      out.println("Node " + _gen.getElement() + " = node;");
      out.println("node = " + ptr + ";");
    }
    else {
      out.print("NodeIterator " + iter + " = " + sel);
      out.println(".select(node, " + getEnv() + ");");
      out.println("ExprEnvironment " + oldEnv + " = env.setExprEnv(" + iter + ");");
      out.println("while (" + iter + ".hasNext()) {");
      out.pushDepth();
      _gen.setSelectDepth(_gen.getSelectDepth() + 1);
     
      _gen.pushLoop();
     
      out.println("Node " + _gen.getElement() + " = node;");
      out.println("node = " + iter + ".nextNode();");
     
    }
    out.println("env.setCurrentNode(node);");
   
    // println(pos + "++;");

    // String oldPos = currentPos;
    // currentPos = pos;

    AbstractPattern oldNodeListContext = _gen.getNodeListContext();
    _gen.setNodeListContext(parseMatch(_select));

    generateChildren(out);

    _gen.setNodeListContext(oldNodeListContext);
View Full Code Here

      sort[i] = _sorts.get(i).generateSort();
   
    out.println("{");
    out.pushDepth();

    AbstractPattern select = parseSelect(_select);
   
    boolean hasExprEnv = ! allowJavaSelect(select);

    int id = _gen.generateId();
   
    String sel = "_xsl_sel" + id;
    String oldCxt = "_xsl_cxt" + id;
    String oldCur = "_xsl_cur" + id;
    String oldSel = "_xsl_old_sel" + id;
    String oldEnv = "_xsl_env" + id;
   
    out.println("env.setCurrentNode(node);");
    String pos = "_xsl_pos" + _gen.generateId();
    String list = "_xsl_list" + _gen.generateId();

    int sortIndex = _gen.addSort(sort);
   
    out.println("Node " + oldCxt + " = env.getContextNode();");
    out.println("Node " + oldCur + " = env.getCurrentNode();");
   
    out.println("ArrayList " + list +
            " = xslSort(node, env" +
            ", _select_patterns[" + _gen.addSelect(select) + "]" +
            ", _xsl_sorts[" + sortIndex + "]);");
    out.println("env.setContextSize(" + list + ".size());");
    out.println("for (int " + pos + " = 1; " + pos +
            " <= " + list + ".size(); " + pos + "++) {");
    _gen.pushLoop();
    out.pushDepth();
    out.println("Node " + _gen.getElement() + " = node;");
    out.println("node = (Node) " + list + ".get(" + pos + " - 1);");

    String oldPos = _gen.getCurrentPosition();
    _gen.setCurrentPosition(pos);
   
    out.println("env.setPosition(" + pos + ");");
   
    AbstractPattern oldNodeListContext = _gen.getNodeListContext();
    _gen.setNodeListContext(parseMatch(_select));

    generateChildren(out);

    _gen.setCurrentPosition(oldPos);
View Full Code Here

    boolean isAlphabetic = true;
    if (! "alphabetic".equals(_letter))
      isAlphabetic = false;

    AbstractPattern countPattern = null;
    if (_count != null)
      countPattern = parseMatch(_count);

    AbstractPattern fromPattern = null;
    if (_from != null)
      fromPattern = parseMatch(_from);

    if (_level == null || _level.equals("single")) {
      _level = "single";
View Full Code Here

   * @param out the output writer for the generated java.
   */
  public void generate(JavaWriter out)
    throws Exception
  {
    AbstractPattern selectPattern = null;
   
    if (_select != null) {
      selectPattern = parseSelect(_select);
    }

View Full Code Here

      }
    }

    boolean oldCacheable = _isCacheable;
    boolean oldDefaultCacheable = _defaultCacheable;
    AbstractPattern oldNodeListContext = _nodeListContext;
    if (! patternString.equals(""))
      _nodeListContext = parseMatch(patternString);

    _isCacheable = true;
    printTemplate(element, name, patternString, mode, dPriority);
View Full Code Here

    throws Exception
  {
    QElement element = (QElement) node;
    String select = element.getAttribute("select");
    String mode = element.getAttribute("mode");
    AbstractPattern selectPattern = null;
    if (! select.equals(""))
      selectPattern = parseSelect(select, node);

    Sort []sort = generateSort(node);
View Full Code Here

    boolean isAlphabetic = true;
    if (! letter.equals("alphabetic"))
      isAlphabetic = false;

    AbstractPattern countPattern = null;
    if (! count.equals(""))
      countPattern = parseMatch(count);

    AbstractPattern fromPattern = null;
    if (! from.equals(""))
      fromPattern = parseMatch(from);

    if (level.equals("") || level.equals("single"))
      level = "single";
View Full Code Here

TOP

Related Classes of com.caucho.xpath.pattern.AbstractPattern

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.