01: /*
02: * Copyright 1999-2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.apache.xpath.objects;
18:
19: import org.apache.xml.dtm.DTM;
20: import org.apache.xpath.XPathContext;
21:
22: /*
23: *
24: * @author igorh
25: *
26: * Simple wrapper to DTM and XPathContext objects.
27: * Used in XRTreeFrag for caching references to the objects.
28: */
29: public final class DTMXRTreeFrag {
30: private DTM m_dtm;
31: private int m_dtmIdentity = DTM.NULL;
32: private XPathContext m_xctxt;
33:
34: public DTMXRTreeFrag(int dtmIdentity, XPathContext xctxt) {
35: m_xctxt = xctxt;
36: m_dtmIdentity = dtmIdentity;
37: m_dtm = xctxt.getDTM(dtmIdentity);
38: }
39:
40: public final void destruct() {
41: m_dtm = null;
42: m_xctxt = null;
43: }
44:
45: final DTM getDTM() {
46: return m_dtm;
47: }
48:
49: public final int getDTMIdentity() {
50: return m_dtmIdentity;
51: }
52:
53: final XPathContext getXPathContext() {
54: return m_xctxt;
55: }
56:
57: public final int hashCode() {
58: return m_dtmIdentity;
59: }
60:
61: public final boolean equals(Object obj) {
62: if (obj instanceof DTMXRTreeFrag) {
63: return (m_dtmIdentity == ((DTMXRTreeFrag) obj)
64: .getDTMIdentity());
65: }
66: return false;
67: }
68:
69: }
|