Exemplo n.º 1
0
        private static TriStateMatrix XorMatrix(TriStateMatrix first, BitMatrix second)
        {
            int            width        = first.Width;
            TriStateMatrix maskedMatrix = new TriStateMatrix(width);

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < width; y++)
                {
                    MatrixStatus states = first.MStatus(x, y);
                    switch (states)
                    {
                    case MatrixStatus.NoMask:
                        maskedMatrix[x, y, MatrixStatus.NoMask] = first[x, y];
                        break;

                    case MatrixStatus.Data:
                        maskedMatrix[x, y, MatrixStatus.Data] = first[x, y] ^ second[x, y];
                        break;

                    default:
                        throw new ArgumentException($"{nameof(TriStateMatrix)} has None value cell.", nameof(first));
                    }
                }
            }

            return(maskedMatrix);
        }
Exemplo n.º 2
0
 public bool this[int i, int j, MatrixStatus mstatus]
 {
 	set
 	{
 		m_stateMatrix[i, j] = mstatus;
 		m_InternalArray[i, j] = value;
 	}
 }
Exemplo n.º 3
0
 /// <summary>
 /// Sets the <see cref="System.Boolean"/> with the specified ERROR.
 /// </summary>
 /// <remarks></remarks>
 public bool this[int i, int j, MatrixStatus mstatus]
 {
     set
     {
         m_stateMatrix[i, j]   = mstatus;
         m_InternalArray[i, j] = value;
     }
 }
Exemplo n.º 4
0
 internal void CopyTo(TriStateMatrix target, MatrixRectangle sourceArea, MatrixPoint targetPoint, MatrixStatus mstatus)
 {
     for (int j = 0; j < sourceArea.Size.Height; j++)
     {
         for (int i = 0; i < sourceArea.Size.Width; i++)
         {
             bool value = this[sourceArea.Location.X + i, sourceArea.Location.Y + j];
             target[targetPoint.X + i, targetPoint.Y + j, mstatus] = value;
         }
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Copies to.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="sourceArea">The source area.</param>
 /// <param name="targetPoint">The target point.</param>
 /// <param name="mstatus">The mstatus.</param>
 /// <remarks></remarks>
 internal void CopyTo(TriStateMatrix target, MatrixRectangle sourceArea, MatrixPoint targetPoint,
                      MatrixStatus mstatus)
 {
     for (int j = 0; j < sourceArea.Size.Height; j++)
     {
         for (int i = 0; i < sourceArea.Size.Width; i++)
         {
             bool value = this[sourceArea.Location.X + i, sourceArea.Location.Y + j];
             target[targetPoint.X + i, targetPoint.Y + j, mstatus] = value;
         }
     }
 }
Exemplo n.º 6
0
 internal void CopyTo(TriStateMatrix target, MatrixPoint targetPoint, MatrixStatus mstatus)
 {
     CopyTo(target, new MatrixRectangle(new MatrixPoint(0, 0), new MatrixSize(Width, Height)), targetPoint, mstatus);
 }
Exemplo n.º 7
0
 internal void CopyTo(TriStateMatrix target, MatrixPoint targetPoint, MatrixStatus mstatus)
 {
     CopyTo(target, new MatrixRectangle(new MatrixPoint(0,0), new MatrixSize(Width, Height)), targetPoint, mstatus);
 }
 public StateMatrix(int width)
 {
     Width        = width;
     MatrixStatus = new MatrixStatus[width, width];
 }