water.parser
Class Enum

java.lang.Object
  extended by water.Iced
      extended by water.parser.Enum
All Implemented Interfaces:
java.lang.Cloneable, Freezable

public final class Enum
extends Iced
implements java.lang.Cloneable

Class for tracking enum columns. Basically a wrapper around non blocking hash map. In the first pass, we just collect set of unique strings per column (if there are less than MAX_ENUM_SIZE unique elements). After pass1, the keys are sorted and indexed alphabetically. In the second pass, map is used only for lookup and never updated. Enum objects are shared among threads on the local nodes!


Field Summary
static int MAX_ENUM_SIZE
           
 
Constructor Summary
Enum()
           
 
Method Summary
 long addedElems()
           
 void addKey(java.lang.String str)
           
 int addKey(ValueString str)
          Add key to this map (treated as hash set in this case).
 Enum clone()
           
 java.lang.String[] computeColumnDomain()
           
 boolean containsKey(java.lang.Object key)
           
 int getTokenId(java.lang.String str)
           
 int getTokenId(ValueString str)
           
 boolean isKilled()
           
 void kill()
           
 int maxId()
           
 void merge(Enum other)
           
 Enum read(AutoBuffer ab)
          Deserialize from the AutoBuffer into a pre-existing 'this' object.
 int size()
           
 java.lang.String toString()
           
 AutoBuffer write(AutoBuffer ab)
          Serialize the 'this' object into the AutoBuffer, returning the AutoBuffer.
 
Methods inherited from class water.Iced
frozenType, init, newInstance, toDocField, writeJSON, writeJSONFields
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_ENUM_SIZE

public static final int MAX_ENUM_SIZE
See Also:
Constant Field Values
Constructor Detail

Enum

public Enum()
Method Detail

clone

public Enum clone()
Overrides:
clone in class Iced

addKey

public int addKey(ValueString str)
Add key to this map (treated as hash set in this case). All keys are added with value = 1.

Parameters:
str -

containsKey

public final boolean containsKey(java.lang.Object key)

addKey

public void addKey(java.lang.String str)

getTokenId

public int getTokenId(java.lang.String str)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addedElems

public long addedElems()

getTokenId

public int getTokenId(ValueString str)

merge

public void merge(Enum other)

maxId

public int maxId()

size

public int size()

isKilled

public boolean isKilled()

kill

public void kill()

computeColumnDomain

public java.lang.String[] computeColumnDomain()

write

public AutoBuffer write(AutoBuffer ab)
Description copied from interface: Freezable
Serialize the 'this' object into the AutoBuffer, returning the AutoBuffer.

Specified by:
write in interface Freezable
Overrides:
write in class Iced

read

public Enum read(AutoBuffer ab)
Description copied from interface: Freezable
Deserialize from the AutoBuffer into a pre-existing 'this' object.

Specified by:
read in interface Freezable
Overrides:
read in class Iced