2using System.Collections.Generic;
3using System.Reflection;
18 private bool[] values;
19 private ICollection<IElement> elements;
20 private readonly
int dimension;
30 this.dimension =
Values.Length;
51 if (this.values is
null)
53 bool[] v =
new bool[this.dimension];
78 if (this.elements is
null)
83 for (i = 0; i < this.dimension; i++)
101 StringBuilder sb =
null;
103 foreach (
bool d
in this.
Values)
106 sb =
new StringBuilder(
"[");
118 return sb.ToString();
129 if (this.associatedVectorSpace is
null)
132 return this.associatedVectorSpace;
157 bool[] v =
new bool[this.dimension];
159 for (i = 0; i < this.dimension; i++)
182 bool[] v =
new bool[this.dimension];
183 for (i = 0; i < this.dimension; i++)
184 v[i] =
Values[i] ^ Values2[i];
215 for (i = 0; i < this.dimension; i++)
217 if (
Values[i] != Values2[i])
234 for (i = 0; i < this.dimension; i++)
245 get {
return false; }
271 if (this.zero is
null)
287 if (Index < 0 || Index >= this.dimension)
302 if (Index < 0 || Index >= this.dimension)
306 throw new ScriptException(
"Elements in a boolean vector are required to be boolean values.");
309 this.elements =
null;
322 if (DesiredType == typeof(
bool[]))
327 else if (DesiredType.GetTypeInfo().IsAssignableFrom(typeof(
BooleanVector).GetTypeInfo()))
Base class for all types of elements.
abstract object AssociatedObjectValue
Associated object value.
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, 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.
Base class for all nodes in a parsed script tree.
override IVectorSpaceElement MultiplyScalar(IFieldElement Scalar)
Tries to multiply a scalar to the current element.
override int Dimension
Dimension of vector.
override bool Equals(object obj)
Compares the element to another.
BooleanVector(params bool[] Values)
Boolean-valued vector.
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 ICollection< IElement > ChildElements
An enumeration of child elements. If the element is a scalar, this property will return null.
override bool TryConvertTo(Type DesiredType, out object Value)
Converts the value to a .NET type.
override IElement GetElement(int Index)
Gets an element of the vector.
bool[] Values
Vector element values.
override bool IsScalar
If the element represents a scalar value.
override IAbelianGroupElement Add(IAbelianGroupElement Element)
Tries to add an element to the current element.
ICollection< IElement > Elements
Vector elements.
override IAbelianGroupElement Zero
Returns the zero element of the group.
override int GetHashCode()
Calculates a hash code of the element.
override IVectorSpace AssociatedVectorSpace
Associated Right-VectorSpace.
override object AssociatedObjectValue
Associated object value.
override void SetElement(int Index, IElement Value)
Sets an element in the vector.
BooleanVector(ICollection< IElement > Elements)
Boolean-valued vector.
override string ToString()
override IGroupElement Negate()
Negates the element.
Pseudo-vector space of Boolean-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.
Basic interface for all types of modules.