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

Class CWRule

base/src/main/java/net/time4j/Weekmodel.java:1490–1757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1488 }
1489
1490 private static class CWRule<T extends ChronoEntity<T>>
1491 implements ElementRule<T, Integer> {
1492
1493 //~ Instanzvariablen ----------------------------------------------
1494
1495 private final CalendarWeekElement owner;
1496
1497 //~ Konstruktoren -------------------------------------------------
1498
1499 private CWRule(CalendarWeekElement owner) {
1500 super();
1501
1502 this.owner = owner;
1503
1504 }
1505
1506 //~ Methoden ------------------------------------------------------
1507
1508 @Override
1509 public Integer getMinimum(T context) {
1510
1511 return Integer.valueOf(1);
1512
1513 }
1514
1515 @Override
1516 public Integer getMaximum(T context) {
1517
1518 PlainDate date = context.get(CALENDAR_DATE);
1519 return Integer.valueOf(this.getMaxCalendarWeek(date));
1520
1521 }
1522
1523 @Override
1524 public ChronoElement<?> getChildAtFloor(T context) {
1525
1526 return this.getChild();
1527
1528 }
1529
1530 @Override
1531 public ChronoElement<?> getChildAtCeiling(T context) {
1532
1533 return this.getChild();
1534
1535 }
1536
1537 private ChronoElement<?> getChild() {
1538
1539 return this.owner.getModel().localDayOfWeek();
1540
1541 }
1542
1543 @Override
1544 public Integer getValue(T context) {
1545
1546 PlainDate date = context.get(CALENDAR_DATE);
1547 return Integer.valueOf(this.getCalendarWeek(date));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected