1 package org.lsst.ccs.localdb.statusdb.server;
2
3 import javax.xml.bind.annotation.XmlAttribute;
4 import javax.xml.bind.annotation.XmlElement;
5
6 public class TrendingData {
7
8 @XmlElement
9 DataValue[] datavalue;
10 @XmlElement
11 AxisValue axisvalue;
12
13 public static class DataValue {
14
15 @XmlAttribute
16 String name = "";
17 @XmlAttribute
18 double value;
19
20 public DataValue(String name, double value) {
21 this.name = name;
22 this.value = value;
23 }
24
25 public DataValue() {
26 }
27
28 public double getValue() {
29 return value;
30 }
31
32 public String getName() {
33 return name;
34 }
35 }
36
37 public static class AxisValue {
38
39 @XmlAttribute
40 String name = "";
41 @XmlAttribute
42 long value;
43 @XmlAttribute
44 long loweredge;
45 @XmlAttribute
46 long upperedge;
47
48 public AxisValue(String name, long value) {
49 this.name = name;
50 this.value = value;
51 this.loweredge = value;
52 this.upperedge = value;
53 }
54
55 public AxisValue(String name, long value, long loweredge, long upperedge) {
56 this.name = name;
57 this.value = value;
58 this.loweredge = loweredge;
59 this.upperedge = upperedge;
60 }
61
62 public AxisValue() {
63 }
64
65 public long getLoweredge() {
66 return loweredge;
67 }
68
69 public String getName() {
70 return name;
71 }
72
73 public long getUpperedge() {
74 return upperedge;
75 }
76
77 public long getValue() {
78 return value;
79 }
80 }
81
82 public void setAxisValue(AxisValue axisValue) {
83 this.axisvalue = axisValue;
84 }
85
86 public void setDataValue(DataValue[] dataValue) {
87 this.datavalue = dataValue;
88 }
89
90 public DataValue[] getDatavalue() {
91 return datavalue;
92 }
93
94 public AxisValue getAxisvalue() {
95 return axisvalue;
96 }
97
98 public double getValue(String name) {
99 for ( int i = 0; i < datavalue.length; i++ ) {
100 if ( datavalue[i].getName().equals(name) )
101 return datavalue[i].getValue();
102 }
103 return Double.NaN;
104 }
105
106 }