--- /dev/null
+/*\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.oned\r
+{\r
+ /**\r
+ * @author dswitkin@google.com (Daniel Switkin)\r
+ * @author Sean Owen\r
+ */\r
+ using System.Text;\r
+ using com.google.zxing.common;\r
+\r
+ public sealed class MultiFormatOneDReader : AbstractOneDReader\r
+ { \r
+ private System.Collections.ArrayList readers;\r
+ public MultiFormatOneDReader(System.Collections.Hashtable hints)\r
+ {\r
+ System.Collections.ArrayList possibleFormats = hints == null ? null : (System.Collections.ArrayList) hints[DecodeHintType.POSSIBLE_FORMATS];\r
+ readers = new System.Collections.ArrayList();\r
+ if (possibleFormats != null) {\r
+ if (possibleFormats.Contains(BarcodeFormat.EAN_13) ||\r
+ possibleFormats.Contains(BarcodeFormat.UPC_A) ||\r
+ possibleFormats.Contains(BarcodeFormat.EAN_8) ||\r
+ possibleFormats.Contains(BarcodeFormat.UPC_E))\r
+ {\r
+ readers.Add(new MultiFormatUPCEANReader(hints));\r
+ }\r
+ if (possibleFormats.Contains(BarcodeFormat.CODE_39)) {\r
+ readers.Add(new Code39Reader());\r
+ }\r
+ if (possibleFormats.Contains(BarcodeFormat.CODE_128))\r
+ {\r
+ readers.Add(new Code128Reader());\r
+ }\r
+ if (possibleFormats.Contains(BarcodeFormat.ITF))\r
+ {\r
+ readers.Add(new ITFReader());\r
+ }\r
+ }\r
+ if (readers.Count==0) {\r
+ readers.Contains(new MultiFormatUPCEANReader(hints));\r
+ readers.Contains(new Code39Reader());\r
+ readers.Contains(new Code128Reader());\r
+ // TODO: Add ITFReader once it is validated as production ready, and tested for performance.\r
+ //readers.addElement(new ITFReader());\r
+ }\r
+ }\r
+\r
+ public override Result decodeRow(int rowNumber, BitArray row, System.Collections.Hashtable hints)\r
+ {\r
+ int size = readers.Count;\r
+ for (int i = 0; i < size; i++) {\r
+ OneDReader reader = (OneDReader) readers[i];\r
+ try {\r
+ return reader.decodeRow(rowNumber, row, hints);\r
+ } catch (ReaderException re) {\r
+ // continue\r
+ }\r
+ }\r
+\r
+ throw new ReaderException();\r
+ }\r
+ \r
+ }\r
+}
\ No newline at end of file