org.erights.e.elib.tables
Class ConstMapImpl

java.lang.Object
  |
  +--org.erights.e.elib.tables.EMap
        |
        +--org.erights.e.elib.tables.ConstMap
              |
              +--org.erights.e.elib.tables.ConstMapImpl
All Implemented Interfaces:
EPrintable, Iteratable, Marker, PassByConstruction, Persistent, Selfless, Serializable

class ConstMapImpl
extends ConstMap

Author:
Mark S. Miller

Field Summary
private  FlexMap myTable
          This class should never be directly unserialized, so this instance variable need not be declared serial.
private static long serialVersionUID
           
 
Fields inherited from class org.erights.e.elib.tables.ConstMap
EmptyMap
 
Fields inherited from class org.erights.e.elib.tables.EMap
 
Fields inherited from interface org.erights.e.elib.serial.PassByConstruction
HONORARY, HONORED_NAMES
 
Fields inherited from interface org.erights.e.elib.tables.Selfless
HONORARY, HONORED_NAMES
 
Fields inherited from interface org.erights.e.elib.serial.Persistent
HONORARY, HONORED_NAMES
 
Constructor Summary
(package private) ConstMapImpl(FlexMap map)
          Callers *MUST* be sure to hand in the only reference to this map.
 
Method Summary
 FlexMap diverge(Class keyType, Class valueType)
          Enabled: Returns a FlexMap whose initial state is a snapshot of the state of this map at the time of the diverge() request.
 Object get(Object key, Object instead)
          Enabled: What value does 'key' map to? Returns 'instead' if key doesn't map to anything.
 Object getKeys(Class type)
          Enabled: Returns a divergent array-of-type of all the keys in order.
 Object getValues(Class type)
          Enabled: Returns a divergent array-of-type of all the values in order.
 void iterate(AssocFunc func)
          Enabled: Call 'func' with each key-value pair in the table, in order.
 Class keyType()
          Enabled: All keys in this map must be of this type.
 int size()
          Enabled: How many entries are in the table?
 Class valueType()
          Enabled: All values in this map must be of this type
private  Object writeReplace()
          Unserialzes to a promise for 'ConstMapMaker.fromColumns(key, values)'
 
Methods inherited from class org.erights.e.elib.tables.ConstMap
__printOn, compareTo, domain, fromColumns, fromPairs, fromProperties, fromPropertiesString, GetMaker, getSpreadUncall, readOnly, snapshot, testProp
 
Methods inherited from class org.erights.e.elib.tables.EMap
and, butNot, contains, diverge, extract, get, getKeys, getPair, getPair, getValues, intersects, maps, optExtract, or, or, printOn, sortKeys, sortKeys, sortValues, sortValues, toString, with, without
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID

myTable

private final transient FlexMap myTable
This class should never be directly unserialized, so this instance variable need not be declared serial.

Constructor Detail

ConstMapImpl

ConstMapImpl(FlexMap map)
Callers *MUST* be sure to hand in the only reference to this map.

Method Detail

writeReplace

private Object writeReplace()
                     throws ObjectStreamException
Unserialzes to a promise for 'ConstMapMaker.fromColumns(key, values)'

ObjectStreamException

diverge

public FlexMap diverge(Class keyType,
                       Class valueType)
Description copied from class: EMap
Enabled: Returns a FlexMap whose initial state is a snapshot of the state of this map at the time of the diverge() request.

Further changes to the original and/or the new map are independent -- they diverge.

The new map is constrained to only hold associations from 'keyType' to 'valueType'. XXX keyType and valueType should be declared as ValueGuards rather than Classes.

Overrides:
diverge in class EMap

size

public int size()
Description copied from class: EMap
Enabled: How many entries are in the table?

Specified by:
size in class EMap

iterate

public void iterate(AssocFunc func)
Description copied from class: EMap
Enabled: Call 'func' with each key-value pair in the table, in order.

Specified by:
iterate in interface Iteratable
Overrides:
iterate in class EMap

get

public Object get(Object key,
                  Object instead)
Description copied from class: EMap
Enabled: What value does 'key' map to? Returns 'instead' if key doesn't map to anything.

Specified by:
get in class EMap
Parameters:
key - nullOk;
instead - nullOk;
Returns:
nullOk;
See Also:
org.erights.e.elib.ref.Ref#isSettled

getKeys

public Object getKeys(Class type)
Description copied from class: EMap
Enabled: Returns a divergent array-of-type of all the keys in order.

XXX Should 'type' be a ValueGuard rather than a Class?

Specified by:
getKeys in class EMap

getValues

public Object getValues(Class type)
Description copied from class: EMap
Enabled: Returns a divergent array-of-type of all the values in order.

XXX Should 'type' be a ValueGuard rather than a Class?

Specified by:
getValues in class EMap

keyType

public Class keyType()
Description copied from class: EMap
Enabled: All keys in this map must be of this type.

XXX Should this return a ValueGuard rather than a Class?

Specified by:
keyType in class EMap

valueType

public Class valueType()
Description copied from class: EMap
Enabled: All values in this map must be of this type

XXX Should this return a ValueGuard rather than a Class?

Specified by:
valueType in class EMap


comments?