EMMA Coverage Report (generated Fri Jan 30 13:20:29 EST 2009)
[all classes][org.springframework.batch.item.xml.stax]

COVERAGE SUMMARY FOR SOURCE FILE [EventSequence.java]

nameclass, %method, %block, %line, %
EventSequence.java100% (1/1)88%  (7/8)82%  (66/80)93%  (14/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EventSequence100% (1/1)88%  (7/8)82%  (66/80)93%  (14/15)
peek (): XMLEvent 0%   (0/1)0%   (0/14)0%   (0/1)
EventSequence (): void 100% (1/1)100% (5/5)100% (3/3)
addEvent (XMLEvent): void 100% (1/1)100% (6/6)100% (2/2)
clear (): void 100% (1/1)100% (3/3)100% (2/2)
hasNext (): boolean 100% (1/1)100% (12/12)100% (1/1)
init (): void 100% (1/1)100% (19/19)100% (3/3)
nextEvent (): XMLEvent 100% (1/1)100% (17/17)100% (1/1)
reset (): void 100% (1/1)100% (4/4)100% (2/2)

1package org.springframework.batch.item.xml.stax;
2 
3import java.util.ArrayList;
4import java.util.List;
5 
6import javax.xml.stream.events.XMLEvent;
7 
8/**
9 * Holds a list of XML events, typically corresponding to a single record.
10 * 
11 * @deprecated no longer used, to be removed in 2.0
12 *  
13 * @author tomas.slanina
14 */
15class EventSequence {
16        
17        private static final int BEFORE_BEGINNING = -1;
18        
19        private List events;
20        
21        private int currentIndex;
22        
23        /**
24         * Creates instance of this class.
25         *
26         */
27        public EventSequence() {
28                init();
29        }
30        
31        /**
32         * Adds event to the list of stored events.
33         * 
34         * @param event
35         */
36        public void addEvent(XMLEvent event) {
37                events.add(event);
38        }
39        
40        /**
41         * Gets next XMLEvent from cache and moves cursor to next event.
42         * If cache contains no more events, null is returned.
43         */
44        public XMLEvent nextEvent() {
45                return (hasNext()) ? (XMLEvent)events.get(++currentIndex) :null;
46         }
47        
48        /**
49         * Gets next XMLEvent from cache but cursor remains on the same position.
50         * If cache contains no more events, null is returned.
51         */
52        public XMLEvent peek() {
53                return (hasNext()) ? (XMLEvent)events.get(currentIndex+1) :null;
54        }
55        
56        /**
57         * Removes events from the internal cache.
58         *
59         */
60        public void clear() {
61                init();
62        }
63        
64        /**
65         * Resets cursor to the cache start.
66         *
67         */
68        public void reset() {
69                currentIndex = BEFORE_BEGINNING;
70        }
71        
72        /**
73         * Check if there are more events. Returns true if there are more events and
74         * false otherwise.
75         * 
76         * @return true if the event reader has more events, false otherwise
77         */
78        public boolean hasNext() {
79                return currentIndex + 1 < events.size();
80        }
81        
82        private void init() {
83                events = (events != null) ? new ArrayList(events.size())
84                        : new ArrayList(1000);
85                
86                reset();
87        }
88        
89        
90}

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