org.onemind.commons.java.datastructure
Class SimpleNametable

java.lang.Object
  extended byorg.onemind.commons.java.datastructure.SimpleNametable
All Implemented Interfaces:
Nametable

public class SimpleNametable
extends java.lang.Object
implements Nametable

A simple implementation of nametable

Author:
TiongHiang Lee (thlee@onemindsoft.org)

Constructor Summary
SimpleNametable(java.util.Map m)
          Constructor
 
Method Summary
 java.lang.Object access(java.lang.String name)
          Access the value associated with name
 java.util.Map asMap()
          Return the name table as a map
 java.lang.Object assign(java.lang.String name, java.lang.Object value)
          Assign a variable in the name table
 boolean containsName(java.lang.String name)
          Whether the nametable contains the name
 void declare(java.lang.String name, java.lang.Object value)
          Declare a variable in the name table
 java.lang.String toString()
           
 void undeclare(java.lang.String name)
          Undeclare the name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleNametable

public SimpleNametable(java.util.Map m)
Constructor

Parameters:
m - the name
Method Detail

declare

public void declare(java.lang.String name,
                    java.lang.Object value)
Declare a variable in the name table

Specified by:
declare in interface Nametable
Parameters:
name - the name
value - the value

assign

public java.lang.Object assign(java.lang.String name,
                               java.lang.Object value)
Assign a variable in the name table

Specified by:
assign in interface Nametable
Parameters:
name - the name
value - the value
Returns:
the old value, or null

containsName

public boolean containsName(java.lang.String name)
Whether the nametable contains the name

Specified by:
containsName in interface Nametable
Parameters:
name - the name
Returns:
true if contains the name

access

public java.lang.Object access(java.lang.String name)
Access the value associated with name

Specified by:
access in interface Nametable
Parameters:
name -
Returns:

undeclare

public void undeclare(java.lang.String name)
Undeclare the name

Specified by:
undeclare in interface Nametable
Parameters:
name -

toString

public java.lang.String toString()

asMap

public java.util.Map asMap()
Return the name table as a map

Specified by:
asMap in interface Nametable
Returns:
unmodifiable map representation of the name table


Copyright © 2004-2006 . All Rights Reserved.