3using System.Reflection;
16 private BigInteger value;
69 set => this.value = value;
83 get {
return associatedEuclidianDomain; }
100 if (Obj is BigInteger i)
101 return new Integer(this.value * i);
106 if (Obj is Complex z)
118 if (this.value.IsOne ||
this.value == BigInteger.MinusOne)
119 return new Integer(this.value);
133 if (Obj is BigInteger i)
134 return new Integer(this.value + i);
139 if (Obj is Complex z)
151 return new Integer(-this.value);
160 object Obj = E.AssociatedObjectValue;
162 if (Obj is BigInteger i)
163 return this.value == i;
166 return (
double)this.value == d;
168 if (Obj is Complex z)
169 return (
double)this.value == z;
177 return this.value.GetHashCode();
204 if (DesiredType.GetTypeInfo().IsAssignableFrom(typeof(BigInteger).GetTypeInfo()))
209 else if (DesiredType == typeof(
byte))
211 if (this.value >=
byte.MinValue && this.value <=
byte.MaxValue)
213 Value = (byte)this.value;
217 else if (DesiredType == typeof(decimal))
219 Value = (decimal)this.value;
222 else if (DesiredType == typeof(
double))
224 Value = (double)this.value;
227 else if (DesiredType == typeof(
short))
229 if (this.value >=
short.MinValue && this.value <=
short.MaxValue)
231 Value = (short)this.value;
235 else if (DesiredType == typeof(
int))
237 if (this.value >=
int.MinValue && this.value <=
int.MaxValue)
239 Value = (int)this.value;
243 else if (DesiredType == typeof(
long))
245 if (this.value >=
long.MinValue && this.value <=
long.MaxValue)
247 Value = (long)this.value;
251 else if (DesiredType == typeof(sbyte))
253 if (this.value >= sbyte.MinValue &&
this.value <= sbyte.MaxValue)
255 Value = (sbyte)this.value;
259 else if (DesiredType == typeof(
float))
261 Value = (float)this.value;
264 else if (DesiredType == typeof(ushort))
266 if (this.value >= ushort.MinValue &&
this.value <= ushort.MaxValue)
268 Value = (ushort)this.value;
272 else if (DesiredType == typeof(uint))
274 if (this.value >= uint.MinValue &&
this.value <= uint.MaxValue)
276 Value = (uint)this.value;
280 else if (DesiredType == typeof(ulong))
282 if (this.value >= ulong.MinValue &&
this.value <= ulong.MaxValue)
284 Value = (ulong)this.value;
288 else if (DesiredType == typeof(
Integer))
Base class for all types of elements.
abstract object AssociatedObjectValue
Associated object value.
Base class for all types of Euclidian domain elements.
Class managing a script expression.
static bool TryConvert(object Value, Type DesiredType, out object Result)
Tries to convert an object Value to an object of type DesiredType .
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
Integer(uint Value)
BigInteger-valued number.
override IEuclidianDomain AssociatedEuclidianDomain
Associated Euclidian Domain.
override IAbelianGroupElement Add(IAbelianGroupElement Element)
Tries to add an element to the current element.
override int GetHashCode()
Calculates a hash code of the element. Hash code.
override IRingElement Invert()
Inverts the element, if possible.
Integer(int Value)
BigInteger-valued number.
override ICommutativeRingElement Multiply(ICommutativeRingElement Element)
Tries to multiply an element to the current element.
BigInteger Value
BigInteger value.
override bool Equals(object obj)
Compares the element to another. If elements are equal.
override ICommutativeRingWithIdentityElement One
Returns the identity element of the commutative ring with identity.
override object AssociatedObjectValue
Associated object value.
override IAbelianGroupElement Zero
Returns the zero element of the group.
Integer(ulong Value)
BigInteger-valued number.
int Compare(IElement x, IElement y)
Compares two rational numbers.
Integer(BigInteger Value)
Integer-valued number.
override string ToString()
Integer(long Value)
BigInteger-valued number.
override bool TryConvertTo(Type DesiredType, out object Value)
Converts the value to a .NET type.
override IGroupElement Negate()
Negates the element.
Euclidian domain of integers.
Field of rational numbers.
static int CompareNumbers(IElement x, IElement y)
Compares two rational numbers.
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 elements.
Basic interface for all types of group elements.
Basic interface for all types of ring elements.
Basic interface for all types of euclidian domains.
Basic interface for ordered sets.