1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package de.desy.acop.displayers.chart;
24
25 import java.io.Serializable;
26
27
28
29
30
31
32
33
34
35 public class HistoryParameters implements Serializable {
36
37 private static final long serialVersionUID = 1L;
38
39 private String historyContext;
40 private String historyServer;
41 private String historyDevice;
42 private String historyProperty;
43 private int historyIndex;
44
45
46
47
48
49
50
51
52
53
54 public HistoryParameters(String historyContext, String historyServer, String historyDevice, String historyProperty, int historyIndex) {
55 this.historyContext = historyContext;
56 this.historyServer = historyServer;
57 this.historyDevice = historyDevice;
58 this.historyProperty = historyProperty;
59 this.historyIndex = historyIndex;
60 }
61
62
63
64
65
66
67
68 public HistoryParameters(String remoteName) {
69 String[] s = remoteName.split("/");
70
71 this.historyContext = (s.length>0 && s[0]!=null) ? s[0] : "";
72 this.historyServer = (s.length>1 && s[1]!=null) ? s[1] : "";
73 this.historyProperty = (s.length>3 && s[s.length-1]!=null) ? s[s.length-1] : "";
74
75 StringBuilder sb= new StringBuilder(128);
76
77 if (s.length>2 && s[2]!=null) {
78 sb.append(s[2]);
79 }
80 for (int i = 3; i < s.length-1; i++) {
81 sb.append('/');
82 if (s[i]!=null) sb.append(s[i]);
83 }
84
85 this.historyDevice = sb.toString();
86 }
87
88
89
90
91 @Override
92 public boolean equals(Object obj) {
93 if (!(obj instanceof HistoryParameters)) return false;
94 return this.toString().equals(obj.toString());
95 }
96
97
98
99
100 @Override
101 public String toString() {
102 return historyContext + "/" + historyServer + "/" + historyDevice + "/" + historyProperty;
103 }
104
105
106
107
108
109
110
111 public String getRemoteName() {
112 return historyContext + "/" + historyServer + "/" + historyDevice + "/" + historyProperty;
113 }
114
115
116
117
118
119
120 public String getHistoryContext() {
121 return historyContext;
122 }
123
124
125
126
127
128 public void setHistoryContext(String historyContext) {
129 this.historyContext = historyContext;
130 }
131
132
133
134
135
136
137 public String getHistoryDevice() {
138 return historyDevice;
139 }
140
141
142
143
144
145
146 public void setHistoryDevice(String historyDevice) {
147 this.historyDevice = historyDevice;
148 }
149
150
151
152
153
154
155 public String getHistoryProperty() {
156 return historyProperty;
157 }
158
159
160
161
162
163 public void setHistoryProperty(String historyProperty) {
164 this.historyProperty = historyProperty;
165 }
166
167
168
169
170
171 public String getHistoryServer() {
172 return historyServer;
173 }
174
175
176
177
178
179
180 public void setHistoryServer(String historyServer) {
181 this.historyServer = historyServer;
182 }
183
184
185
186
187
188
189 public int getHistoryIndex() {
190 return historyIndex;
191 }
192
193
194
195
196
197
198 public void setHistoryIndex(int historyIndex) {
199 this.historyIndex = historyIndex;
200 }
201
202 @Override
203 public int hashCode() {
204 return getRemoteName().hashCode();
205 }
206
207 }