Remove getBits()
[zxing.git] / core / src / com / google / zxing / common / BitMatrix.java
index 9500ee4..5440787 100755 (executable)
@@ -30,7 +30,7 @@ package com.google.zxing.common;
  * <p>This class is a convenient wrapper around this representation, but also exposes the internal\r
  * array for efficient access and manipulation.</p>\r
  *\r
- * @author srowen@google.com (Sean Owen)\r
+ * @author Sean Owen\r
  */\r
 public final class BitMatrix {\r
 \r
@@ -71,6 +71,17 @@ public final class BitMatrix {
     bits[offset >> 5] |= 1 << (offset & 0x1F);\r
   }\r
 \r
+  /**\r
+   * <p>Flips the given bit.</p>\r
+   *\r
+   * @param i row offset\r
+   * @param j column offset\r
+   */\r
+  public void flip(int i, int j) {\r
+    int offset = i + dimension * j;\r
+    bits[offset >> 5] ^= 1 << (offset & 0x1F);\r
+  }\r
+\r
   /**\r
    * <p>Sets a square region of the bit matrix to true.</p>\r
    *\r
@@ -108,18 +119,11 @@ public final class BitMatrix {
     return dimension;\r
   }\r
 \r
-  /**\r
-   * @return array of ints holding internal representation of this matrix's bits\r
-   */\r
-  public int[] getBits() {\r
-    return bits;\r
-  }\r
-\r
   public String toString() {\r
     StringBuffer result = new StringBuffer(dimension * (dimension + 1));\r
     for (int i = 0; i < dimension; i++) {\r
       for (int j = 0; j < dimension; j++) {\r
-        result.append(get(i, j) ? 'X' : ' ');\r
+        result.append(get(i, j) ? "X " : "  ");\r
       }\r
       result.append('\n');\r
     }\r