Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IterableAxis |
|
| 1.2;1.2 |
1 | /* | |
2 | $Id: IterableAxis.java,v 1.9 2006/02/05 21:47:42 elharo Exp $ | |
3 | ||
4 | Copyright 2003 The Werken Company. All Rights Reserved. | |
5 | | |
6 | Redistribution and use in source and binary forms, with or without | |
7 | modification, are permitted provided that the following conditions are | |
8 | met: | |
9 | ||
10 | * Redistributions of source code must retain the above copyright | |
11 | notice, this list of conditions and the following disclaimer. | |
12 | ||
13 | * Redistributions in binary form must reproduce the above copyright | |
14 | notice, this list of conditions and the following disclaimer in the | |
15 | documentation and/or other materials provided with the distribution. | |
16 | ||
17 | * Neither the name of the Jaxen Project nor the names of its | |
18 | contributors may be used to endorse or promote products derived | |
19 | from this software without specific prior written permission. | |
20 | ||
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | |
22 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
23 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | |
24 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER | |
25 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
26 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
27 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
28 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
29 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
30 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 | ||
33 | */ | |
34 | package org.jaxen.expr.iter; | |
35 | ||
36 | import java.io.Serializable; | |
37 | import java.util.Iterator; | |
38 | ||
39 | import org.jaxen.ContextSupport; | |
40 | import org.jaxen.UnsupportedAxisException; | |
41 | ||
42 | /** | |
43 | * Provide access to the XPath axes. | |
44 | * | |
45 | * @author Bob McWhirter | |
46 | * @author James Strachan | |
47 | * @author Stephen Colebourne | |
48 | */ | |
49 | public abstract class IterableAxis implements Serializable { | |
50 | ||
51 | /** The axis type */ | |
52 | private int value; | |
53 | ||
54 | /** | |
55 | * Constructor. | |
56 | * | |
57 | * @param axisValue | |
58 | */ | |
59 | 9212 | public IterableAxis(int axisValue) { |
60 | 9212 | this.value = axisValue; |
61 | 9212 | } |
62 | ||
63 | /** | |
64 | * Gets the axis value. | |
65 | * | |
66 | * @return the axis value | |
67 | */ | |
68 | public int value() { | |
69 | 22882 | return this.value; |
70 | } | |
71 | ||
72 | /** | |
73 | * Gets the iterator for a specific XPath axis. | |
74 | * | |
75 | * @param contextNode the current context node to work from | |
76 | * @param support the additional context information | |
77 | * @return an iterator for the axis | |
78 | * @throws UnsupportedAxisException | |
79 | */ | |
80 | public abstract Iterator iterator(Object contextNode, ContextSupport support) throws UnsupportedAxisException; | |
81 | ||
82 | /** | |
83 | * Gets the iterator for a specific XPath axis that supports named access. | |
84 | * | |
85 | * @param contextNode the current context node to work from | |
86 | * @param support the additional context information | |
87 | * @param localName the local name of the nodes to return | |
88 | * @param namespacePrefix the prefix of the namespace of the nodes to return | |
89 | * @param namespaceURI the URI of the namespace of the nodes to return | |
90 | */ | |
91 | public Iterator namedAccessIterator( | |
92 | Object contextNode, | |
93 | ContextSupport support, | |
94 | String localName, | |
95 | String namespacePrefix, | |
96 | String namespaceURI) | |
97 | throws UnsupportedAxisException { | |
98 | ||
99 | 2 | throw new UnsupportedOperationException("Named access unsupported"); |
100 | } | |
101 | ||
102 | /** | |
103 | * Does this axis support named access? | |
104 | * | |
105 | * @param support the additional context information | |
106 | * @return true if named access supported. If not iterator() will be used | |
107 | */ | |
108 | public boolean supportsNamedAccess(ContextSupport support) { | |
109 | 284 | return false; |
110 | } | |
111 | ||
112 | } |