(
T context,
boolean ceiling
)
| 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( |
no test coverage detected