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 Details

    • minutes_per_hour

      public static final BigDecimal minutes_per_hour
      Evident
    • seconds_per_minute

      public static final BigDecimal seconds_per_minute
      Evident
    • hours

      protected int hours
      Complete hours covered by ths duration. This field is valid after normalization by split().
    • minutes

      protected int minutes
      Complete minutes this duration is longer than hours. This field is valid after normalization by split().
    • secondsOnly

      protected BigDecimal secondsOnly
      Complete seconds (with fractinal part) ths duration is longer than hours and minutes. This field is valid after normalization by split().
    • value

      protected BigDecimal value
      The value of this duration, in seconds. Can have a fractional component.
    • isSplit

      protected boolean isSplit
      Whether normalization has been done.
  • Constructor Details

    • Duration_calendaric

      public Duration_calendaric(BigDecimal s)
      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 by get_hours().
    • get_secondsOnly

      public BigDecimal 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

      public BigDecimal get_valueInSeconds()
      Return the duration value measured in seconds and fractions of seconds.
    • compareTo

      public int compareTo(Duration_calendaric d)
      Evident
      Specified by:
      compareTo in interface Comparable<Duration_calendaric>
    • toString

      public String 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).
      Overrides:
      toString in class Object
    • toRational

      public Rational toRational()
      This conversion fails since no translation relation is per default.
      Specified by:
      toRational in interface DurationIndication
    • fromRational

      public static Duration_calendaric 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.