Class YearMonthDurationItem

java.lang.Object
org.rumbledb.items.AbstractAtomicItem
org.rumbledb.items.YearMonthDurationItem
All Implemented Interfaces:
Serializable, Item

public class YearMonthDurationItem extends AbstractAtomicItem
See Also:
  • Constructor Details

    • YearMonthDurationItem

      public YearMonthDurationItem(Period value)
    • YearMonthDurationItem

      public YearMonthDurationItem(String value)
  • Method Details

    • copy

      public Item copy(boolean mutable)
      Description copied from interface: Item
      Makes a copy.
      Parameters:
      mutable - whether the copy should be mutable (if supported by the item).
      Returns:
      a copy
    • isYearMonthDuration

      public boolean isYearMonthDuration()
      Description copied from interface: Item
      Tests whether the item is an atomic item of type yearMonthDuration.
      Returns:
      true if it is an atomic item of type yearMonthDuration, false otherwise.
    • isAtomic

      public boolean isAtomic()
      Description copied from interface: Item
      Tests whether the item is an atomic item.
      Returns:
      true if it is an atomic item, false otherwise.
    • isDuration

      public boolean isDuration()
      Description copied from interface: Item
      Tests whether the item is an atomic item of type duration.
      Returns:
      true if it is an atomic item of type duration, false otherwise.
    • getEffectiveBooleanValue

      public boolean getEffectiveBooleanValue()
      Description copied from interface: Item
      Returns the effective boolean value of the item, if atomic.
      Returns:
      the effective boolean value.
    • getStringValue

      public String getStringValue()
      Description copied from interface: Item
      Returns the string value of the item, if it is an atomic item.
      Returns:
      the string value.
    • getDynamicType

      public ItemType getDynamicType()
      Description copied from interface: Item
      Returns the dynamic type of the item (only for error message purposes).
      Returns:
      the dynamic type as an item type.
    • getDurationValue

      public Duration getDurationValue()
      Description copied from interface: Item
      Returns the duration value of the item, if it is a duration.
      Returns:
      the duration value as a Duration.
    • getPeriodValue

      public Period getPeriodValue()
      Description copied from interface: Item
      Returns the period value of the item, if it is a duration.
      Returns:
      the period value as a Period.
    • getDayTimeDurationComponent

      public Duration getDayTimeDurationComponent()
      Description copied from interface: Item
      Returns the day-time (seconds) component of a duration item, i.e., the value of the duration excluding its months component. Unlike getDurationValue(), this is not anchored to any reference date, since days, hours, minutes and seconds have a fixed length and can be converted to a Duration unambiguously.
      Returns:
      the day-time component as a Duration.
    • getEpochMillis

      public long getEpochMillis()
      Description copied from interface: Item
      Returns the EpochMillis of the item, if it's DateTime or Duration It will collect all the parts of the item and compress it into the EpochMillis
      Returns:
      the EpochMillis
    • normalizeDuration

      public static String normalizeDuration(Period period)
    • normalizeMonthsToYears

      public static Period normalizeMonthsToYears(Period period)
    • getYear

      public int getYear()
      Description copied from interface: Item
      Return year of the item, if it's DateTime or Duration
      Returns:
      year
    • getMonth

      public int getMonth()
      Description copied from interface: Item
      Return only month of the item, if it's DateTime or Duration It will not convert years into months
      Returns:
      only month
    • getDay

      public int getDay()
      Description copied from interface: Item
      Return only day of the item, if it's DateTime or Duration It will not convert months and years into days.
      Returns:
      only day
    • getHour

      public int getHour()
      Description copied from interface: Item
      Return only hour of the item, if it's DateTime, Time or Duration
      Returns:
      only hour
    • getMinute

      public int getMinute()
      Description copied from interface: Item
      Return only minutes of the item, if it's DateTime, Time or Duration It will not convert hours into minutes
      Returns:
      only minute
    • getSecond

      public double getSecond()
      Description copied from interface: Item
      Return only seconds of the item, if it's DateTime, Time or Duration It will not convert hours and minutes into seconds
      Returns:
      only seconds