startParent.addChild(endNode);
startParent.addSuccesor(endNode);
	public boolean connect (GEStreamNode startNode, GEStreamNode endNode, int nodesConnected)	{		GEStreamNode startParent = startNode.getEncapsulatingNode();		GEStreamNode endParent = endNode.getEncapsulatingNode();				if ((startParent == endNode) || (endParent == startNode) || (startParent == null) || (endParent == null))		{			return false;		}				if (startParent.getType() == GEType.PIPELINE)		{			ArrayList startParentChildren = startParent.getSuccesors();			ArrayList endParentChildren = endParent.getSuccesors();						switch(nodesConnected)			{				case RelativePosition.START_PRESENT:				{						if (endParent == startParent)					{						//TODO Add all of the nodes that are connected after endNode						startParentChildren.add(endNode);					}					else					{						int startIndex =  startParentChildren.indexOf(startNode);						startParentChildren.add(startIndex + 1, endNode);											}										break;				}				case RelativePosition.END_PRESENT:				{					if (endParent == startParent)					{						//TODO Add all of the nodes that are connected before startNode						int endNodeIndex = startParentChildren.indexOf(endNode);						int addedAtIndex = endNodeIndex == 0 ? 0 : endNodeIndex - 1;						startParentChildren.add(addedAtIndex, startNode);					}					else					{						//TODO						int endNodeIndex = startParentChildren.indexOf(endParent);						int addedAtIndex = endNodeIndex == 0 ? 0 : endNodeIndex - 1;						startParentChildren.add(addedAtIndex, startNode);																}					break;				}				case RelativePosition.BOTH_PRESENT:				{					if ((endParent.getType() == GEType.PIPELINE) || 						(endParent.getType() == GEType.FEEDBACK_LOOP) ||						(endParent.getType() == GEType.SPLIT_JOIN))						{							int startNodeIndex = startParentChildren.indexOf(startNode);							startParentChildren.add(startNodeIndex + 1, endParent);						}					break;				}								case RelativePosition.NONE_PRESENT:				{					startParentChildren.add(endNode);					startParentChildren.add(startNode);					break;				}			}			connectDraw(startNode, endNode);					}		else if (startParent.getType() == GEType.SPLIT_JOIN)		{			GESplitter splitter = ((GESplitJoin) startParent).getSplitter();			GEJoiner joiner =  ((GESplitJoin) startParent).getJoiner();						switch(nodesConnected)			{								case RelativePosition.START_PRESENT:				{					System.out.println("BEFORE THE TEST splitter");										/** The startNode always has to be the splitter. 					 * Cannot connect from the splitter to a node outside the parent SplitJoin **/					if ((startNode == splitter) && (startParent == endParent))					{													System.out.println("THE STARTNODE EQUALS THE SPLITTER");						startParent.addChild(endNode);						connectDraw(splitter, endNode);						connectDraw(endNode, joiner);						break;								}					else if (startNode == joiner)					{ 						GEStreamNode grandparent = startParent.getEncapsulatingNode();						if (grandparent != null)						{							ArrayList grandparentChildList = grandparent.getSuccesors();							int parentIndex = grandparentChildList.indexOf(startParent);							grandparentChildList.add(parentIndex, endNode);							connectDraw(startNode, endNode);							break;						}						else						{							return false;						}					}					else					{							return false;					}									}				case RelativePosition.END_PRESENT:				{					System.out.println("BEFORE THE TEST joiner");					if (endNode == joiner)					{						System.out.println("THE ENDNODE EQUALS THE JOINER");						startParent.addChild(startNode);						connectDraw(splitter, startNode);						connectDraw(startNode, joiner);						break;					}						else {						return false;					}				}				case RelativePosition.NONE_PRESENT:				case RelativePosition.BOTH_PRESENT:				default:				{					return false;					}			}					}		else if (startParent.getType() == GEType.FEEDBACK_LOOP)		{			return false;		}		else		{			System.out.println("ERROR : The parent type is invalid");			return false;		}		return true;	}