org.erights.e.elib.tables
Class ConstMap

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

public abstract class ConstMap
extends EMap
implements PassByConstruction, Selfless

Safe:

See Also:
Serialized Form

Field Summary
private static StaticMaker ConstMapMaker
           
static ConstMap EmptyMap
          Enabled: The canonical empty ConstMap
private static long serialVersionUID
           
 
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) ConstMap()
          Only subclasses within the package
 
Method Summary
 void __printOn(TextWriter out)
          Enabled: Prints using E language notation
 double compareTo(ConstMap other)
          Enabled: This method enables E's magnitude comparison operators (<, <=, <=>, >=, >) to express subset-ness of the domains of ConstMaps.
 ESet domain()
          Enabled: The domain of a ConstMap is always a ConstSet, but is declared as an ESet because Java's type system doesn't allow covariant return types.
static ConstMap fromColumns(ConstList keys, ConstList vals)
          Enabled: Used by my getSpreadUncall
static ConstMap fromPairs(Object[][] pairs)
          Enabled: Used in the expansion of E's map syntax
static ConstMap fromProperties(Properties props)
          Enabled:
static ConstMap fromPropertiesString(String propsString)
          Enabled:
static StaticMaker GetMaker()
          Enabled: The static variable cache is initialized lazily to avoid circular static initialization dependency with StaticMaker.
 Object[] getSpreadUncall()
          Enabled: Uses 'ConstMapMaker.fromColumns(key, values)'
 EMap readOnly()
          Enabled: Returns itself
 ConstMap snapshot()
          Enabled: Returns itself
static boolean testProp(ConstMap props, String propName)
          Enabled: Test the setting of a boolean property.
 
Methods inherited from class org.erights.e.elib.tables.EMap
and, butNot, contains, diverge, diverge, extract, get, get, getKeys, getKeys, getPair, getPair, getValues, getValues, intersects, iterate, keyType, maps, optExtract, or, or, printOn, size, sortKeys, sortKeys, sortValues, sortValues, toString, valueType, 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

ConstMapMaker

private static StaticMaker ConstMapMaker

EmptyMap

public static final ConstMap EmptyMap
Enabled: The canonical empty ConstMap

Constructor Detail

ConstMap

ConstMap()
Only subclasses within the package

Method Detail

GetMaker

public static StaticMaker GetMaker()
Enabled: The static variable cache is initialized lazily to avoid circular static initialization dependency with StaticMaker.


getSpreadUncall

public Object[] getSpreadUncall()
Enabled: Uses 'ConstMapMaker.fromColumns(key, values)'

Specified by:
getSpreadUncall in interface Selfless

snapshot

public ConstMap snapshot()
Enabled: Returns itself

Specified by:
snapshot in class EMap

readOnly

public EMap readOnly()
Enabled: Returns itself

Specified by:
readOnly in class EMap

domain

public ESet domain()
Enabled: The domain of a ConstMap is always a ConstSet, but is declared as an ESet because Java's type system doesn't allow covariant return types.

Specified by:
domain in class EMap

compareTo

public double compareTo(ConstMap other)
Enabled: This method enables E's magnitude comparison operators (<, <=, <=>, >=, >) to express subset-ness of the domains of ConstMaps.

If this ConstMap's domain is a strict subset of other's, return -1.0. If this ConstMap has the same domain as other, return 0.0. If this ConstMap's domain is a strict superset of other's, return 1.0. Otherwise return NaN. The canonical implementation of ConstMap (ConstMapImpl) recursively turns the question around of this ConstMap's size() is smaller that other's. Therefore, the base case is one in which this ConstMap's size() is >= other's. Therefore, alternate implementations of ConstMaps must also treat this as the base case. XXX security implications?


__printOn

public void __printOn(TextWriter out)
               throws IOException
Enabled: Prints using E language notation

Specified by:
__printOn in interface EPrintable
IOException

fromPairs

public static ConstMap fromPairs(Object[][] pairs)
Enabled: Used in the expansion of E's map syntax


fromColumns

public static ConstMap fromColumns(ConstList keys,
                                   ConstList vals)
                            throws ArityMismatchException
Enabled: Used by my getSpreadUncall

ArityMismatchException

fromProperties

public static ConstMap fromProperties(Properties props)
Enabled:


fromPropertiesString

public static ConstMap fromPropertiesString(String propsString)
                                     throws UnsupportedEncodingException,
                                            IOException
Enabled:

UnsupportedEncodingException
IOException

testProp

public static boolean testProp(ConstMap props,
                               String propName)
Enabled: Test the setting of a boolean property.

A boolean property is true if its (String) value is "true", and false if it's absent, or if its string value is "false" or "allow".

XXX ConstMap is a silly place for this method, but where should it go? XXX Should the comparison be case insensitive?

Parameters:
props - A ConstMap representing the Properties
propName - The name of the property to test
Returns:
the value of the property as a boolean.
Throws:
IllegalArgumentException - if propValue is neither "true", nor "false", nor "allow"


comments?