Class BaseBuilder<T>
java.lang.Object
org.shredzone.commons.suncalc.util.BaseBuilder<T>
- Type Parameters:
T- Type of the final builder
- All Implemented Interfaces:
Cloneable,GenericParameter<T>,LocationParameter<T>,TimeParameter<T>
public class BaseBuilder<T>
extends Object
implements GenericParameter<T>, LocationParameter<T>, TimeParameter<T>, Cloneable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a copy of the current parameters.doubleReturns the height, in meters above sea level.Returns theJulianDateto be used.doubleReturns the latitude.doubleReturns the latitude.doubleReturns the longitude.doubleReturns the longitude.height(double h) Sets the height.latitude(double lat) Sets the latitude.longitude(double lng) Sets the longitude.midnight()Sets the time to the start of the current date ("last midnight").now()Sets the current date and time.on(int year, int month, int date, int hour, int minute, int second) Sets date and time.Uses the givenInstantinstance.Uses the givenLocalDateinstance, and assumes midnight.on(LocalDateTime dateTime) Uses the givenLocalDateTimeinstance.on(ZonedDateTime dateTime) Uses the givenZonedDateTimeinstance.plusDays(int days) Adds a number of days to the current date.Uses the same location as given in theLocationParameterat this moment.sameTimeAs(TimeParameter<?> t) Uses the same time as given in theTimeParameter.Sets the givenZoneId.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.shredzone.commons.suncalc.param.LocationParameter
at, at, latitude, longitude
-
Constructor Details
-
BaseBuilder
public BaseBuilder()
-
-
Method Details
-
on
Description copied from interface:TimeParameterUses the givenZonedDateTimeinstance.- Specified by:
onin interfaceTimeParameter<T>- Parameters:
dateTime-ZonedDateTimeto be used.- Returns:
- itself
-
on
Description copied from interface:TimeParameterUses the givenLocalDateTimeinstance.- Specified by:
onin interfaceTimeParameter<T>- Parameters:
dateTime-LocalDateTimeto be used.- Returns:
- itself
-
on
Description copied from interface:TimeParameterUses the givenLocalDateinstance, and assumes midnight.- Specified by:
onin interfaceTimeParameter<T>- Parameters:
date-LocalDateto be used.- Returns:
- itself
-
on
Description copied from interface:TimeParameterUses the givenInstantinstance.- Specified by:
onin interfaceTimeParameter<T>- Parameters:
instant-Instantto be used.- Returns:
- itself
-
on
Description copied from interface:TimeParameterSets date and time. Note that also seconds can be passed in for convenience, but the results are not that accurate.- Specified by:
onin interfaceTimeParameter<T>- Parameters:
year- Yearmonth- Month (1 = January, 2 = February, ...)date- Day of monthhour- Hour of dayminute- Minutesecond- Second- Returns:
- itself
-
now
Description copied from interface:TimeParameterSets the current date and time. This is the default.- Specified by:
nowin interfaceTimeParameter<T>- Returns:
- itself
-
plusDays
Description copied from interface:TimeParameterAdds a number of days to the current date.- Specified by:
plusDaysin interfaceTimeParameter<T>- Parameters:
days- Number of days to add- Returns:
- itself
-
midnight
Description copied from interface:TimeParameterSets the time to the start of the current date ("last midnight").- Specified by:
midnightin interfaceTimeParameter<T>- Returns:
- itself
-
timezone
Description copied from interface:TimeParameterSets the givenZoneId. The local time is retained, so the parameter order is not important.- Specified by:
timezonein interfaceTimeParameter<T>- Parameters:
tz-ZoneIdto be used.- Returns:
- itself
-
latitude
Description copied from interface:LocationParameterSets the latitude.- Specified by:
latitudein interfaceLocationParameter<T>- Parameters:
lat- Latitude, in degrees.- Returns:
- itself
-
longitude
Description copied from interface:LocationParameterSets the longitude.- Specified by:
longitudein interfaceLocationParameter<T>- Parameters:
lng- Longitude, in degrees.- Returns:
- itself
-
height
Description copied from interface:LocationParameterSets the height.- Specified by:
heightin interfaceLocationParameter<T>- Parameters:
h- Height, in meters above sea level. Default: 0.0 m. Negative values are silently changed to the acceptable minimum of 0.0 m.- Returns:
- itself
-
sameTimeAs
Description copied from interface:TimeParameterUses the same time as given in theTimeParameter.Changes to the source parameter will not affect this parameter, though.
- Specified by:
sameTimeAsin interfaceTimeParameter<T>- Parameters:
t-TimeParameterto be used.- Returns:
- itself
-
sameLocationAs
Description copied from interface:LocationParameterUses the same location as given in theLocationParameterat this moment.Changes to the source parameter will not affect this parameter, though.
- Specified by:
sameLocationAsin interfaceLocationParameter<T>- Parameters:
l-LocationParameterto be used.- Returns:
- itself
-
copy
Description copied from interface:GenericParameterCreates a copy of the current parameters. The copy can be changed independently.- Specified by:
copyin interfaceGenericParameter<T>
-
getLongitude
Returns the longitude.- Returns:
- Longitude, in degrees.
-
getLatitude
Returns the latitude.- Returns:
- Latitude, in degrees.
-
getLongitudeRad
Returns the longitude.- Returns:
- Longitude, in radians.
-
getLatitudeRad
Returns the latitude.- Returns:
- Latitude, in radians.
-
getHeight
Returns the height, in meters above sea level.- Returns:
- Height, meters above sea level
-
getJulianDate
Returns theJulianDateto be used.- Returns:
JulianDate
-