예제 #1
0
 public bool Compare(BoolVector vector)
 {
     for (int i = 0; i < this.Count; i++)
     {
         if (!this[i].Compare(vector[i]))
         {
             return(false);
         }
     }
     return(true);
 }
예제 #2
0
 /// <summary>
 /// Определяение перпендикулярности векторов
 /// </summary>
 public bool IsOrtogonal(BoolVector vect2)
 {
     for (var i = 0; i < this.Count(); i++)
     {
         if (this[i].Value != "-" && vect2[i].Value != "-" && this[i].GetInvers() == vect2[i].Value)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #3
0
 public bool Equals(BoolVector vector)
 {
     for (var i = 0; i < Count; i++)
     {
         if (!this[i].Equals(vector[i]))
         {
             return(false);
         }
     }
     return(true);
 }
예제 #4
0
 /// <summary>
 /// Поглащается ли вектор
 /// </summary>
 public bool IsAbsorpt(BoolVector vector)
 {
     for (var i = 0; i < this.Count(); i++)
     {
         if (this[i].Value == "-" || this[i].Value == vector[i].Value)
         {
             continue;
         }
         return(false);
     }
     return(true);
 }
예제 #5
0
        public BoolVector Union(BoolVector vector)
        {
            var newVector = new BoolVector(this);

            for (int i = 0; i < Count; i++)
            {
                if (this[i].Value == "-" && vector[i].Value != "-")
                {
                    newVector[i] = new MatrixValue(vector[i].Value);
                }
            }
            return(newVector);
        }
예제 #6
0
        /// <summary>
        /// Определяение смежности векторов
        /// </summary>
        public bool IsAdjacent(BoolVector vect2)
        {
            var intersectionCount = 0;

            for (var i = 0; i < this.Count(); i++)
            {
                if (this[i].Value == "-" || vect2[i].Value == "-")
                {
                    continue;
                }
                if (this[i].GetInvers() == vect2[i].Value)
                {
                    intersectionCount++;
                }
            }
            return(intersectionCount == 1);
        }
예제 #7
0
        /// <summary>
        /// Обобщенное склеивание
        /// </summary>
        /// <param name="vector"></param>
        /// <returns></returns>
        public BoolVector GenericBonding(BoolVector vector)
        {
            if (!IsAdjacent(vector) || this.Count != vector.Count)
            {
                return(null);
            }

            var newVector = new BoolVector(this);

            for (var i = 0; i < this.Count; i++)
            {
                if (this[i].Value == vector[i].GetInvers())
                {
                    newVector[i] = new MatrixValue("-");
                }
                else if (vector[i].Value != "-")
                {
                    newVector[i] = new MatrixValue(vector[i].Value);
                }
            }
            return(newVector);//.Any(item => item.Value != "-")? newVector : null;
        }
예제 #8
0
        /// <summary>
        /// Склеивание двух векторов
        /// </summary>
        /// <param name="vector"></param>
        /// <returns></returns>
        public BoolVector Gluing(BoolVector vector)
        {
            if (this.Count != vector.Count)
            {
                return(null);
            }

            var differentPositionsCount = 0;
            var position = 0;

            for (var i = 0; i < this.Count(); i++)
            {
                if (this[i].Value == vector[i].Value)
                {
                    continue;
                }

                if (this[i].GetInvers() == vector[i].Value && differentPositionsCount == 0)
                {
                    differentPositionsCount++;
                    position = i;
                }
                else
                {
                    return(null);
                }
            }
            if (position <= -1 || differentPositionsCount >= 2)
            {
                return(null);
            }
            var newVector = new BoolVector(this);

            newVector[position] = new MatrixValue("-");
            return(newVector);
        }