/[schmitzm]/trunk/src/skrueger/geotools/AttributeMetadataMap.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/AttributeMetadataMap.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 518 by alfonx, Fri Nov 13 18:16:38 2009 UTC revision 533 by alfonx, Thu Nov 19 17:27:01 2009 UTC
# Line 1  Line 1 
1  package skrueger.geotools;  package skrueger.geotools;
2    
3  import java.util.ArrayList;  import java.util.ArrayList;
4    import java.util.Collections;
5  import java.util.List;  import java.util.List;
6  import java.util.TreeMap;  import java.util.TreeMap;
7    
# Line 8  import org.apache.log4j.Logger; Line 9  import org.apache.log4j.Logger;
9  import org.geotools.feature.NameImpl;  import org.geotools.feature.NameImpl;
10  import org.opengis.feature.type.Name;  import org.opengis.feature.type.Name;
11    
12    import cern.colt.Arrays;
13    
14  import skrueger.AttributeMetadata;  import skrueger.AttributeMetadata;
15  import skrueger.i8n.I8NUtil;  import skrueger.i8n.I8NUtil;
16    import skrueger.i8n.Translation;
17    
18  /**  /**
19   * An extension of TreeMap, that is copyable in the sense of the {@link Copyable} interface   * An extension of TreeMap, that is copyable in the sense of the {@link Copyable} interface
# Line 17  import skrueger.i8n.I8NUtil; Line 21  import skrueger.i8n.I8NUtil;
21  public class AttributeMetadataMap extends TreeMap<Name, AttributeMetadata>  public class AttributeMetadataMap extends TreeMap<Name, AttributeMetadata>
22                  implements Copyable<AttributeMetadataMap> {                  implements Copyable<AttributeMetadataMap> {
23          static private final Logger LOGGER = Logger.getLogger(AttributeMetadataMap.class);          static private final Logger LOGGER = Logger.getLogger(AttributeMetadataMap.class);
24            private List<String> langs;
25            
26            public AttributeMetadataMap(List<String> defLanguages) {
27                    langs = defLanguages;
28            }
29            
30            @Deprecated
31            public AttributeMetadataMap() {
32                    langs = new ArrayList<String>();
33                    langs.add(Translation.getActiveLang());
34            }
35                    
36                    
37            public AttributeMetadataMap(String[] strings) {
38                    langs = new ArrayList<String>(java.util.Arrays.asList(strings));
39            }
40    
41          /**          /**
42           * @Deprecated use get(Name name) or get(String localName)           * @Deprecated use get(Name name) or get(String localName)
43           */           */
# Line 33  public class AttributeMetadataMap extend Line 52  public class AttributeMetadataMap extend
52          public AttributeMetadata get(Name name) {          public AttributeMetadata get(Name name) {
53                  final AttributeMetadata attributeMetadata = super.get(name);                  final AttributeMetadata attributeMetadata = super.get(name);
54                  if (attributeMetadata == null && name != null && !name.getLocalPart().trim().isEmpty()) {                  if (attributeMetadata == null && name != null && !name.getLocalPart().trim().isEmpty()) {
55                          put(name,new AttributeMetadata(name));                          put(name,new AttributeMetadata(name, langs));
56                          return super.get(name);                          return super.get(name);
57                  }                  }
58                  return attributeMetadata;                  return attributeMetadata;
# Line 57  public class AttributeMetadataMap extend Line 76  public class AttributeMetadataMap extend
76    
77          @Override          @Override
78          public AttributeMetadataMap copy() {          public AttributeMetadataMap copy() {
79                  AttributeMetadataMap copy = new AttributeMetadataMap();                  AttributeMetadataMap copy = new AttributeMetadataMap(langs);
80                  return copyTo(copy);                  return copyTo(copy);
81          }          }
82    
# Line 87  public class AttributeMetadataMap extend Line 106  public class AttributeMetadataMap extend
106                          return 1.;                          return 1.;
107    
108          }          }
109    
110            public List<String> getLanguages() {
111                    return langs;
112            }
113  }  }

Legend:
Removed from v.518  
changed lines
  Added in v.533

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26