/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package metamodel.mmaemilia.provider;

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

import metamodel.mmaemilia.util.mmaemiliaAdapterFactory;

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;

/**
 * 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 mmaemiliaItemProviderAdapterFactory extends mmaemiliaAdapterFactory 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 mmaemiliaItemProviderAdapterFactory() {
		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 metamodel.mmaemilia.AEmiliaSpecification} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AEmiliaSpecificationItemProvider aEmiliaSpecificationItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.AEmiliaSpecification}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createAEmiliaSpecificationAdapter() {
		if (aEmiliaSpecificationItemProvider == null) {
			aEmiliaSpecificationItemProvider = new AEmiliaSpecificationItemProvider(this);
		}

		return aEmiliaSpecificationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.ArchiType} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArchiTypeItemProvider archiTypeItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.ArchiType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createArchiTypeAdapter() {
		if (archiTypeItemProvider == null) {
			archiTypeItemProvider = new ArchiTypeItemProvider(this);
		}

		return archiTypeItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.ArchiElemTypes} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArchiElemTypesItemProvider archiElemTypesItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.ArchiElemTypes}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createArchiElemTypesAdapter() {
		if (archiElemTypesItemProvider == null) {
			archiElemTypesItemProvider = new ArchiElemTypesItemProvider(this);
		}

		return archiElemTypesItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.ArchiTopology} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArchiTopologyItemProvider archiTopologyItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.ArchiTopology}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createArchiTopologyAdapter() {
		if (archiTopologyItemProvider == null) {
			archiTopologyItemProvider = new ArchiTopologyItemProvider(this);
		}

		return archiTopologyItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.Interaction} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected InteractionItemProvider interactionItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.Interaction}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createInteractionAdapter() {
		if (interactionItemProvider == null) {
			interactionItemProvider = new InteractionItemProvider(this);
		}

		return interactionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.LocalInteraction} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LocalInteractionItemProvider localInteractionItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.LocalInteraction}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createLocalInteractionAdapter() {
		if (localInteractionItemProvider == null) {
			localInteractionItemProvider = new LocalInteractionItemProvider(this);
		}

		return localInteractionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.ArchitecturalInteraction} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArchitecturalInteractionItemProvider architecturalInteractionItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.ArchitecturalInteraction}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createArchitecturalInteractionAdapter() {
		if (architecturalInteractionItemProvider == null) {
			architecturalInteractionItemProvider = new ArchitecturalInteractionItemProvider(this);
		}

		return architecturalInteractionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.InputInteraction} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected InputInteractionItemProvider inputInteractionItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.InputInteraction}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createInputInteractionAdapter() {
		if (inputInteractionItemProvider == null) {
			inputInteractionItemProvider = new InputInteractionItemProvider(this);
		}

		return inputInteractionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.OutputInteraction} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected OutputInteractionItemProvider outputInteractionItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.OutputInteraction}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createOutputInteractionAdapter() {
		if (outputInteractionItemProvider == null) {
			outputInteractionItemProvider = new OutputInteractionItemProvider(this);
		}

		return outputInteractionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.ArchiElemInstance} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ArchiElemInstanceItemProvider archiElemInstanceItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.ArchiElemInstance}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createArchiElemInstanceAdapter() {
		if (archiElemInstanceItemProvider == null) {
			archiElemInstanceItemProvider = new ArchiElemInstanceItemProvider(this);
		}

		return archiElemInstanceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.Attachment} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AttachmentItemProvider attachmentItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.Attachment}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createAttachmentAdapter() {
		if (attachmentItemProvider == null) {
			attachmentItemProvider = new AttachmentItemProvider(this);
		}

		return attachmentItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.ElemType} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ElemTypeItemProvider elemTypeItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.ElemType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createElemTypeAdapter() {
		if (elemTypeItemProvider == null) {
			elemTypeItemProvider = new ElemTypeItemProvider(this);
		}

		return elemTypeItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.To} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ToItemProvider toItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.To}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createToAdapter() {
		if (toItemProvider == null) {
			toItemProvider = new ToItemProvider(this);
		}

		return toItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.From} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FromItemProvider fromItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.From}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createFromAdapter() {
		if (fromItemProvider == null) {
			fromItemProvider = new FromItemProvider(this);
		}

		return fromItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link metamodel.mmaemilia.Elem} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ElemItemProvider elemItemProvider;

	/**
	 * This creates an adapter for a {@link metamodel.mmaemilia.Elem}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createElemAdapter() {
		if (elemItemProvider == null) {
			elemItemProvider = new ElemItemProvider(this);
		}

		return elemItemProvider;
	}

	/**
	 * 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 (aEmiliaSpecificationItemProvider != null) aEmiliaSpecificationItemProvider.dispose();
		if (archiTypeItemProvider != null) archiTypeItemProvider.dispose();
		if (archiElemTypesItemProvider != null) archiElemTypesItemProvider.dispose();
		if (archiTopologyItemProvider != null) archiTopologyItemProvider.dispose();
		if (interactionItemProvider != null) interactionItemProvider.dispose();
		if (localInteractionItemProvider != null) localInteractionItemProvider.dispose();
		if (architecturalInteractionItemProvider != null) architecturalInteractionItemProvider.dispose();
		if (inputInteractionItemProvider != null) inputInteractionItemProvider.dispose();
		if (outputInteractionItemProvider != null) outputInteractionItemProvider.dispose();
		if (archiElemInstanceItemProvider != null) archiElemInstanceItemProvider.dispose();
		if (attachmentItemProvider != null) attachmentItemProvider.dispose();
		if (elemTypeItemProvider != null) elemTypeItemProvider.dispose();
		if (toItemProvider != null) toItemProvider.dispose();
		if (fromItemProvider != null) fromItemProvider.dispose();
		if (elemItemProvider != null) elemItemProvider.dispose();
	}

}
