EMMA Coverage Report (generated Sat Apr 14 15:01:05 EDT 2012)
[all classes][org.deduced.viewer.web.server]

COVERAGE SUMMARY FOR SOURCE FILE [ChangeEventAggregator.java]

nameclass, %method, %block, %line, %
ChangeEventAggregator.java100% (1/1)100% (3/3)100% (18/18)100% (5/5)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ChangeEventAggregator100% (1/1)100% (3/3)100% (18/18)100% (5/5)
ChangeEventAggregator (): void 100% (1/1)100% (9/9)100% (2/2)
getChangeEventList (): List 100% (1/1)100% (3/3)100% (1/1)
propertyChanged (PropertyChangeEvent): void 100% (1/1)100% (6/6)100% (2/2)

1/**
2 *    Copyright 2005-2011 Steve McDuff d-duff@users.sourceforge.net
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.deduced.viewer.web.server;
17 
18import java.util.ArrayList;
19import java.util.Collections;
20import java.util.List;
21 
22import org.deduced.PropertyChangeEvent;
23import org.deduced.PropertyListener;
24 
25/**
26 * 
27 * ChangeEventAggregator is used to listen to change events and aggregate them
28 * in a list of synchronized change events.
29 * 
30 * @author Steve McDuff
31 * 
32 * @param <K> listener key
33 * @param <V> listener value
34 */
35public class ChangeEventAggregator<K, V> implements PropertyListener<K, V>
36{
37 
38        /**
39         * monitored change event list
40         */
41        private List<PropertyChangeEvent<? extends K, ? extends V>> changeEventList =
42                Collections
43                        .synchronizedList(new ArrayList<PropertyChangeEvent<? extends K, ? extends V>>());
44 
45        /**
46         * get the Change Event List. The list is synchronized so it is multi-thread
47         * safe. The caller can also modify the list as desired. A common usage is
48         * to purge the list of pending events.
49         * 
50         * @return the change event list
51         */
52        public List<PropertyChangeEvent<? extends K, ? extends V>> getChangeEventList()
53        {
54                return changeEventList;
55        }
56 
57        /**
58         * (non-JSDoc)
59         * 
60         * @see org.deduced.PropertyListener#propertyChanged(org.deduced.PropertyChangeEvent)
61         */
62        @Override
63        public void propertyChanged(
64                PropertyChangeEvent<? extends K, ? extends V> event)
65        {
66                changeEventList.add(event);
67        }
68 
69}

[all classes][org.deduced.viewer.web.server]
EMMA 2.0.9525 (unsupported private build) (C) Vladimir Roubtsov