/**
 */
package ua.ansymo.hintco.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 ua.ansymo.hintco.util.HintcoAdapterFactory;

/**
 * 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 HintcoItemProviderAdapterFactory extends HintcoAdapterFactory 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 HintcoItemProviderAdapterFactory() {
		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 ua.ansymo.hintco.HintConfiguration} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected HintConfigurationItemProvider hintConfigurationItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.HintConfiguration}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createHintConfigurationAdapter() {
		if (hintConfigurationItemProvider == null) {
			hintConfigurationItemProvider = new HintConfigurationItemProvider(this);
		}

		return hintConfigurationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.VariantDiagram} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected VariantDiagramItemProvider variantDiagramItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.VariantDiagram}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createVariantDiagramAdapter() {
		if (variantDiagramItemProvider == null) {
			variantDiagramItemProvider = new VariantDiagramItemProvider(this);
		}

		return variantDiagramItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.RootCandidateScenario} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RootCandidateScenarioItemProvider rootCandidateScenarioItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.RootCandidateScenario}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createRootCandidateScenarioAdapter() {
		if (rootCandidateScenarioItemProvider == null) {
			rootCandidateScenarioItemProvider = new RootCandidateScenarioItemProvider(this);
		}

		return rootCandidateScenarioItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.HierarchicalCosimUnit} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected HierarchicalCosimUnitItemProvider hierarchicalCosimUnitItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.HierarchicalCosimUnit}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createHierarchicalCosimUnitAdapter() {
		if (hierarchicalCosimUnitItemProvider == null) {
			hierarchicalCosimUnitItemProvider = new HierarchicalCosimUnitItemProvider(this);
		}

		return hierarchicalCosimUnitItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.CosimUnitDeclaration} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CosimUnitDeclarationItemProvider cosimUnitDeclarationItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.CosimUnitDeclaration}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createCosimUnitDeclarationAdapter() {
		if (cosimUnitDeclarationItemProvider == null) {
			cosimUnitDeclarationItemProvider = new CosimUnitDeclarationItemProvider(this);
		}

		return cosimUnitDeclarationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.CosimUnitInstance} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CosimUnitInstanceItemProvider cosimUnitInstanceItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.CosimUnitInstance}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createCosimUnitInstanceAdapter() {
		if (cosimUnitInstanceItemProvider == null) {
			cosimUnitInstanceItemProvider = new CosimUnitInstanceItemProvider(this);
		}

		return cosimUnitInstanceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.HierarchicalUnitPort} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected HierarchicalUnitPortItemProvider hierarchicalUnitPortItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.HierarchicalUnitPort}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createHierarchicalUnitPortAdapter() {
		if (hierarchicalUnitPortItemProvider == null) {
			hierarchicalUnitPortItemProvider = new HierarchicalUnitPortItemProvider(this);
		}

		return hierarchicalUnitPortItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.InputPortInstance} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected InputPortInstanceItemProvider inputPortInstanceItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.InputPortInstance}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createInputPortInstanceAdapter() {
		if (inputPortInstanceItemProvider == null) {
			inputPortInstanceItemProvider = new InputPortInstanceItemProvider(this);
		}

		return inputPortInstanceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.OutputPortInstance} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected OutputPortInstanceItemProvider outputPortInstanceItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.OutputPortInstance}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createOutputPortInstanceAdapter() {
		if (outputPortInstanceItemProvider == null) {
			outputPortInstanceItemProvider = new OutputPortInstanceItemProvider(this);
		}

		return outputPortInstanceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.XorUnitAdaptation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected XorUnitAdaptationItemProvider xorUnitAdaptationItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.XorUnitAdaptation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createXorUnitAdaptationAdapter() {
		if (xorUnitAdaptationItemProvider == null) {
			xorUnitAdaptationItemProvider = new XorUnitAdaptationItemProvider(this);
		}

		return xorUnitAdaptationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.XorPortAdaptation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected XorPortAdaptationItemProvider xorPortAdaptationItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.XorPortAdaptation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createXorPortAdaptationAdapter() {
		if (xorPortAdaptationItemProvider == null) {
			xorPortAdaptationItemProvider = new XorPortAdaptationItemProvider(this);
		}

		return xorPortAdaptationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.MultiRateAdaptation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MultiRateAdaptationItemProvider multiRateAdaptationItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.MultiRateAdaptation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createMultiRateAdaptationAdapter() {
		if (multiRateAdaptationItemProvider == null) {
			multiRateAdaptationItemProvider = new MultiRateAdaptationItemProvider(this);
		}

		return multiRateAdaptationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.PowerBondAdaptation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PowerBondAdaptationItemProvider powerBondAdaptationItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.PowerBondAdaptation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createPowerBondAdaptationAdapter() {
		if (powerBondAdaptationItemProvider == null) {
			powerBondAdaptationItemProvider = new PowerBondAdaptationItemProvider(this);
		}

		return powerBondAdaptationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.ExtrapolationAdaptation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ExtrapolationAdaptationItemProvider extrapolationAdaptationItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.ExtrapolationAdaptation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createExtrapolationAdaptationAdapter() {
		if (extrapolationAdaptationItemProvider == null) {
			extrapolationAdaptationItemProvider = new ExtrapolationAdaptationItemProvider(this);
		}

		return extrapolationAdaptationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.RollbackInterpolationAdaptation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RollbackInterpolationAdaptationItemProvider rollbackInterpolationAdaptationItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.RollbackInterpolationAdaptation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createRollbackInterpolationAdaptationAdapter() {
		if (rollbackInterpolationAdaptationItemProvider == null) {
			rollbackInterpolationAdaptationItemProvider = new RollbackInterpolationAdaptationItemProvider(this);
		}

		return rollbackInterpolationAdaptationItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link ua.ansymo.hintco.InterpolationAdaptation} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected InterpolationAdaptationItemProvider interpolationAdaptationItemProvider;

	/**
	 * This creates an adapter for a {@link ua.ansymo.hintco.InterpolationAdaptation}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createInterpolationAdaptationAdapter() {
		if (interpolationAdaptationItemProvider == null) {
			interpolationAdaptationItemProvider = new InterpolationAdaptationItemProvider(this);
		}

		return interpolationAdaptationItemProvider;
	}

	/**
	 * 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 (hintConfigurationItemProvider != null) hintConfigurationItemProvider.dispose();
		if (variantDiagramItemProvider != null) variantDiagramItemProvider.dispose();
		if (rootCandidateScenarioItemProvider != null) rootCandidateScenarioItemProvider.dispose();
		if (hierarchicalCosimUnitItemProvider != null) hierarchicalCosimUnitItemProvider.dispose();
		if (cosimUnitDeclarationItemProvider != null) cosimUnitDeclarationItemProvider.dispose();
		if (cosimUnitInstanceItemProvider != null) cosimUnitInstanceItemProvider.dispose();
		if (hierarchicalUnitPortItemProvider != null) hierarchicalUnitPortItemProvider.dispose();
		if (inputPortInstanceItemProvider != null) inputPortInstanceItemProvider.dispose();
		if (outputPortInstanceItemProvider != null) outputPortInstanceItemProvider.dispose();
		if (xorUnitAdaptationItemProvider != null) xorUnitAdaptationItemProvider.dispose();
		if (xorPortAdaptationItemProvider != null) xorPortAdaptationItemProvider.dispose();
		if (multiRateAdaptationItemProvider != null) multiRateAdaptationItemProvider.dispose();
		if (powerBondAdaptationItemProvider != null) powerBondAdaptationItemProvider.dispose();
		if (extrapolationAdaptationItemProvider != null) extrapolationAdaptationItemProvider.dispose();
		if (rollbackInterpolationAdaptationItemProvider != null) rollbackInterpolationAdaptationItemProvider.dispose();
		if (interpolationAdaptationItemProvider != null) interpolationAdaptationItemProvider.dispose();
	}

}
