/*
 * $RCSfile: EmfModelWrapper.java,v $
 * $Date: 2006/01/26 14:48:59 $
 * $Revision: 1.1.2.1 $
 * $Author: andreys $
 */
 
/*
 * Copyright (c) 2002-2003 IST-2004-2006-511731 ModelWare - ModelBus.
 * All rights reserved.
 *
 * This software is published under the terms of the ModelBus Software License
 * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * A copy of ModelBus Software License is provided with this distribution in
 * doc/LICENSE.txt file.
 */
 
/*
 * Registry.java Add description 
 * 
 * @author Prawee Sriplakich
 * @version $Revision: 1.1.2.1 $ $Date: 2006/01/26 14:48:59 $
 * @see Add references
 *
 * TODO Add description
 * TODO Add references
 */
package org.eclipse.mddi.modelbus.adapter.infrastructure.model_manipulation.wrapper.emf;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.mddi.modelbus.adapter.infrastructure.model_manipulation.ModelWrapper;

/**
 * @author P. Sriplakich
 *
 *
 */
public class EmfModelWrapper extends ModelWrapper {
    
    static {
      ModelWrapper.addRegistry("EMF", new EmfModelWrapper());    
    
    }
    


    /* (non-Javadoc)
     * @see org.eclipse.mddi.modelbus.adapter.infrastructure.model_manipulation.wrapper.WPackageRegistry#wrapModelElement(java.lang.Object)
     */
    public EObject wrapModelElement(Object o) {
        return (EObject)o;
    }

    /* (non-Javadoc)
     * @see org.eclipse.mddi.modelbus.adapter.infrastructure.model_manipulation.wrapper.WPackageRegistry#canWrap(java.lang.Object)
     */
    public boolean canWrap(Object o) {
        return o instanceof EObject;
    }

    /* (non-Javadoc)
     * @see org.eclipse.mddi.modelbus.adapter.infrastructure.model_manipulation.wrapper.WPackageRegistry#create(org.eclipse.emf.ecore.EClass)
     */
    public EObject create(EClass c) {
        EObject o = EcoreUtil.create(c);
        return o;
    }

    /* (non-Javadoc)
     * @see org.eclipse.mddi.modelbus.adapter.infrastructure.model_manipulation.wrapper.WPackageRegistry#unwrapModelElement(org.eclipse.emf.ecore.EObject)
     */
    public Object unwrapModelElement(EObject o) {
        return o;
    }

    /* (non-Javadoc)
     * @see org.eclipse.mddi.modelbus.adapter.infrastructure.model_manipulation.wrapper.WPackageRegistry#canUnwrap(java.lang.Object)
     */
    public boolean canUnwrap(Object o) {
        return (o instanceof EObjectImpl);
    }
    
    
}
