1 package org.catacomb.graph.gui;
2
3 import org.catacomb.interlish.structure.IDable;
4 import org.catacomb.util.StringUtil;
5
6
7 import java.util.ArrayList;
8
9
10
11
12 public class DataView implements IDable {
13
14 public String id;
15 public String abscissa;
16 public String[] ordinates;
17
18 public String multiOrdinate;
19 public int[] multiIndexes;
20
21 public double xMin;
22 public double xMax;
23 public double yMin;
24 public double yMax;
25
26
27 public final static int XY = 1;
28 public final static int MOVIE = 2;
29 public final static int EVTSEQ = 3;
30 public int style;
31
32
33 public String itemPath;
34
35
36
37 public DataView() {
38 style = XY;
39 }
40
41 public DataView(String s) {
42 id = s;
43 style = XY;
44 }
45
46
47 public DataView makeCopy() {
48 DataView dv = new DataView(id);
49 dv.setAbscissa(abscissa);
50 dv.setOrdinates(StringUtil.copyArray(ordinates));
51 dv.setMultiOrdinate(multiOrdinate);
52 dv.setMultiIndexes(multiIndexes);
53 dv.setXRange(xMin, xMax);
54 dv.setYRange(yMin, yMax);
55 dv.itemPath = itemPath;
56 dv.style = style;
57 return dv;
58 }
59
60
61
62 public void setID(String s) {
63 id = s;
64 }
65
66
67 public String getID() {
68 return id;
69 }
70
71 public boolean isMovie() {
72 return (style == MOVIE);
73 }
74
75 public boolean isXY() {
76 return (style == XY);
77 }
78
79 public boolean isEventSequence() {
80 return (style == EVTSEQ);
81 }
82
83
84
85 public void setMoviePath(String s) {
86 style = MOVIE;
87 itemPath = s;
88 }
89
90 public void setEventSequencePath(String s) {
91 style = EVTSEQ;
92 itemPath = s;
93 }
94
95 public String getItemPath() {
96 return itemPath;
97 }
98
99 public String getMoviePath() {
100 return itemPath;
101 }
102
103 public void setAbscissa(String a) {
104 abscissa = a;
105 }
106
107 public String getAbscissa() {
108 return abscissa;
109 }
110
111 public void setOrdinates(String[] sa) {
112 ordinates = sa;
113 }
114
115 public void setOrdinates(ArrayList<String> als) {
116 ordinates = als.toArray(new String[0]);
117 }
118
119
120 public String[] getOrdinates() {
121 return ordinates;
122 }
123
124
125 public void setXRange(double[] da) {
126 setXRange(da[0], da[1]);
127 }
128
129 public void setYRange(double[] da) {
130 setYRange(da[0], da[1]);
131 }
132
133 public void setXRange(double d, double e) {
134 xMin = d;
135 xMax = e;
136 }
137
138 public void setYRange(double d, double e) {
139 yMin = d;
140 yMax = e;
141 }
142
143 public boolean hasLimits() {
144 return (xMax > xMin && yMax > yMin);
145 }
146
147 public double[] getXYXYLimits() {
148 double[] d = {xMin, yMin, xMax, yMax};
149 return d;
150 }
151
152
153 public String getMultiOrdinate() {
154 return multiOrdinate;
155 }
156
157 public void setMultiOrdinate(String s) {
158 multiOrdinate = s;
159 }
160
161 public void clearMultiOrdinate() {
162 multiOrdinate = null;
163 }
164
165 public void setMultiIndexes(int[] ia) {
166 multiIndexes = ia;
167 }
168
169 public int[] getMultiIndexes() {
170 return multiIndexes;
171 }
172
173 public void setAllMultiIndexes() {
174 multiIndexes = null;
175 }
176
177 public void setNoneMultiIndexes() {
178 multiIndexes = new int[0];
179 }
180 }