Examples of AbstractPattern


Examples of com.caucho.xpath.pattern.AbstractPattern

  /**
   * Sets the selection context
   */
  public AbstractPattern setSelect(Node node, AbstractPattern select)
  {
    AbstractPattern oldSelect = _select;
   
    _contextNode = node;
    _select = select;

    _position = 0;
View Full Code Here

Examples of com.caucho.xpath.pattern.AbstractPattern

    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

Examples of com.caucho.xpath.pattern.AbstractPattern

   * @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

Examples of com.caucho.xpath.pattern.AbstractPattern

    }
   
    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

Examples of com.caucho.xpath.pattern.AbstractPattern

      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

Examples of com.caucho.xpath.pattern.AbstractPattern

  public static Pattern parseSelect(String query, NamespaceContext namespace)
    throws XPathParseException
  {
    XPathParser parser = new XPathParser(query, namespace);

    AbstractPattern pattern = parser.parseSelect();

    if (log.isLoggable(Level.FINER))
      log.finest("select: " + pattern);

    return new Pattern(pattern);
View Full Code Here

Examples of com.caucho.xpath.pattern.AbstractPattern

  public static Pattern parseMatch(String query, NamespaceContext namespace)
    throws XPathParseException
  {
    XPathParser parser = new XPathParser(query, namespace);

    AbstractPattern pattern = parser.parseMatch();

    if (log.isLoggable(Level.FINER))
      log.finest("match: " + pattern);

    return new Pattern(pattern);
View Full Code Here

Examples of com.caucho.xpath.pattern.AbstractPattern

  /**
   * Sets the selection context
   */
  public AbstractPattern setSelect(Node node, AbstractPattern select)
  {
    AbstractPattern oldSelect = _select;
   
    _contextNode = node;
    _select = select;

    _position = 0;
View Full Code Here

Examples of com.caucho.xpath.pattern.AbstractPattern

  public static Pattern parseSelect(String query, NamespaceContext namespace)
    throws XPathParseException
  {
    XPathParser parser = new XPathParser(query, namespace);

    AbstractPattern pattern = parser.parseSelect();

    if (log.isLoggable(Level.FINER))
      log.finest("select: " + pattern);

    return new Pattern(pattern);
View Full Code Here

Examples of com.caucho.xpath.pattern.AbstractPattern

  public static Pattern parseMatch(String query, NamespaceContext namespace)
    throws XPathParseException
  {
    XPathParser parser = new XPathParser(query, namespace);

    AbstractPattern pattern = parser.parseMatch();

    if (log.isLoggable(Level.FINER))
      log.finest("match: " + pattern);

    return new Pattern(pattern);
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.