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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 474 - (show annotations)
Thu Oct 15 14:04:16 2009 UTC (15 years, 4 months ago) by alfonx
Original Path: branches/1.0-gt2-2.6/src/skrueger/geotools/AttributeMetadataMap.java
File MIME type: text/plain
File size: 1555 byte(s)
* AS-Hacking: Improved two label labeling. The seperation char only appears when the second property is not empty.
1 package skrueger.geotools;
2
3 import java.util.ArrayList;
4 import java.util.List;
5 import java.util.TreeMap;
6
7 import org.geotools.feature.NameImpl;
8 import org.opengis.feature.type.Name;
9
10 import skrueger.AttributeMetadata;
11
12 /**
13 * An extension of TreeMap, that is copyable in the sense of the {@link Copyable} interface
14 */
15 public class AttributeMetadataMap extends TreeMap<Name, AttributeMetadata>
16 implements Copyable<AttributeMetadataMap> {
17
18 /**
19 * @Deprecated use get(Name name) or get(String localName)
20 */
21 @Deprecated
22 public AttributeMetadata get(Object key) {
23 return super.get(key);
24 }
25
26 public AttributeMetadata get(Name name) {
27 final AttributeMetadata attributeMetadata = super.get(name);
28 if (attributeMetadata == null && name != null && !name.getLocalPart().trim().isEmpty()) {
29 put(name,new AttributeMetadata(name));
30 return super.get(name);
31 }
32 return attributeMetadata;
33 }
34
35 public AttributeMetadata get(String localName) {
36 return this.get(new NameImpl(localName));
37 }
38
39 @Override
40 public AttributeMetadataMap copyTo(AttributeMetadataMap amdMap) {
41
42 amdMap.clear();
43
44 for (Name key : keySet()) {
45 AttributeMetadata attributeMetaData = get(key);
46 amdMap.put(key, attributeMetaData.copy());
47 }
48 return amdMap;
49 }
50
51 @Override
52 public AttributeMetadataMap copy() {
53 AttributeMetadataMap copy = new AttributeMetadataMap();
54 return copyTo(copy);
55 }
56
57 public List<AttributeMetadata> sortedValues() {
58 ArrayList<AttributeMetadata> list = new ArrayList<AttributeMetadata>();
59 list.addAll(values());
60 return list;
61 }
62 }

Properties

Name Value
svn:eol-style native
svn:keywords Id URL
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26