Range.java
791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.github.mikephil.charting.highlight;
/**
* Created by Philipp Jahoda on 24/07/15. Class that represents the range of one value in a stacked bar entry. e.g.
* stack values are -10, 5, 20 -> then ranges are (-10 - 0, 0 - 5, 5 - 25).
*/
public final class Range {
public float from;
public float to;
public Range(float from, float to) {
this.from = from;
this.to = to;
}
/**
* Returns true if this range contains (if the value is in between) the given value, false if not.
*
* @param value
* @return
*/
public boolean contains(float value) {
if (value > from && value <= to)
return true;
else
return false;
}
public boolean isLarger(float value) {
return value > to;
}
public boolean isSmaller(float value) {
return value < from;
}
}