Subversion Repository Public Repository

litesoft

Diff Revisions 941 vs 942 for /trunk/Java/core/Anywhere/src/org/litesoft/core/simpletypes/temporal/SimpleTime.java

Diff revisions: vs.
  @@ -1,19 +1,20 @@
1 1 // This Source Code is in the Public Domain per: http://litesoft.org/License.txt
2 2 package org.litesoft.core.simpletypes.temporal;
3 3
4 - import java.util.*;
5 -
4 + import org.litesoft.commonfoundation.typeutils.gregorian.*;
6 5 import org.litesoft.core.*;
7 6 import org.litesoft.core.simpletypes.nonpublic.*;
8 7 import org.litesoft.core.simpletypes.temporal.nonpublic.*;
9 8
9 + import java.util.*;
10 +
10 11 /**
11 12 * A Simple Time object with variable resolution from the Hour thru the Millisecond.
12 13 */
13 14 public final class SimpleTime extends AbstractWithTimeRes<SimpleTime> implements // TODO: ??? CalendarSupport.Chunk,
14 - TimeWithResolutionAccessor,
15 - TemporalSimpleType,
16 - SQLtimeable
15 + TimeWithResolutionAccessor,
16 + TemporalSimpleType,
17 + SQLtimeable
17 18 {
18 19 private static final long serialVersionUID = 1L;
19 20
  @@ -601,17 +602,20 @@
601 602
602 603 public StandIn( int pResolutionIndex, Date pDate )
603 604 {
604 - inject( pResolutionIndex, new UtilDateAdaptor( pDate, TemporalResolution.values()[pResolutionIndex + 3] ) );
605 + inject( pResolutionIndex, new UtilDateAdaptor( pDate, TemporalResolution.ToHour.plus( pResolutionIndex ) ) );
605 606 }
606 607
607 608 public StandIn( UtilDateAdaptor pAdaptor )
608 609 {
609 - inject( pAdaptor.getTimeRes().getIndex(), pAdaptor );
610 + inject( pAdaptor.getTemporalResolution().getTimeFieldsCount() - 1, pAdaptor );
610 611 }
611 612
612 613 public void inject( int pResolutionIndex, UtilDateAdaptor pAdaptor )
613 614 {
614 - mResolutionIndex = pResolutionIndex;
615 + if ( (mResolutionIndex = pResolutionIndex) < 0 )
616 + {
617 + throw new IllegalArgumentException( "UtilDateAdaptor has No Time elements!" );
618 + }
615 619 mHour = pAdaptor.getHour();
616 620 mMin = pAdaptor.getMin();
617 621 mSec = pAdaptor.getSec();