| /******************************************************************************* |
| * Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Pierre Allard, |
| * Regent L'Archeveque, |
| * Olivier L. Larouche - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| * |
| *******************************************************************************/ |
| package org.eclipse.apogy.core.invocator.impl; |
| |
| import java.util.Iterator; |
| |
| import org.eclipse.apogy.core.invocator.Type; |
| import org.eclipse.apogy.core.invocator.TypeMember; |
| import org.eclipse.apogy.core.invocator.TypeMemberImplementation; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| public abstract class AbstractTypeImplementationCustomImpl extends AbstractTypeImplementationImpl { |
| |
| @Override |
| public Type getHandlingType() { |
| Type handlingType = basicGetHandlingType(); |
| return handlingType != null && handlingType.eIsProxy() ? (Type) eResolveProxy((InternalEObject) handlingType) |
| : handlingType; |
| } |
| |
| @Override |
| abstract public Type basicGetHandlingType(); |
| |
| @Override |
| public TypeMemberImplementation getTypeMemberImplementation(String name) { |
| TypeMemberImplementation result = null; |
| |
| Iterator<TypeMemberImplementation> iterator = getTypeMemberImplementations().iterator(); |
| while (iterator.hasNext() && result == null) { |
| TypeMemberImplementation current = iterator.next(); |
| |
| if (current.getTypeMember().getName().equals(name)) { |
| result = current; |
| } |
| } |
| |
| return result; |
| } |
| |
| @Override |
| public TypeMemberImplementation getTypeMemberImplementation(TypeMember typeMember) { |
| TypeMemberImplementation result = null; |
| Iterator<TypeMemberImplementation> typeMemberImplementations = getTypeMemberImplementations().iterator(); |
| while (typeMemberImplementations.hasNext() && result == null) { |
| TypeMemberImplementation current = typeMemberImplementations.next(); |
| if (current.getTypeMember() == typeMember) { |
| result = current; |
| } |
| } |
| |
| return result; |
| } |
| |
| } // AbstractTypeImplementationImpl |