6
|
1 |
/*
|
|
2 |
* reserved comment block
|
|
3 |
* DO NOT REMOVE OR ALTER!
|
|
4 |
*/
|
|
5 |
/*
|
|
6 |
* Copyright 1999-2004 The Apache Software Foundation.
|
|
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: XNull.java,v 1.2.4.1 2005/09/14 20:34:46 jeffsuttor Exp $
|
|
22 |
*/
|
|
23 |
package com.sun.org.apache.xpath.internal.objects;
|
|
24 |
|
|
25 |
import com.sun.org.apache.xml.internal.dtm.DTM;
|
|
26 |
import com.sun.org.apache.xpath.internal.XPathContext;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* This class represents an XPath null object, and is capable of
|
|
30 |
* converting the null to other types, such as a string.
|
|
31 |
* @xsl.usage general
|
|
32 |
*/
|
|
33 |
public class XNull extends XNodeSet
|
|
34 |
{
|
|
35 |
static final long serialVersionUID = -6841683711458983005L;
|
|
36 |
|
|
37 |
/**
|
|
38 |
* Create an XObject.
|
|
39 |
*/
|
|
40 |
public XNull()
|
|
41 |
{
|
|
42 |
super();
|
|
43 |
}
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Tell what kind of class this is.
|
|
47 |
*
|
|
48 |
* @return type CLASS_NULL
|
|
49 |
*/
|
|
50 |
public int getType()
|
|
51 |
{
|
|
52 |
return CLASS_NULL;
|
|
53 |
}
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Given a request type, return the equivalent string.
|
|
57 |
* For diagnostic purposes.
|
|
58 |
*
|
|
59 |
* @return type string "#CLASS_NULL"
|
|
60 |
*/
|
|
61 |
public String getTypeString()
|
|
62 |
{
|
|
63 |
return "#CLASS_NULL";
|
|
64 |
}
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Cast result object to a number.
|
|
68 |
*
|
|
69 |
* @return 0.0
|
|
70 |
*/
|
|
71 |
|
|
72 |
public double num()
|
|
73 |
{
|
|
74 |
return 0.0;
|
|
75 |
}
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Cast result object to a boolean.
|
|
79 |
*
|
|
80 |
* @return false
|
|
81 |
*/
|
|
82 |
public boolean bool()
|
|
83 |
{
|
|
84 |
return false;
|
|
85 |
}
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Cast result object to a string.
|
|
89 |
*
|
|
90 |
* @return empty string ""
|
|
91 |
*/
|
|
92 |
public String str()
|
|
93 |
{
|
|
94 |
return "";
|
|
95 |
}
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Cast result object to a result tree fragment.
|
|
99 |
*
|
|
100 |
* @param support XPath context to use for the conversion
|
|
101 |
*
|
|
102 |
* @return The object as a result tree fragment.
|
|
103 |
*/
|
|
104 |
public int rtf(XPathContext support)
|
|
105 |
{
|
|
106 |
// DTM frag = support.createDocumentFragment();
|
|
107 |
// %REVIEW%
|
|
108 |
return DTM.NULL;
|
|
109 |
}
|
|
110 |
|
|
111 |
// /**
|
|
112 |
// * Cast result object to a nodelist.
|
|
113 |
// *
|
|
114 |
// * @return null
|
|
115 |
// */
|
|
116 |
// public DTMIterator iter()
|
|
117 |
// {
|
|
118 |
// return null;
|
|
119 |
// }
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Tell if two objects are functionally equal.
|
|
123 |
*
|
|
124 |
* @param obj2 Object to compare this to
|
|
125 |
*
|
|
126 |
* @return True if the given object is of type CLASS_NULL
|
|
127 |
*/
|
|
128 |
public boolean equals(XObject obj2)
|
|
129 |
{
|
|
130 |
return obj2.getType() == CLASS_NULL;
|
|
131 |
}
|
|
132 |
}
|