EMMA Coverage Report (generated Tue May 06 07:29:23 PDT 2008)
[all classes][org.springframework.batch.core]

COVERAGE SUMMARY FOR SOURCE FILE [StepContribution.java]

nameclass, %method, %block, %line, %
StepContribution.java100% (1/1)92%  (11/12)72%  (70/97)95%  (20/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StepContribution100% (1/1)92%  (11/12)72%  (70/97)95%  (20/21)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/1)
StepContribution (StepExecution): void 100% (1/1)100% (10/10)100% (4/4)
combineSkipCounts (): void 100% (1/1)100% (11/11)100% (3/3)
getCommitCount (): int 100% (1/1)100% (3/3)100% (1/1)
getItemCount (): int 100% (1/1)100% (3/3)100% (1/1)
getReadSkipCount (): int 100% (1/1)100% (3/3)100% (1/1)
getSkipCount (): int 100% (1/1)100% (3/3)100% (1/1)
getStepSkipCount (): int 100% (1/1)100% (9/9)100% (1/1)
incrementCommitCount (): void 100% (1/1)100% (7/7)100% (2/2)
incrementItemCount (): void 100% (1/1)100% (7/7)100% (2/2)
incrementReadSkipCount (): void 100% (1/1)100% (7/7)100% (2/2)
incrementSkipCount (): void 100% (1/1)100% (7/7)100% (2/2)

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 */
16package org.springframework.batch.core;
17 
18/**
19 * Represents a contribution to a {@link StepExecution}, buffering changes
20 * until they can be applied at a chunk boundary.
21 * 
22 * @author Dave Syer
23 * 
24 */
25public class StepContribution {
26 
27        private int itemCount = 0;
28 
29        private int parentSkipCount;
30 
31        private int commitCount;
32 
33        private int skipCount;
34 
35        private int readSkipCount;
36 
37        /**
38         * @param execution
39         */
40        public StepContribution(StepExecution execution) {
41                this.parentSkipCount = execution.getSkipCount();
42        }
43 
44        /**
45         * Increment the counter for the number of items processed.
46         */
47        public void incrementItemCount() {
48                itemCount++;
49        }
50 
51        /**
52         * Public access to the item counter.
53         * 
54         * @return the item counter.
55         */
56        public int getItemCount() {
57                return itemCount;
58        }
59 
60        /**
61         * Increment the commit counter.
62         */
63        public void incrementCommitCount() {
64                commitCount++;
65        }
66 
67        /**
68         * Public getter for the commit counter.
69         * @return the commitCount
70         */
71        public int getCommitCount() {
72                return commitCount;
73        }
74 
75        /**
76         * @return the sum of skips accumulated in the parent {@link StepExecution}
77         * and this <code>StepContribution</code>, including uncommitted read
78         * skips.
79         */
80        public int getStepSkipCount() {
81                return readSkipCount + skipCount + parentSkipCount;
82        }
83 
84        /**
85         * @return the number of skips collected in this
86         * <code>StepContribution</code> (not including skips accumulated in the
87         * parent {@link StepExecution}.
88         */
89        public int getSkipCount() {
90                return skipCount;
91        }
92 
93        /**
94         * Increment the total skip count for this contribution
95         */
96        public void incrementSkipCount() {
97                skipCount++;
98        }
99 
100        /**
101         * Increment the counter for skipped reads
102         */
103        public void incrementReadSkipCount() {
104                readSkipCount++;
105        }
106 
107        /**
108         * @return the read skip count
109         */
110        public int getReadSkipCount() {
111                return readSkipCount;
112        }
113 
114        /**
115         * Combine the skip counts and reset read skips to zero.
116         */
117        public void combineSkipCounts() {
118                skipCount += readSkipCount;
119                readSkipCount = 0;
120        }
121 
122        /*
123         * (non-Javadoc)
124         * @see java.lang.Object#toString()
125         */
126        public String toString() {
127                return "[StepContribution: items=" + itemCount + ", commits=" + commitCount + ", readSkips=" + readSkipCount
128                                + ", skips=" + skipCount + "]";
129        }
130 
131}

[all classes][org.springframework.batch.core]
EMMA 2.0.5312 (C) Vladimir Roubtsov