|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elib.tables.EList | +--org.erights.e.elib.tables.ROList
A ROList gives read-only access to an underlying potentially mutable list.
org.erights.e.elib.tables.ConstList
,
org.erights.e.elib.tables.FlexList
Field Summary | |
private FlexList |
myPrecious
the list we're protecting |
(package private) static long |
serialVersionUID
|
Fields inherited from interface org.erights.e.elib.serial.PassByProxy |
HONORARY, HONORED_NAMES |
Fields inherited from interface org.erights.e.elib.serial.Persistent |
HONORARY, HONORED_NAMES |
Constructor Summary | |
(package private) |
ROList(FlexList precious)
|
Method Summary | |
void |
__printOn(TextWriter out)
Not transparently forwarded. |
ConstList |
add(Object other)
Enabled: Concatenates (snapshots of) this list and other. |
ConstMap |
asKeys()
Enabled: Turns [a, b, ...] into [a => null, b => null, ...] |
ConstMap |
asMap()
Enabled: Turns [a, b, ...] into [0 => a, 1 => b, ...] |
boolean |
contains(Object candidate)
Enabled: Does the candidate appear as a value in this list? |
FlexList |
diverge(Class valueType)
Enabled: Returns a FlexList whose initial state is a snapshot of the state of this list at the time of the diverge() request. |
Object |
get(int index)
Enabled: What value does 'index' map to? |
boolean |
includes(EList candidate)
Enabled: Does this list include candidate as a sub-list? |
int |
indexOf1(Object candidate)
Enabled: The first index at which 'candidate' appears in this list, or -1 if none. |
int |
indexOf1(Object candidate,
int start)
Enabled: The first index >= 'start' at which 'candidate' appears in this list, or -1 if none. |
void |
iterate(AssocFunc func)
Enabled: Call 'func' with each index-value pair in the table in order. |
int |
lastIndexOf1(Object candidate)
Enabled: The last index at which 'candidate' appears in this list, or -1 if none. |
int |
lastIndexOf1(Object candidate,
int start)
Enabled: The last index <= 'start' at which 'candidate' appears in this list, or -1 if none. |
int |
lastStartOf(EList candidate)
Enabled: The last index at which 'candidate' begins as a sub-list of this list, or -1 if none. |
int |
lastStartOf(EList candidate,
int start)
Enabled: The last index <= start at which 'candidate' appears as a sub-list of this list, or -1 if none. |
ConstList |
multiply(int n)
Enabled: Return the result of concatenating n snapshots of this list |
SealedBox |
optSealedDispatch(Brand brand)
Divulges itself only to a holder of PersistentKeyHolder.THE_UNSEALER . |
EList |
readOnly()
Just returns itself rather than forwarding |
ConstList |
run(int start,
int bound)
Enabled: Returns a snapshot of the sublist from 'start' (inclusive) to 'bound' (exclusive). |
ConstList |
run(Object intReg)
Enabled: Returns a snapshot of the run at intReg. |
int |
size()
Enabled: How many entries are in the list? |
ConstList |
snapshot()
Enabled: Returns a ConstList whose state is a snapshot of the state of this list at the time of the snapshot() request. |
int |
startOf(EList candidate)
Enabled: The first index at which 'candidate' begins as a sub-list of this list, or -1 if none. |
int |
startOf(EList candidate,
int start)
Enabled: The first index >= start at which 'candidate' begins as a sub-list of this list, or -1 if none. |
Class |
valueType()
Enabled: All values in this table must be of this type |
Methods inherited from class org.erights.e.elib.tables.EList |
asSet, diverge, getArray, getArray, getArray, last, printOn, sort, sort, toString, with, with |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final long serialVersionUID
private final FlexList myPrecious
Constructor Detail |
ROList(FlexList precious)
Method Detail |
public ConstList snapshot()
EList
snapshot
in class EList
public EList readOnly()
readOnly
in class EList
public FlexList diverge(Class valueType)
EList
Further changes to the original and/or the new list are independent -- they diverge.
The new list is constrained to only hold values of 'valueType'. XXX valueType should be of type ValueGuard rather than Class.
diverge
in class EList
public Object get(int index) throws IndexOutOfBoundsException
EList
get
in class EList
IndexOutOfBoundsException
- if index isn't in 0..!size.public boolean contains(Object candidate)
EList
contains
in class EList
public int size()
EList
size
in class EList
public void iterate(AssocFunc func)
EList
iterate
in interface Iteratable
iterate
in class EList
public Class valueType()
EList
XXX Should this return a ValueGuard rather than a Class?
valueType
in class EList
public ConstList add(Object other)
EList
XXX If they have a common class, we should use it.
The default implementation here insists that other coerces to an EList, but this is overridden in the Twine subclass.
add
in class EList
public ConstList multiply(int n)
EList
multiply
in class EList
public ConstMap asMap()
EList
asMap
in class EList
public ConstMap asKeys()
EList
asKeys
in class EList
public boolean includes(EList candidate)
EList
includes
in class EList
public ConstList run(Object intReg)
EList
run
in class EList
public ConstList run(int start, int bound)
EList
run
in class EList
public int indexOf1(Object candidate)
EList
indexOf1
in class EList
public int indexOf1(Object candidate, int start)
EList
indexOf1
in class EList
public int lastIndexOf1(Object candidate)
EList
Note that choosing '-1' leads to a programming pun that's too tempting to avoid (though it should be documented). If you want the index of, for example, the beginning of the last dot-separated substring of a string, you can say "lastIndexOf1('.')+1". If there is no dot, this returns 0, which is the correct answer for this case.
lastIndexOf1
in class EList
public int lastIndexOf1(Object candidate, int start)
EList
lastIndexOf1
in class EList
public int startOf(EList candidate)
EList
startOf
in class EList
public int startOf(EList candidate, int start)
EList
startOf
in class EList
public int lastStartOf(EList candidate)
EList
lastStartOf
in class EList
public int lastStartOf(EList candidate, int start)
EList
lastStartOf
in class EList
public SealedBox optSealedDispatch(Brand brand)
PersistentKeyHolder.THE_UNSEALER
.
XXX Should provide an optional creation-time parameter of a Sealer to use in addition (or instead?) as a secret divulging channel.
optSealedDispatch
in interface Amplifiable
brand
-
public void __printOn(TextWriter out) throws IOException
"[a, b, ...].diverge().readOnly()"
__printOn
in interface EPrintable
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |