org.flexiblepower.efi.util
T - The type of value that is stored at each elementpublic class FillLevelFunction<T> extends java.util.AbstractList<FillLevelFunction.RangeElement<T>>
List of FillLevelFunction.RangeElements and can be used in that manner.| Modifier and Type | Class and Description |
|---|---|
static class |
FillLevelFunction.Builder<T>
This helper class should be used to easily define a
FillLevelFunction. |
static class |
FillLevelFunction.RangeElement<T>
This class stores the values for each range.
|
| Modifier and Type | Field and Description |
|---|---|
protected FillLevelFunction.RangeElement<T>[] |
elements |
| Constructor and Description |
|---|
FillLevelFunction(java.util.List<FillLevelFunction.RangeElement<T>> elements) |
| Modifier and Type | Method and Description |
|---|---|
static <T> FillLevelFunction.Builder<T> |
create(double lowerBound) |
boolean |
equals(java.lang.Object obj) |
FillLevelFunction.RangeElement<T> |
get(int index) |
double |
getLowerBound() |
FillLevelFunction.RangeElement<T> |
getRangeElementForFillLevel(double fillLevel) |
double |
getUpperBound() |
T |
getValueForFillLevel(double fillLevel) |
int |
hashCode() |
boolean |
isAboveMaximum(double fillLevel) |
boolean |
isBelowMinimum(double fillLevel) |
boolean |
isOutsideOfRange(double fillLevel) |
int |
size() |
java.lang.String |
toString() |
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayprotected final FillLevelFunction.RangeElement<T>[] elements
public FillLevelFunction(java.util.List<FillLevelFunction.RangeElement<T>> elements)
public static <T> FillLevelFunction.Builder<T> create(double lowerBound)
lowerBound - The lowest boundFillLevelFunction.Builder object that can be used to easily create the FillLevelFunctionpublic FillLevelFunction.RangeElement<T> get(int index)
get in interface java.util.List<FillLevelFunction.RangeElement<T>>get in class java.util.AbstractList<FillLevelFunction.RangeElement<T>>public int size()
size in interface java.util.Collection<FillLevelFunction.RangeElement<T>>size in interface java.util.List<FillLevelFunction.RangeElement<T>>size in class java.util.AbstractCollection<FillLevelFunction.RangeElement<T>>public double getLowerBound()
public double getUpperBound()
public T getValueForFillLevel(double fillLevel)
fillLevel - The fill level of the buffer for which to get the corresponding valuejava.lang.IllegalArgumentException - when the fillLevel is outside the bounds (see getLowerBound() and getUpperBound())public FillLevelFunction.RangeElement<T> getRangeElementForFillLevel(double fillLevel)
fillLevel - The fill level of the buffer for which to get the corresponding elementjava.lang.IllegalArgumentException - when the fillLevel is outside the bounds (see getLowerBound() and getUpperBound())public boolean isOutsideOfRange(double fillLevel)
fillLevel - the value to check.public boolean isBelowMinimum(double fillLevel)
fillLevel - the value to check.public boolean isAboveMaximum(double fillLevel)
fillLevel - the value to check.public int hashCode()
hashCode in interface java.util.Collection<FillLevelFunction.RangeElement<T>>hashCode in interface java.util.List<FillLevelFunction.RangeElement<T>>hashCode in class java.util.AbstractList<FillLevelFunction.RangeElement<T>>public boolean equals(java.lang.Object obj)
equals in interface java.util.Collection<FillLevelFunction.RangeElement<T>>equals in interface java.util.List<FillLevelFunction.RangeElement<T>>equals in class java.util.AbstractList<FillLevelFunction.RangeElement<T>>public java.lang.String toString()
toString in class java.util.AbstractCollection<FillLevelFunction.RangeElement<T>>