package org.arakhne.neteditor.fsm.constructs ;

import org.arakhne.neteditor.formalism.standard.StandardAnchor;

public class FSMAnchor extends StandardAnchor<FiniteStateMachine,AbstractFSMNode,FSMAnchor,FSMTransition> {

	public FSMAnchor() {
		super();
	}
	
	@Override
	public boolean canConnectAsEndAnchor(FSMTransition edge,
			FSMAnchor startAnchor) {
		if (getNode() instanceof FSMStartPoint) {
			return false;
		}
		if (getNode() instanceof FSMEndPoint) {
			if (startAnchor!=null) {
				return startAnchor.getNode() instanceof FSMState;
			}
		}
		return true;
	}
	
	@Override
	public boolean canConnectAsStartAnchor(FSMTransition edge,
			FSMAnchor endAnchor) {
		if (getNode() instanceof FSMEndPoint) {
			return false;
		}
		if (getNode() instanceof FSMStartPoint) {
			if (endAnchor!=null) {
				return endAnchor.getNode() instanceof FSMState;
			}
		}
		return true;
	}
	
}