| /******************************************************************************* |
| * 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.camera.impl; |
| |
| import org.eclipse.apogy.examples.camera.ApogyExamplesCameraFactory; |
| import org.eclipse.apogy.examples.camera.Camera; |
| import org.eclipse.apogy.examples.camera.CameraSimulated; |
| import org.eclipse.apogy.examples.camera.CameraStub; |
| import org.eclipse.apogy.examples.camera.PTUCamera; |
| import org.eclipse.apogy.examples.camera.PTUCameraSimulated; |
| import org.eclipse.apogy.examples.camera.PTUCameraStub; |
| |
| public class ApogyExamplesCameraFacadeCustomImpl extends ApogyExamplesCameraFacadeImpl { |
| @Override |
| public Camera makeCameraSameType(Camera camera) { |
| // Keep track of the new camera instance |
| Camera newCamera = null; |
| |
| // If the given camera instance is a simulated implementation |
| if (camera instanceof CameraSimulated) { |
| // Create a simulated instance |
| newCamera = ApogyExamplesCameraFactory.eINSTANCE.createCameraSimulated(); |
| } |
| // Else if the given camera instance is a stub implementation |
| else if (camera instanceof CameraStub) { |
| // Create a stub instance |
| newCamera = ApogyExamplesCameraFactory.eINSTANCE.createCameraStub(); |
| } |
| |
| // Return the new camera instance |
| return newCamera; |
| } |
| |
| @Override |
| public PTUCamera makePTUCameraSameType(PTUCamera ptuCamera) { |
| // Keep track of the new PTU camera instance |
| PTUCamera newPtuCamera = null; |
| |
| // If the given PTU camera instance is a simulated implementation |
| if (ptuCamera instanceof PTUCameraSimulated) { |
| // Create a simulated instance |
| newPtuCamera = ApogyExamplesCameraFactory.eINSTANCE.createPTUCameraSimulated(); |
| } |
| // Else if the given PTU camera instance is a stub implementation |
| else if (ptuCamera instanceof PTUCameraStub) { |
| // Create a stub instance |
| newPtuCamera = ApogyExamplesCameraFactory.eINSTANCE.createPTUCameraStub(); |
| } |
| |
| // Return the new PTU camera instance |
| return newPtuCamera; |
| } |
| } |