Class SolarTime.Sunshine

java.lang.Object
net.time4j.calendar.astro.SolarTime.Sunshine
Enclosing class:
SolarTime

public static class SolarTime.Sunshine extends Object

Collects various data around sunrise and sunset.

Since:
3.34/4.29
Author:
Meno Hochschild
  • Method Details

    • startUTC

      public Moment startUTC()

      Obtains the moment of sunrise if it exists.

      Note: If there is no sunrise but the sun is already above the horizon at the start of day then this method yields the start of day.

      Returns:
      moment of sunrise
      Throws:
      IllegalStateException - in case of absent sunshine (polar night)
      See Also:
      isAbsent()
    • endUTC

      public Moment endUTC()

      Obtains the moment of sunset if it exists.

      Note: If there is no sunset but the sun is still above the horizon at the end of day then this method yields the end of day.

      Returns:
      moment of sunset (exclusive)
      Throws:
      IllegalStateException - in case of absent sunshine (polar night)
      See Also:
      isAbsent()
    • startLocal

      public PlainTimestamp startLocal()

      Obtains the local timestamp of sunrise if it exists.

      Note: If there is no sunrise but the sun is already above the horizon at the start of day then this method yields the start of day.

      Returns:
      local timestamp of sunrise
      Throws:
      IllegalStateException - in case of absent sunshine (polar night)
      See Also:
      isAbsent()
    • endLocal

      public PlainTimestamp endLocal()

      Obtains the local timestamp of sunset if it exists.

      Note: If there is no sunset but the sun is still above the horizon at the end of day then this method yields the end of day.

      Returns:
      local timestamp of sunset (exclusive)
      Throws:
      IllegalStateException - in case of absent sunshine (polar night)
      See Also:
      isAbsent()
    • isPresent

      public boolean isPresent(Moment moment)

      Is there any sunshine at given moment?

      Parameters:
      moment - the instant to be queried
      Returns:
      boolean
    • isPresent

      public boolean isPresent(PlainTimestamp tsp)

      Is there any sunshine at given local timestamp?

      Parameters:
      tsp - the local timestamp to be queried
      Returns:
      boolean
    • isAbsent

      public boolean isAbsent()

      Checks if any sunshine is unavailable (polar night).

      Returns:
      true if this instance corresponds to a polar night else false
    • length

      public int length()

      Obtains the length of sunshine in seconds.

      Returns:
      physical length of sunshine in seconds (without leap seconds)
      See Also:
      TimeUnit.SECONDS
    • toString

      public String toString()

      For debugging purposes.

      Overrides:
      toString in class Object
      Returns:
      String