1 28 29 package com.caucho.xpath.pattern; 30 31 import com.caucho.xpath.Env; 32 import com.caucho.xpath.ExprEnvironment; 33 import com.caucho.xpath.XPathException; 34 35 import org.w3c.dom.Node ; 36 37 40 public class CurrentPattern extends Axis { 41 public CurrentPattern() 42 { 43 super(null); 44 } 45 46 54 public boolean match(Node node, ExprEnvironment env) 55 { 56 return (node == env.getCurrentNode()); 57 } 58 59 62 boolean isSingleSelect() 63 { 64 return true; 65 } 66 67 76 public NodeIterator createNodeIterator(Node node, ExprEnvironment env, 77 AbstractPattern match) 78 throws XPathException 79 { 80 Node current = env.getCurrentNode(); 81 82 if (match == null || match.match(current, env)) 83 return new SingleNodeIterator(env, current); 84 else 85 return null; 86 } 87 88 95 public Node firstNode(Node node, ExprEnvironment env) 96 { 97 return env.getCurrentNode(); 98 } 99 100 108 public Node nextNode(Node node, Node last) 109 { 110 return null; 111 } 112 113 116 public int position(Node node, Env env, AbstractPattern pattern) 117 { 118 return 1; 119 } 120 123 public int count(Node node, Env env, Node context) 124 { 125 return 1; 126 } 127 128 public String toString() 129 { 130 return "current()"; 131 } 132 } 133 | Popular Tags |