Home » xmlbeans-2.5.0-src » org.apache » xmlbeans » [javadoc | source]

    1   /*   Copyright 2004 The Apache Software Foundation
    2    *
    3    *   Licensed under the Apache License, Version 2.0 (the "License");
    4    *   you may not use this file except in compliance with the License.
    5    *   You may obtain a copy of the License at
    6    *
    7    *       http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    *   Unless required by applicable law or agreed to in writing, software
   10    *   distributed under the License is distributed on an "AS IS" BASIS,
   11    *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12    *   See the License for the specific language governing permissions and
   13    *  limitations under the License.
   14    */
   15   
   16   package org.apache.xmlbeans;
   17   
   18   import java.math.BigDecimal;
   19   
   20   /**
   21    * Represents an XML Schema-compatible duration.
   22    * <p>
   23    * Both the immutable GDuration and the mutable GDurationBuilder are
   24    * GDurationSpecifications.  Use this interface where you want to
   25    * allow callers to pass any implementation of a GDuration.
   26    * 
   27    * @see GDuration
   28    */
   29   public interface GDurationSpecification
   30   {
   31       /**
   32        * True if this instance is immutable.
   33        */
   34       boolean isImmutable();
   35   
   36       /**
   37        * Returns the sign of the duration: +1 is forwards
   38        * and -1 is backwards in time.
   39        */
   40       int getSign();
   41   
   42       /**
   43        * Gets the year component.
   44        */
   45       int getYear();
   46   
   47       /**
   48        * Gets the month-of-year component.
   49        */
   50       int getMonth();
   51   
   52       /**
   53        * Gets the day-of-month component.
   54        */
   55       int getDay();
   56   
   57       /**
   58        * Gets the hour-of-day component.
   59        */
   60       int getHour();
   61   
   62       /**
   63        * Gets the minute-of-hour component.
   64        */
   65       int getMinute();
   66   
   67       /**
   68        * Gets the second-of-minute component.
   69        */
   70       int getSecond();
   71   
   72       /**
   73        * Gets the fraction-of-second. Range from 0 (inclusive) to 1 (exclusive).
   74        */
   75       BigDecimal getFraction();
   76   
   77       /**
   78        * Returns true if all of the individual components
   79        * of the duration are nonnegative.
   80        */
   81       boolean isValid();
   82   
   83       /**
   84        * Comparison to another GDuration.
   85        * <ul>
   86        * <li>Returns -1 if this < duration. (less-than)
   87        * <li>Returns 0 if this == duration. (equal)
   88        * <li>Returns 1 if this > duration. (greater-than)
   89        * <li>Returns 2 if this <> duration. (incomparable)
   90        * </ul>
   91        * Two instances are incomparable if they have different amounts
   92        * of information.
   93        */
   94       int compareToGDuration(GDurationSpecification duration);
   95   }

Home » xmlbeans-2.5.0-src » org.apache » xmlbeans » [javadoc | source]