Skip to content

Package: NoStrategy

NoStrategy

nameinstructionbranchcomplexitylinemethod
NoStrategy()
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
deregister(ChangeObserver)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
getAllObservers()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getObservers(Notification)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
register(ChangeObserver)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * jfaltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.changebroker.internal;
15:
16: import java.util.LinkedHashSet;
17: import java.util.Set;
18:
19: import org.eclipse.emf.common.notify.Notification;
20: import org.eclipse.emf.ecp.changebroker.spi.ChangeObserver;
21:
22: /**
23: * @author jfaltermeier
24: *
25: */
26: public class NoStrategy implements Strategy {
27:
28:         private final Set<ChangeObserver> registry = new LinkedHashSet<ChangeObserver>();
29:
30:         /**
31:          * Registers an observer.
32:          *
33:          * @param observer the observer
34:          */
35:         public void register(ChangeObserver observer) {
36:                 registry.add(observer);
37:         }
38:
39:         /**
40:          * {@inheritDoc}
41:          *
42:          * @see org.eclipse.emf.ecp.changebroker.internal.Strategy#getObservers(org.eclipse.emf.common.notify.Notification)
43:          */
44:         @Override
45:         public Set<ChangeObserver> getObservers(Notification notification) {
46:                 return new LinkedHashSet<ChangeObserver>(registry);
47:         }
48:
49:         /**
50:          *
51:          * {@inheritDoc}
52:          *
53:          * @see org.eclipse.emf.ecp.changebroker.internal.Strategy#deregister(ChangeObserver)
54:          */
55:         @Override
56:         public void deregister(ChangeObserver observer) {
57:                 registry.remove(observer);
58:         }
59:
60:         /**
61:          * {@inheritDoc}
62:          *
63:          * @see org.eclipse.emf.ecp.changebroker.internal.Strategy#getAllObservers()
64:          */
65:         @Override
66:         public Set<ChangeObserver> getAllObservers() {
67:                 return new LinkedHashSet<ChangeObserver>(registry);
68:         }
69:
70: }