KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > mapper > metadata > Node


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
18  * You can also get it at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.mapper.metadata;
24
25 /**
26  * Data structure that corresponds to XML logical structure nodes.
27  *
28  */

29 public class Node implements Cloneable JavaDoc
30 {
31     private static final String JavaDoc RCSRevision = "$Revision: 1.1 $";
32     private static final String JavaDoc RCSName = "$Name: $";
33     
34     public long oid = -1;
35     public long last = -1;
36     public short path = -2; // -1 is ROOT path ID !
37

38     /* Code for setting the type of node */
39     public short type = -1;
40     
41   // not stored
42

43     public Node()
44     {}
45     
46     public Node(long oid, short path, short type)
47     {
48         set(oid, path, type);
49     }
50     
51     public Node(long oid, long last, short path, short type)
52     {
53         set(oid, last, path, type);
54     }
55     
56     public void setNodeType(short lt)
57     {
58         this.type = lt;
59     }
60     
61     public int getNodeType()
62     {
63         return type;
64     }
65     
66     /**
67      * This method is for recycling objects. This method is prefered to the constructor call.
68      */

69     public void set(long oid, short path, short type)
70     {
71         this.oid = oid;
72         this.path = path;
73         this.type = type;
74     }
75     
76     public void set(long oid, long last, short path, short type)
77     {
78         set(oid, path , type);
79         this.last = last;
80     }
81     
82     public void clear()
83     {
84         set( -1, -1, (short)-2,(short)-1); // -1 is ROOT path ID !
85
}
86     
87     public String JavaDoc toString()
88     {
89         return "[" + oid + ", " + last + ", " + path+ ", " + type + "]";
90     }
91     
92     public Object JavaDoc clone()
93     {
94         Object JavaDoc o = null;
95         try {
96             o = super.clone();
97         }
98         catch (CloneNotSupportedException JavaDoc e) {
99         }
100         return o;
101     }
102 }
103
Popular Tags