Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / libaddressinput / src / java / src / com / android / i18n / addressinput / AddressVerificationNodeData.java
1 /*
2  * Copyright (C) 2010 Google Inc.
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.android.i18n.addressinput;
18
19 import java.util.Iterator;
20 import java.util.Map;
21
22 /**
23  * A map of {@link AddressDataKey}s to JSON strings. Provides data for a single node in the address
24  * data hierarchy (for example, "data/US/CA"). Key is an AddressDataKey and the value is the raw
25  * string representing that data. This is either a single string, or an array of strings represented
26  * as a single string using '~' to separate the elements of the array, depending on the
27  * AddressDataKey.
28  */
29 public class AddressVerificationNodeData {
30
31   private final Map<AddressDataKey, String> map;
32
33   public AddressVerificationNodeData(Map<AddressDataKey, String> map) {
34     Util.checkNotNull("Cannot construct StandardNodeData with null map");
35     this.map = map;
36   }
37
38   /**
39    * Iterates through the map.
40    */
41   public Iterator<AddressDataKey> iterator() {
42     return map.keySet().iterator();
43   }
44
45   public boolean containsKey(AddressDataKey key) {
46     return map.containsKey(key);
47   }
48
49   /**
50    * Gets the value for a particular key in the map.
51    */
52   public String get(AddressDataKey key) {
53     return map.get(key);
54   }
55 }