public enum SimpleGranularity extends Enum<SimpleGranularity> implements IGranularity<SimpleGranularity>
TimeGranularity
enumerator. A simple enumerator value represents
an order of 10 (1, 10, 100, 1000, 10000, 100000, ....). The documentation
within this class uses the term milliseconds but the numbers could as
well be called units or steps. If an application performs
scheduling tasks that are based on units and steps instead of real
time then it could easily use this enumerator.SimpleGranularityDatelineModel
,
SimpleGranularityDatelineRenderer
,
SimpleGranularityGridPolicy
Enum Constant and Description |
---|
BILLION
A granularity representing one billion milliseconds.
|
BILLION_HUNDRED
A granularity representing one hundred billion milliseconds.
|
BILLION_TEN
A granularity representing ten billion milliseconds.
|
HUNDRED
A granularity representing one hundred milliseconds.
|
MILLION
A granularity representing one million milliseconds.
|
MILLION_HUNDRED
A granularity representing one hundred million milliseconds.
|
MILLION_TEN
A granularity representing ten million milliseconds.
|
ONE
A granularity representing one millisecond.
|
TEN
A granularity representing ten milliseconds.
|
THOUSAND
A granularity representing one thousand milliseconds.
|
THOUSAND_HUNDRED
A granularity representing one hundred thousand milliseconds.
|
THOUSAND_TEN
A granularity representing ten thousand milliseconds.
|
TRILLION
A granularity representing one trillion milliseconds.
|
Modifier and Type | Method and Description |
---|---|
long |
adjust(long time)
Adjusts the given time point by rounding it down to the nearest multitude
of the milliseconds represented by the granularity value.
|
long |
decrement(long time)
Decrements the given number of milliseconds with the milliseconds
represented by the enumerator value.
|
double |
getDelta(ITimeSpan span)
Calculates how often the number of milliseconds represented by the time
granularity fits into the difference between the given start and end
times:
(endTime - startTime) / millis . |
long |
getMillis()
Returns the number of milliseconds represented by the granularity.
|
String |
getName()
Returns the name of the granularity (e.g.
|
String |
getSingularName()
Returns the singular name of the granularity (e.g.
|
long |
getStandardDuration()
Returns the standard duration in milliseconds of the granularity, e.g.
|
long |
increment(long time)
Increments the given number of milliseconds with the milliseconds
represented by the enumerator value.
|
boolean |
isDisplayingMarkerType(MarkerType type)
Determines whether markers of the given type will be shown in the
timeline.
|
boolean |
isLarger(SimpleGranularity sg)
Checks whether this granularity is considered to be larger than the given
one.
|
boolean |
isSmaller(SimpleGranularity sg)
Checks whether this granularity is considered to be smaller than the
given one.
|
SimpleGranularity |
next()
Returns the next larger granularity (example: ONE -> TEN -> HUNDRED).
|
SimpleGranularity |
previous()
Returns the previous smaller granularity (example: HUNDRED -> TEN ->
ONE).
|
static SimpleGranularity |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SimpleGranularity[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SimpleGranularity ONE
public static final SimpleGranularity TEN
public static final SimpleGranularity HUNDRED
public static final SimpleGranularity THOUSAND
public static final SimpleGranularity THOUSAND_TEN
public static final SimpleGranularity THOUSAND_HUNDRED
public static final SimpleGranularity MILLION
public static final SimpleGranularity MILLION_TEN
public static final SimpleGranularity MILLION_HUNDRED
public static final SimpleGranularity BILLION
public static final SimpleGranularity BILLION_TEN
public static final SimpleGranularity BILLION_HUNDRED
public static final SimpleGranularity TRILLION
public static SimpleGranularity[] values()
for (SimpleGranularity c : SimpleGranularity.values()) System.out.println(c);
public static SimpleGranularity valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getName()
IGranularity
getName
in interface IGranularity<SimpleGranularity>
public String getSingularName()
IGranularity
getSingularName
in interface IGranularity<SimpleGranularity>
public long increment(long time)
time
- the time to incrementpublic long decrement(long time)
time
- the time to incrementpublic long adjust(long time)
THOUSAND
would adjust the time point 4366 to 4000.time
- the time that needs adjustmentpublic long getMillis()
public long getStandardDuration()
IGranularity
getStandardDuration
in interface IGranularity<SimpleGranularity>
public double getDelta(ITimeSpan span)
(endTime - startTime) / millis
.span
- the time span for which to return the deltapublic SimpleGranularity next()
public SimpleGranularity previous()
public boolean isSmaller(SimpleGranularity sg)
SimpleGranularity.THOUSAND.isSmaller(SimpleGranularity.HUNDRED)
would return FALSE since one thousand milliseconds is a larger number
than one hundred milliseconds.isSmaller
in interface IGranularity<SimpleGranularity>
sg
- the granularity to compare withpublic boolean isLarger(SimpleGranularity sg)
SimpleGranularity.THOUSAND.isLarger(SimpleGranularity.HUNDRED)
would return TRUE since one thousand milliseconds is a larger number than
one hundred milliseconds.isLarger
in interface IGranularity<SimpleGranularity>
sg
- the granularity to compare withpublic boolean isDisplayingMarkerType(MarkerType type)
IGranularity
isDisplayingMarkerType
in interface IGranularity<SimpleGranularity>
type
- the type of marker to checkCopyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.