flip() 공개 메소드

Flips the given bit.

public flip ( int x, int y ) : void
x int The horizontal component (i.e. which column)
y int The vertical component (i.e. which row)
리턴 void
예제 #1
0
        public void testRectangularMatrix()
        {
            BitMatrix matrix = new BitMatrix(75, 20);

            Assert.AreEqual(75, matrix.Width);
            Assert.AreEqual(20, matrix.Height);
            matrix[10, 0] = true;
            matrix[11, 1] = true;
            matrix[50, 2] = true;
            matrix[51, 3] = true;
            matrix.flip(74, 4);
            matrix.flip(0, 5);

            // Should all be on
            Assert.IsTrue(matrix[10, 0]);
            Assert.IsTrue(matrix[11, 1]);
            Assert.IsTrue(matrix[50, 2]);
            Assert.IsTrue(matrix[51, 3]);
            Assert.IsTrue(matrix[74, 4]);
            Assert.IsTrue(matrix[0, 5]);

            // Flip a couple back off
            matrix.flip(50, 2);
            matrix.flip(51, 3);
            Assert.IsFalse(matrix[50, 2]);
            Assert.IsFalse(matrix[51, 3]);
        }
예제 #2
0
 /// <summary> <p>Implementations of this method reverse the data masking process applied to a QR Code and
 /// make its bits ready to read.</p>
 /// 
 /// </summary>
 /// <param name="bits">representation of QR Code bits
 /// </param>
 /// <param name="dimension">dimension of QR Code, represented by bits, being unmasked
 /// </param>
 internal void unmaskBitMatrix(BitMatrix bits, int dimension)
 {
    for (int i = 0; i < dimension; i++)
    {
       for (int j = 0; j < dimension; j++)
       {
          if (isMasked(i, j))
          {
             bits.flip(j, i);
          }
       }
    }
 }