15 private Type valueType;
16 private IComparable comparable;
33 this.valueType =
null;
34 this.comparable =
null;
53 this.valueType =
null;
54 this.comparable =
null;
105 return DataType == this.StringType ? Grade.Ok :
Grade.NotAtAll;
134 StringBuilder sb =
new StringBuilder();
142 return sb.ToString();
160 if (this.valueType is
null)
162 this.valueType = this.value?.GetType() ?? typeof(
object);
163 this.comparable = this.value as IComparable;
166 if (Typed.valueType is
null)
168 Typed.valueType = Typed.value?.GetType() ?? typeof(
object);
169 Typed.comparable = Typed.value as IComparable;
172 if (this.valueType == Typed.valueType && !(
this.comparable is
null))
173 return this.comparable.CompareTo(Typed.value);
176 return base.CompareTo(obj);
Helps with common JSON-related tasks.
static string Encode(string s)
Encodes a string for inclusion in JSON.
Abstract base class for semantic elements.
Abstract base class for semantic literal values.
virtual IRing AssociatedRing
Associated Ring.
override int CompareTo(object obj)
Compares the current instance with another object of the same type and returns an integer that indica...
virtual ISemiGroup AssociatedSemiGroup
Associated Semi-Group.
abstract ISemanticLiteral Encapsulate(object Value)
Encapsulates an object value as a semantic literal value.
override bool IsLiteral
If element is a literal.
virtual Grade Supports(string DataType)
How well the type supports a given data type.
virtual IAbelianGroupElement Zero
Returns the zero element of the group.
virtual IAbelianGroup AssociatedAbelianGroup
Associated Abelian Group.
abstract string StringType
Type name (or null if literal value is a string)
virtual IRingElement MultiplyLeft(IRingElement Element)
Tries to multiply an element to the current element, from the left.
SemanticLiteral()
Abstract base class for semantic literal values.
abstract ISemanticLiteral Parse(string Value, string DataType, string Language)
Tries to parse a string value of the type supported by the class..
virtual IRingElement Invert()
Inverts the element, if possible.
SemanticLiteral(object Value, string StringValue)
Abstract base class for semantic literal values.
virtual IAbelianGroupElement Add(IAbelianGroupElement Element)
Tries to add an element to the current element.
virtual ISemiGroupElement AddLeft(ISemiGroupElement Element)
Tries to add an element to the current element, from the left.
override object AssociatedObjectValue
Associated object value.
virtual IRingElement MultiplyRight(IRingElement Element)
Tries to multiply an element to the current element, from the right.
string StringValue
String representation of value.
virtual IGroup AssociatedGroup
Associated Group.
override string ToString()
virtual ISemiGroupElement AddRight(ISemiGroupElement Element)
Tries to add an element to the current element, from the right.
object Value
Parsed value.
virtual IGroupElement Negate()
Negates the element.
abstract Grade Supports(Type ValueType)
How well the type supports a given value type.
Set of semantic literals.
static readonly SemanticLiterals Instance
Instance reference to the set of semantic literals.
override IAbelianGroupElement Zero
Returns the zero element of the group.
Base class for all types of elements.
Interface for semantic literals.
Basic interface for all types of abelian group elements.
Basic interface for all types of group elements.
Basic interface for all types of ring elements.
Basic interface for all types of semigroup elements.
Basic interface for all types of abelian groups.
Basic interface for all types of groups.
Basic interface for all types of rings.
Basic interface for all types of semigroups.