Klasse Time

java.lang.Object
ch.nolix.system.element.base.Element
ch.nolix.system.time.moment.Time
Alle implementierten Schnittstellen:
IElement, ITime

public final class Time extends Element implements ITime
Time stores a point in time with a precision of 1 millisecond. A Time is not mutable. Technically, a Time is a wrapper around a JDK's ZonedDateTime.
Version:
2016-09-01
Autor:
Silvan Wyss
  • Felddetails

    • DEFAULT_YEAR

      public static final int DEFAULT_YEAR
      Siehe auch:
    • DEFAULT_MONTH_OF_YEAR

      public static final int DEFAULT_MONTH_OF_YEAR
      Siehe auch:
    • DEFAULT_DAY_OF_MONTH

      public static final int DEFAULT_DAY_OF_MONTH
      Siehe auch:
    • DEFAULT_HOUR_OF_DAY

      public static final int DEFAULT_HOUR_OF_DAY
      Siehe auch:
    • DEFAULT_MINUTE_OF_HOUR

      public static final int DEFAULT_MINUTE_OF_HOUR
      Siehe auch:
    • DEFAULT_SECOND_OF_MINUTE

      public static final int DEFAULT_SECOND_OF_MINUTE
      Siehe auch:
    • DEFAULT_MILLISECOND_OF_SECOND

      public static final int DEFAULT_MILLISECOND_OF_SECOND
      Siehe auch:
  • Methodendetails

    • fromSpecification

      public static Time fromSpecification(INode<?> specification)
      Parameter:
      specification -
      Gibt zurück:
      a new Time from the given specification.
      Löst aus:
      InvalidArgumentException - if the given specification is not valid.
    • fromString

      public static Time fromString(String string)
      Parameter:
      string -
      Gibt zurück:
      a new Time from the given string.
      Löst aus:
      ArgumentIsNullException - if the given string is null.
    • ofNow

      public static Time ofNow()
      Gibt zurück:
      a new Time that represents the current time on the local computer.
    • withYear

      public static Time withYear(int year)
      Parameter:
      year -
      Gibt zurück:
      a new Time with the given year.
    • withYearAndMonthOfYear

      public static Time withYearAndMonthOfYear(int year, int monthOfYear)
      Parameter:
      year -
      monthOfYear -
      Gibt zurück:
      a new Time with the given year and monthOfYear.
    • withYearAndMonthOfYearAndDayOfMonth

      public static Time withYearAndMonthOfYearAndDayOfMonth(int year, int monthOfYear, int dayOfMonth)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      Gibt zurück:
      a new Time with the given year, monthOfYear and dayOfMonth.
    • withYearAndMonthOfYearAndDayOfMonthAndHourOfDay

      public static Time withYearAndMonthOfYearAndDayOfMonthAndHourOfDay(int year, int monthOfYear, int dayOfMonth, int hourOfDay)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      hourOfDay -
      Gibt zurück:
      a new Time with the given year, monthOfYear, dayOfMonth and hourOfDay.
    • withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinuteOfHour

      public static Time withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinuteOfHour(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      hourOfDay -
      minuteOfHour -
      Gibt zurück:
      a new Time with the given year, monthOfYear, dayOfMonth, hourOfDay and minuteOfHour.
    • withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinuteOfHourAndSecondOfMinute

      public static Time withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinuteOfHourAndSecondOfMinute(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      hourOfDay -
      minuteOfHour -
      secondOfMinute -
      Gibt zurück:
      a new Time with the given year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour and secondOfMinute.
    • withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinuteOfHourAndSecondOfMinuteAndMillisecondOfSecond

      public static Time withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinuteOfHourAndSecondOfMinuteAndMillisecondOfSecond(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisecondOfSecond)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      hourOfDay -
      minuteOfHour -
      secondOfMinute -
      millisecondOfSecond -
      Gibt zurück:
      a new Time with the given year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute and millisecondOfSecond.
    • getAttributes

      public IContainer<INode<?>> getAttributes()
      Angegeben von:
      getAttributes in Schnittstelle IElement
      Gibt zurück:
      the attributes of the current IElement.
    • getDay

      public Time getDay()
      Gibt zurück:
      the day of the current Time.
    • getDayOfMonth

      public int getDayOfMonth()
      Gibt zurück:
      the day of the month of the current Time.
    • getDaysTo

      public int getDaysTo(Time time)
      This method returns a negative value if the current Time is after the given time.
      Parameter:
      time -
      Gibt zurück:
      the number of days from the current Time to the given time.
    • getHour

      public Time getHour()
      Gibt zurück:
      the hour of the current Time.
    • getHourOfDay

      public int getHourOfDay()
      Gibt zurück:
      the hour of the month of the current Time.
    • getMilliseconds

      public long getMilliseconds()
      Angegeben von:
      getMilliseconds in Schnittstelle ITime
      Gibt zurück:
      the milliseconds of the current ITime.
    • getMillisecondOfSecond

      public int getMillisecondOfSecond()
      Gibt zurück:
      the millisecond of the second of the current Time.
    • getMillisecondsTo

      public long getMillisecondsTo(ITime time)
      This method returns a negative value if the current Time is after the given time.
      Parameter:
      time -
      Gibt zurück:
      the number of milliseconds from the current Time to the given time.
    • getMinute

      public Time getMinute()
      Gibt zurück:
      the minute of the current Time.
    • getMinuteOfHour

      public int getMinuteOfHour()
      Gibt zurück:
      the minute of the hour of the current Time.
    • getMonth

      public Time getMonth()
      Gibt zurück:
      the month of the current Time.
    • getMonthOfYear

      public Month getMonthOfYear()
      Angegeben von:
      getMonthOfYear in Schnittstelle ITime
      Gibt zurück:
      the month of the year of the current ITime.
    • getMonthOfYearAsInt

      public int getMonthOfYearAsInt()
      Gibt zurück:
      the month of the year of the current Time.
    • getNextDay

      public Time getNextDay()
      Gibt zurück:
      the next day of the current Time.
    • getNextHour

      public Time getNextHour()
      Gibt zurück:
      the next hour of the current Time.
    • getNextMinute

      public Time getNextMinute()
      Gibt zurück:
      the next minute of the current Time.
    • getNextMonth

      public Time getNextMonth()
      Gibt zurück:
      the next month of the current Time.
    • getNextSecond

      public Time getNextSecond()
      Gibt zurück:
      the next second of the current Time.
    • getNextYear

      public Time getNextYear()
      Gibt zurück:
      the next year of the current Time.
    • getSecond

      public Time getSecond()
      Gibt zurück:
      the second of the current Time.
    • getSecondOfMinute

      public int getSecondOfMinute()
      Gibt zurück:
      the second of the minute of the current Time.
    • getWeekday

      public Weekday getWeekday()
      Angegeben von:
      getWeekday in Schnittstelle ITime
      Gibt zurück:
      the weekday of the current ITime.
    • getWithAddedOrSubtractedDays

      public Time getWithAddedOrSubtractedDays(int days)
      Parameter:
      days -
      Gibt zurück:
      a new Time with the given days added or subtracted to the current Time.
    • getWithAddedOrSubtractedHours

      public Time getWithAddedOrSubtractedHours(int hours)
      Parameter:
      hours -
      Gibt zurück:
      a new Time with the given hours added or subtracted to the current Time.
    • getWithAddedOrSubtractedMilliseconds

      public Time getWithAddedOrSubtractedMilliseconds(int milliseconds)
      Parameter:
      milliseconds -
      Gibt zurück:
      a new Time with the given milliseconds added or subtracted to the current Time.
    • getWithAddedOrSubtractedMinutes

      public Time getWithAddedOrSubtractedMinutes(int minutes)
      Parameter:
      minutes -
      Gibt zurück:
      a new Time with the given minutes added or subtracted to the current Time.
    • getWithAddedOrSubtractedSeconds

      public Time getWithAddedOrSubtractedSeconds(int seconds)
      Parameter:
      seconds -
      Gibt zurück:
      a new Time with the given seconds added or subtracted to the current Time.
    • getYear

      public Time getYear()
      Gibt zurück:
      the year of the current Time.
    • getYearAsInt

      public int getYearAsInt()
      Gibt zurück:
      the year of the current Time.
    • isAfter

      public boolean isAfter(ITime time)
      Angegeben von:
      isAfter in Schnittstelle ITime
      Parameter:
      time -
      Gibt zurück:
      true if the current ITime is after the given time.
    • isBefore

      public boolean isBefore(ITime time)
      Angegeben von:
      isBefore in Schnittstelle ITime
      Parameter:
      time -
      Gibt zurück:
      true if the current ITime is before the given time.
    • isInLeapYear

      public boolean isInLeapYear()
      Gibt zurück:
      true if the current Time is in a leap year.