コード例 #1
0
 public void testToMutableDateTimeISO() {
   DateTime test = new DateTime(TEST_TIME1, PARIS);
   MutableDateTime result = test.toMutableDateTimeISO();
   assertSame(MutableDateTime.class, result.getClass());
   assertSame(ISOChronology.class, result.getChronology().getClass());
   assertEquals(test.getMillis(), result.getMillis());
   assertEquals(ISO_PARIS, result.getChronology());
 }
コード例 #2
0
  public void testToMutableDateTime_Chronology() {
    DateTime test = new DateTime(TEST_TIME1);
    MutableDateTime result = test.toMutableDateTime(ISO_DEFAULT);
    assertEquals(test.getMillis(), result.getMillis());
    assertEquals(ISO_DEFAULT, result.getChronology());

    test = new DateTime(TEST_TIME1);
    result = test.toMutableDateTime(GREGORIAN_PARIS);
    assertEquals(test.getMillis(), result.getMillis());
    assertEquals(GREGORIAN_PARIS, result.getChronology());

    test = new DateTime(TEST_TIME1, GREGORIAN_PARIS);
    result = test.toMutableDateTime((Chronology) null);
    assertEquals(test.getMillis(), result.getMillis());
    assertEquals(ISO_DEFAULT, result.getChronology());

    test = new DateTime(TEST_TIME1);
    result = test.toMutableDateTime((Chronology) null);
    assertEquals(test.getMillis(), result.getMillis());
    assertEquals(ISO_DEFAULT, result.getChronology());
  }
コード例 #3
0
  public void testToMutableDateTime_DateTimeZone() {
    DateTime test = new DateTime(TEST_TIME1);
    MutableDateTime result = test.toMutableDateTime(LONDON);
    assertEquals(test.getMillis(), result.getMillis());
    assertEquals(ISO_DEFAULT, result.getChronology());

    test = new DateTime(TEST_TIME1);
    result = test.toMutableDateTime(PARIS);
    assertEquals(test.getMillis(), result.getMillis());
    assertEquals(ISO_PARIS, result.getChronology());

    test = new DateTime(TEST_TIME1, PARIS);
    result = test.toMutableDateTime((DateTimeZone) null);
    assertEquals(test.getMillis(), result.getMillis());
    assertEquals(ISO_DEFAULT, result.getChronology());

    test = new DateTime(TEST_TIME1);
    result = test.toMutableDateTime((DateTimeZone) null);
    assertEquals(test.getMillis(), result.getMillis());
    assertEquals(ISO_DEFAULT, result.getChronology());
  }
コード例 #4
0
ファイル: MutableDateTime.java プロジェクト: tbaum/gwt-time
 /**
  * Round to the highest whole unit of this field.
  *
  * @return the mutable datetime being used, so calls can be chained
  * @see DateTimeField#roundCeiling
  */
 public MutableDateTime roundCeiling() {
   iInstant.setMillis(getField().roundCeiling(iInstant.getMillis()));
   return iInstant;
 }
コード例 #5
0
ファイル: MutableDateTime.java プロジェクト: tbaum/gwt-time
 /**
  * Round to the nearest whole unit of this field. If halfway, the ceiling is favored over the
  * floor only if it makes this field's value even.
  *
  * @return the mutable datetime being used, so calls can be chained
  * @see DateTimeField#roundHalfEven
  */
 public MutableDateTime roundHalfEven() {
   iInstant.setMillis(getField().roundHalfEven(iInstant.getMillis()));
   return iInstant;
 }
コード例 #6
0
ファイル: MutableDateTime.java プロジェクト: tbaum/gwt-time
 /**
  * Sets a text value.
  *
  * @param text the text value to set
  * @param locale optional locale to use for selecting a text symbol
  * @return the mutable datetime being used, so calls can be chained
  * @throws IllegalArgumentException if the text value isn't valid
  */
 public MutableDateTime set(String text, LocaleInfo locale) {
   iInstant.setMillis(getField().set(iInstant.getMillis(), text, locale));
   return iInstant;
 }
コード例 #7
0
ファイル: MutableDateTime.java プロジェクト: tbaum/gwt-time
 /**
  * Sets a value.
  *
  * @param value the value to set.
  * @return the mutable datetime being used, so calls can be chained
  * @see DateTimeField#set(long,int)
  */
 public MutableDateTime set(int value) {
   iInstant.setMillis(getField().set(iInstant.getMillis(), value));
   return iInstant;
 }
コード例 #8
0
ファイル: MutableDateTime.java プロジェクト: tbaum/gwt-time
 /**
  * Adds a value to the millis value.
  *
  * @param value the value to add
  * @return the mutable datetime being used, so calls can be chained
  * @see DateTimeField#add(long,long)
  */
 public MutableDateTime add(long value) {
   iInstant.setMillis(getField().add(iInstant.getMillis(), value));
   return iInstant;
 }
コード例 #9
0
ファイル: MutableDateTime.java プロジェクト: tbaum/gwt-time
 /**
  * Gets the chronology of the datetime that this property is linked to.
  *
  * @return the chronology
  * @since 1.4
  */
 protected Chronology getChronology() {
   return iInstant.getChronology();
 }
コード例 #10
0
ファイル: MutableDateTime.java プロジェクト: tbaum/gwt-time
 /**
  * Gets the milliseconds of the datetime that this property is linked to.
  *
  * @return the milliseconds
  */
 protected long getMillis() {
   return iInstant.getMillis();
 }