koala.dynamicjava.interpreter.context
Class VariableContext.Scope

java.lang.Object
  extended bykoala.dynamicjava.interpreter.context.VariableContext.Scope
Enclosing class:
VariableContext

protected static class VariableContext.Scope
extends java.lang.Object

A table which maps a string with an object


Nested Class Summary
protected static class VariableContext.Scope.Entry
          To manage collisions
protected static class VariableContext.Scope.EntryFactory
          To create an entry
 
Field Summary
protected  int count
          The number of entries
protected static int INITIAL_CAPACITY
          The initial capacity
protected static float LOAD_FACTOR
          The load factor
protected static java.lang.Object NO_SUCH_KEY
          The object used to notify that a key do not exists
protected  VariableContext.Scope.Entry[] table
          The underlying array
protected  int threshold
          The resizing threshold
 
Constructor Summary
VariableContext.Scope()
          Creates a new scope
 
Method Summary
 void clear()
          Clears this scope
 java.lang.Object get(java.lang.String key)
          Gets the value of a variable
 java.util.Set keySet()
          Returns a set that contains the keys
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Sets a new value for the given variable
protected  void rehash()
          Rehash the table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOAD_FACTOR

protected static final float LOAD_FACTOR
The load factor

See Also:
Constant Field Values

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
The initial capacity

See Also:
Constant Field Values

NO_SUCH_KEY

protected static final java.lang.Object NO_SUCH_KEY
The object used to notify that a key do not exists


table

protected VariableContext.Scope.Entry[] table
The underlying array


count

protected int count
The number of entries


threshold

protected int threshold
The resizing threshold

Constructor Detail

VariableContext.Scope

public VariableContext.Scope()
Creates a new scope

Method Detail

get

public java.lang.Object get(java.lang.String key)
Gets the value of a variable

Returns:
the value or NO_SUCH_KEY

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Sets a new value for the given variable

Returns:
the old value or NO_SUCH_KEY

keySet

public java.util.Set keySet()
Returns a set that contains the keys


clear

public void clear()
Clears this scope


rehash

protected void rehash()
Rehash the table



Copyright © 2001 Stephane Hillion. All Rights Reserved.