Enhanced C#
Language of your choice: library documentation
|
A list of non-null references to LNode. More...
A list of non-null references to LNode.
Users of Loyc trees previously needed to refer directly to VList<LNode> so they were dependent on which list implementation is used, which is unfortunate. It is nice to have the freedom of a struct for the node list so that implementations like VList are possible, but to refer to VList by name prevents easily changing list representations.
In the future we'll probably move away from VList as a representation, mainly so that Loyc.Syntax.dll does not need to take a dependency on Loyc.Collections.dll. This struct will aid the transition.
For now, there are implicit conversions between VList<LNode> and LNodeList. These will be removed eventually.
A disadvantage of this approach is that C# does not support user-defined conversions to interfaces. Therefore, conversion to IReadOnlyList will box the wrapper instead of the underlying implementation. Ugh.
This change is issue #100: https://github.com/qwertie/ecsharp/issues/100
Public fields | |
LNode | this[int index, LNode defaultValue] => _list[index |
LNode | defaultValue |
int | Count => _list.Count |
bool | IsReadOnly => false |
bool | IsEmpty => _list.IsEmpty |
LNode | Last => _list.Last |
Public static fields | |
static readonly LNodeList | Empty = new LNodeList() |
Properties | |
LNode | this[int index] [get, set] |
Public Member Functions | |
LNodeList (LNode item_0) | |
LNodeList (LNode item_0, LNode item_1) | |
LNodeList (params LNode[] items) | |
LNodeList (IEnumerable< LNode > items) | |
LNodeList (VList< LNode > list) | |
void ICollection< LNode >. | Add (LNode item) |
LNodeList | Add (LNode item) |
void | Clear () |
bool | Contains (LNode item) |
void | CopyTo (LNode[] array, int arrayIndex) |
IEnumerator< LNode > | GetEnumerator () |
int | IndexOf (LNode item) |
void IList< LNode >. | Insert (int index, LNode item) |
LNodeList | Insert (int index, LNode item) |
bool | Remove (LNode item) |
void IList< LNode >. | RemoveAt (int index) |
LNodeList | RemoveAt (int index) |
IRange< LNode > IListSource< LNode >. | Slice (int start, int count) |
Slice_< LNode > | Slice (int start, int count=int.MaxValue) |
LNode | TryGet (int index, out bool fail) |
IEnumerator IEnumerable. | GetEnumerator () |
LNodeList ICloneable< LNodeList >. | Clone () |
LNodeList | First (int count) |
LNodeList | Initial (int count) |
LNodeList | Final (int count) |
LNodeList | WithoutLast (int count) |
LNodeList | SmartSelect (Func< LNode, LNode > map) |
Maps a list to another list of the same length. More... | |
LNodeList | SmartSelectMany (Func< LNode, IReadOnlyList< LNode >> map) |
Maps a list to another list by concatenating the outputs of a mapping function. More... | |
LNodeList | SmartWhere (Func< LNode, bool > filter) |
Filters the list, returning the same list if the filter function returns true for every item. More... | |
LNodeList | WhereSelect (Func< LNode, Maybe< LNode >> filter) |
Filters and maps a list with a user-defined function. More... | |
LNodeList | AddRange (VList< LNode > list) |
LNodeList | AddRange (LNodeList list) |
LNodeList | AddRange (IReadOnlyList< LNode > list) |
LNodeList | AddRange (IEnumerable< LNode > list) |
LNodeList | InsertRange (int index, IReadOnlyList< LNode > list) |
LNodeList | RemoveRange (int index, int count) |
LNode | Pop () |
bool | Equals (LNodeList other) |
override bool | Equals (object rhs) |
override int | GetHashCode () |
override string | ToString () |
Public Member Functions inherited from Loyc.ICloneable< LNodeList > | |
T | Clone () |
Static Public Member Functions | |
static implicit | operator LNodeList (VList< LNode > list) |
static implicit | operator VList< LNode > (LNodeList list) |
static bool | operator== (LNodeList lhs, LNodeList rhs) |
Returns whether the two list references are the same. Does not compare the contents of the lists. More... | |
static bool | operator!= (LNodeList lhs, LNodeList rhs) |
Returns whether the two list references are different. Does not compare the contents of the lists. More... | |
Returns whether the two list references are different. Does not compare the contents of the lists.
Returns whether the two list references are the same. Does not compare the contents of the lists.
Maps a list to another list of the same length.
map | A function that transforms each item in the list. |
This method is called "Smart" because of what happens if the map doesn't do anything. If the map function returns the first N items unmodified, those N items are typically not copied, but shared between the existing list and the new one. This is useful for functional code that often processes a list without modifying it at all.
Maps a list to another list by concatenating the outputs of a mapping function.
map | A function that transforms each item in the list to a list of items. |
map
.This method is called "Smart" because of what happens if the map returns the same list again. If, for the first N items, the map
returns a list of length 1, and that one item is the same item that was passed in, then those N items are typically not copied, but shared between the existing list and the new one. This is useful for functional code that often processes a list without modifying it at all.
Filters the list, returning the same list if the filter function returns true for every item.
Referenced by Loyc.Syntax.LNodeExt.WithoutTrailingTrivia().
Filters and maps a list with a user-defined function.
filter | A function that chooses which items to include in a new list, and what to change them to. |
This is a smart function. If the filter does not modify the first N items it is passed (which are the last items in a FVList), those N items are typically not copied, but shared between the existing list and the new one.
Referenced by Loyc.Syntax.CallNode.Select().