| /******************************************************************************* |
| * 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 - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************/ |
| package org.eclipse.apogy.examples.mobile_platform.impl; |
| |
| import org.eclipse.apogy.examples.mobile_platform.ApogyExamplesMobilePlatformFactory; |
| import org.eclipse.apogy.examples.mobile_platform.MobilePlatform; |
| import org.eclipse.apogy.examples.mobile_platform.MobilePlatformSimulated; |
| import org.eclipse.apogy.examples.mobile_platform.MobilePlatformStub; |
| import org.eclipse.apogy.examples.mobile_platform.NamedPosition; |
| import org.eclipse.apogy.examples.mobile_platform.Position; |
| |
| public class ApogyExamplesMobilePlatformFacadeCustomImpl extends ApogyExamplesMobilePlatformFacadeImpl { |
| @Override |
| public Position makePositionSameType(Position position) { |
| // Used to keep track of the new position object |
| Position newPosition = null; |
| |
| // If the position is a named position |
| if (position instanceof NamedPosition) { |
| // Create the named position |
| newPosition = ApogyExamplesMobilePlatformFactory.eINSTANCE.createNamedPosition(); |
| } |
| // Otherwise if it's just a regular position |
| else if (position instanceof Position) { |
| // Create the regular position |
| newPosition = ApogyExamplesMobilePlatformFactory.eINSTANCE.createPosition(); |
| } |
| |
| // Just return the position |
| return newPosition; |
| } |
| |
| @Override |
| public MobilePlatform makeMobilePlatformSameType(MobilePlatform mobilePlatform) { |
| // Used to keep track of the new mobile platform instance |
| MobilePlatform newMobilePlatform = null; |
| |
| // If the given mobile platform has a simulated implementation |
| if (mobilePlatform instanceof MobilePlatformSimulated) { |
| // Create a simulated mobile platform |
| newMobilePlatform = ApogyExamplesMobilePlatformFactory.eINSTANCE.createMobilePlatformSimulated(); |
| } |
| // Else if the given mobile platform has a stub implementation |
| else if (mobilePlatform instanceof MobilePlatformStub) { |
| // Create a stub mobile platform |
| newMobilePlatform = ApogyExamplesMobilePlatformFactory.eINSTANCE.createMobilePlatformStub(); |
| } |
| |
| // Return the newly created mobile platform |
| return newMobilePlatform; |
| } |
| } |