Updated the Android client to use native/local QR Code encoding. For now it still...
[zxing.git] / core / src / com / google / zxing / qrcode / encoder / Debug.java
1 /*
2  * Copyright 2008 ZXing authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package com.google.zxing.qrcode.encoder;
18
19 /**
20  * JAVAPORT: Equivalent methods to the C++ versions. It's debateable whether these should throw or
21  * assert. We can revisit that decision, or remove these throughout the code later.
22  *
23  * @author dswitkin@google.com (Daniel Switkin)
24  */
25 public class Debug {
26
27   public static void LOG_ERROR(String message) {
28     // Can't use IllegalStateException unfortunately in J2ME
29     // TODO do something else with this anyway
30     throw new RuntimeException(message);
31   }
32
33   public static void LOG_INFO(String message) {
34     // Chris M -- throwing RuntimeException in an INFO function seems terribly
35     // strange and violates my assumptions about logging information. Even
36     // ERROR is borderline since it's effectively going to go unchecked by most
37     // callers. There has to be a more general way to do this.
38     // throw new RuntimeException(message);
39   }
40
41   public static void DCHECK(boolean condition) {
42     if (!condition) {
43       throw new RuntimeException();
44     }
45   }
46
47   public static void DCHECK_LT(int a, int b) {
48     DCHECK(a < b);
49   }
50
51   public static void DCHECK_LE(int a, int b) {
52     DCHECK(a <= b);
53   }
54
55   public static void DCHECK_GT(int a, int b) {
56     DCHECK(a > b);
57   }
58
59   public static void DCHECK_GE(int a, int b) {
60     DCHECK(a >= b);
61   }
62
63   public static void DCHECK_EQ(int a, int b) {
64     DCHECK(a == b);
65   }
66
67 }