2using System.Collections.Generic;
3using System.Reflection;
19 private ICollection<IElement> elements;
20 private readonly
int dimension;
38 LinkedList<IElement> Elements2 =
new LinkedList<IElement>();
43 this.elements = Elements2;
44 this.dimension = Elements2.Count;
53 LinkedList<IElement> Elements2 =
new LinkedList<IElement>();
58 this.elements = Elements2;
59 this.dimension = Elements2.Count;
76 : this((ICollection<object>)
Elements)
87 if (this.values is
null)
90 this.elements.CopyTo(v, 0);
105 return this.elements;
117 StringBuilder sb =
null;
122 sb =
new StringBuilder(
"[");
135 return sb.ToString();
146 if (this.associatedVectorSpace is
null)
149 return this.associatedVectorSpace;
162 if (!(this.associatedObjectValue is
null))
163 return this.associatedObjectValue;
165 object[] V =
new object[this.dimension];
168 foreach (
IElement E
in this.elements)
176 this.associatedObjectValue = V;
177 return this.associatedObjectValue;
181 private object[] associatedObjectValue =
null;
190 LinkedList<IElement>
Elements =
new LinkedList<IElement>();
193 Elements.AddLast(Operators.Arithmetics.Multiply.EvaluateMultiplication(Scalar,
Element,
null));
205 LinkedList<IElement>
Elements =
new LinkedList<IElement>();
211 IEnumerator<IElement> e1 = this.elements.GetEnumerator();
214 while (e1.MoveNext() && e2.MoveNext())
215 Elements.AddLast(Operators.Arithmetics.Add.EvaluateAddition(e1.Current, e2.Current,
null));
226 LinkedList<IElement>
Elements =
new LinkedList<IElement>();
229 Elements.AddLast(Operators.Arithmetics.Negate.EvaluateNegation(
Element));
248 IEnumerator<IElement> e1 = this.elements.GetEnumerator();
249 IEnumerator<IElement> e2 =
ObjectVector.elements.GetEnumerator();
251 while (e1.MoveNext() && e2.MoveNext())
253 if (!e1.Current.Equals(e2.Current))
279 get {
return false; }
316 if (Index < 0 || Index >= this.dimension)
330 if (Index < 0 || Index >= this.dimension)
334 this.elements =
null;
347 if (DesiredType == typeof(
object[]))
352 else if (DesiredType.GetTypeInfo().IsAssignableFrom(typeof(
ObjectVector).GetTypeInfo()))
357 else if (DesiredType.IsArray)
359 Type ElementType = DesiredType.GetElementType();
360 Array Result = Array.CreateInstance(ElementType, this.dimension);
364 for (i = 0; i < this.dimension; i++)
372 Result.SetValue(Value, i);
Base class for all types of elements.
abstract override int GetHashCode()
Calculates a hash code of the element.
virtual bool IsScalar
If the element represents a scalar value.
virtual ICollection< IElement > ChildElements
An enumeration of child elements. If the element is a scalar, this property will return null.
Base class for all types of vector space elements (vectors).
Base class for script exceptions.
Class managing a script expression.
static IElement Encapsulate(object Value)
Encapsulates an object.
static bool TryConvert(object Value, Type DesiredType, out object Result)
Tries to convert an object Value to an object of type DesiredType .
Base class for all nodes in a parsed script tree.
override IAbelianGroupElement Zero
Returns the zero element of the group.
override IElement Encapsulate(ICollection< IElement > Elements, ScriptNode Node)
Encapsulates a set of elements into a similar structure as that provided by the current element.
override string ToString()
override void SetElement(int Index, IElement Value)
Sets an element in the vector.
override int Dimension
Dimension of vector.
override IElement GetElement(int Index)
Gets an element of the vector.
override IVectorSpaceElement MultiplyScalar(IFieldElement Scalar)
Tries to multiply a scalar to the current element.
override bool IsScalar
If the element represents a scalar value.
override bool TryConvertTo(Type DesiredType, out object Value)
Converts the value to a .NET type.
override IAbelianGroupElement Add(IAbelianGroupElement Element)
Tries to add an element to the current element.
ObjectVector(params object[] Elements)
Object-valued vector.
ObjectVector(ICollection< IElement > Elements)
Object-valued vector.
override ICollection< IElement > ChildElements
An enumeration of child elements. If the element is a scalar, this property will return null.
ObjectVector(Array Elements)
Object-valued vector.
override int GetHashCode()
Calculates a hash code of the element.
override IVectorSpace AssociatedVectorSpace
Associated Right-VectorSpace.
ObjectVector(ICollection< object > Elements)
Object-valued vector.
ICollection< IElement > Elements
Vector elements.
IElement[] Values
Vector element values.
ObjectVector(params IElement[] Elements)
Object-valued vector.
override bool Equals(object obj)
Compares the element to another.
override IGroupElement Negate()
Negates the element.
override object AssociatedObjectValue
Associated object value.
Pseudo-vector space of Object-valued vectors.
static IElement Encapsulate(Array Elements, bool CanEncapsulateAsMatrix, ScriptNode Node)
Encapsulates the elements of a vector.
Basic interface for all types of abelian group elements.
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
Basic interface for all types of field elements.
Basic interface for all types of group elements.
Basic interface for all types of module elements.
IAbelianGroupElement Zero
Returns the zero element of the group.
Basic interface for all types of modules.