KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > xpath > impl > XPathLocationPathImpl


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.xpath.impl;
21
22 import org.netbeans.modules.xml.xpath.LocationStep;
23 import org.netbeans.modules.xml.xpath.XPathLocationPath;
24 import org.netbeans.modules.xml.xpath.visitor.XPathVisitable;
25 import org.netbeans.modules.xml.xpath.visitor.XPathVisitor;
26
27
28 /**
29  * @todo PUT DESCRIPTION HERE
30  *
31  * @author Enrico Lelina
32  * @version $Revision: 1.4 $
33  */

34 public class XPathLocationPathImpl
35     extends XPathExpressionImpl
36     implements XPathLocationPath {
37         
38     /** The steps. */
39     LocationStep[] mSteps;
40     
41     /** The absolute flag; defaults to false. */
42     boolean mAbsolute;
43
44     /** Flag to figure out if it is a simple path
45      * Recognized paths formatted as foo/bar[3]/baz[@name = 'biz'] .
46      */

47     private boolean mIsSimplePath;
48     
49     /**
50      * Constructor.
51      * @param steps the steps
52      */

53     public XPathLocationPathImpl(LocationStep[] steps) {
54         this(steps, false, true);
55     }
56     
57     
58     /**
59      * Constructor.
60      * @param steps the steps
61      * @param absolute flag
62      * @param isSimplePath flag whether path is simple
63      */

64     public XPathLocationPathImpl(LocationStep[] steps, boolean absolute
65                                  , boolean isSimplePath) {
66         super();
67         setSteps(steps);
68         setAbsolute(absolute);
69         mIsSimplePath = isSimplePath;
70     }
71     
72     
73     /**
74      * Gets the flag the tells whether this is an absolute path or not.
75      * @return flag
76      */

77     public boolean getAbsolute() {
78         return mAbsolute;
79     }
80     
81     
82     /**
83      * Sets the flag that tells whether this is an absolute path or not.
84      * @param absolute flag
85      */

86     public void setAbsolute(boolean absolute) {
87         mAbsolute = absolute;
88     }
89     
90     
91     /**
92      * Gets the steps of the location path.
93      * @return the steps
94      */

95     public LocationStep[] getSteps() {
96         return mSteps;
97     }
98     
99     
100     /**
101      * Sets the steps of the location path.
102      * @param steps the steps
103      */

104     public void setSteps(LocationStep[] steps) {
105         mSteps = steps;
106     }
107     
108     /**
109      * Describe <code>isSimplePath</code> method here.
110      *
111      * @return a <code>boolean</code> value
112      */

113     public boolean isSimplePath() {
114         return mIsSimplePath;
115     }
116
117     /**
118      * Describe <code>setSimplePath</code> method here.
119      *
120      * @param isSimplePath a <code>boolean</code> value
121      */

122     public void setSimplePath(boolean isSimplePath) {
123         mIsSimplePath = isSimplePath;
124     }
125
126     /**
127      * Calls the visitor.
128      * @param visitor the visitor
129      */

130     public void accept(XPathVisitor visitor) {
131         visitor.visit(this);
132     }
133 }
134
Popular Tags