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

COVERAGE SUMMARY FOR SOURCE FILE [BasicSingleEraDateTimeField.java]

nameclass, %method, %block, %line, %
BasicSingleEraDateTimeField.java100% (1/1)38%  (6/16)31%  (19/61)38%  (8/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BasicSingleEraDateTimeField100% (1/1)38%  (6/16)31%  (19/61)38%  (8/21)
getMaximumTextLength (Locale): int 0%   (0/1)0%   (0/4)0%   (0/1)
getMaximumValue (): int 0%   (0/1)0%   (0/2)0%   (0/1)
getMinimumValue (): int 0%   (0/1)0%   (0/2)0%   (0/1)
roundCeiling (long): long 0%   (0/1)0%   (0/2)0%   (0/1)
roundFloor (long): long 0%   (0/1)0%   (0/2)0%   (0/1)
roundHalfCeiling (long): long 0%   (0/1)0%   (0/2)0%   (0/1)
roundHalfEven (long): long 0%   (0/1)0%   (0/2)0%   (0/1)
roundHalfFloor (long): long 0%   (0/1)0%   (0/2)0%   (0/1)
set (long, String, Locale): long 0%   (0/1)0%   (0/17)0%   (0/3)
set (long, int): long 0%   (0/1)0%   (0/7)0%   (0/2)
BasicSingleEraDateTimeField (String): void 100% (1/1)100% (7/7)100% (3/3)
get (long): int 100% (1/1)100% (2/2)100% (1/1)
getAsText (int, Locale): String 100% (1/1)100% (3/3)100% (1/1)
getDurationField (): DurationField 100% (1/1)100% (3/3)100% (1/1)
getRangeDurationField (): DurationField 100% (1/1)100% (2/2)100% (1/1)
isLenient (): boolean 100% (1/1)100% (2/2)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 java.util.Locale;
19 
20import org.joda.time.DateTimeConstants;
21import org.joda.time.DateTimeFieldType;
22import org.joda.time.DurationField;
23import org.joda.time.DurationFieldType;
24import org.joda.time.IllegalFieldValueException;
25import org.joda.time.field.BaseDateTimeField;
26import org.joda.time.field.FieldUtils;
27import org.joda.time.field.UnsupportedDurationField;
28 
29/**
30 * Provides time calculations for the coptic era component of time.
31 *
32 * @author Brian S O'Neill
33 * @author Stephen Colebourne
34 * @since 1.2, refactored from CopticEraDateTimeField
35 */
36final class BasicSingleEraDateTimeField extends BaseDateTimeField {
37 
38    /**
39     * Value of the era, which will be the same as DateTimeConstants.CE.
40     */
41    private static final int ERA_VALUE = DateTimeConstants.CE;
42    /**
43     * Text value of the era.
44     */
45    private final String iEraText;
46 
47    /**
48     * Restricted constructor.
49     */
50    BasicSingleEraDateTimeField(String text) {
51        super(DateTimeFieldType.era());
52        iEraText = text;
53    }
54 
55    /** @inheritDoc */
56    public boolean isLenient() {
57        return false;
58    }
59 
60    /** @inheritDoc */
61    public int get(long instant) {
62        return ERA_VALUE;
63    }
64 
65    /** @inheritDoc */
66    public long set(long instant, int era) {
67        FieldUtils.verifyValueBounds(this, era, ERA_VALUE, ERA_VALUE);
68        return instant;
69    }
70 
71    /** @inheritDoc */
72    public long set(long instant, String text, Locale locale) {
73        if (iEraText.equals(text) == false && "1".equals(text) == false) {
74            throw new IllegalFieldValueException(DateTimeFieldType.era(), text);
75        }
76        return instant;
77    }
78 
79    /** @inheritDoc */
80    public long roundFloor(long instant) {
81        return Long.MIN_VALUE;
82    }
83 
84    /** @inheritDoc */
85    public long roundCeiling(long instant) {
86        return Long.MAX_VALUE;
87    }
88 
89    /** @inheritDoc */
90    public long roundHalfFloor(long instant) {
91        return Long.MIN_VALUE;
92    }
93 
94    /** @inheritDoc */
95    public long roundHalfCeiling(long instant) {
96        return Long.MIN_VALUE;
97    }
98 
99    /** @inheritDoc */
100    public long roundHalfEven(long instant) {
101        return Long.MIN_VALUE;
102    }
103 
104    /** @inheritDoc */
105    public DurationField getDurationField() {
106        return UnsupportedDurationField.getInstance(DurationFieldType.eras());
107    }
108 
109    /** @inheritDoc */
110    public DurationField getRangeDurationField() {
111        return null;
112    }
113 
114    /** @inheritDoc */
115    public int getMinimumValue() {
116        return ERA_VALUE;
117    }
118 
119    /** @inheritDoc */
120    public int getMaximumValue() {
121        return ERA_VALUE;
122    }
123 
124    /** @inheritDoc */
125    public String getAsText(int fieldValue, Locale locale) {
126        return iEraText;
127    }
128 
129    /** @inheritDoc */
130    public int getMaximumTextLength(Locale locale) {
131        return iEraText.length();
132    }
133 
134}

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