• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.unicode.cldr.draft;
2 
3 import java.util.ArrayList;
4 import java.util.List;
5 
6 import com.ibm.icu.text.StringTransform;
7 
8 /**
9  * Immutable class that does a compound transform
10  *
11  * @author markdavis
12  */
13 
14 public class CompoundTransform implements StringTransform {
15     private final List<StringTransform> transforms;
16 
CompoundTransform(List<StringTransform> transforms)17     public CompoundTransform(List<StringTransform> transforms) {
18         this.transforms = new ArrayList<StringTransform>(transforms);
19     }
20 
transform(String source)21     public String transform(String source) {
22         for (int i = 0; i < transforms.size(); ++i) {
23             source = transforms.get(i).transform(source);
24         }
25         return source;
26     }
27 
toString()28     public String toString() {
29         StringBuilder result = new StringBuilder();
30         for (int i = 0; i < transforms.size(); ++i) {
31             if (i != 0) {
32                 result.append(":: NULL ;\n");
33             }
34             result.append(transforms.get(i).toString());
35         }
36         return result.toString();
37     }
38 }
39