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 FromSelf extends Axis { 41 public FromSelf(AbstractPattern parent) 42 { 43 super(parent); 44 } 45 53 public boolean match(Node node, ExprEnvironment env) 54 throws XPathException 55 { 56 return _parent == null || _parent.match(node, env); 57 } 58 59 62 public int position(Node node, Env env, AbstractPattern pattern) 63 { 64 return 1; 65 } 66 67 70 public int count(Node node, Env env, AbstractPattern pattern) 71 { 72 return 1; 73 } 74 75 82 public Node firstNode(Node node, ExprEnvironment env) 83 { 84 return node; 85 } 86 87 95 public Node nextNode(Node node, Node lastNode) 96 { 97 return null; 98 } 99 100 103 public boolean equals(Object b) 104 { 105 if (! (b instanceof FromSelf)) 106 return false; 107 108 FromSelf bPattern = (FromSelf) b; 109 110 return (_parent == bPattern._parent || 111 (_parent != null && _parent.equals(bPattern._parent))); 112 } 113 114 public String toString() 115 { 116 return getPrefix() + "self::"; 117 } 118 } 119 | Popular Tags |