7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 /*
21 * $Id: Arg.java,v 1.1.2.1 2005/08/01 01:30:11 jeffsuttor Exp $
22 */
23 package com.sun.org.apache.xpath.internal;
24
25 import com.sun.org.apache.xml.internal.utils.QName;
26 import com.sun.org.apache.xpath.internal.objects.XObject;
27
28 /**
29 * This class holds an instance of an argument on
30 * the stack. The value of the argument can be either an
31 * XObject or a String containing an expression.
32 * @xsl.usage internal
33 */
34 public class Arg
35 {
36
37 /** Field m_qname: The name of this argument, expressed as a QName
38 * (Qualified Name) object.
39 * @see getQName
40 * @see setQName
41 * */
42 private QName m_qname;
43
44 /**
45 * Get the qualified name for this argument.
46 *
165 return m_isVisible;
166 }
167
168 /**
169 * Update visibility status of this variable.
170 */
171 public void setIsVisible(boolean b)
172 {
173 m_isVisible = b;
174 }
175
176 /**
177 * Construct a dummy parameter argument, with no QName and no
178 * value (either expression string or value XObject). isVisible
179 * defaults to true.
180 */
181 public Arg()
182 {
183
184 m_qname = new QName("");
185 ; // so that string compares can be done.
186 m_val = null;
187 m_expression = null;
188 m_isVisible = true;
189 m_isFromWithParam = false;
190 }
191
192 /**
193 * Construct a parameter argument that contains an expression.
194 *
195 * @param qname Name of the argument, expressed as a QName object.
196 * @param expression String to be stored as this argument's value expression.
197 * @param isFromWithParam True if this is a parameter variable.
198 */
199 public Arg(QName qname, String expression, boolean isFromWithParam)
200 {
201
202 m_qname = qname;
203 m_val = null;
204 m_expression = expression;
205 m_isFromWithParam = isFromWithParam;
206 m_isVisible = !isFromWithParam;
207 }
208
209 /**
210 * Construct a parameter argument which has an XObject value.
211 * isVisible defaults to true.
212 *
213 * @param qname Name of the argument, expressed as a QName object.
214 * @param val Value of the argument, expressed as an XObject
215 */
216 public Arg(QName qname, XObject val)
217 {
218
219 m_qname = qname;
220 m_val = val;
221 m_isVisible = true;
222 m_isFromWithParam = false;
223 m_expression = null;
224 }
225
226 /**
227 * Equality function specialized for the variable name. If the argument
228 * is not a qname, it will deligate to the super class.
229 *
230 * @param obj the reference object with which to compare.
231 * @return <code>true</code> if this object is the same as the obj
232 * argument; <code>false</code> otherwise.
233 */
234 public boolean equals(Object obj)
235 {
236 if(obj instanceof QName)
237 {
238 return m_qname.equals(obj);
239 }
240 else
241 return super.equals(obj);
242 }
243
244 /**
245 * Construct a parameter argument.
246 *
247 * @param qname Name of the argument, expressed as a QName object.
248 * @param val Value of the argument, expressed as an XObject
249 * @param isFromWithParam True if this is a parameter variable.
250 */
251 public Arg(QName qname, XObject val, boolean isFromWithParam)
252 {
253
|
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 /*
21 * $Id: Arg.java,v 1.1.2.1 2005/08/01 01:30:11 jeffsuttor Exp $
22 */
23 package com.sun.org.apache.xpath.internal;
24
25 import com.sun.org.apache.xml.internal.utils.QName;
26 import com.sun.org.apache.xpath.internal.objects.XObject;
27 import java.util.Objects;
28
29 /**
30 * This class holds an instance of an argument on
31 * the stack. The value of the argument can be either an
32 * XObject or a String containing an expression.
33 * @xsl.usage internal
34 */
35 public class Arg
36 {
37
38 /** Field m_qname: The name of this argument, expressed as a QName
39 * (Qualified Name) object.
40 * @see getQName
41 * @see setQName
42 * */
43 private QName m_qname;
44
45 /**
46 * Get the qualified name for this argument.
47 *
166 return m_isVisible;
167 }
168
169 /**
170 * Update visibility status of this variable.
171 */
172 public void setIsVisible(boolean b)
173 {
174 m_isVisible = b;
175 }
176
177 /**
178 * Construct a dummy parameter argument, with no QName and no
179 * value (either expression string or value XObject). isVisible
180 * defaults to true.
181 */
182 public Arg()
183 {
184
185 m_qname = new QName("");
186 // so that string compares can be done.
187 m_val = null;
188 m_expression = null;
189 m_isVisible = true;
190 m_isFromWithParam = false;
191 }
192
193 /**
194 * Construct a parameter argument that contains an expression.
195 *
196 * @param qname Name of the argument, expressed as a QName object.
197 * @param expression String to be stored as this argument's value expression.
198 * @param isFromWithParam True if this is a parameter variable.
199 */
200 public Arg(QName qname, String expression, boolean isFromWithParam)
201 {
202
203 m_qname = qname;
204 m_val = null;
205 m_expression = expression;
206 m_isFromWithParam = isFromWithParam;
207 m_isVisible = !isFromWithParam;
208 }
209
210 /**
211 * Construct a parameter argument which has an XObject value.
212 * isVisible defaults to true.
213 *
214 * @param qname Name of the argument, expressed as a QName object.
215 * @param val Value of the argument, expressed as an XObject
216 */
217 public Arg(QName qname, XObject val)
218 {
219
220 m_qname = qname;
221 m_val = val;
222 m_isVisible = true;
223 m_isFromWithParam = false;
224 m_expression = null;
225 }
226
227 @Override
228 public int hashCode() {
229 return Objects.hashCode(this.m_qname);
230 }
231
232 /**
233 * Equality function specialized for the variable name. If the argument
234 * is not a qname, it will deligate to the super class.
235 *
236 * @param obj the reference object with which to compare.
237 * @return <code>true</code> if this object is the same as the obj
238 * argument; <code>false</code> otherwise.
239 */
240 @Override
241 public boolean equals(Object obj)
242 {
243 if(obj instanceof QName)
244 {
245 return m_qname.equals(obj);
246 }
247 else
248 return super.equals(obj);
249 }
250
251 /**
252 * Construct a parameter argument.
253 *
254 * @param qname Name of the argument, expressed as a QName object.
255 * @param val Value of the argument, expressed as an XObject
256 * @param isFromWithParam True if this is a parameter variable.
257 */
258 public Arg(QName qname, XObject val, boolean isFromWithParam)
259 {
260
|