EList
From Erights
Kevin Reid (Talk | contribs) m (noincluded too much) |
Kevin Reid (Talk | contribs) (fixed up some arg/return types, wrote some doc/test) |
||
Line 11: | Line 11: | ||
{{XXX|Used a program to generate this list of msgdoc headers from E-on-Java. Clean up and write specs.}} | {{XXX|Used a program to generate this list of msgdoc headers from E-on-Java. Clean up and write specs.}} | ||
- | {{instance msgdoc|add|1|<var>_</var> | + | {{instance msgdoc|add|1|<var>_</var>|[[ConstList]]}} |
- | {{instance msgdoc|asKeys|0||[ | + | {{instance msgdoc|asKeys|0||[[ConstMap]]}} |
- | {{instance msgdoc|asMap|0||[ | + | {{instance msgdoc|asMap|0||[[ConstMap]]}} |
- | {{instance msgdoc|asSet|0||[ | + | {{instance msgdoc|asSet|0||[[ConstSet]]}} |
{{instance msgdoc|contains|1|<var>_</var> :null|[[Boolean]]}} | {{instance msgdoc|contains|1|<var>_</var> :null|[[Boolean]]}} | ||
- | {{instance msgdoc|diverge|0||[ | + | {{instance msgdoc|diverge|0||[[FlexList]]}} |
- | {{instance msgdoc|diverge|1|<var>_</var> : | + | {{instance msgdoc|diverge|1|<var>_</var> :[[Guard]]|[[FlexList]]}} |
- | {{instance msgdoc|fetch|2|<var> | + | {{instance msgdoc|fetch|2|<var>index</var> :[[Integer]], <var>_</var> :[[Thunk]]|[[any]]}} |
{{instance msgdoc|get|1|<var>index</var> :[[Integer]]|<var>valueType</var>}} | {{instance msgdoc|get|1|<var>index</var> :[[Integer]]|<var>valueType</var>}} | ||
Line 47: | Line 47: | ||
{{instance msgdoc|getArray|1|<var>_</var> :nullOk[Class]|[[any]]}} | {{instance msgdoc|getArray|1|<var>_</var> :nullOk[Class]|[[any]]}} | ||
- | {{instance msgdoc|getArray|3|<var>_</var> :nullOk[Class], <var>_</var> : | + | {{instance msgdoc|getArray|3|<var>_</var> :nullOk[Class], <var>_</var> :[[Integer]], <var>_</var> :[[Integer]]|[[any]]}} |
{{instance msgdoc|includes|1|<var>_</var> :nullOk[EList]|[[Boolean]]}} | {{instance msgdoc|includes|1|<var>_</var> :nullOk[EList]|[[Boolean]]}} | ||
- | {{instance msgdoc|indexOf1|1|<var>_</var> | + | {{instance msgdoc|indexOf1|1|<var>_</var>|[[Integer]]}} |
- | {{instance msgdoc|indexOf1|2|<var>_</var> | + | {{instance msgdoc|indexOf1|2|<var>_</var>, <var>_</var> :[[Integer]]|[[Integer]]}} |
- | {{instance msgdoc|iterate|1|<var> | + | {{instance msgdoc|iterate|1|<var>assocFunc</var> :[[AssocFunc]]|[[void]]}} |
{{instance msgdoc|last|0||[[any]]}} | {{instance msgdoc|last|0||[[any]]}} | ||
- | {{instance msgdoc|lastIndexOf1|1|<var>_</var> | + | {{instance msgdoc|lastIndexOf1|1|<var>_</var>|[[Integer]]}} |
- | {{instance msgdoc|lastIndexOf1|2|<var>_</var> | + | {{instance msgdoc|lastIndexOf1|2|<var>_</var>, <var>_</var> :[[Integer]]|[[Integer]]}} |
- | {{instance msgdoc|lastStartOf|1|<var>_</var> : | + | {{instance msgdoc|lastStartOf|1|<var>_</var> :[[EList]]|[[Integer]]}} |
- | {{instance msgdoc|lastStartOf|2|<var>_</var> : | + | {{instance msgdoc|lastStartOf|2|<var>_</var> :[[EList]], <var>_</var> :[[Integer]]|[[Integer]]}} |
- | {{instance msgdoc|multiply|1|<var>_</var> : | + | {{instance msgdoc|multiply|1|<var>_</var> :[[Integer]]|[[ConstList]]}} |
- | {{instance msgdoc|printOn|4|<var>_</var> : | + | {{instance msgdoc|printOn|4|<var>_</var> :String, <var>_</var> :String, <var>_</var> :String, <var>out</var> :TextWriter|[[void]]}} |
- | {{instance msgdoc|readOnly|0||[ | + | {{instance msgdoc|readOnly|0||[[EList]]}} |
+ | |||
+ | Return an EList which is a read-only view of this list. If this list is immutable the result may be the same as this list. | ||
{{instance msgdoc|run|2|<var>start</var> :[[Integer]], <var>end</var> :[[Integer]]}} :[[ConstList]] | {{instance msgdoc|run|2|<var>start</var> :[[Integer]], <var>end</var> :[[Integer]]}} :[[ConstList]] | ||
Line 97: | Line 99: | ||
- | {{instance msgdoc|size|0||[[ | + | {{instance msgdoc|size|0||[[Integer]]}} |
- | + | Return the current number of elements of this list. | |
- | + | ? abcd.size() | |
+ | # value: 4 | ||
- | {{instance msgdoc| | + | {{instance msgdoc|snapshot|0||[[ConstList]]}} |
- | + | Return a ConstList with the current elements of this list. | |
- | {{ | + | {{XXX|test this vs. mutation}} |
- | {{instance msgdoc|valueType|0||[[ | + | ? abcd.snapshot() |
+ | # value: ["a", "b", "c", "d"] | ||
+ | |||
+ | {{instance msgdoc|sort|0||[[ConstList]]}} | ||
+ | |||
+ | {{instance msgdoc|sort|1|<var>_</var> :[[CompFunc]]|[[ConstList]]}} | ||
+ | |||
+ | {{instance msgdoc|startOf|1|<var>_</var> :[[EList]]|[[int32]]}} | ||
+ | |||
+ | {{instance msgdoc|startOf|2|<var>_</var> :[[EList]], <var>_</var> :[[Integer]]|[[int32]]}} | ||
+ | |||
+ | {{instance msgdoc|valueType|0||[[Guard]]}} | ||
+ | |||
+ | {{instance msgdoc|with|1|<var>new</var>|[[ConstList]]}} | ||
+ | |||
+ | Return a ConstList with the current elements of this list, followed by the one additional element <var>new</var>. | ||
+ | |||
+ | ? abcd.with("e") | ||
+ | # value: ["a", "b", "c", "d", "e"] | ||
+ | |||
+ | ? {{{fromConst|__identityFunc}}}([]).with(1) | ||
+ | # value: [1] | ||
- | {{ | + | {{XXX|more tests?}} |
- | {{instance msgdoc|with|2|<var>_</var> : | + | {{instance msgdoc|with|2|<var>_</var> :[[Integer]], <var>_</var> :null|[[ConstList]]}} |
<noinclude> | <noinclude> |
Revision as of 02:56, 17 March 2009
EList is the abstract supertype (XXX establish terminology: supertype or superclass?) of ConstList, FlexList, and ReadOnlyList. (XXX complete list?)
All indexing is zero-based. All ranges are specified as beginning index, inclusive, to ending index, exclusive (not inclusive end or location and size).
Protocol
? def abcd := __identityFunc(["a", "b", "c", "d"]); null
XXX Used a program to generate this list of msgdoc headers from E-on-Java. Clean up and write specs.
add/1
- Signature: add(_) :ConstList
asKeys/0
- Signature: asKeys() :ConstMap
asMap/0
- Signature: asMap() :ConstMap
asSet/0
- Signature: asSet() :ConstSet
contains/1
- Signature: contains(_ :null) :Boolean
diverge/0
- Signature: diverge() :FlexList
diverge/1
fetch/2
get/1
- Signature: get(index :Integer) :valueType
Return the element at index.
? abcd[0] # value: "a" ? abcd[2] # value: "c" ? abcd[-1] # problem: <XXX specify form of error> ? abcd[4] # problem: <XXX specify form of error>
getArray/0
- Signature: getArray() :any
getArray/1
- Signature: getArray(_ :nullOk[Class]) :any
getArray/3
includes/1
- Signature: includes(_ :nullOk[EList]) :Boolean
indexOf1/1
- Signature: indexOf1(_) :Integer
indexOf1/2
iterate/1
last/0
- Signature: last() :any
lastIndexOf1/1
- Signature: lastIndexOf1(_) :Integer
lastIndexOf1/2
lastStartOf/1
- Signature: lastStartOf(_ :EList) :Integer
lastStartOf/2
multiply/1
printOn/4
- Signature: printOn(_ :String, _ :String, _ :String, out :TextWriter) :void
readOnly/0
- Signature: readOnly() :EList
Return an EList which is a read-only view of this list. If this list is immutable the result may be the same as this list.
run/2
Return a ConstList containing the subsequence of elements in this list starting with element index start and ending with the element before index end.
? abcd.run(1, 3) # value: ["b", "c"] ? abcd.run(0, abcd.size()) # value: ["a", "b", "c", "d"] ? ESpec.requireWrongArgsFail(abcd, "run", [0..!(abcd.size()), 0..!(abcd.size())])
{{XXX the above 'ESpec' is an idea about defining some utilities
run/1
Equivalent to thisEList.run(start, thisEList.size())
.
? abcd.run(1) # value: ["b", "c", "d"] ? abcd.run(0) # value: ["a", "b", "c", "d"]
size/0
- Signature: size() :Integer
Return the current number of elements of this list.
? abcd.size() # value: 4
snapshot/0
- Signature: snapshot() :ConstList
Return a ConstList with the current elements of this list.
XXX test this vs. mutation
? abcd.snapshot() # value: ["a", "b", "c", "d"]
sort/0
- Signature: sort() :ConstList
sort/1
startOf/1
- Signature: startOf(_ :EList) :int32
startOf/2
valueType/0
- Signature: valueType() :Guard
with/1
- Signature: with(new) :ConstList
Return a ConstList with the current elements of this list, followed by the one additional element new.
? abcd.with("e") # value: ["a", "b", "c", "d", "e"] ? __identityFunc([]).with(1) # value: [1]
XXX more tests?
with/2
- Signature: with(_ :Integer, _ :null) :ConstList
- This page is a stub; it should be expanded with more information. If doing so, check the original E web site and the mailing list archives for content which could be moved into this page.