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

COVERAGE SUMMARY FOR SOURCE FILE [GJDayOfWeekDateTimeField.java]

nameclass, %method, %block, %line, %
GJDayOfWeekDateTimeField.java100% (1/1)91%  (10/11)92%  (44/48)92%  (12/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class GJDayOfWeekDateTimeField100% (1/1)91%  (10/11)92%  (44/48)92%  (12/13)
readResolve (): Object 0%   (0/1)0%   (0/4)0%   (0/1)
GJDayOfWeekDateTimeField (BasicChronology, DurationField): void 100% (1/1)100% (8/8)100% (3/3)
convertText (String, Locale): int 100% (1/1)100% (5/5)100% (1/1)
get (long): int 100% (1/1)100% (5/5)100% (1/1)
getAsShortText (int, Locale): String 100% (1/1)100% (5/5)100% (1/1)
getAsText (int, Locale): String 100% (1/1)100% (5/5)100% (1/1)
getMaximumShortTextLength (Locale): int 100% (1/1)100% (4/4)100% (1/1)
getMaximumTextLength (Locale): int 100% (1/1)100% (4/4)100% (1/1)
getMaximumValue (): int 100% (1/1)100% (2/2)100% (1/1)
getMinimumValue (): int 100% (1/1)100% (2/2)100% (1/1)
getRangeDurationField (): DurationField 100% (1/1)100% (4/4)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.field.PreciseDurationDateTimeField;
24 
25/**
26 * GJDayOfWeekDateTimeField provides time calculations for the
27 * day of the week component of time.
28 *
29 * @since 1.0
30 * @author Guy Allard
31 * @author Stephen Colebourne
32 * @author Brian S O'Neill
33 */
34final class GJDayOfWeekDateTimeField extends PreciseDurationDateTimeField {
35    
36    /** Serialization version */
37    private static final long serialVersionUID = -3857947176719041436L;
38 
39    private final BasicChronology iChronology;
40 
41    /**
42     * Restricted constructor.
43     */
44    GJDayOfWeekDateTimeField(BasicChronology chronology, DurationField days) {
45        super(DateTimeFieldType.dayOfWeek(), days);
46        iChronology = chronology;
47    }
48 
49    /**
50     * Get the value of the specified time instant.
51     * 
52     * @param instant  the time instant in millis to query
53     * @return the day of the week extracted from the input
54     */
55    public int get(long instant) {
56        return iChronology.getDayOfWeek(instant);
57    }
58 
59    /**
60     * Get the textual value of the specified time instant.
61     * 
62     * @param fieldValue  the field value to query
63     * @param locale  the locale to use
64     * @return the day of the week, such as 'Monday'
65     */
66    public String getAsText(int fieldValue, Locale locale) {
67        return GJLocaleSymbols.forLocale(locale).dayOfWeekValueToText(fieldValue);
68    }
69 
70    /**
71     * Get the abbreviated textual value of the specified time instant.
72     * 
73     * @param fieldValue  the field value to query
74     * @param locale  the locale to use
75     * @return the day of the week, such as 'Mon'
76     */
77    public String getAsShortText(int fieldValue, Locale locale) {
78        return GJLocaleSymbols.forLocale(locale).dayOfWeekValueToShortText(fieldValue);
79    }
80 
81    /**
82     * Convert the specified text and locale into a value.
83     * 
84     * @param text  the text to convert
85     * @param locale  the locale to convert using
86     * @return the value extracted from the text
87     * @throws IllegalArgumentException if the text is invalid
88     */
89    protected int convertText(String text, Locale locale) {
90        return GJLocaleSymbols.forLocale(locale).dayOfWeekTextToValue(text);
91    }
92 
93    public DurationField getRangeDurationField() {
94        return iChronology.weeks();
95    }
96 
97    /**
98     * Get the minimum value that this field can have.
99     * 
100     * @return the field's minimum value
101     */
102    public int getMinimumValue() {
103        return DateTimeConstants.MONDAY;
104    }
105 
106    /**
107     * Get the maximum value that this field can have.
108     * 
109     * @return the field's maximum value
110     */
111    public int getMaximumValue() {
112        return DateTimeConstants.SUNDAY;
113    }
114 
115    /**
116     * Get the maximum length of the text returned by this field.
117     * 
118     * @param locale  the locale to use
119     * @return the maximum textual length
120     */
121    public int getMaximumTextLength(Locale locale) {
122        return GJLocaleSymbols.forLocale(locale).getDayOfWeekMaxTextLength();
123    }
124 
125    /**
126     * Get the maximum length of the abbreviated text returned by this field.
127     * 
128     * @param locale  the locale to use
129     * @return the maximum abbreviated textual length
130     */
131    public int getMaximumShortTextLength(Locale locale) {
132        return GJLocaleSymbols.forLocale(locale).getDayOfWeekMaxShortTextLength();
133    }
134 
135    /**
136     * Serialization singleton
137     */
138    private Object readResolve() {
139        return iChronology.dayOfWeek();
140    }
141}

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