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

COVERAGE SUMMARY FOR SOURCE FILE [DelegatedDurationField.java]

nameclass, %method, %block, %line, %
DelegatedDurationField.java0%   (0/1)0%   (0/22)0%   (0/140)0%   (0/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DelegatedDurationField0%   (0/1)0%   (0/22)0%   (0/140)0%   (0/28)
DelegatedDurationField (DurationField): void 0%   (0/1)0%   (0/5)0%   (0/2)
DelegatedDurationField (DurationField, DurationFieldType): void 0%   (0/1)0%   (0/21)0%   (0/6)
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)
compareTo (Object): int 0%   (0/1)0%   (0/5)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)
getMillis (int): long 0%   (0/1)0%   (0/5)0%   (0/1)
getMillis (int, long): long 0%   (0/1)0%   (0/6)0%   (0/1)
getMillis (long): long 0%   (0/1)0%   (0/5)0%   (0/1)
getMillis (long, long): long 0%   (0/1)0%   (0/6)0%   (0/1)
getName (): String 0%   (0/1)0%   (0/4)0%   (0/1)
getType (): DurationFieldType 0%   (0/1)0%   (0/3)0%   (0/1)
getUnitMillis (): long 0%   (0/1)0%   (0/4)0%   (0/1)
getValue (long): int 0%   (0/1)0%   (0/5)0%   (0/1)
getValue (long, long): int 0%   (0/1)0%   (0/6)0%   (0/1)
getValueAsLong (long): long 0%   (0/1)0%   (0/5)0%   (0/1)
getValueAsLong (long, long): long 0%   (0/1)0%   (0/6)0%   (0/1)
getWrappedField (): DurationField 0%   (0/1)0%   (0/3)0%   (0/1)
isPrecise (): boolean 0%   (0/1)0%   (0/4)0%   (0/1)
isSupported (): boolean 0%   (0/1)0%   (0/4)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/19)0%   (0/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.field;
17 
18import java.io.Serializable;
19import org.joda.time.DurationField;
20import org.joda.time.DurationFieldType;
21 
22/**
23 * <code>DelegatedDurationField</code> delegates each method call to the
24 * duration field it wraps.
25 * <p>
26 * DelegatedDurationField is thread-safe and immutable, and its subclasses must
27 * be as well.
28 *
29 * @author Brian S O'Neill
30 * @see DecoratedDurationField
31 * @since 1.0
32 */
33public class DelegatedDurationField extends DurationField implements Serializable {
34 
35    /** Serialization lock. */
36    private static final long serialVersionUID = -5576443481242007829L;
37 
38    /** The DurationField being wrapped */
39    private final DurationField iField;
40    /** The field type */
41    private final DurationFieldType iType;
42 
43    /**
44     * Constructor.
45     * 
46     * @param field  the base field
47     */
48    protected DelegatedDurationField(DurationField field) {
49        this(field, null);
50    }
51 
52    /**
53     * Constructor.
54     * 
55     * @param field  the base field
56     * @param type  the field type to use
57     */
58    protected DelegatedDurationField(DurationField field, DurationFieldType type) {
59        super();
60        if (field == null) {
61            throw new IllegalArgumentException("The field must not be null");
62        }
63        iField = field;
64        iType = (type == null ? field.getType() : type);
65    }
66 
67    //-----------------------------------------------------------------------
68    /**
69     * Gets the wrapped duration field.
70     * 
71     * @return the wrapped DurationField
72     */
73    public final DurationField getWrappedField() {
74        return iField;
75    }
76 
77    public DurationFieldType getType() {
78        return iType;
79    }
80 
81    public String getName() {
82        return iType.getName();
83    }
84 
85    /**
86     * Returns true if this field is supported.
87     */
88    public boolean isSupported() {
89        return iField.isSupported();
90    }
91 
92    public boolean isPrecise() {
93        return iField.isPrecise();
94    }
95    
96    public int getValue(long duration) {
97        return iField.getValue(duration);
98    }
99 
100    public long getValueAsLong(long duration) {
101        return iField.getValueAsLong(duration);
102    }
103 
104    public int getValue(long duration, long instant) {
105        return iField.getValue(duration, instant);
106    }
107 
108    public long getValueAsLong(long duration, long instant) {
109        return iField.getValueAsLong(duration, instant);
110    }
111 
112    public long getMillis(int value) {
113        return iField.getMillis(value);
114    }
115 
116    public long getMillis(long value) {
117        return iField.getMillis(value);
118    }
119 
120    public long getMillis(int value, long instant) {
121        return iField.getMillis(value, instant);
122    }
123 
124    public long getMillis(long value, long instant) {
125        return iField.getMillis(value, instant);
126    }
127 
128    public long add(long instant, int value) {
129        return iField.add(instant, value);
130    }
131 
132    public long add(long instant, long value) {
133        return iField.add(instant, value);
134    }
135 
136    public int getDifference(long minuendInstant, long subtrahendInstant) {
137        return iField.getDifference(minuendInstant, subtrahendInstant);
138    }
139 
140    public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) {
141        return iField.getDifferenceAsLong(minuendInstant, subtrahendInstant);
142    }
143 
144    public long getUnitMillis() {
145        return iField.getUnitMillis();
146    }
147 
148    public int compareTo(Object durationField) {
149        return iField.compareTo(durationField);
150    }
151 
152    public String toString() {
153        return (iType == null) ? iField.toString() :
154            ("DurationField[" + iType + ']');
155    }
156 
157}

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