/******************************************************************************* | |
* <copyright> | |
* | |
* Copyright (c) 2013, 2013 SAP AG. | |
* 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: | |
* SAP AG - initial API, implementation and documentation | |
* | |
* </copyright> | |
* | |
*******************************************************************************/ | |
package org.eclipse.fmc.blockdiagram.editor.algorithm.connection; | |
import org.eclipse.graphiti.mm.pictograms.Connection; | |
import org.eclipse.graphiti.mm.pictograms.PictogramElement; | |
/** | |
* This factory produces connection algorithms. | |
* | |
* @author Benjamin Schmeling | |
* | |
*/ | |
public class FMCConnectionAlgorithmFactory { | |
private static FMCConnectionAlgorithmFactory instance = null; | |
/** | |
* This class cannot be instantiated it is a singleton. | |
*/ | |
private FMCConnectionAlgorithmFactory() { | |
} | |
/** | |
* Return the singleton instance of this factory class. | |
* | |
* @return The factory instance. | |
*/ | |
public static synchronized FMCConnectionAlgorithmFactory getInstance() { | |
if (instance == null) { | |
instance = new FMCConnectionAlgorithmFactory(); | |
} | |
return instance; | |
} | |
/** | |
* Returns the connection algorithm for the pictogram element. If the | |
* pictogram element is not a connection, this method will return null. | |
* | |
* @param picto | |
* The pictogram element for determination of the connection | |
* algorithm. | |
* | |
* @return The connection algorithm matching the pictogram input. Currently, | |
* there is only one type of connection algorithm | |
*/ | |
public FMCConnectionAlgorithm getAlgorithm(PictogramElement picto) { | |
if (picto instanceof Connection) | |
return new FMCConnectionAlgorithm(); | |
return null; | |
} | |
} |