Debian Codegraph @

plugins/org.eclipse.emf.gwt.common/src/org/eclipse/emf/common/notify/impl/NotifierImpl.java

raw
1 /**
2 * Copyright (c) 2002-2010 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v2.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v20.html
7 *
8 * Contributors:
9 * IBM - Initial API and implementation
10 */
11 package org.eclipse.emf.common.notify.impl;
12
13
14 import org.eclipse.emf.common.notify.Adapter;
15 import org.eclipse.emf.common.util.BasicEList;
16 import org.eclipse.emf.common.util.EList;
17
18 /**
19 * An extensible notifier implementation.
20 */
21 public class NotifierImpl extends BasicNotifierImpl
22 {
23 /**
24 * The bit of {@link #eFlags} that is used to represent {@link #eDeliver}.
25 */
26 protected static final int EDELIVER = 0x0001;
27
28 /**
29 * The last bit used by this class; derived classes may use bit values higher than this.
30 */
31 protected static final int ELAST_NOTIFIER_FLAG = EDELIVER;
32
33 /**
34 * An extensible set of bit flags;
35 * the first bit is used for {@link #EDELIVER} to implement {@link #eDeliver}.
36 */
37 protected int eFlags = EDELIVER;
38
39 /**
40 * The list of {@link org.eclipse.emf.common.notify.Adapter}s associated with the notifier.
41 */
42 protected BasicEList<Adapter> eAdapters;
43
44 /**
45 * Creates a blank new instance.
46 */
47 public NotifierImpl()
48 {
49 super();
50 }
51
52 @Override
53 public EList<Adapter> eAdapters()
54 {
55 if (eAdapters == null)
56 {
57 eAdapters = new EAdapterList<Adapter>(this);
58 }
59 return eAdapters;
60 }
61
62 @Override
63 protected BasicEList<Adapter> eBasicAdapters()
64 {
65 return eAdapters;
66 }
67
68 @Override
69 public boolean eDeliver()
70 {
71 return (eFlags & EDELIVER) != 0;
72 }
73
74 @Override
75 public void eSetDeliver(boolean deliver)
76 {
77 if (deliver)
78 {
79 this.eFlags |= EDELIVER;
80 }
81 else
82 {
83 this.eFlags &= ~EDELIVER;
84 }
85 }
86 }