EMMA Coverage Report (generated Tue May 06 07:28:24 PDT 2008)
[all classes][org.springframework.batch.item.file.transform]

COVERAGE SUMMARY FOR SOURCE FILE [Range.java]

nameclass, %method, %block, %line, %
Range.java100% (1/1)89%  (8/9)88%  (83/94)86%  (19.8/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Range100% (1/1)89%  (8/9)88%  (83/94)86%  (19.8/23)
setMin (int): void 0%   (0/1)0%   (0/9)0%   (0/3)
checkMinMaxValues (int, int): void 100% (1/1)88%  (14/16)93%  (2.8/3)
Range (int): void 100% (1/1)100% (13/13)100% (5/5)
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)
setMax (int): void 100% (1/1)100% (9/9)100% (3/3)
toString (): String 100% (1/1)100% (20/20)100% (1/1)

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

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