1 16 package org.joda.time.chrono.gj; 17 18 import org.joda.time.DateTimeFieldType; 19 import org.joda.time.DurationField; 20 21 25 class TestGJDayOfWeekField extends TestGJDateTimeField { 26 public TestGJDayOfWeekField(TestGJChronology chrono) { 27 super(DateTimeFieldType.dayOfWeek(), TestGJChronology.MILLIS_PER_DAY, chrono); 28 } 29 30 public int get(long millis) { 31 int dayOfWeek = (int) TestGJChronology.mod(iChronology.fixedFromMillis(millis), 7); 32 if (dayOfWeek == 0) { 33 dayOfWeek = 7; 34 } 35 return dayOfWeek; 36 } 37 38 public long set(long millis, int value) { 39 return add(millis, (long) value - get(millis)); 40 } 41 42 public long add(long millis, long value) { 43 return millis + value * TestGJChronology.MILLIS_PER_DAY; 44 } 45 46 public DurationField getRangeDurationField() { 47 return iChronology.weeks(); 48 } 49 50 public int getMinimumValue() { 51 return 1; 52 } 53 54 public int getMaximumValue() { 55 return 7; 56 } 57 58 public long roundFloor(long millis) { 59 return iChronology.getDateOnlyMillis(millis); 60 } 61 } 62 | Popular Tags |