]> nv-tegra.nvidia Code Review - android/platform/packages/apps/Tag.git/blob - src/com/android/vcard/VCardInterpreterCollection.java
Copy VCard utilities
[android/platform/packages/apps/Tag.git] / src / com / android / vcard / VCardInterpreterCollection.java
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
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 package com.android.vcard;
17
18 import java.util.Collection;
19 import java.util.List;
20
21 /**
22  * The {@link VCardInterpreter} implementation which aggregates more than one
23  * {@link VCardInterpreter} objects and make a user object treat them as one
24  * {@link VCardInterpreter} object.
25  */
26 public final class VCardInterpreterCollection implements VCardInterpreter {
27     private final Collection<VCardInterpreter> mInterpreterCollection;
28
29     public VCardInterpreterCollection(Collection<VCardInterpreter> interpreterCollection) {
30         mInterpreterCollection = interpreterCollection;
31     }
32
33     public Collection<VCardInterpreter> getCollection() {
34         return mInterpreterCollection;
35     }
36
37     public void start() {
38         for (VCardInterpreter builder : mInterpreterCollection) {
39             builder.start();
40         }
41     }
42
43     public void end() {
44         for (VCardInterpreter builder : mInterpreterCollection) {
45             builder.end();
46         }
47     }
48
49     public void startEntry() {
50         for (VCardInterpreter builder : mInterpreterCollection) {
51             builder.startEntry();
52         }
53     }
54
55     public void endEntry() {
56         for (VCardInterpreter builder : mInterpreterCollection) {
57             builder.endEntry();
58         }
59     }
60
61     public void startProperty() {
62         for (VCardInterpreter builder : mInterpreterCollection) {
63             builder.startProperty();
64         }
65     }
66
67     public void endProperty() {
68         for (VCardInterpreter builder : mInterpreterCollection) {
69             builder.endProperty();
70         }
71     }
72
73     public void propertyGroup(String group) {
74         for (VCardInterpreter builder : mInterpreterCollection) {
75             builder.propertyGroup(group);
76         }
77     }
78
79     public void propertyName(String name) {
80         for (VCardInterpreter builder : mInterpreterCollection) {
81             builder.propertyName(name);
82         }
83     }
84
85     public void propertyParamType(String type) {
86         for (VCardInterpreter builder : mInterpreterCollection) {
87             builder.propertyParamType(type);
88         }
89     }
90
91     public void propertyParamValue(String value) {
92         for (VCardInterpreter builder : mInterpreterCollection) {
93             builder.propertyParamValue(value);
94         }
95     }
96
97     public void propertyValues(List<String> values) {
98         for (VCardInterpreter builder : mInterpreterCollection) {
99             builder.propertyValues(values);
100         }
101     }
102 }