KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > org > apache > xpath > internal > objects > DTMXRTreeFrag


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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 com.sun.org.apache.xpath.internal.objects;
18
19 import com.sun.org.apache.xml.internal.dtm.DTM;
20 import com.sun.org.apache.xpath.internal.XPathContext;
21 /*
22  *
23  * @author igorh
24  *
25  * Simple wrapper to DTM and XPathContext objects.
26  * Used in XRTreeFrag for caching references to the objects.
27  */

28  public final class DTMXRTreeFrag {
29   private DTM m_dtm;
30   private int m_dtmIdentity = DTM.NULL;
31   private XPathContext m_xctxt;
32  
33   public DTMXRTreeFrag(int dtmIdentity, XPathContext xctxt){
34       m_xctxt = xctxt;
35       m_dtmIdentity = dtmIdentity;
36       m_dtm = xctxt.getDTM(dtmIdentity);
37     }
38
39   public final void destruct(){
40     m_dtm = null;
41     m_xctxt = null;
42  }
43
44 final DTM getDTM(){return m_dtm;}
45 public final int getDTMIdentity(){return m_dtmIdentity;}
46 final XPathContext getXPathContext(){return m_xctxt;}
47
48 public final int hashCode() { return m_dtmIdentity; }
49 public final boolean equals(Object JavaDoc obj) {
50    if (obj instanceof DTMXRTreeFrag) {
51        return (m_dtmIdentity == ((DTMXRTreeFrag)obj).getDTMIdentity());
52    }
53    return false;
54  }
55
56 }
57
Popular Tags