MCPcopy Create free account
hub / github.com/MenoData/Time4J / getChild

Method getChild

base/src/main/java/net/time4j/Weekmodel.java:1815–1849  ·  view source on GitHub ↗
(
            T context,
            boolean ceiling
        )

Source from the content-addressed store, hash-verified

1813 }
1814
1815 private ChronoElement<?> getChild(
1816 T context,
1817 boolean ceiling
1818 ) {
1819
1820 PlainDate date = context.get(CALENDAR_DATE);
1821 ChronoElement<Weekday> dow =
1822 this.owner.getModel().localDayOfWeek();
1823 int weeknum = this.getValue(context).intValue();
1824
1825 if (ceiling) {
1826 if (weeknum >= (this.owner.isYearRelated() ? 52 : 4)) {
1827 PlainDate max = date.with(dow, context.getMaximum(dow));
1828 if (this.owner.isYearRelated()) {
1829 if (max.getDayOfYear() < date.getDayOfYear()) {
1830 return PlainDate.DAY_OF_YEAR;
1831 }
1832 } else if (max.getDayOfMonth() < date.getDayOfMonth()) {
1833 return PlainDate.DAY_OF_MONTH;
1834 }
1835 }
1836 } else if (weeknum <= 1) {
1837 PlainDate min = date.with(dow, context.getMinimum(dow));
1838 if (this.owner.isYearRelated()) {
1839 if (min.getDayOfYear() > date.getDayOfYear()) {
1840 return PlainDate.DAY_OF_YEAR;
1841 }
1842 } else if (min.getDayOfMonth() > date.getDayOfMonth()) {
1843 return PlainDate.DAY_OF_MONTH;
1844 }
1845 }
1846
1847 return dow;
1848
1849 }
1850
1851 @Override
1852 public boolean isValid(

Callers 2

getChildAtFloorMethod · 0.95
getChildAtCeilingMethod · 0.95

Calls 10

getValueMethod · 0.95
getDayOfYearMethod · 0.95
getDayOfMonthMethod · 0.95
isYearRelatedMethod · 0.80
getMethod · 0.65
withMethod · 0.65
getMaximumMethod · 0.65
getMinimumMethod · 0.65
localDayOfWeekMethod · 0.45
getModelMethod · 0.45

Tested by

no test coverage detected