Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   *  Copyright 2001-2013 Stephen Colebourne
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  *  Unless required by applicable law or agreed to in writing, software
  *  distributed under the License is distributed on an "AS IS" BASIS,
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
 package org.joda.time.chrono;
 
Provides time calculations for the year of era component of time.

Author(s):
Brian S O'Neill
Since:
1.0
 
 
     @SuppressWarnings("unused")
     private static final long serialVersionUID = -5961050944769862059L;
 
     private final BasicChronology iChronology;

    
Restricted constructor.
 
     GJYearOfEraDateTimeField(DateTimeField yearFieldBasicChronology chronology) {
         super(yearField, DateTimeFieldType.yearOfEra());
          = chronology;
     }
 
     public int get(long instant) {
         int year = getWrappedField().get(instant);
         if (year <= 0) {
             year = 1 - year;
         }
         return year;
     }
 
     public long add(long instantint years) {
         return getWrappedField().add(instantyears);
     }
 
     public long add(long instantlong years) {
         return getWrappedField().add(instantyears);
     }
 
     public long addWrapField(long instantint years) {
         return getWrappedField().addWrapField(instantyears);
     }
 
     public int[] addWrapField(ReadablePartial instantint fieldIndexint[] valuesint years) {
         return getWrappedField().addWrapField(instantfieldIndexvaluesyears);
     }
 
     public int getDifference(long minuendInstantlong subtrahendInstant) {
         return getWrappedField().getDifference(minuendInstantsubtrahendInstant);
     }
 
     public long getDifferenceAsLong(long minuendInstantlong subtrahendInstant) {
         return getWrappedField().getDifferenceAsLong(minuendInstantsubtrahendInstant);
     }

    
Set the year component of the specified time instant.

Parameters:
instant the time instant in millis to update.
year the year (0,292278994) to update the time to.
Returns:
the updated time instant.
Throws:
java.lang.IllegalArgumentException if year is invalid.
 
     public long set(long instantint year) {
         FieldUtils.verifyValueBounds(thisyear, 1, getMaximumValue());
         if (.getYear(instant) <= 0) {
             year = 1 - year;
         }
         return super.set(instantyear);
     }
 
     public int getMinimumValue() {
         return 1;
     }
 
     public int getMaximumValue() {
         return getWrappedField().getMaximumValue();
     }
    public long roundFloor(long instant) {
        return getWrappedField().roundFloor(instant);
    }
    public long roundCeiling(long instant) {
        return getWrappedField().roundCeiling(instant);
    }
    public long remainder(long instant) {
        return getWrappedField().remainder(instant);
    }

    
Serialization singleton
    private Object readResolve() {
        return .yearOfEra();
    }
New to GrepCode? Check out our FAQ X