Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ObjectValues.cs
1using System;
5
7{
11 public sealed class ObjectValues : Set, IOrderedSet
12 {
13 private static readonly int hashCode = typeof(ObjectValues).FullName.GetHashCode();
14
18 public ObjectValues()
19 {
20 }
21
27 public override bool Contains(IElement Element)
28 {
29 return Element is ObjectValue;
30 }
31
33 public override bool Equals(object obj)
34 {
35 return obj is ObjectValues;
36 }
37
39 public override int GetHashCode()
40 {
41 return hashCode;
42 }
43
50 public int Compare(IElement x, IElement y)
51 {
52 object o1 = x.AssociatedObjectValue;
53 object o2 = y.AssociatedObjectValue;
54 IComparable c1 = o1 as IComparable;
55 IComparable c2 = o2 as IComparable;
56
57 if (c1 is null || c2 is null)
58 {
59 if (!(o1 is null || o2 is null))
60 {
61 if (o1.Equals(o2))
62 return 0;
63
65 if (E?.AssociatedObjectValue is bool B)
66 return B ? -1 : 1;
67 }
68
69 if (c1 is null && c2 is null)
70 return 0;
71 else if (c1 is null)
72 return -1;
73 else
74 return 1;
75 }
76
77 return c1.CompareTo(c2);
78 }
79 }
80}
Base class for all types of elements.
Definition: Element.cs:13
Base class for all types of sets.
Definition: Set.cs:14
override object AssociatedObjectValue
Associated object value.
Definition: Set.cs:57
Base class for all binary operators.
static IElement EvaluateNamedOperator(string Name, IElement Left, IElement Right, ScriptNode Node)
Evaluates a named operator available in code-behind.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
static readonly ScriptNode EmptyNode
Empty Script Node
Definition: ScriptNode.cs:452
override int GetHashCode()
Calculates a hash code of the element. Hash code.
Definition: ObjectValues.cs:39
override bool Equals(object obj)
Compares the element to another. If elements are equal.
Definition: ObjectValues.cs:33
ObjectValues()
Set of object values.
Definition: ObjectValues.cs:18
int Compare(IElement x, IElement y)
Compares two object values.
Definition: ObjectValues.cs:50
override bool Contains(IElement Element)
Checks if the set contains an element.
Definition: ObjectValues.cs:27
Basic interface for all types of elements.
Definition: IElement.cs:20
object AssociatedObjectValue
Associated object value.
Definition: IElement.cs:33
Basic interface for ordered sets.
Definition: IOrderedSet.cs:11