src/infinity/ecs/core/EntityManager.java
/**
	 * Adds a new nested Entity to a super Entity, removes the nested Entity from _parentEntities
	 * and _parentEntitiesByMask
	 * 
	 * @param parent
	 * @param child
	 * @throws infinity.ecs.exceptions.AlreadyNestedException
	 */
Adds a new nested Entity to a super Entity, removes the nested Entity from _parentEntities
and _parentEntitiesByMask

@param parent
@param child
@throws infinity.ecs.exceptions.AlreadyNestedException
Adds a new nested Entity to a super Entity removes the nested Entity from _parentEntities and _parentEntitiesByMask @param parent @param child @throws infinity . ecs . exceptions . AlreadyNestedException
public void addChildEntity(Entity parent, Entity child)
			throws IllegalArgumentException, AlreadyNestedException {
		if (parent == null || child == null || child == parent)
			throw new IllegalArgumentException();
		List<Entity> tChilds = _children.get(parent.getId());
		if (tChilds == null)
			throw new IllegalArgumentException();
		if (_parents.get(child.getId()) != null)
			throw new AlreadyNestedException();
		Entity parentOfParent = _parents.get(parent.getId());
		while (parentOfParent != null)
		{
			if (parentOfParent == child)
				throw new IllegalArgumentException();
			parentOfParent = _parents.get(parentOfParent.getId());
		}
		tChilds.add(child);
		_parents.set(child.getId(), parent);
		if (_msgEndpoint != null)
			_msgEndpoint.send(new ChildEntityAddedMessage(parent, child));
	}
public void addChildEntity ( Entity parent , Entity child ) throws IllegalArgumentException , AlreadyNestedException { if ( parent == null || child == null || child == parent ) throw new IllegalArgumentException ( ) ; List < Entity > tChilds = _children . get ( parent . getId ( ) ) ; if ( tChilds == null ) throw new IllegalArgumentException ( ) ; if ( _parents . get ( child . getId ( ) ) != null ) throw new AlreadyNestedException ( ) ; Entity parentOfParent = _parents . get ( parent . getId ( ) ) ; while ( parentOfParent != null ) { if ( parentOfParent == child ) throw new IllegalArgumentException ( ) ; parentOfParent = _parents . get ( parentOfParent . getId ( ) ) ; } tChilds . add ( child ) ; _parents . set ( child . getId ( ) , parent ) ; if ( _msgEndpoint != null ) _msgEndpoint . send ( new ChildEntityAddedMessage ( parent , child ) ) ; }
Adds a new nested Entity to a super Entity, removes the nested Entity from _parentEntities
 and _parentEntitiesByMask
Adds a new nested Entity to a super Entity removes the nested Entity from _parentEntities and _parentEntitiesByMask
// check for null and also make sure nobody tries to add the entity to itself
 // check if the entity is registered in the entity manager and try to get the list of
 // all the children it currently has
 // check if the child already has a parent
 // check if the child is in truth a parent of the 'parent'
 // finally add the child to the parent
