org.erights.e.elib.tables
Class ConstList

java.lang.Object
  |
  +--org.erights.e.elib.tables.EList
        |
        +--org.erights.e.elib.tables.ConstList
All Implemented Interfaces:
EPrintable, Guard, Iteratable, Marker, PassByConstruction, Persistent, Selfless, Serializable, SlotGuard, ValueGuard
Direct Known Subclasses:
ConstListImpl, Twine

public abstract class ConstList
extends EList
implements Guard, PassByConstruction, Selfless

Safe: A ConstList is an immutable list that simplifies to an array or String, which is Selfless and pass by construction.

A ConstList can be compared for partial ordering with other ConstLists.

As a special case, a ConstList all of whose elements are DeepPassByCopy is itself considered to be DeepPassByCopy by Ref.isDeepPassByCopy/1.

Author:
Mark S. Miller
See Also:
Serialized Form

Field Summary
private static StaticMaker ConstListMaker
          Initialized lazily to avoid circular initialization.
private static Object[] EmptyArray
           
static ConstList EmptyList
          Enabled: The canonical empty ConstList
private static long serialVersionUID
           
 
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) ConstList()
          Only subclasses within the package
 
Method Summary
 Object[] __optUncall()
          Enabled: Ensure the public overrides in non-public subclasses are actually public.
 void __printOn(TextWriter out)
          Enabled: Prints using E list syntax
 boolean accepts(Object specimen)
          Enabled: Virtually inherit from BaseGuard
 Guard and(Guard other)
          Enabled:
 Guard butNot(Guard other)
          Enabled:
 Object coerce(Object specimen)
          Enabled: Virtually inherit from BaseGuard
 Object coerce(Object specimen, OneArgFunc optEjector)
          Enabled: Given that this list is a list of ValueGuards and that the specimen is a ConstList of the same size, coerces each element of specimen by the corresponding element of myself and return a ConstList of the resulting values.
 double compareTo(ConstList other)
          Enabled: Ordered by lexicographic ordering of the elements.
 double compareTo(ConstList other, CompFunc compFunc)
          Enabled: Like one-arg compareTo, but uses the provided compFunc to compare the elements.
static ConstList fromArray(Object oldArray)
          Enabled:
static ConstList fromArray(Object oldArray, int start, int bound)
          Enabled:
 Guard get()
          Enabled: Virtually inherit from BaseGuard
static StaticMaker GetMaker()
          Enabled:
 String getName()
          Enabled:
 Slot makeSlot(Object specimen)
          Enabled: Virtually inherit from BaseGuard
 Slot makeSlot(Object specimen, OneArgFunc optEjector)
          Enabled: Virtually inherit from BaseGuard
static Object match(String verb, ConstList args)
          Suppressed: This defines the matcher of the ConstListMaker -- the StaticMaker on the class ConstList -- to respond to a "run" method of any arity by returning the list of arguments as a list.
 Guard not()
          Enabled:
 Guard or(Guard other)
          Enabled:
 EList readOnly()
          Enabled: Just returns itself
 ConstList snapshot()
          Enabled: Just returns itself
 Guard xor(Guard other)
          Enabled:
 
Methods inherited from class org.erights.e.elib.tables.EList
add, asKeys, asMap, asSet, contains, diverge, diverge, get, getArray, getArray, getArray, includes, indexOf1, indexOf1, iterate, last, lastIndexOf1, lastIndexOf1, lastStartOf, lastStartOf, multiply, printOn, run, run, size, sort, sort, startOf, startOf, toString, valueType, with, with
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.erights.e.elib.tables.Selfless
getSpreadUncall
 

Field Detail

serialVersionUID

private static final long serialVersionUID

ConstListMaker

private static StaticMaker ConstListMaker
Initialized lazily to avoid circular initialization.


EmptyArray

private static final Object[] EmptyArray

EmptyList

public static final ConstList EmptyList
Enabled: The canonical empty ConstList

Constructor Detail

ConstList

ConstList()
Only subclasses within the package

Method Detail

GetMaker

public static StaticMaker GetMaker()
Enabled:


fromArray

public static ConstList fromArray(Object oldArray)
Enabled:


fromArray

public static ConstList fromArray(Object oldArray,
                                  int start,
                                  int bound)
Enabled:


match

public static Object match(String verb,
                           ConstList args)
                    throws NoSuchMethodException
Suppressed: This defines the matcher of the ConstListMaker -- the StaticMaker on the class ConstList -- to respond to a "run" method of any arity by returning the list of arguments as a list.

If this were a method of an instance, we'd declare the instance to implement org.erights.e.elib.prim.JMatcher.

Parameters:
verb -
args -
Returns:
Throws:
NoSuchMethodException - if the verb isn't "run"

snapshot

public ConstList snapshot()
Enabled: Just returns itself

Specified by:
snapshot in class EList

readOnly

public EList readOnly()
Enabled: Just returns itself

Specified by:
readOnly in class EList

compareTo

public double compareTo(ConstList other)
Enabled: Ordered by lexicographic ordering of the elements. In other words, the ordering is the same as the ordering of the first unequal comparison, in left-to-right order. If all compare equal but one list is shorter, the shorter list is less than the longer list.


compareTo

public double compareTo(ConstList other,
                        CompFunc compFunc)
Enabled: Like one-arg compareTo, but uses the provided compFunc to compare the elements.


getName

public String getName()
Enabled:

Specified by:
getName in interface SlotGuard

coerce

public Object coerce(Object specimen,
                     OneArgFunc optEjector)
Enabled: Given that this list is a list of ValueGuards and that the specimen is a ConstList of the same size, coerces each element of specimen by the corresponding element of myself and return a ConstList of the resulting values.

Redundant with org.erights.e.elib.slot.TupleGuard. Should refactor ConstList to delegate to TupleGuard.

Specified by:
coerce in interface ValueGuard

coerce

public Object coerce(Object specimen)
Enabled: Virtually inherit from BaseGuard

Specified by:
coerce in interface Guard

accepts

public boolean accepts(Object specimen)
Enabled: Virtually inherit from BaseGuard

Specified by:
accepts in interface Guard

makeSlot

public Slot makeSlot(Object specimen)
Enabled: Virtually inherit from BaseGuard

Specified by:
makeSlot in interface Guard

makeSlot

public Slot makeSlot(Object specimen,
                     OneArgFunc optEjector)
Enabled: Virtually inherit from BaseGuard

Specified by:
makeSlot in interface SlotGuard

get

public Guard get()
Enabled: Virtually inherit from BaseGuard

Specified by:
get in interface Guard

or

public Guard or(Guard other)
Enabled:

Specified by:
or in interface Guard
Parameters:
other -
Returns:

and

public Guard and(Guard other)
Enabled:

Specified by:
and in interface Guard
Parameters:
other -
Returns:

not

public Guard not()
Enabled:

Specified by:
not in interface Guard
Returns:

butNot

public Guard butNot(Guard other)
Enabled:

Specified by:
butNot in interface Guard
Parameters:
other -
Returns:

xor

public Guard xor(Guard other)
Enabled:

Specified by:
xor in interface Guard
Parameters:
other -
Returns:

__optUncall

public Object[] __optUncall()
Enabled: Ensure the public overrides in non-public subclasses are actually public.

The default implementation here just delegates to MirandaMethods.__optUncall(java.lang.Object).


__printOn

public void __printOn(TextWriter out)
               throws IOException
Enabled: Prints using E list syntax

Specified by:
__printOn in interface EPrintable
IOException


comments?