/**
 * generated by Xtext 2.9.0
 */
package org.xtext.datavault.datavaultDsl.provider;

import java.util.ArrayList;
import java.util.Collection;

import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;

import org.eclipse.emf.edit.provider.ChangeNotifier;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IChangeNotifier;
import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.INotifyChangedListener;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;

import org.xtext.datavault.datavaultDsl.util.DatavaultDslAdapterFactory;

/**
 * This is the factory that is used to provide the interfaces needed to support Viewers.
 * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
 * The adapters also support Eclipse property sheets.
 * Note that most of the adapters are shared among multiple instances.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class DatavaultDslItemProviderAdapterFactory extends DatavaultDslAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
	/**
	 * This keeps track of the root adapter factory that delegates to this adapter factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ComposedAdapterFactory parentAdapterFactory;

	/**
	 * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IChangeNotifier changeNotifier = new ChangeNotifier();

	/**
	 * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Collection<Object> supportedTypes = new ArrayList<Object>();

	/**
	 * This constructs an instance.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DatavaultDslItemProviderAdapterFactory() {
		supportedTypes.add(IEditingDomainItemProvider.class);
		supportedTypes.add(IStructuredItemContentProvider.class);
		supportedTypes.add(ITreeItemContentProvider.class);
		supportedTypes.add(IItemLabelProvider.class);
		supportedTypes.add(IItemPropertySource.class);
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.DataVault} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DataVaultItemProvider dataVaultItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.DataVault}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createDataVaultAdapter() {
		if (dataVaultItemProvider == null) {
			dataVaultItemProvider = new DataVaultItemProvider(this);
		}

		return dataVaultItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.Type} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TypeItemProvider typeItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.Type}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createTypeAdapter() {
		if (typeItemProvider == null) {
			typeItemProvider = new TypeItemProvider(this);
		}

		return typeItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.DataType} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DataTypeItemProvider dataTypeItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.DataType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createDataTypeAdapter() {
		if (dataTypeItemProvider == null) {
			dataTypeItemProvider = new DataTypeItemProvider(this);
		}

		return dataTypeItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.Entity} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EntityItemProvider entityItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.Entity}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createEntityAdapter() {
		if (entityItemProvider == null) {
			entityItemProvider = new EntityItemProvider(this);
		}

		return entityItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.NodeEntity} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected NodeEntityItemProvider nodeEntityItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.NodeEntity}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createNodeEntityAdapter() {
		if (nodeEntityItemProvider == null) {
			nodeEntityItemProvider = new NodeEntityItemProvider(this);
		}

		return nodeEntityItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.SatelliteEntity} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SatelliteEntityItemProvider satelliteEntityItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.SatelliteEntity}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createSatelliteEntityAdapter() {
		if (satelliteEntityItemProvider == null) {
			satelliteEntityItemProvider = new SatelliteEntityItemProvider(this);
		}

		return satelliteEntityItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.ContextFeature} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ContextFeatureItemProvider contextFeatureItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.ContextFeature}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createContextFeatureAdapter() {
		if (contextFeatureItemProvider == null) {
			contextFeatureItemProvider = new ContextFeatureItemProvider(this);
		}

		return contextFeatureItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.FeatureSurrogateKey} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FeatureSurrogateKeyItemProvider featureSurrogateKeyItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.FeatureSurrogateKey}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createFeatureSurrogateKeyAdapter() {
		if (featureSurrogateKeyItemProvider == null) {
			featureSurrogateKeyItemProvider = new FeatureSurrogateKeyItemProvider(this);
		}

		return featureSurrogateKeyItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.FeatureBusinessKey} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FeatureBusinessKeyItemProvider featureBusinessKeyItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.FeatureBusinessKey}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createFeatureBusinessKeyAdapter() {
		if (featureBusinessKeyItemProvider == null) {
			featureBusinessKeyItemProvider = new FeatureBusinessKeyItemProvider(this);
		}

		return featureBusinessKeyItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.Timestamp} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TimestampItemProvider timestampItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.Timestamp}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createTimestampAdapter() {
		if (timestampItemProvider == null) {
			timestampItemProvider = new TimestampItemProvider(this);
		}

		return timestampItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.Link} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LinkItemProvider linkItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.Link}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createLinkAdapter() {
		if (linkItemProvider == null) {
			linkItemProvider = new LinkItemProvider(this);
		}

		return linkItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.SatelliteReference} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SatelliteReferenceItemProvider satelliteReferenceItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.SatelliteReference}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createSatelliteReferenceAdapter() {
		if (satelliteReferenceItemProvider == null) {
			satelliteReferenceItemProvider = new SatelliteReferenceItemProvider(this);
		}

		return satelliteReferenceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.Satellite} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SatelliteItemProvider satelliteItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.Satellite}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createSatelliteAdapter() {
		if (satelliteItemProvider == null) {
			satelliteItemProvider = new SatelliteItemProvider(this);
		}

		return satelliteItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.NodeReference} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected NodeReferenceItemProvider nodeReferenceItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.NodeReference}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createNodeReferenceAdapter() {
		if (nodeReferenceItemProvider == null) {
			nodeReferenceItemProvider = new NodeReferenceItemProvider(this);
		}

		return nodeReferenceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.xtext.datavault.datavaultDsl.Node} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected NodeItemProvider nodeItemProvider;

	/**
	 * This creates an adapter for a {@link org.xtext.datavault.datavaultDsl.Node}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createNodeAdapter() {
		if (nodeItemProvider == null) {
			nodeItemProvider = new NodeItemProvider(this);
		}

		return nodeItemProvider;
	}

	/**
	 * This returns the root adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComposeableAdapterFactory getRootAdapterFactory() {
		return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
	}

	/**
	 * This sets the composed adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
		this.parentAdapterFactory = parentAdapterFactory;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean isFactoryForType(Object type) {
		return supportedTypes.contains(type) || super.isFactoryForType(type);
	}

	/**
	 * This implementation substitutes the factory itself as the key for the adapter.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter adapt(Notifier notifier, Object type) {
		return super.adapt(notifier, this);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object adapt(Object object, Object type) {
		if (isFactoryForType(type)) {
			Object adapter = super.adapt(object, type);
			if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
				return adapter;
			}
		}

		return null;
	}

	/**
	 * This adds a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void addListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.addListener(notifyChangedListener);
	}

	/**
	 * This removes a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void removeListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.removeListener(notifyChangedListener);
	}

	/**
	 * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void fireNotifyChanged(Notification notification) {
		changeNotifier.fireNotifyChanged(notification);

		if (parentAdapterFactory != null) {
			parentAdapterFactory.fireNotifyChanged(notification);
		}
	}

	/**
	 * This disposes all of the item providers created by this factory. 
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void dispose() {
		if (dataVaultItemProvider != null) dataVaultItemProvider.dispose();
		if (typeItemProvider != null) typeItemProvider.dispose();
		if (dataTypeItemProvider != null) dataTypeItemProvider.dispose();
		if (entityItemProvider != null) entityItemProvider.dispose();
		if (nodeEntityItemProvider != null) nodeEntityItemProvider.dispose();
		if (satelliteEntityItemProvider != null) satelliteEntityItemProvider.dispose();
		if (contextFeatureItemProvider != null) contextFeatureItemProvider.dispose();
		if (featureSurrogateKeyItemProvider != null) featureSurrogateKeyItemProvider.dispose();
		if (featureBusinessKeyItemProvider != null) featureBusinessKeyItemProvider.dispose();
		if (timestampItemProvider != null) timestampItemProvider.dispose();
		if (linkItemProvider != null) linkItemProvider.dispose();
		if (satelliteReferenceItemProvider != null) satelliteReferenceItemProvider.dispose();
		if (satelliteItemProvider != null) satelliteItemProvider.dispose();
		if (nodeReferenceItemProvider != null) nodeReferenceItemProvider.dispose();
		if (nodeItemProvider != null) nodeItemProvider.dispose();
	}

}
