Ejemplo n.º 1
0
        /// <summary>
        /// Equals method.
        /// </summary>
        /// <param name="o">
        /// A <see cref="System.Object"/>
        /// </param>
        /// <returns>
        /// A <see cref="System.Boolean"/>
        /// </returns>
        public override bool Equals(object o)
        {
            if (o.GetType() != this.GetType())
            {
                return(false);
            }

            CheckVector vector   = (CheckVector)o;
            int         distance = this.Distance(vector);

            // The vectors are the same if the distance is zero
            return(distance == 0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates the distance between <c>CharacteristicVector</c>s
        /// instances.
        /// </summary>
        /// <param name="vector">
        /// The <c>CharacteristicVector</c> instance the invoking is going to
        /// be compared to.
        /// </param>
        /// <returns>
        /// The distance between vectors, as the number of differences between
        /// them.
        /// </returns>
        public int Distance(CheckVector vector)
        {
            int count = 0;

            if (values.Count != vector.Length)
            {
                throw new ArgumentException("Vector lengths aren't equal");
            }

            for (int i = 0; i < values.Count; i++)
            {
                if (this.values[i] != vector.values[i])
                {
                    count++;
                }
            }

            return(count);
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Calculates the distance between <c>CharacteristicVector</c>s
		/// instances.
		/// </summary>
		/// <param name="vector">
		/// The <c>CharacteristicVector</c> instance the invoking is going to 
		/// be compared to.
		/// </param>
		/// <returns>
		/// The distance between vectors, as the number of differences between 
		/// them.
		/// </returns>
		public int Distance(CheckVector vector)
		{
			int count=0;
			
			if(values.Count != vector.Length)
			{
				throw new ArgumentException("Vector lengths aren't equal");
			}
			
			for(int i=0;i<values.Count; i++)
			{
				if(this.values[i]!=vector.values[i])
				{
					count++;
				}			
			}
			
			return count;
		}