EMMA Coverage Report (generated Tue Oct 28 00:01:11 GMT 2008)
[all classes][org.joda.time.chrono]

COVERAGE SUMMARY FOR SOURCE FILE [ISOYearOfEraDateTimeField.java]

nameclass, %method, %block, %line, %
ISOYearOfEraDateTimeField.java100% (1/1)38%  (6/16)33%  (34/103)38%  (8/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ISOYearOfEraDateTimeField100% (1/1)38%  (6/16)33%  (34/103)38%  (8/21)
add (long, int): long 0%   (0/1)0%   (0/6)0%   (0/1)
add (long, long): long 0%   (0/1)0%   (0/6)0%   (0/1)
addWrapField (ReadablePartial, int, int [], int): int [] 0%   (0/1)0%   (0/8)0%   (0/1)
addWrapField (long, int): long 0%   (0/1)0%   (0/6)0%   (0/1)
getDifference (long, long): int 0%   (0/1)0%   (0/6)0%   (0/1)
getDifferenceAsLong (long, long): long 0%   (0/1)0%   (0/6)0%   (0/1)
readResolve (): Object 0%   (0/1)0%   (0/2)0%   (0/1)
remainder (long): long 0%   (0/1)0%   (0/5)0%   (0/1)
roundCeiling (long): long 0%   (0/1)0%   (0/5)0%   (0/1)
set (long, int): long 0%   (0/1)0%   (0/19)0%   (0/4)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
ISOYearOfEraDateTimeField (): void 100% (1/1)100% (6/6)100% (2/2)
get (long): int 100% (1/1)100% (12/12)100% (2/2)
getMaximumValue (): int 100% (1/1)100% (4/4)100% (1/1)
getMinimumValue (): int 100% (1/1)100% (2/2)100% (1/1)
roundFloor (long): long 100% (1/1)100% (5/5)100% (1/1)

1/*
2 *  Copyright 2001-2005 Stephen Colebourne
3 *
4 *  Licensed under the Apache License, Version 2.0 (the "License");
5 *  you may not use this file except in compliance with the License.
6 *  You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *  Unless required by applicable law or agreed to in writing, software
11 *  distributed under the License is distributed on an "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 *  See the License for the specific language governing permissions and
14 *  limitations under the License.
15 */
16package org.joda.time.chrono;
17 
18import org.joda.time.DateTimeField;
19import org.joda.time.DateTimeFieldType;
20import org.joda.time.ReadablePartial;
21import org.joda.time.field.DecoratedDateTimeField;
22import org.joda.time.field.FieldUtils;
23 
24/**
25 * This field is not publicy exposed by ISOChronology, but rather it is used to
26 * build the yearOfCentury and centuryOfEra fields. It merely drops the sign of
27 * the year.
28 *
29 * @author Brian S O'Neill
30 * @see GJYearOfEraDateTimeField
31 * @since 1.0
32 */
33class ISOYearOfEraDateTimeField extends DecoratedDateTimeField {
34 
35    private static final long serialVersionUID = 7037524068969447317L;
36 
37    /**
38     * Singleton instance
39     */
40    static final DateTimeField INSTANCE = new ISOYearOfEraDateTimeField();
41 
42    /**
43     * Restricted constructor.
44     */
45    private ISOYearOfEraDateTimeField() {
46        super(GregorianChronology.getInstanceUTC().year(), DateTimeFieldType.yearOfEra());
47    }
48 
49    public int get(long instant) {
50        int year = getWrappedField().get(instant);
51        return year < 0 ? -year : year;
52    }
53 
54    public long add(long instant, int years) {
55        return getWrappedField().add(instant, years);
56    }
57 
58    public long add(long instant, long years) {
59        return getWrappedField().add(instant, years);
60    }
61 
62    public long addWrapField(long instant, int years) {
63        return getWrappedField().addWrapField(instant, years);
64    }
65 
66    public int[] addWrapField(ReadablePartial instant, int fieldIndex, int[] values, int years) {
67        return getWrappedField().addWrapField(instant, fieldIndex, values, years);
68    }
69 
70    public int getDifference(long minuendInstant, long subtrahendInstant) {
71        return getWrappedField().getDifference(minuendInstant, subtrahendInstant);
72    }
73 
74    public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) {
75        return getWrappedField().getDifferenceAsLong(minuendInstant, subtrahendInstant);
76    }
77 
78    public long set(long instant, int year) {
79        FieldUtils.verifyValueBounds(this, year, 0, getMaximumValue());
80        if (getWrappedField().get(instant) < 0) {
81            year = -year;
82        }
83        return super.set(instant, year);
84    }
85 
86    public int getMinimumValue() {
87        return 0;
88    }
89 
90    public int getMaximumValue() {
91        return getWrappedField().getMaximumValue();
92    }
93 
94    public long roundFloor(long instant) {
95        return getWrappedField().roundFloor(instant);
96    }
97 
98    public long roundCeiling(long instant) {
99        return getWrappedField().roundCeiling(instant);
100    }
101 
102    public long remainder(long instant) {
103        return getWrappedField().remainder(instant);
104    }
105 
106    /**
107     * Serialization singleton
108     */
109    private Object readResolve() {
110        return INSTANCE;
111    }
112}

[all classes][org.joda.time.chrono]
EMMA 2.0.5312 (C) Vladimir Roubtsov