1
2
3
4
5
6
7
8
9
10
11 package edu.uci.ics.jung.io.graphml;
12
13 import java.util.Map;
14
15
16
17
18
19
20 public class Key {
21
22
23
24
25
26 public enum ForType {
27 ALL, GRAPH, NODE, EDGE, HYPEREDGE, PORT, ENDPOINT
28 }
29
30 private String id;
31 private String description;
32 private String attributeName;
33 private String attributeType;
34 private String defaultValue;
35 private ForType forType = ForType.ALL;
36
37 public String getDescription() {
38 return description;
39 }
40
41 public void setDescription(String description) {
42 this.description = description;
43 }
44
45 public String getAttributeName() {
46 return attributeName;
47 }
48
49 public void setAttributeName(String attributeName) {
50 this.attributeName = attributeName;
51 }
52
53 public String getAttributeType() {
54 return attributeType;
55 }
56
57 public void setAttributeType(String attributeType) {
58 this.attributeType = attributeType;
59 }
60
61 public String getDefaultValue() {
62 return defaultValue;
63 }
64
65 public void setDefaultValue(String defaultValue) {
66 this.defaultValue = defaultValue;
67 }
68
69 public void setId(String id) {
70 this.id = id;
71 }
72
73 public void setForType(ForType forType) {
74 this.forType = forType;
75 }
76
77 public String getId() {
78 return this.id;
79 }
80
81 public String defaultValue() {
82 return this.defaultValue;
83 }
84
85 public ForType getForType() {
86 return this.forType;
87 }
88
89 public void applyKey( Metadata metadata ) {
90 Map<String,String> props = metadata.getProperties();
91 if( defaultValue != null && !props.containsKey(id) ) {
92 props.put(id, defaultValue);
93 }
94 }
95 }