Type parameters:
| T | Type of data in twig. |
Properties
CommonMetaData
#Gets the common meta data in this twig. This means the meta data shared amongst all non-null items. Any conflicting meta data (i.e. identical name, different values) will be omitted from this result.
Implements: CommonMetaData
Constraint
#Gets the type constraint for this twig. Since each ITwig instance is some form of Twig<T>, this property tells you what T is.
Implements: Constraint
NullCount
#Gets the number of items in this twig that are nulls. Note: even when a twig contains ValueTypes, it may still have nulls.
Implements: NullCount
TightConstraint
#Gets the type which is common to all values stored in this twig. This is potentially quite an expensive property to call and its value is not cached internally. If the twig contains no values at all, the return value is somewhat undefined but will either be object or ITwig.Constraint.
Implements: TightConstraint
Indexers
Methods
Add
#Add an item with meta data to this twig.
AddRange
#Add a collection of item/data pears to this twig. This is the fastest AddRange method, especially if the pears argument is in fact an array of pears.
Apply
#Apply an expression to all non-null elements in this twig. For an expression to be successful it needs to not throw exceptions and have a return type that is compatible with the underlying type of this twig.
public Twig<T> Apply()
expression,
Expression to apply.
resolver,
Variable resolver to use.
report
Report on all expression evaluation issues.
Apply
#Create a new twig by applying a delegate to all values.
public Twig<T> Apply()
method,
Modifier delegate.
nullMethod,
Modifier for null values. If not specified, null items will be copied verbatim.
token
Cancellation token.
Returns: Twig with modified values.
Cast
#Cast this twig to a Twig<T> type. This will only work if all non-null items are of the given type.
Cast<TQ>
#Cast this twig to a Twig<T> type. This will only work if all non-null items are of type TQ.
Convert<TQ>
#Convert this twig into another twig of a different type.
public Twig<TQ> Convert<TQ>()
converter,
Converter.
token,
Cancellation token.
record
If not null, conversion messages will be added to this record.
Returns: Twig with converted data.
Convert<TQ>
#Convert this twig into another twig of a different type.
Returns: Twig with converted data.
Convert<TQ>
#Convert this twig by applying a function to all non-null items.
Returns: Tree with new items but the same metadata.
CountItems
#Count how many items pass a predicate method. Null items are not tested and do not contribute towards the test.
Returns: Number of non-null items that pass the predicate.
CountPears
#Count how many item/data pears pass a predicate method. Null items will be included as pears.NullAt = true;
Returns: Number of non-null pears that pass the predicate.
Expand
#Expand this twig until the count is equal to the target count. This functionality is the basis for LongestList matching.
Returns: True if twig was modified in any way.
Format
#Format this twig.
public void Format()
style,
Formatting style.
formatDelegate,
Delegate to use for formatting specific items.
builder
String builder to append to.
Returns: A formatted string representing this twig.
Format
#Format this twig.
public void Format()
style,
Formatting style.
formatDelegate,
Delegate to use for formatting specific items.
builder
String builder to append to.
Returns: A formatted string representing this twig.
Format
#Format the items and/or data in this twig.
public void Format()
formatting,
Formatting settings.
formatDelegate,
Delegate to use for formatting specific items.
builder
String builder to append to.
Returns: A formatted string representing this twig.
Format
#Format the items and/or data in this twig.
public void Format()
formatting,
Formatting settings.
formatDelegate,
Delegate to use for formatting specific items.
builder
String builder to append to.
Returns: A formatted string representing this twig.
Implements: Apply
Implements: Format
Implements: Format
Implements: MergeMetaData
Implements: MergeMetaData
Implements: RemoveAll
Implements: RemoveAll
Implements: RemoveIndices
Implements: RemoveMetaData
Implements: RemovePattern
Insert
#Insert an item/data pear into this twig.
Insert
#Insert an item with data into this twig.
Insert
#Insert an item into this twig.
InsertNull
#Insert a null item into this twig.
InsertRange
#Insert a collection of items and data into this twig.
InsertRange
#Insert a twig into this one.
MergeMetaData
#Merge all meta data from another twig.
public Twig<T> MergeMetaData()
sourceTwig,
Twig with meta data to merge. Must have the same length as this twig.
mergeBehaviour
Merge behaviour for conflicts.
Returns: Twig with merged data.
MergeMetaData
#Merge meta data into every item in this twig.
public virtual Twig<T> MergeMetaData()
metaData,
Meta data to merge into every item in this twig.
mergeBehaviour
Merge behaviour for conflicts.
Returns: Twig with merged data.
NullAt
#Gets whether the item at the given index is considered to be a null value.
Returns: True if item at index is null.
Implements: NullAt
RemoveAll
#Remove all item/data pears that pass a predicate method.
public Twig<T> RemoveAll()
predicate,
Predicate delegate.
method,
Removal comparison method.
token
Cancellation token.
Returns: Number of items removed.
RemoveAll
#Remove all items that pass a predicate method.
public Twig<T> RemoveAll()
predicate,
Predicate delegate.
method,
Removal comparison method.
token
Cancellation token.
Returns: Number of items removed.
RemoveMetaData
#Remove all meta values with the given names from this twig.
Returns: Modified twig or the same twig if the name did not occur.
RemovePattern
#Remove all items that are represented by a boolean pattern.
public Twig<T> RemovePattern()
pattern,
Pattern. If the pattern is shorter than the twig, it will be repeated.
method
Removal comparison method.
Returns: Number of items removed.
Modified twig.
Modified twig.
Shrink
#Shrink this twig until the count is equal to the target count. This functionality is the basis for ShortestList matching.
Returns: True if twig was modified in any way.
ToItemArrayInternal
#Return a direct reference to the internal item array if it exists.
protected abstract T[] ToItemArrayInternal()
ToMetaArray
#Copy the meta data (if any) to an array.
Returns: Array of meta data or null depending on twig state and method.
Implements: ToMetaArray
ToNullArray
#Copy the null data (if any) to an array. This method may return null if there is no null data.
Returns: Array of booleans or null depending on twig state and method.
Implements: ToNullArray
TrueForItems
#Test whether a specific predicate is true for all items in this twig. Null items are not tested and do not contribute towards the test.
Returns: True if all non-null items in this twig pass the predicate.
TrueForPears
#Test whether a specific predicate is true for all item/data pears in this twig.
Returns: True if all pears in this twig pass the predicate.
TryConvert<TQ>
#Try and convert this twig into another using the set of centrally registered conversion delegates.
public Twig<TQ> TryConvert<TQ>()
token,
Cancellation token.
record
If not null, conversion messages will be added to this record.
Returns: Converted twig or null.
Implements: TryConvert
TryConvert<TQ>
#Try and convert this twig into another using the set of centrally registered conversion delegates.
Returns: Converted twig or null.
Implements: TryConvert
TypeName
#Gets the user friendly type name of the twig type constraint.
Returns: User friendly type name.
Implements: TypeName
TypeName
#Gets the user friendly type name of the twig type constraint.
Returns: User friendly type name.
Implements: TypeName
ValidateIndex
#Throw an exception if the index + length range exceed the twig size.
ValidateIndexPlusOne
#Throw an exception if the index + length range exceed the twig size plus one.