1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 }