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.Document ; 36 import org.w3c.dom.Node ; 37 38 42 abstract class Axis extends AbstractPattern { 43 Axis(AbstractPattern parent) 44 { 45 super(parent); 46 } 47 48 57 public int position(Node node, Env env, AbstractPattern pattern) 58 throws XPathException 59 { 60 return 1; 61 } 62 63 72 public int count(Node node, Env env, AbstractPattern pattern) 73 throws XPathException 74 { 75 return 1; 76 } 77 78 87 public NodeIterator createNodeIterator(Node node, ExprEnvironment env, 88 AbstractPattern match) 89 throws XPathException 90 { 91 if (_parent == null) 92 return new AxisIterator(null, this, node, env, match); 93 else if (_parent instanceof FromRoot) { 94 if (node instanceof Document ) 95 return new AxisIterator(null, this, node, env, match); 96 else if (node != null) 97 return new AxisIterator(null, this, node.getOwnerDocument(), 98 env, match); 99 } 100 101 NodeIterator parentIter; 102 parentIter = _parent.createNodeIterator(node, env, _parent.copyPosition()); 103 104 return new AxisIterator(parentIter, this, null, env, match); 105 } 106 107 110 public AbstractPattern copyAxis() 111 { 112 return this; 113 } 114 115 118 public AbstractPattern copyPosition() 119 { 120 return null; 121 } 122 123 126 boolean isSingleSelect() 127 { 128 return false; 129 } 130 131 134 public boolean isStrictlyAscending() 135 { 136 return isSingleLevel(); 137 } 138 139 142 public boolean isUnique() 143 { 144 return isStrictlyAscending(); 145 } 146 } 147 | Popular Tags |