PageRenderTime 41ms CodeModel.GetById 20ms app.highlight 4ms RepoModel.GetById 16ms app.codeStats 0ms

/bundles/plugins-trunk/XInsert/src/XTreeNode.java

#
Java | 78 lines | 42 code | 13 blank | 23 comment | 10 complexity | 7ae619385f664f18a24d8d18c3ad270a MD5 | raw file
 1/*
 2 * 17:26:43 01/08/99
 3 *
 4 * XTreeNode.java - Part of the XTree system
 5 * Copyright (C) 1999 Romain Guy - powerteam@chez.com
 6 * Portions Copyright (C) 2000 Dominic Stolerman - dominic@sspd.org.uk
 7 * www.chez.com/powerteam
 8 *
 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24
25import java.util.Hashtable;
26import javax.swing.tree.*;
27
28public class XTreeNode extends DefaultMutableTreeNode {
29  private int pos = -1;
30	private Hashtable table;
31
32  public XTreeNode(String userObject) {
33    super(userObject);
34  }
35
36  public XTreeNode(String userObject, int pos) {
37    super(userObject);
38    this.pos = pos;
39  }
40
41  public void setIndex(int pos) {
42    this.pos = pos;
43  }
44
45  public int getIndex() {
46    return pos;
47  }
48
49	public void addVariable(String key, String value) {
50		if(table == null)
51			table = new Hashtable();
52		table.put(key, value);
53	}
54
55	public String getVariable(String key) {
56		if(table != null)
57			return (String)table.get(key);
58		else
59			return null;
60	}
61
62	public boolean containsVariable(String key) {
63		if(table != null)
64			return table.containsKey(key);
65		else
66			return false;
67	}
68
69	public boolean hasVariables() {
70		if(table != null && !table.isEmpty())
71			return true;
72		else 
73			return false;
74	}
75}
76
77// End of XTreeNode.java
78