Package eu.bandm.music.entities
Class Duration_calendaric
java.lang.Object
eu.bandm.music.entities.Duration_calendaric
- All Implemented Interfaces:
DurationIndication
,Comparable<Duration_calendaric>
public class Duration_calendaric
extends Object
implements Comparable<Duration_calendaric>, DurationIndication
Durations in the "calendaric" scale, meaning hours, minutes, seconds and
decimal fractions of seconds.
Printing and parsing support different formats.
Input can be done in seconds and minutes of more than fiftynine(59), iff
the higher-valued syntactic elements are omitted.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
Complete hours covered by ths duration.protected boolean
Whether normalization has been done.protected int
Complete minutes this duration is longer thanhours
.static final BigDecimal
Evidentstatic final BigDecimal
Evidentprotected BigDecimal
protected BigDecimal
The value of this duration, in seconds. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Evidentstatic Duration_calendaric
This conversion fails since no translation relation is per default.int
Return the maximum number of hours which is equal or less than the duration.int
Return the number of minutes the duration is longer than the integral hours delivered byget_hours()
.Return the number of seconds the duration is longer than the maximum number of integral minutes (=get_hours()
* 60 +get_minutes()
.Return the duration value measured in seconds and fractions of seconds.static final Translet.Parser<Duration_calendaric>
parser
(boolean lowerLimitForInternals, boolean upperLimitForLeading) Returns a parser for calendaric time.This conversion fails since no translation relation is per default.toString()
Always prints INNER minutes and seconds (i.e.
-
Field Details
-
minutes_per_hour
Evident -
seconds_per_minute
Evident -
hours
protected int hoursComplete hours covered by ths duration. This field is valid after normalization bysplit()
. -
minutes
protected int minutesComplete minutes this duration is longer thanhours
. This field is valid after normalization bysplit()
. -
secondsOnly
-
value
The value of this duration, in seconds. Can have a fractional component. -
isSplit
protected boolean isSplitWhether normalization has been done.
-
-
Constructor Details
-
Duration_calendaric
Public constructor.- Parameters:
s
- Duration in seconds and fractions of seconds.
-
-
Method Details
-
get_hours
public int get_hours()Return the maximum number of hours which is equal or less than the duration. -
get_minutes
public int get_minutes()Return the number of minutes the duration is longer than the integral hours delivered byget_hours()
. -
get_secondsOnly
Return the number of seconds the duration is longer than the maximum number of integral minutes (=get_hours()
* 60 +get_minutes()
. -
get_valueInSeconds
Return the duration value measured in seconds and fractions of seconds. -
compareTo
Evident- Specified by:
compareTo
in interfaceComparable<Duration_calendaric>
-
toString
Always prints INNER minutes and seconds (i.e. preceded by a higher-valued number) in a two(2) digits fields.
Always prints minutes, even in case they are zero(0). -
toRational
This conversion fails since no translation relation is per default.- Specified by:
toRational
in interfaceDurationIndication
-
fromRational
This conversion fails since no translation relation is per default. -
parser
public static final Translet.Parser<Duration_calendaric> parser(boolean lowerLimitForInternals, boolean upperLimitForLeading) Returns a parser for calendaric time. Acceptes variants are:12h03'45.678 12h 12h03 ==> NO!! 12h03' 03' = 3' 03'4 = 03'04 03'45.678 03'45 03'45 45.678 123' 123'45.678 123.45678
Attention, does not support "leap second", »0'60"«- Parameters:
lowerLimitForInternals
- true iff at least two(2) digits must be specified for minutes/seconds, which are NOT the leading part of the denotation (=which are an inner text component)upperLimitForLeading
- true iff not more than "59" may be specified for minutes and seconds, even when they are the leading part of the denotation.
-