3using System.Reflection;
20 private ICollection<IElement> elements;
21 private readonly
int dimension;
44 this.elements = Elements2;
45 this.dimension = Elements2.Count;
59 this.elements = Elements2;
60 this.dimension = Elements2.Count;
77 : this((ICollection<object>)
Elements)
88 if (this.values is
null)
91 this.elements.CopyTo(v, 0);
102 public ICollection<IElement>
Elements => this.elements;
112 StringBuilder sb =
null;
117 sb =
new StringBuilder(
"[");
130 return sb.ToString();
141 if (this.associatedVectorSpace is
null)
144 return this.associatedVectorSpace;
157 if (!(this.associatedObjectValue is
null))
158 return this.associatedObjectValue;
160 object[] V =
new object[this.dimension];
163 foreach (
IElement E
in this.elements)
171 this.associatedObjectValue = V;
172 return this.associatedObjectValue;
176 private object[] associatedObjectValue =
null;
188 Elements.Add(Operators.Arithmetics.Multiply.EvaluateMultiplication(Scalar,
Element,
null));
206 IEnumerator<IElement> e1 = this.elements.GetEnumerator();
211 while (e1.MoveNext() && e2.MoveNext())
212 Elements.Add(Operators.Arithmetics.Add.EvaluateAddition(e1.Current, e2.Current,
null));
251 IEnumerator<IElement> e1 = this.elements.GetEnumerator();
252 IEnumerator<IElement> e2 =
ObjectVector.elements.GetEnumerator();
256 while (e1.MoveNext() && e2.MoveNext())
258 if (!e1.Current.Equals(e2.Current))
290 get {
return false; }
338 if (Index < 0 || Index >= this.dimension)
352 if (Index < 0 || Index >= this.dimension)
356 this.elements =
null;
369 if (DesiredType == typeof(
object[]))
374 else if (DesiredType.IsAssignableFrom(typeof(
ObjectVector).GetTypeInfo()))
379 else if (DesiredType.IsArray)
381 Type ElementType = DesiredType.GetElementType();
382 Array Result = Array.CreateInstance(ElementType, this.dimension);
386 for (i = 0; i < this.dimension; i++)
394 Result.SetValue(Value, i);
A chunked list is a linked list of chunks of objects of type T .
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 bool TryConvert(object Value, Type DesiredType, bool AcceptInformationLoss, out object Result)
Tries to convert an object Value to an object of type DesiredType .
static IElement Encapsulate(object Value)
Encapsulates an object.
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 IElement Encapsulate(ChunkedList< IElement > Elements, ScriptNode Node)
Encapsulates a set of elements into a similar structure as that provided by the current element.
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.