1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.utgenome.gwt.utgb.client.track.impl;
26
27 import java.util.HashSet;
28 import java.util.Set;
29
30 import org.utgenome.gwt.utgb.client.track.TrackGroupProperty;
31 import org.utgenome.gwt.utgb.client.track.TrackGroupPropertyChange;
32 import org.utgenome.gwt.utgb.client.track.TrackWindow;
33 import org.utgenome.gwt.utgb.client.util.xml.XMLWriter;
34
35
36
37
38
39
40
41 class TrackPropertyChangeImpl implements TrackGroupPropertyChange {
42 private HashSet<String> _keySetOfChangedProperties = new HashSet<String>();
43
44 private TrackGroupProperty _reader;
45
46 public TrackPropertyChangeImpl(TrackGroupProperty reader, String keyOfChangedProperty) {
47 this._reader = reader;
48 addChangedProperty(keyOfChangedProperty);
49 }
50
51 public TrackPropertyChangeImpl(TrackGroupProperty reader, Set<String> keySet) {
52 this._reader = reader;
53 addChangedProperty(keySet);
54 }
55
56 public void addChangedProperty(String key) {
57 _keySetOfChangedProperties.add(key);
58 }
59
60 public void addChangedProperty(Set<String> keySet) {
61 for (String key : keySet)
62 addChangedProperty(key);
63 }
64
65 public boolean contains(String key) {
66 return _keySetOfChangedProperties.contains(key);
67 }
68
69 public boolean containsOneOf(String[] keySet) {
70 for (int i = 0; i < keySet.length; i++) {
71 if (_keySetOfChangedProperties.contains(keySet[i]))
72 return true;
73 }
74 return false;
75 }
76
77 public boolean containsOneOf(Iterable<String> keyList) {
78 for (String key : keyList) {
79 if (_keySetOfChangedProperties.contains(key))
80 return true;
81 }
82 return false;
83 }
84
85 public String getProperty(String key) {
86 return _reader.getProperty(key);
87 }
88
89 public String getProperty(String key, String defaultValue) {
90 return _reader.getProperty(key, defaultValue);
91 }
92
93 public TrackWindow getTrackWindow() {
94 return _reader.getTrackWindow();
95 }
96
97 public Set<String> keySet() {
98 return _reader.keySet();
99 }
100
101 public Set<String> changedKeySet() {
102 return _keySetOfChangedProperties;
103 }
104
105 public void toXML(XMLWriter xmlWriter) {
106 _reader.toXML(xmlWriter);
107 }
108
109 }