1 /*
2 * Copyright (C) 2004 TiongHiang Lee
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Email: thlee@onemindsoft.org
19 */
20
21 package org.onemind.commons.java.datastructure;
22
23 import java.util.Map;
24
25 /***
26 * A name table interface
27 * @author TiongHiang Lee (thlee@onemindsoft.org)
28 */
29 public interface Nametable
30 {
31
32 /***
33 * Declare a variable in the name table
34 * @param name the name
35 * @param value the value
36 */
37 void declare(String name, Object value);
38
39 /***
40 * Assign a variable in the name table
41 * @param name the name
42 * @param value the value
43 * @return the old value, or null
44 */
45 Object assign(String name, Object value);
46
47 /***
48 * Whether the nametable contains the name
49 * @param name the name
50 * @return true if contains the name
51 */
52 boolean containsName(String name);
53
54 /***
55 * Access the value associated with name
56 * @param name
57 * @return
58 */
59 Object access(String name);
60
61 /***
62 * Undeclare the name
63 * @param name
64 */
65 void undeclare(String name);
66
67 /***
68 * Return map representation of this nametable
69 * @return unmodifiable map representation of this nametable
70 */
71 Map asMap();
72 }