< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DurationYearMonthImpl.java

Print this page


   1 /*
   2  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  31 
  32 /**
  33  * <p>Represent a subtype <code>xdt:yearMonthDuration</code> of a <code>Duration</code>
  34  * as specified in <a href="http://www.w3.org/TR/xpath-datamodel#yearMonthDuration">
  35  *   XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration</a>.</p>
  36  *
  37  *
  38  * <p>The DurationYearMonth object represents a period of Gregorian time,
  39  * with a lexical representation, "<em>PnYnM</em>" that contains only year and month components.
  40  * </p>
  41  *
  42  *
  43  * @author <a href="mailto:Vikram.Aroskar@Sun.COM">Vikram Aroskar</a>
  44  * @author <a href="mailto:Huizhe.wang@oracle.com">Joe Wang</a>
  45 
  46  * @see XMLGregorianCalendar#add(Duration)
  47  */
  48 
  49 class DurationYearMonthImpl
  50         extends DurationImpl {
  51 
  52 
  53     /**
  54      * <p>Constructs a new Duration object by specifying each field individually.</p>
  55      *
  56      * <p>All the parameters are optional as long as at least one field is present.
  57      * If specified, parameters have to be zero or positive.</p>
  58      *
  59      * @param isPositive Set to <code>false</code> to create a negative duration. When the length
  60      *   of the duration is zero, this parameter will be ignored.
  61      * @param years of this <code>Duration</code>
  62      * @param months of this <code>Duration</code>
  63      *
  64      * @throws IllegalArgumentException
  65      *    If years, months parameters are all <code>null</code>. Or if any
  66      *    of those parameters are negative.
  67      */
  68     public DurationYearMonthImpl(
  69         boolean isPositive,
  70         BigInteger years,
  71         BigInteger months) {


   1 /*
   2  * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  31 
  32 /**
  33  * <p>Represent a subtype <code>xdt:yearMonthDuration</code> of a <code>Duration</code>
  34  * as specified in <a href="http://www.w3.org/TR/xpath-datamodel#yearMonthDuration">
  35  *   XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration</a>.</p>
  36  *
  37  *
  38  * <p>The DurationYearMonth object represents a period of Gregorian time,
  39  * with a lexical representation, "<em>PnYnM</em>" that contains only year and month components.
  40  * </p>
  41  *
  42  *
  43  * @author <a href="mailto:Vikram.Aroskar@Sun.COM">Vikram Aroskar</a>
  44  * @author <a href="mailto:Huizhe.wang@oracle.com">Joe Wang</a>
  45 
  46  * @see XMLGregorianCalendar#add(Duration)
  47  */
  48 
  49 class DurationYearMonthImpl
  50         extends DurationImpl {
  51     private static final long serialVersionUID = -4430140662861507958L;
  52 
  53     /**
  54      * <p>Constructs a new Duration object by specifying each field individually.</p>
  55      *
  56      * <p>All the parameters are optional as long as at least one field is present.
  57      * If specified, parameters have to be zero or positive.</p>
  58      *
  59      * @param isPositive Set to <code>false</code> to create a negative duration. When the length
  60      *   of the duration is zero, this parameter will be ignored.
  61      * @param years of this <code>Duration</code>
  62      * @param months of this <code>Duration</code>
  63      *
  64      * @throws IllegalArgumentException
  65      *    If years, months parameters are all <code>null</code>. Or if any
  66      *    of those parameters are negative.
  67      */
  68     public DurationYearMonthImpl(
  69         boolean isPositive,
  70         BigInteger years,
  71         BigInteger months) {


< prev index next >