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 day of the year component of time.

Author(s):
Guy Allard
Stephen Colebourne
Brian S O'Neill
Since:
1.1, refactored from GJDayOfYearDateTimeField
 
 
     @SuppressWarnings("unused")
     private static final long serialVersionUID = -6821236822336841037L;
 
     private final BasicChronology iChronology;

    
Restricted constructor
 
         super(DateTimeFieldType.dayOfYear(), days);
          = chronology;
     }

    
Get the day of the year component of the specified time instant.

Parameters:
instant the time instant in millis to query.
Returns:
the day of the year extracted from the input.
 
     public int get(long instant) {
         return .getDayOfYear(instant);
     }
 
     public DurationField getRangeDurationField() {
         return .years();
     }
 
     public int getMinimumValue() {
         return 1;
     }
 
     public int getMaximumValue() {
         return .getDaysInYearMax();
     }
 
     public int getMaximumValue(long instant) {
         int year = .getYear(instant);
         return .getDaysInYear(year);
     }
 
     public int getMaximumValue(ReadablePartial partial) {
         if (partial.isSupported(DateTimeFieldType.year())) {
             int year = partial.get(DateTimeFieldType.year());
             return .getDaysInYear(year);
         }
         return .getDaysInYearMax();
     }
 
     public int getMaximumValue(ReadablePartial partialint[] values) {
         int size = partial.size();
         for (int i = 0; i < sizei++) {
             if (partial.getFieldType(i) == DateTimeFieldType.year()) {
                 int year = values[i];
                 return .getDaysInYear(year);
             }
         }
         return .getDaysInYearMax();
     }
 
     protected int getMaximumValueForSet(long instantint value) {
         int maxLessOne = .getDaysInYearMax() - 1;
         return (value > maxLessOne || value < 1) ? getMaximumValue(instant) : maxLessOne;
     }

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