If you think the Android project customhellochartdemo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package lecho.lib.hellocharts.model;
//www.java2s.com/**
* Holds selected values indexes, i.e. for LineChartModel it will be firstIndex=lineIndex; secondIndex=valueIndex.
*
*/publicclass SelectedValue {
/**
* First index i.e for LineChart that will be line index.
*/privateint firstIndex;
/**
* Second index i.e for LineChart that will be PointValue index.
*/privateint secondIndex;
/**
* Used only for combo charts i.e 1 means user selected LinePoint, 2 means user selected ColumnValue.
*/privateint thirdIndex;
public SelectedValue() {
clear();
}
public SelectedValue(int firstIndex, int secondIndex, int dataType) {
set(firstIndex, secondIndex, dataType);
}
publicvoid set(int firstIndex, int secondIndex, int third) {
this.firstIndex = firstIndex;
this.secondIndex = secondIndex;
this.thirdIndex = third;
}
publicvoid set(SelectedValue selectedValue) {
this.firstIndex = selectedValue.firstIndex;
this.secondIndex = selectedValue.secondIndex;
this.thirdIndex = selectedValue.thirdIndex;
}
publicvoid clear() {
set(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
}
/**
* Return true if selected value have meaningful value.
*/publicboolean isSet() {
if (firstIndex >= 0 && secondIndex >= 0 && thirdIndex >= 0) {
return true;
} else {
return false;
}
}
/**
* First index i.e for LineChart that will be line index.
*/publicint getFirstIndex() {
return firstIndex;
}
publicvoid setFirstIndex(int firstIndex) {
this.firstIndex = firstIndex;
}
/**
* Second index i.e for LineChart that will be PointValue index.
*/publicint getSecondIndex() {
return secondIndex;
}
publicvoid setSecondIndex(int secondIndex) {
this.secondIndex = secondIndex;
}
/**
* Used only for combo charts i.e 1 means user selected LinePoint, 2 means user selected ColumnValue,.
*/publicint getThirdIndex() {
return thirdIndex;
}
publicvoid setThirdIndex(int thirdIndex) {
this.thirdIndex = thirdIndex;
}
@Override
publicint hashCode() {
finalint prime = 31;
int result = 1;
result = prime * result + thirdIndex;
result = prime * result + firstIndex;
result = prime * result + secondIndex;
return result;
}
@Override
publicboolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SelectedValue other = (SelectedValue) obj;
if (thirdIndex != other.thirdIndex)
return false;
if (firstIndex != other.firstIndex)
return false;
if (secondIndex != other.secondIndex)
return false;
return true;
}
@Override
public String toString() {
return"SelectedValue [firstIndex=" + firstIndex + ", secondIndex=" + secondIndex + ", thirdIndex="
+ thirdIndex + "]";
}
}