EMMA Coverage Report (generated Thu Jan 24 13:37:04 CST 2013)
[all classes][org.springframework.batch.item.file.transform]

COVERAGE SUMMARY FOR SOURCE FILE [Range.java]

nameclass, %method, %block, %line, %
Range.java100% (1/1)100% (7/7)97%  (66/68)99%  (13.8/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Range100% (1/1)100% (7/7)97%  (66/68)99%  (13.8/14)
checkMinMaxValues (int, int): void 100% (1/1)88%  (14/16)93%  (2.8/3)
Range (int): void 100% (1/1)100% (5/5)100% (2/2)
Range (int, int): void 100% (1/1)100% (13/13)100% (5/5)
getMax (): int 100% (1/1)100% (3/3)100% (1/1)
getMin (): int 100% (1/1)100% (3/3)100% (1/1)
hasMaxValue (): boolean 100% (1/1)100% (8/8)100% (1/1)
toString (): String 100% (1/1)100% (20/20)100% (1/1)

1/*
2 * Copyright 2006-2007 the original author or authors.
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 */
16 
17package org.springframework.batch.item.file.transform;
18 
19import org.springframework.util.Assert;
20 
21/**
22 * A class to represent ranges. A Range can have minimum/maximum values from
23 * interval <1,Integer.MAX_VALUE-1> A Range can be unbounded at maximum
24 * side. This can be specified by passing {@link Range#UPPER_BORDER_NOT_DEFINED}} as max
25 * value or using constructor {@link #Range(int)}.
26 * 
27 * @author peter.zozom
28 */
29public class Range {
30 
31        public final static int UPPER_BORDER_NOT_DEFINED = Integer.MAX_VALUE;
32        
33        final private int min;        
34        final private int max;
35        
36        public Range(int min) {
37                this(min,UPPER_BORDER_NOT_DEFINED);                
38        }
39        
40        public Range(int min, int max) {
41                checkMinMaxValues(min, max);
42                this.min = min;
43                this.max = max;
44        }
45 
46        public int getMax() {                
47                return max;
48        }
49 
50        public int getMin() {
51                return min;
52        }
53 
54        public boolean hasMaxValue() {
55                return max != UPPER_BORDER_NOT_DEFINED;
56        }
57        
58        public String toString() {
59                return hasMaxValue() ? min + "-" + max : String.valueOf(min);
60        }
61        
62        private void checkMinMaxValues(int min, int max) {
63                Assert.isTrue(min>0, "Min value must be higher than zero");
64                Assert.isTrue(min<=max, "Min value should be lower or equal to max value");                
65        }
66}

[all classes][org.springframework.batch.item.file.transform]
EMMA 2.0.5312 (C) Vladimir Roubtsov