2 * Copyright (C) 2010 ZXing authors
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * These authors would like to acknowledge the Spanish Ministry of Industry,
19 * Tourism and Trade, for the support in the project TSI020301-2008-2
20 * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled
21 * Mobile Dynamic Environments", led by Treelogic
22 * ( http://www.treelogic.com/ ):
24 * http://www.piramidepse.com/
27 package com.google.zxing.client.result;
29 import java.util.Hashtable;
32 * @author Antonio Manuel Benjumea Conde, Servinform, S.A.
33 * @author AgustÃn Delgado, Servinform, S.A.
35 public class ExpandedProductParsedResult extends ParsedResult {
37 public static final String KILOGRAM = "KG";
38 public static final String POUND = "LB";
40 private final String productID;
41 private final String sscc;
42 private final String lotNumber;
43 private final String productionDate;
44 private final String packagingDate;
45 private final String bestBeforeDate;
46 private final String expirationDate;
47 private final String weight;
48 private final String weightType;
49 private final String weightIncrement;
50 private final String price;
51 private final String priceIncrement;
52 private final String priceCurrency;
53 // For AIS that not exist in this object
54 private final Hashtable uncommonAIs;
56 ExpandedProductParsedResult() {
57 super(ParsedResultType.PRODUCT);
61 this.productionDate = "";
62 this.packagingDate = "";
63 this.bestBeforeDate = "";
64 this.expirationDate = "";
67 this.weightIncrement = "";
69 this.priceIncrement = "";
70 this.priceCurrency = "";
71 this.uncommonAIs = new Hashtable();
74 public ExpandedProductParsedResult(String productID, String sscc,
75 String lotNumber, String productionDate, String packagingDate,
76 String bestBeforeDate, String expirationDate, String weight,
77 String weightType, String weightIncrement, String price,
78 String priceIncrement, String priceCurrency, Hashtable uncommonAIs) {
79 super(ParsedResultType.PRODUCT);
80 this.productID = productID;
82 this.lotNumber = lotNumber;
83 this.productionDate = productionDate;
84 this.packagingDate = packagingDate;
85 this.bestBeforeDate = bestBeforeDate;
86 this.expirationDate = expirationDate;
88 this.weightType = weightType;
89 this.weightIncrement = weightIncrement;
91 this.priceIncrement = priceIncrement;
92 this.priceCurrency = priceCurrency;
93 this.uncommonAIs = uncommonAIs;
96 public boolean equals(Object o){
97 if (!(o instanceof ExpandedProductParsedResult)) {
101 ExpandedProductParsedResult other = (ExpandedProductParsedResult)o;
103 return this.productID.equals( other.productID)
104 && this.sscc.equals( other.sscc)
105 && this.lotNumber.equals( other.lotNumber)
106 && this.productionDate.equals( other.productionDate)
107 && this.bestBeforeDate.equals( other.bestBeforeDate)
108 && this.expirationDate.equals( other.expirationDate)
109 && this.weight.equals( other.weight)
110 && this.weightType.equals( other.weightType)
111 && this.weightIncrement.equals( other.weightIncrement)
112 && this.price.equals( other.price)
113 && this.priceIncrement.equals( other.priceIncrement)
114 && this.priceCurrency.equals( other.priceCurrency)
115 && this.uncommonAIs.equals( other.uncommonAIs);
118 public int hashCode(){
119 int hash1 = this.productID.hashCode();
120 hash1 = 31 * hash1 + this.sscc.hashCode();
121 hash1 = 31 * hash1 + this.lotNumber.hashCode();
122 hash1 = 31 * hash1 + this.productionDate.hashCode();
123 hash1 = 31 * hash1 + this.bestBeforeDate.hashCode();
124 hash1 = 31 * hash1 + this.expirationDate.hashCode();
125 hash1 = 31 * hash1 + this.weight.hashCode();
127 int hash2 = this.weightType.hashCode();
128 hash2 = 31 * hash2 + this.weightIncrement.hashCode();
129 hash2 = 31 * hash2 + this.price.hashCode();
130 hash2 = 31 * hash2 + this.priceIncrement.hashCode();
131 hash2 = 31 * hash2 + this.priceCurrency.hashCode();
132 hash2 = 31 * hash2 + this.uncommonAIs.hashCode();
133 return hash1 ^ hash2;
136 public String getProductID() {
140 public String getSscc() {
144 public String getLotNumber() {
148 public String getProductionDate() {
149 return productionDate;
152 public String getPackagingDate() {
153 return packagingDate;
156 public String getBestBeforeDate() {
157 return bestBeforeDate;
160 public String getExpirationDate() {
161 return expirationDate;
164 public String getWeight() {
168 public String getWeightType() {
172 public String getWeightIncrement() {
173 return weightIncrement;
176 public String getPrice() {
180 public String getPriceIncrement() {
181 return priceIncrement;
184 public String getPriceCurrency() {
185 return priceCurrency;
188 public Hashtable getUncommonAIs() {
192 public String getDisplayResult() {