Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
EmptySet.cs
1using System;
2using System.Collections.Generic;
5
7{
11 public sealed class EmptySet : Set
12 {
13 private static readonly int hashCode = typeof(EmptySet).GetHashCode();
14
18 public EmptySet()
19 {
20 }
21
25 public static readonly EmptySet Instance = new EmptySet();
26
32 public override bool Contains(IElement Element)
33 {
34 return false;
35 }
36
42 public override bool Equals(object obj)
43 {
44 return obj is EmptySet;
45 }
46
51 public override int GetHashCode()
52 {
53 return hashCode;
54 }
55
59 public override ICollection<IElement> ChildElements
60 {
61 get
62 {
63 return noElements;
64 }
65 }
66
67 private static readonly IElement[] noElements = new IElement[0];
68
72 public override int? Size
73 {
74 get { return 0; }
75 }
76
78 public override string ToString()
79 {
80 return "∅";
81 }
82
83 }
84}
Base class for all types of elements.
Definition: Element.cs:13
Base class for all types of sets.
Definition: Set.cs:14
abstract override int GetHashCode()
Calculates a hash code of the element.
override bool Equals(object obj)
Compares the element to another.
Definition: EmptySet.cs:42
static readonly EmptySet Instance
Instance of the empty set.
Definition: EmptySet.cs:25
override int GetHashCode()
Calculates a hash code of the element.
Definition: EmptySet.cs:51
override string ToString()
Definition: EmptySet.cs:78
override ICollection< IElement > ChildElements
An enumeration of child elements. If the element is a scalar, this property will return null.
Definition: EmptySet.cs:60
override? int Size
Size of set, if finite and known, otherwise null is returned.
Definition: EmptySet.cs:73
override bool Contains(IElement Element)
Checks if the set contains an element.
Definition: EmptySet.cs:32
Basic interface for all types of elements.
Definition: IElement.cs:20