001 /**
002 * <copyright>
003 *
004 * Copyright (c) 2002-2006 IBM Corporation and others.
005 * All rights reserved. This program and the accompanying materials
006 * are made available under the terms of the Eclipse Public License v1.0
007 * which accompanies this distribution, and is available at
008 * http://www.eclipse.org/legal/epl-v10.html
009 *
010 * Contributors:
011 * IBM - Initial API and implementation
012 *
013 * </copyright>
014 *
015 * $Id: NotifierImpl.java,v 1.3 2006/12/05 20:19:58 emerks Exp $
016 */
017 package org.eclipse.emf.common.notify.impl;
018
019
020 import org.eclipse.emf.common.notify.Adapter;
021 import org.eclipse.emf.common.util.BasicEList;
022 import org.eclipse.emf.common.util.EList;
023
024 /**
025 * An extensible notifier implementation.
026 */
027 public class NotifierImpl extends BasicNotifierImpl
028 {
029 /**
030 * The bit of {@link #eFlags} that is used to represent {@link #eDeliver}.
031 */
032 protected static final int EDELIVER = 0x0001;
033
034 /**
035 * The last bit used by this class; derived classes may use bit values higher than this.
036 */
037 protected static final int ELAST_NOTIFIER_FLAG = EDELIVER;
038
039 /**
040 * An extensible set of bit flags;
041 * the first bit is used for {@link #EDELIVER} to implement {@link #eDeliver}.
042 */
043 protected int eFlags = EDELIVER;
044
045 /**
046 * The list of {@link org.eclipse.emf.common.notify.Adapter}s associated with the notifier.
047 */
048 protected BasicEList<Adapter> eAdapters;
049
050 /**
051 * Creates a blank new instance.
052 */
053 public NotifierImpl()
054 {
055 super();
056 }
057
058 @Override
059 public EList<Adapter> eAdapters()
060 {
061 if (eAdapters == null)
062 {
063 eAdapters = new EAdapterList<Adapter>(this);
064 }
065 return eAdapters;
066 }
067
068 @Override
069 protected BasicEList<Adapter> eBasicAdapters()
070 {
071 return eAdapters;
072 }
073
074 @Override
075 public boolean eDeliver()
076 {
077 return (eFlags & EDELIVER) != 0;
078 }
079
080 @Override
081 public void eSetDeliver(boolean deliver)
082 {
083 if (deliver)
084 {
085 this.eFlags |= EDELIVER;
086 }
087 else
088 {
089 this.eFlags &= ~EDELIVER;
090 }
091 }
092 }