Class FrenchRepublicanCalendar
- All Implemented Interfaces:
Serializable
,Comparable<FrenchRepublicanCalendar>
,CalendarDate
,ChronoDisplay
,Temporal<CalendarDate>
Represents the calendar used in French Revolution between 1792 and 1805.
Its design is radically different from standard year-month-day-calendars like the gregorian one. The year started at autumnal equinox at the longitude of Paris observatory and was divided into 12 months with the constant length of 30 days. In order to complete the revolution of the earth around the sun, 5 or 6 complementary days were added after the last month. These complementary days are not part of any month and were sometimes also called "Sansculottides". The sixth complementary day only happened in leap years depending on which day the autumnal equinox of next year started, usually every fourth year.
Napoléon abolished the calendar with begin of gregorian year 1806. Interestingly, the Paris Commune of 1871 reintroduced it for 18 days until its militarian destruction.
This calendar had originally no seven-day-week. Instead the months were divided each into three decades of 10 days, and the 10th day was considered as day of rest - like Sunday in the gregorian calendar. However, Time4J makes both the decade design and the standard seven-day-week available, last one mainly for comparison purposes and especially after April 1802 when the calendar abandoned the original decade system. More calendar details see also Wikipedia.
Following elements which are declared as constants are registered by this class:
DAY_OF_DECADE
DAY_OF_WEEK
DAY_OF_MONTH
DAY_OF_YEAR
DECADE_OF_MONTH
MONTH_OF_YEAR
SANSCULOTTIDES
YEAR_OF_ERA
ERA
Furthermore, all elements defined in EpochDays
are supported.
Formatting and parsing: When using format patterns the
dynamic pattern type
is strongly recommended instead of CLDR-like pattern types because this calendar
is structurally different from month-based calendars. Following symbol-element
table holds:
element | symbol | type |
---|---|---|
ERA | G | text |
YEAR_OF_ERA | y/Y | number |
MONTH_OF_YEAR | m/M | number/text |
SANSCULOTTIDES | s/S | text |
DAY_OF_MONTH | d/D | number |
DAY_OF_DECADE | c/C | text |
DAY_OF_WEEK | E | text |
Note: The standalone form of some enums like the republican month can be printed in a capitalized way
if the formatter is first constructed on builder level by using a sectional attribute for the output context.
Alternatively, users can simply modify the formatter by calling
f.with(Attributes.OUTPUT_CONTEXT, OutputContext.STANDALONE)
.
Furthermore: The abbreviated form of the republican month is usually numeric with two arabic digits. For more control about the numeric representation, the builder offers extra fine-tuned methods.
It is strongly recommended to use the or-operator "|" in format patterns because not every date of this calendar has a month. Example:
ChronoFormatter<FrenchRepublicanCalendar> f = ChronoFormatter.ofPattern( "[D. MMMM|SSSS]', an 'Y", PatternType.DYNAMIC, Locale.FRENCH, FrenchRepublicanCalendar.axis()); FrenchRepublicanCalendar cal = PlainDate.of(2018, 9, 23).transform(FrenchRepublicanCalendar.axis()); System.out.println(f.format(cal)); // output => 1. vendémiaire, an CCXXVII cal = cal.minus(CalendarDays.ONE); System.out.println(f.format(cal)); // output => jour de la révolution, an CCXXVI
- Since:
- 3.33/4.28
- Author:
- Meno Hochschild
- See Also:
FrenchRepublicanEra
,FrenchRepublicanMonth
,Sansculottides
,DayOfDecade
, Serialized Form
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Static view of calendar date taking into account possibly different calendar algorithms.static class
Defines come calendar units for the French revolutionary calendar. -
Field Summary
Modifier and TypeFieldDescriptionstatic ChronoElement<DayOfDecade>
Represents the days of decade which consists of ten days.Represents the day of month if available.Represents the day of week where the week is seven days long.Represents the day of year.Yields the decade of republican month if available.static ChronoElement<FrenchRepublicanEra>
Represents the Republican era of the French revolution.Represents the month (Vendémiaire - Fructidor) if available.static ChronoElement<Sansculottides>
Represents the complementary days of the French revolutionary calendar.Represents the republican year since 1792-09-22 (in range 1-1202). -
Method Summary
Modifier and TypeMethodDescriptionCreates a new local timestamp with this date and given wall time.atTime(int hour, int minute)
Is equivalent toat(PlainTime.of(hour, minute))
.axis()
Returns the associated time axis.boolean
contains(ChronoElement<?> element)
Queries if the value for given chronological element can be accessed viaget(element)
.boolean
Based on the epoch day number and the calendar system.getDate(FrenchRepublicanAlgorithm algorithm)
Obtains an alternative date view specific for given algorithm.Yields the day of decade if available (ten-day-week).int
Yields the day of month if available.Determines the day of standard-week (with seven days).int
Yields the day of year.int
Yields the decade of current republican month if available.getEra()
Yields the republican era.getMonth()
Yields the republican month if available.Yields the complementary day if available.int
getYear()
Yields the republican year.int
hashCode()
Based on the epoch day number.boolean
hasMonth()
Does this date contain a month?boolean
Is this date a complementary day?boolean
Is the year of this date a leap year?static boolean
isLeapYear(int year)
Is given republican year a leap year?static boolean
isValid(int year, int month, int dayOfMonth)
Queries if given parameter values form a well defined calendar date.<V> boolean
isValid(ChronoElement<V> element, V value)
Tests if the value for given chronological value is invalid.static FrenchRepublicanCalendar
Obtains the current calendar date in system time.static FrenchRepublicanCalendar
of(int year, int month, int dayOfMonth)
Creates a new instance of a French republican date.static FrenchRepublicanCalendar
of(int year, FrenchRepublicanMonth month, int dayOfMonth)
Creates a new instance of a French republican date.static FrenchRepublicanCalendar
of(int year, Sansculottides sansculottides)
Creates a new instance of a French republican date as complementary day.toString()
Provides a complete textual representation of the state of this time point.Obtains the next leap day when the franciade ends.Methods inherited from class net.time4j.engine.Calendrical
compareTo, getDaysSinceEpochUTC, isAfter, isBefore, isSimultaneous, minus, plus
Methods inherited from class net.time4j.engine.TimePoint
max, min, minus, minus, plus, plus, until, until
Methods inherited from class net.time4j.engine.ChronoEntity
get, get, getInt, getMaximum, getMinimum, getRegisteredElements, getTimezone, hasTimezone, isValid, isValid, matches, with, with, with, with
Methods inherited from interface net.time4j.engine.CalendarDate
transform, transform, transform, transform, transform, transform
Methods inherited from interface net.time4j.engine.Temporal
isAfterAll, isAfterOrEqual, isBeforeAll, isBeforeOrEqual
-
Field Details
-
ERA
@FormattableElement(format="G", dynamic=true) public static final ChronoElement<FrenchRepublicanEra> ERARepresents the Republican era of the French revolution.
-
YEAR_OF_ERA
@FormattableElement(format="Y", alt="y", dynamic=true) public static final StdCalendarElement<Integer,FrenchRepublicanCalendar> YEAR_OF_ERARepresents the republican year since 1792-09-22 (in range 1-1202).
The year is printed as roman number when using a pattern and the French language.
-
SANSCULOTTIDES
@FormattableElement(format="S", alt="s", dynamic=true) public static final ChronoElement<Sansculottides> SANSCULOTTIDESRepresents the complementary days of the French revolutionary calendar.
Warning: A French republican date does usually not have a complementary day so any access via
get(SANSCULOTTIDES)
will throw an exception unless users make sure that the day in question is indeed a complementary day.However, it is always possible to query the date for the minimum or maximum complementary day or to set the date to a complementary day even if the actual date is not a complementary day.
- See Also:
hasSansculottides()
,hasMonth()
-
MONTH_OF_YEAR
@FormattableElement(format="M", alt="m", dynamic=true) public static final StdCalendarElement<FrenchRepublicanMonth,FrenchRepublicanCalendar> MONTH_OF_YEARRepresents the month (Vendémiaire - Fructidor) if available.
Warning: A French republican date does not always have a month. If the date is a complementary day (Sansculottides) then any access via
get(MONTH_OF_YEAR)
to this element will be rejected by raising an exception. Users have first to make sure that the date is not such a complementary day.However, it is always possible to query the date for the minimum or maximum month or to set the date to a month-related day even if the actual date is a complementary day.
- See Also:
hasSansculottides()
,hasMonth()
-
DECADE_OF_MONTH
Yields the decade of republican month if available.
Warning: A French republican date does not always have a decade. If the date is a complementary day (Sansculottides) then any access to this element will be rejected by raising an exception. Users have first to make sure that the date is not such a complementary day.
- See Also:
hasSansculottides()
,hasMonth()
-
DAY_OF_DECADE
@FormattableElement(format="C", alt="c", dynamic=true) public static final ChronoElement<DayOfDecade> DAY_OF_DECADERepresents the days of decade which consists of ten days.
Warning: A French republican date does not always have a day of decade. If the date is a complementary day (Sansculottides) then any access to this element will be rejected by raising an exception. Users have first to make sure that the date is not such a complementary day.
- See Also:
hasSansculottides()
,hasMonth()
-
DAY_OF_MONTH
@FormattableElement(format="D", alt="d", dynamic=true) public static final StdCalendarElement<Integer,FrenchRepublicanCalendar> DAY_OF_MONTHRepresents the day of month if available.
Warning: A French republican date does not always have a month. If the date is a complementary day (Sansculottides) then any access to this element will be rejected by raising an exception. Users have first to make sure that the date is not such a complementary day.
- See Also:
hasSansculottides()
,hasMonth()
-
DAY_OF_YEAR
Represents the day of year.
-
DAY_OF_WEEK
@FormattableElement(format="E", dynamic=true) public static final StdCalendarElement<Weekday,FrenchRepublicanCalendar> DAY_OF_WEEKRepresents the day of week where the week is seven days long.
If the day-of-week is set to a new value then Time4J handles the calendar week as starting on Sunday.
- See Also:
DAY_OF_DECADE
-
-
Method Details
-
of
Creates a new instance of a French republican date.
- Parameters:
year
- republican year in range 1-1202month
- republican month as enumdayOfMonth
- day of month in range 1-30- Returns:
- new instance of
FrenchRepublicanCalendar
- Throws:
IllegalArgumentException
- in case of any inconsistencies
-
of
Creates a new instance of a French republican date.
- Parameters:
year
- republican year in range 1-1202month
- republican month in range 1-12dayOfMonth
- day of month in range 1-30- Returns:
- new instance of
FrenchRepublicanCalendar
- Throws:
IllegalArgumentException
- in case of any inconsistencies
-
of
Creates a new instance of a French republican date as complementary day.
- Parameters:
year
- republican year in range 1-1202sansculottides
- the complementary day- Returns:
- new instance of
FrenchRepublicanCalendar
- Throws:
IllegalArgumentException
- in case of any inconsistencies
-
nowInSystemTime
Obtains the current calendar date in system time.
Convenient short-cut for:
SystemClock.inLocalView().now(FrenchRepublicanCalendar.axis())
.- Returns:
- current calendar date in system time zone using the system clock
- See Also:
SystemClock.inLocalView()
,ZonalClock.now(Chronology)
-
getEra
Yields the republican era.
- Returns:
FrenchRepublicanEra.REPUBLICAN
-
getYear
public int getYear()Yields the republican year.
- Returns:
- int
-
getMonth
Yields the republican month if available.
- Returns:
- month enum
- Throws:
ChronoException
- if this date is a complementary day- See Also:
MONTH_OF_YEAR
,hasSansculottides()
,hasMonth()
-
getDecade
public int getDecade()Yields the decade of current republican month if available.
- Returns:
- int (1, 2 or 3)
- Throws:
ChronoException
- if this date is a complementary day- See Also:
DECADE_OF_MONTH
,hasSansculottides()
,hasMonth()
-
getDayOfMonth
public int getDayOfMonth()Yields the day of month if available.
- Returns:
- int (1-30)
- Throws:
ChronoException
- if this date is a complementary day- See Also:
DAY_OF_MONTH
,hasSansculottides()
,hasMonth()
-
getDayOfDecade
Yields the day of decade if available (ten-day-week).
- Returns:
- enum
- Throws:
ChronoException
- if this date is a complementary day- See Also:
DAY_OF_DECADE
,hasSansculottides()
,hasMonth()
-
getDayOfWeek
Determines the day of standard-week (with seven days).
- Returns:
- Weekday
-
getDayOfYear
public int getDayOfYear()Yields the day of year.
- Returns:
- int
-
getSansculottides
Yields the complementary day if available.
- Returns:
- Sansculottides enum
- Throws:
ChronoException
- if this date is not a complementary day- See Also:
hasSansculottides()
,hasMonth()
-
hasSansculottides
public boolean hasSansculottides()Is this date a complementary day?
A date in the French revolutionary calendar has either a month or is a complementary day.
- Returns:
- boolean
- See Also:
hasMonth()
,MONTH_OF_YEAR
,DAY_OF_MONTH
,DECADE_OF_MONTH
,DAY_OF_DECADE
,SANSCULOTTIDES
-
hasMonth
public boolean hasMonth()Does this date contain a month?
A date in the French revolutionary calendar has either a month or is a complementary day.
- Returns:
- boolean
- See Also:
hasSansculottides()
,MONTH_OF_YEAR
,DAY_OF_MONTH
,DECADE_OF_MONTH
,DAY_OF_DECADE
,SANSCULOTTIDES
-
isLeapYear
public boolean isLeapYear()Is the year of this date a leap year?
- Returns:
- boolean
-
isLeapYear
public static boolean isLeapYear(int year)Is given republican year a leap year?
- Parameters:
year
- republican year to be checked (in range 1-1202)- Returns:
- boolean
-
isValid
public static boolean isValid(int year, int month, int dayOfMonth)Queries if given parameter values form a well defined calendar date.
- Parameters:
year
- the year of era to be checkedmonth
- the month to be checkeddayOfMonth
- the day of month to be checked- Returns:
true
if valid elsefalse
- Since:
- 3.34/4.29
- See Also:
of(int, int, int)
-
getDate
Obtains an alternative date view specific for given algorithm.
- Parameters:
algorithm
- calendar computation- Returns:
- French republican date (possibly modified)
- Throws:
IllegalArgumentException
- in case of date overflow- Since:
- 3.33/4.28
-
at
Creates a new local timestamp with this date and given wall time.
If the time
T24:00
is used then the resulting timestamp will automatically be normalized such that the timestamp will contain the following day instead.- Parameters:
time
- wall time- Returns:
- general timestamp as composition of this date and given time
-
atTime
Is equivalent to
at(PlainTime.of(hour, minute))
.- Parameters:
hour
- hour of day in range (0-24)minute
- minute of hour in range (0-59)- Returns:
- general timestamp as composition of this date and given time
- Throws:
IllegalArgumentException
- if any argument is out of range
-
withEndOfFranciade
Obtains the next leap day when the franciade ends.
- Returns:
- end of franciade
- See Also:
Sansculottides.LEAP_DAY
-
equals
Description copied from class:Calendrical
Based on the epoch day number and the calendar system.
In other words: Two date object are equal if they have the same temporal position on the local timeline and have the same calendrical type. Subclasses which define further state attributes must override this method.
If an only temporal comparison is required then the method
Calendrical.isSimultaneous(CalendarDate)
is to be used.- Overrides:
equals
in classCalendrical<FrenchRepublicanCalendar.Unit,FrenchRepublicanCalendar>
- See Also:
Chronology.getChronoType()
-
hashCode
public int hashCode()Description copied from class:Calendrical
Based on the epoch day number.
- Overrides:
hashCode
in classCalendrical<FrenchRepublicanCalendar.Unit,FrenchRepublicanCalendar>
-
toString
Description copied from class:TimePoint
Provides a complete textual representation of the state of this time point.
The textual description often follows the conventions of ISO-8601. Usually the description starts with the chronological informations which are coarse-grained and ends with those ones which are fine-grained (for example the ISO-notation YYYY-MM-DD).
- Specified by:
toString
in classTimePoint<FrenchRepublicanCalendar.Unit,FrenchRepublicanCalendar>
-
contains
Description copied from interface:ChronoDisplay
Queries if the value for given chronological element can be accessed via
get(element)
.If the argument is missing then this method will yield
false
. Note: Elements which are not registered but define a suitable rule are also accessible.- Specified by:
contains
in interfaceChronoDisplay
- Overrides:
contains
in classChronoEntity<FrenchRepublicanCalendar>
- Parameters:
element
- chronological element to be asked (optional)- Returns:
true
if the element is registered or there is an element rule for evaluating the value elsefalse
- See Also:
ChronoDisplay.get(ChronoElement)
-
isValid
Description copied from class:ChronoEntity
Tests if the value for given chronological value is invalid.
Notes: This method tests if given value to be in question can be set via the expression
with(element, value)
. A numerical overflow situation (causing anArithmeticException
) will usually not be checked.- Overrides:
isValid
in classChronoEntity<FrenchRepublicanCalendar>
- Type Parameters:
V
- generic type of element value- Parameters:
element
- element the given value shall be assigned tovalue
- candidate value to be validated (optional)- Returns:
true
if the methodwith()
can be called without exception elsefalse
- See Also:
with(ChronoElement, V)
-
axis
Returns the associated time axis.
- Returns:
- chronology
-