예제 #1
0
        /// <summary>
        /// Compares the element to another.
        /// </summary>
        /// <param name="obj">Other element to compare against.</param>
        /// <returns>If elements are equal.</returns>
        public override bool Equals(object obj)
        {
            ObjectVector ObjectVector = obj as ObjectVector;

            if (ObjectVector == null)
            {
                return(false);
            }

            if (ObjectVector.dimension != this.dimension)
            {
                return(false);
            }

            IEnumerator <IElement> e1 = this.elements.GetEnumerator();
            IEnumerator <IElement> e2 = ObjectVector.elements.GetEnumerator();

            while (e1.MoveNext() && e2.MoveNext())
            {
                if (!e1.Current.Equals(e2.Current))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Checks if the set contains an element.
        /// </summary>
        /// <param name="Element">Element.</param>
        /// <returns>If the element is contained in the set.</returns>
        public override bool Contains(IElement Element)
        {
            ObjectVector v = Element as ObjectVector;

            if (v == null)
            {
                return(false);
            }

            return(v.Dimension == this.dimension);
        }
예제 #3
0
 /// <summary>
 /// Pseudo-vector space of Object-valued vectors.
 /// </summary>
 /// <param name="ReferenceVector">Reference vector.</param>
 public ObjectVectors(ObjectVector ReferenceVector)
 {
     this.dimension       = ReferenceVector.Dimension;
     this.referenceVector = ReferenceVector;
 }