Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SemanticElement.cs
1using System;
2using System.Collections.Generic;
7
9{
13 [TypeName(TypeNameSerialization.FullName)]
14 public abstract class SemanticElement : ISemanticElement
15 {
20 {
21 }
22
26 [IgnoreMember]
27 public object Tag { get; set; }
28
32 public abstract bool IsLiteral { get; }
33
38
42 public abstract object AssociatedObjectValue { get; }
43
47 public bool IsScalar => true;
48
52 public ICollection<IElement> ChildElements => null;
53
60 public IElement Encapsulate(ICollection<IElement> Elements, ScriptNode Node)
61 {
62 return null;
63 }
64
71 public virtual bool TryConvertTo(Type DesiredType, out object Value)
72 {
73 Value = null;
74 return false;
75 }
76
78 public override abstract bool Equals(object obj);
79
81 public override abstract int GetHashCode();
82
94 public virtual int CompareTo(object obj)
95 {
96 return this.ToString().CompareTo(obj?.ToString() ?? string.Empty);
97 }
98 }
99}
Abstract base class for semantic elements.
abstract override bool Equals(object obj)
SemanticElement()
Abstract base class for semantic elements.
IElement Encapsulate(ICollection< IElement > Elements, ScriptNode Node)
Encapsulates a set of elements into a similar structure as that provided by the current element.
virtual int CompareTo(object obj)
Compares the current instance with another object of the same type and returns an integer that indica...
ICollection< IElement > ChildElements
An enumeration of child elements. If the element is a scalar, this property will return null.
abstract object AssociatedObjectValue
Associated object value.
abstract bool IsLiteral
If element is a literal.
virtual bool TryConvertTo(Type DesiredType, out object Value)
Converts the value to a .NET type.
bool IsScalar
If the element represents a scalar value.
object Tag
Property used by processor, to tag information to an element.
static readonly SemanticElements Instance
Instance reference to the set of semantic elements.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
Interface for semantic nodes.
Basic interface for all types of elements.
Definition: IElement.cs:20
Basic interface for all types of sets.
Definition: ISet.cs:10
delegate string ToString(IElement Element)
Delegate for callback methods that convert an element value to a string.
TypeNameSerialization
How the type name should be serialized.