Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SemanticNumericLiteral.cs
1using System;
5
7{
12 {
17 {
18 }
19
26 : base(Value, StringValue)
27 {
28 }
29
33 public abstract double ComparableValue { get; }
34
39
44
49
54
59
64
69
74
79
84
89
101 public override int CompareTo(object obj)
102 {
103 if (obj is SemanticNumericLiteral Typed)
104 return this.ComparableValue.CompareTo(Typed.ComparableValue);
105 else
106 return base.CompareTo(obj);
107 }
108
115 {
116 if (Element is SemanticNumericLiteral Typed)
117 return new DoubleLiteral(Typed.ComparableValue * this.ComparableValue);
118 else
119 return null;
120 }
121
128 {
129 if (Element is SemanticNumericLiteral Typed)
130 return new DoubleLiteral(this.ComparableValue * Typed.ComparableValue);
131 else
132 return null;
133 }
134
141 {
142 if (Element is SemanticNumericLiteral Typed)
143 return new DoubleLiteral(Typed.ComparableValue * this.ComparableValue);
144 else
145 return null;
146 }
147
152 public override IRingElement Invert()
153 {
154 double d = this.ComparableValue;
155 if (d == 0)
156 return null;
157 else
158 return new DoubleLiteral(1.0 / d);
159 }
160
167 {
168 if (Element is SemanticNumericLiteral Typed)
169 return new DoubleLiteral(this.ComparableValue + Typed.ComparableValue);
170 else
171 return null;
172 }
173
178 public override IGroupElement Negate()
179 {
180 return new DoubleLiteral(-this.ComparableValue);
181 }
182
189 {
190 if (Element is SemanticNumericLiteral Typed)
191 return new DoubleLiteral(Typed.ComparableValue + this.ComparableValue);
192 else
193 return null;
194 }
195
202 {
203 if (Element is SemanticNumericLiteral Typed)
204 return new DoubleLiteral(this.ComparableValue + Typed.ComparableValue);
205 else
206 return null;
207 }
208 }
209}
static readonly DoubleLiteral OneInstance
Double value 1.0
static readonly DoubleLiteral ZeroInstance
Double value 0.0
Abstract base class for semantic literal values.
string StringValue
String representation of value.
Abstract base class for semantic literal numeric values.
IEuclidianDomain AssociatedEuclidianDomain
Associated Euclidian Domain.
virtual ICommutativeRingElement Multiply(ICommutativeRingElement Element)
Tries to multiply an element to the current element.
abstract double ComparableValue
Comparable numeric value.
SemanticNumericLiteral()
Abstract base class for semantic literal numeric values.
ICommutativeRing AssociatedCommutativeRing
Associated Commutative Ring.
SemanticNumericLiteral(object Value, string StringValue)
Abstract base class for semantic literal values.
override ISemiGroupElement AddLeft(ISemiGroupElement Element)
Tries to add an element to the current element, from the left.
override IAbelianGroupElement Zero
Returns the zero element of the group.
override IGroupElement Negate()
Negates the element.
override ISemiGroup AssociatedSemiGroup
Associated Semi-Group.
override ISemiGroupElement AddRight(ISemiGroupElement Element)
Tries to add an element to the current element, from the right.
override IRingElement MultiplyLeft(IRingElement Element)
Tries to multiply an element to the current element, from the left.
override IAbelianGroup AssociatedAbelianGroup
Associated Abelian Group.
override IRingElement Invert()
Inverts the element, if possible.
override int CompareTo(object obj)
Compares the current instance with another object of the same type and returns an integer that indica...
ICommutativeRingWithIdentityElement One
Returns the identity element of the commutative ring with identity.
override IRingElement MultiplyRight(IRingElement Element)
Tries to multiply an element to the current element, from the right.
IIntegralDomain AssociatedIntegralDomain
Associated Integral Domain.
override IAbelianGroupElement Add(IAbelianGroupElement Element)
Tries to add an element to the current element.
ICommutativeRingWithIdentity AssociatedCommutativeRingWithIdentity
Associated Commutative Ring With Identity.
static readonly SemanticNumericLiterals Instance
Instance reference to the set of semantic numeric literals.
Base class for all types of elements.
Definition: Element.cs:13
Basic interface for all types of abelian group elements.
Basic interface for all types of commutative ring elements.
Basic interface for all types of commutative ring with identity elements.
Basic interface for all types of field elements.
Basic interface for all types of group elements.
Definition: IGroupElement.cs:9
Basic interface for all types of ring elements.
Definition: IRingElement.cs:10
Basic interface for all types of semigroup elements.
Basic interface for all types of abelian groups.
Basic interface for all types of commutative rings.
Basic interface for all types of commutative rings with identity.
Basic interface for all types of euclidian domains.
Basic interface for all types of fields.
Definition: IField.cs:9
Basic interface for all types of groups.
Definition: IGroup.cs:10
Basic interface for all types of integral domains.
Basic interface for all types of rings.
Definition: IRing.cs:10
Basic interface for all types of semigroups.
Definition: ISemiGroup.cs:10