org.flexiblepower.ral.values
T
- The type of the values stored in the elementspublic abstract class Profile<T> extends java.util.AbstractList<Profile.Element<T>>
Profile
class.Modifier and Type | Class and Description |
---|---|
static class |
Profile.Element<T>
Represents each element in the profile.
|
Modifier and Type | Field and Description |
---|---|
protected Profile.Element<T>[] |
elements
The array that contains all the elements.
|
static javax.measure.unit.Unit<javax.measure.quantity.Duration> |
MS
The unit for milliseconds.
|
Modifier | Constructor and Description |
---|---|
protected |
Profile(Profile.Element<T>... elements)
Creates a new instance of the profile by using the given elements.
|
Modifier and Type | Method and Description |
---|---|
Profile.Element<T> |
get(int index) |
Profile.Element<T> |
getElementAtOffset(javax.measure.Measurable<javax.measure.quantity.Duration> offset)
Find the element in the
Profile at a specific offset. |
javax.measure.Measurable<javax.measure.quantity.Duration> |
getTotalDuration() |
int |
size() |
abstract Profile<T> |
subProfile(javax.measure.Measurable<javax.measure.quantity.Duration> offset,
javax.measure.Measurable<javax.measure.quantity.Duration> duration)
An extension of the profile should implement this method to be able to split the profile up into parts.
|
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
public static final javax.measure.unit.Unit<javax.measure.quantity.Duration> MS
protected final Profile.Element<T>[] elements
protected Profile(Profile.Element<T>... elements)
elements
- The array of elements (in order!) that make up this profile.public Profile.Element<T> get(int index)
get
in interface java.util.List<Profile.Element<T>>
get
in class java.util.AbstractList<Profile.Element<T>>
public int size()
size
in interface java.util.Collection<Profile.Element<T>>
size
in interface java.util.List<Profile.Element<T>>
size
in class java.util.AbstractCollection<Profile.Element<T>>
public javax.measure.Measurable<javax.measure.quantity.Duration> getTotalDuration()
public Profile.Element<T> getElementAtOffset(javax.measure.Measurable<javax.measure.quantity.Duration> offset)
Profile
at a specific offset.offset
- Measurable<Duration> of the offset to search for an elementpublic abstract Profile<T> subProfile(javax.measure.Measurable<javax.measure.quantity.Duration> offset, javax.measure.Measurable<javax.measure.quantity.Duration> duration)
offset
- The offset of where the subsection of the profile should start. This should always be >= 0.duration
- The total duration of the new profile. The offset + duration should never be more than the total
duration of this profile.Profile
implementation that represents the selected subprofile.