2using System.Reflection;
19 private string valueLower =
null;
20 private bool caseInsensitive;
29 this.caseInsensitive =
false;
49 set => this.value = value;
57 get => this.caseInsensitive;
58 set => this.caseInsensitive = value;
74 if (this.caseInsensitive)
75 return associatedSemiGroupCis;
77 return associatedSemiGroup;
106 Elements.Add(this.
AddLeft(SE));
144 return string.Compare(this.value, S.value,
this.caseInsensitive || S.caseInsensitive) == 0;
149 if (!(E.AssociatedObjectValue is
string s))
152 return string.Compare(this.value, s, this.caseInsensitive) == 0;
158 if (this.caseInsensitive)
160 if (this.valueLower is
null)
161 this.valueLower = this.value.ToLower();
163 return this.valueLower.GetHashCode();
166 return this.value.GetHashCode();
177 if (DesiredType == typeof(
string))
182 else if (DesiredType == typeof(
char))
184 if (this.value.Length == 1)
186 Value = this.value[0];
195 else if (DesiredType.IsAssignableFrom(typeof(
string).GetTypeInfo()))
200 else if (DesiredType.IsAssignableFrom(typeof(
StringValue).GetTypeInfo()))
A chunked list is a linked list of chunks of objects of type T .
Base class for all types of elements.
virtual IElement Encapsulate(ChunkedList< IElement > Elements, ScriptNode Node)
Encapsulates a set of elements into a similar structure as that provided by the current element.
virtual bool IsScalar
If the element represents a scalar value.
virtual ICollection< IElement > ChildElements
An enumeration of child elements. If the element is a scalar, this property will return null.
Base class for all types of semigroup elements.
Class managing a script expression.
static bool TryConvert(object Value, Type DesiredType, bool AcceptInformationLoss, out object Result)
Tries to convert an object Value to an object of type DesiredType .
static string EncodeString(string s)
Converts a string value to a parsable expression string.
Base class for all nodes in a parsed script tree.
override string ToString()
Semi-group of case-insensitive string values.
override ISemiGroupElement AddLeft(ISemiGroupElement Element)
Tries to add an element to the current element, from the left.
override object AssociatedObjectValue
Associated object value.
static readonly StringValue Empty
The empty string.
override bool TryConvertTo(Type DesiredType, out object Value)
Converts the value to a .NET type.
StringValue(string Value)
String value.
string Value
String value.
override bool Equals(object obj)
Compares the element to another. If elements are equal.
bool CaseInsensitive
If the string value is case insensitive or not.
override ISemiGroup AssociatedSemiGroup
Associated Semi-Group.
override string ToString()
override int GetHashCode()
Calculates a hash code of the element. Hash code.
override ISemiGroupElement AddRight(ISemiGroupElement Element)
Tries to add an element to the current element, from the right.
StringValue(string Value, bool CaseInsensitive)
String value.
Semi-group of string values.
Basic interface for all types of elements.
Basic interface for all types of semigroup elements.
Basic interface for all types of semigroups.