Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
StringValues.cs
1using System;
4
6{
10 public sealed class StringValues : SemiGroup, IOrderedSet
11 {
12 private static readonly int hashCode = typeof(StringValues).FullName.GetHashCode();
13
17 public StringValues()
18 {
19 }
20
24 public static readonly StringValues Instance = new StringValues();
25
31 public override bool Contains(IElement Element)
32 {
33 return Element is StringValue S && !S.CaseInsensitive;
34 }
35
37 public override bool Equals(object obj)
38 {
39 return obj is StringValues;
40 }
41
43 public override int GetHashCode()
44 {
45 return hashCode;
46 }
47
54 public int Compare(IElement x, IElement y)
55 {
56 if (!(x.AssociatedObjectValue is string s1))
58
59 if (!(y.AssociatedObjectValue is string s2))
61
62 return string.Compare(s1, s2, false);
63 }
64 }
65}
Base class for all types of elements.
Definition: Element.cs:13
Base class for all types of semigroups.
Definition: SemiGroup.cs:10
Class managing a script expression.
Definition: Expression.cs:39
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
Definition: Expression.cs:4496
bool CaseInsensitive
If the string value is case insensitive or not.
Definition: StringValue.cs:55
Semi-group of string values.
Definition: StringValues.cs:11
override int GetHashCode()
Calculates a hash code of the element. Hash code.
Definition: StringValues.cs:43
StringValues()
Semi-group of string values.
Definition: StringValues.cs:17
static readonly StringValues Instance
Instance of the set of string values.
Definition: StringValues.cs:24
override bool Contains(IElement Element)
Checks if the set contains an element.
Definition: StringValues.cs:31
override bool Equals(object obj)
Compares the element to another. If elements are equal.
Definition: StringValues.cs:37
int Compare(IElement x, IElement y)
Compares two string values.
Definition: StringValues.cs:54
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