Class YearMonthDurationItem

java.lang.Object
org.rumbledb.items.YearMonthDurationItem
All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable, Serializable, Item

public class YearMonthDurationItem extends Object implements Item
See Also:
  • Constructor Details

    • YearMonthDurationItem

      public YearMonthDurationItem()
    • YearMonthDurationItem

      public YearMonthDurationItem(Period value)
    • YearMonthDurationItem

      public YearMonthDurationItem(String value)
  • Method Details

    • isYearMonthDuration

      public boolean isYearMonthDuration()
      Description copied from interface: Item
      Tests whether the item is an atomic item of type yearMonthDuration.
      Specified by:
      isYearMonthDuration in interface Item
      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.
      Specified by:
      isAtomic in interface 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.
      Specified by:
      isDuration in interface Item
      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.
      Specified by:
      getEffectiveBooleanValue in interface Item
      Returns:
      the effective boolean value.
    • hashCode

      public int hashCode()
      Description copied from interface: Item
      Computes a hash code.
      Specified by:
      hashCode in interface Item
      Overrides:
      hashCode in class Object
      Returns:
      a hash code as an int.
    • write

      public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output)
      Specified by:
      write in interface com.esotericsoftware.kryo.KryoSerializable
    • read

      public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input)
      Specified by:
      read in interface com.esotericsoftware.kryo.KryoSerializable
    • equals

      public boolean equals(Object otherItem)
      Description copied from interface: Item
      Tests for logical equality. The semantics are that of the eq operator.
      Specified by:
      equals in interface Item
      Overrides:
      equals in class Object
      Parameters:
      otherItem - another item.
      Returns:
      true it is equal to other, false otherwise.
    • getStringValue

      public String getStringValue()
      Description copied from interface: Item
      Returns the string value of the item, if it is an atomic item.
      Specified by:
      getStringValue in interface 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).
      Specified by:
      getDynamicType in interface Item
      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.
      Specified by:
      getDurationValue in interface Item
      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.
      Specified by:
      getPeriodValue in interface Item
      Returns:
      the period value as a Period.
    • 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
      Specified by:
      getEpochMillis in interface Item
      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
      Specified by:
      getYear in interface Item
      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
      Specified by:
      getMonth in interface Item
      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.
      Specified by:
      getDay in interface Item
      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
      Specified by:
      getHour in interface Item
      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
      Specified by:
      getMinute in interface Item
      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
      Specified by:
      getSecond in interface Item
      Returns:
      only seconds