1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  package org.diyefi.openlogviewer.propertypanel;
24  
25  import java.awt.Color;
26  import org.diyefi.openlogviewer.genericlog.GenericDataElement;
27  
28  public class SingleProperty implements Comparable<SingleProperty> {
29  	private Color color;
30  	private String header;
31  	private double min;
32  	private double max;
33  	private int split;
34  	private boolean active;
35  
36  	public SingleProperty() {
37  		color = Color.RED;
38  		header = "";
39  		min = 0;
40  		max = 0;
41  		split = 1;
42  		active = false;
43  	}
44  
45  	public SingleProperty(final GenericDataElement GDE) {
46  		color = GDE.getDisplayColor();
47  		header = GDE.getName();
48  		min = GDE.getDisplayMinValue();
49  		max = GDE.getDisplayMaxValue();
50  		split = GDE.getSplitNumber();
51  		active = false;
52  	}
53  
54  	public final Color getColor() {
55  		return color;
56  	}
57  
58  	public final void setColor(final Color color) {
59  		this.color = color;
60  	}
61  
62  	public final String getHeader() {
63  		return header;
64  	}
65  
66  	public final void setHeader(final String header) {
67  		this.header = header;
68  	}
69  
70  	public final double getMax() {
71  		return max;
72  	}
73  
74  	public final void setMax(final double max) {
75  		this.max = max;
76  	}
77  
78  	public final double getMin() {
79  		return min;
80  	}
81  
82  	public final void setMin(final double min) {
83  		this.min = min;
84  	}
85  
86  	public final int getSplit() {
87  		return split;
88  	}
89  
90  	
91  
92  
93  
94  
95  	public final void setSplit(int split) {
96  		if (split < 1) {
97  			split = 1;
98  		}
99  		this.split = split;
100 	}
101 
102 	public final boolean isActive() {
103 		return active;
104 	}
105 
106 	public final void setActive(final boolean active) {
107 		this.active = active;
108 	}
109 
110 	public final String toString() {
111 		return header + "="
112 			+ color.getRed()
113 			+ "," + color.getGreen()
114 			+ "," + color.getBlue()
115 			+ "," + min
116 			+ "," + max
117 			+ "," + split
118 			+ "," + Boolean.toString(active);
119 	}
120 
121 	public final int compareTo(final SingleProperty sp) {
122 		return this.getHeader().compareToIgnoreCase(sp.getHeader());
123 	}
124 
125 	public final boolean equals(final String otherHeader) {
126 		return otherHeader.toLowerCase().equals(this.getHeader().toLowerCase());
127 	}
128 }