Remove old C# port before committing new one
[zxing.git] / csharp / common / BitMatrix.cs
diff --git a/csharp/common/BitMatrix.cs b/csharp/common/BitMatrix.cs
deleted file mode 100755 (executable)
index 3d9a993..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*\r
-* Copyright 2008 ZXing authors\r
-*\r
-* Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-*      http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
-*/\r
-namespace com.google.zxing.common\r
-{\r
-    using System;\r
-    using System.Text;\r
-\r
-    /// <summary> A class which wraps a 2D array of bytes. The default usage is signed. If you want to use it as a\r
-    /// unsigned container, it's up to you to do byteValue & 0xff at each location.\r
-    /// *\r
-    /// JAVAPORT: I'm not happy about the argument ordering throughout the file, as I always like to have\r
-    /// the horizontal component first, but this is for compatibility with the C++ code. The original\r
-    /// code was a 2D array of ints, but since it only ever gets assigned -1, 0, and 1, I'm going to use\r
-    /// less memory and go with bytes.\r
-    /// *\r
-    /// </summary>\r
-    /// <author>  dswitkin@google.com (Daniel Switkin)\r
-    /// \r
-    /// </author>\r
-    public sealed class BitMatrix\r
-    {\r
-          private int dimension;\r
-          private int[] bits;\r
-\r
-          public BitMatrix(int dimension) {\r
-            if (dimension < 1) {\r
-              throw new Exception("dimension must be at least 1");\r
-            }\r
-            this.dimension = dimension;\r
-            int numBits = dimension * dimension;\r
-            int arraySize = numBits >> 5; // one int per 32 bits\r
-            if ((numBits & 0x1F) != 0) { // plus one more if there are leftovers\r
-              arraySize++;\r
-            }\r
-            bits = new int[arraySize];\r
-          }\r
-\r
-          /**\r
-           * @param i row offset\r
-           * @param j column offset\r
-           * @return value of given bit in matrix\r
-           */\r
-          public bool get(int i, int j) {\r
-            int offset = i + dimension * j;\r
-            //return ((bits[offset >> 5] >>> (offset & 0x1F)) & 0x01) != 0;\r
-                       return ((SupportClass.URShift(bits[offset >> 5], (offset & 0x1F))) & 0x01) != 0;\r
-          }\r
-\r
-          /**\r
-           * <p>Sets the given bit to true.</p>\r
-           *\r
-           * @param i row offset\r
-           * @param j column offset\r
-           */\r
-          public void set(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
-           * @param topI row offset of region's top-left corner (inclusive)\r
-           * @param leftJ column offset of region's top-left corner (inclusive)\r
-           * @param height height of region\r
-           * @param width width of region\r
-           */\r
-          public void setRegion(int topI, int leftJ, int height, int width) {\r
-            if (topI < 0 || leftJ < 0) {\r
-              throw new Exception("topI and leftJ must be nonnegative");\r
-            }\r
-            if (height < 1 || width < 1) {\r
-                throw new Exception("height and width must be at least 1");\r
-            }\r
-            int maxJ = leftJ + width;\r
-            int maxI = topI + height;\r
-            if (maxI > dimension || maxJ > dimension) {\r
-                throw new Exception(\r
-                  "topI + height and leftJ + width must be <= matrix dimension");\r
-            }\r
-            for (int j = leftJ; j < maxJ; j++) {\r
-              int jOffset = dimension * j;\r
-              for (int i = topI; i < maxI; i++) {\r
-                int offset = i + jOffset;\r
-                bits[offset >> 5] |= 1 << (offset & 0x1F);\r
-              }\r
-            }\r
-          }\r
-\r
-          /**\r
-           * @return row/column dimension of this matrix\r
-           */\r
-          public int getDimension() {\r
-            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
-              StringBuilder result = new StringBuilder(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
-              }\r
-              result.Append('\n');\r
-            }\r
-            return result.ToString();\r
-          }\r
-   \r
-    }\r
-}
\ No newline at end of file