Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
NullValue.cs
1using System;
3
5{
10 {
14 internal static readonly NullValue Instance = new NullValue();
15
19 public NullValue()
20 : base(null, string.Empty)
21 {
22 }
23
27 public override object AssociatedObjectValue => null;
28
32 public override string StringType => string.Empty;
33
39 public override int CompareTo(object obj)
40 {
41 return obj is NullValue ? 0 : -1;
42 }
43
45 public override string ToString()
46 {
47 return string.Empty;
48 }
49
51 public override bool Equals(object obj)
52 {
53 return obj.GetType() == typeof(NullValue);
54 }
55
57 public override int GetHashCode()
58 {
59 return this.GetType().GetHashCode();
60 }
61
67 public override Grade Supports(string DataType)
68 {
69 return Grade.NotAtAll;
70 }
71
77 public override Grade Supports(Type ValueType)
78 {
79 return Grade.NotAtAll;
80 }
81
89 public override ISemanticLiteral Parse(string Value, string DataType, string Language)
90 {
91 if (Value is null)
92 return new NullValue();
93 else
94 return new CustomLiteral(Value, DataType, Language);
95 }
96
102 public override ISemanticLiteral Encapsulate(object Value)
103 {
104 if (Value is null)
105 return new NullValue();
107 return Literal;
108 else
109 throw new ArgumentException("Not a literal.", nameof(Value));
110 }
111 }
112}
override string StringType
Type name (or null if literal value is a string)
Definition: NullValue.cs:32
override int CompareTo(object obj)
Compares element to another.
Definition: NullValue.cs:39
override ISemanticLiteral Encapsulate(object Value)
Encapsulates an object value as a semantic literal value.
Definition: NullValue.cs:102
override Grade Supports(string DataType)
How well the type supports a given data type.
Definition: NullValue.cs:67
override Grade Supports(Type ValueType)
How well the type supports a given value type.
Definition: NullValue.cs:77
override object AssociatedObjectValue
Associated object value.
Definition: NullValue.cs:27
override ISemanticLiteral Parse(string Value, string DataType, string Language)
Tries to parse a string value of the type supported by the class..
Definition: NullValue.cs:89
static ISemanticElement Encapsulate(object Value)
Encapsulates an object as a semantic element.
Abstract base class for semantic literal values.
Interface for semantic literals.
Grade
Grade enumeration
Definition: Grade.cs:7