src/infinity/ecs/core/EntityManager.java
/**
	 * Adds a new {@link Component} of the specified type to the specified {@link Entity}.
	 * 
	 * @param entity The {@link Entity} to which the {@link Component} should be added.
	 * @param componentType The type of the {@link Component} that should be added.
	 * @return The {@link Component} which has been created.
	 * @throws IllegalArgumentException When the specified {@link Entity} was not part of this
	 * 		{@link EntityManager} or if a new instance of the specified type of {@link Component}
	 * 		could not be constructed.
	 * @throws ComponentAlreadyExistsException when the {@link Component} which should be added is
	 * 		already part of the {@link Entity}.
	 */
Adds a new  Component of the specified type to the specified  Entity.

@param entity The  Entity to which the  Component should be added.
@param componentType The type of the  Component that should be added.
@return The  Component which has been created.
@throws IllegalArgumentException When the specified  Entity was not part of this
EntityManager or if a new instance of the specified type of  Component
could not be constructed.
@throws ComponentAlreadyExistsException when the  Component which should be added is
already part of the  Entity.
Adds a new Component of the specified type to the specified Entity . @param entity The Entity to which the Component should be added . @param componentType The type of the Component that should be added . @return The Component which has been created . @throws IllegalArgumentException When the specified Entity was not part of this EntityManager or if a new instance of the specified type of Component could not be constructed . @throws ComponentAlreadyExistsException when the Component which should be added is already part of the Entity .
public Component addComponent(Entity entity, ComponentType componentType)
			throws IllegalArgumentException, ComponentAlreadyExistsException {
		int eId = entity.getId();
		IndexedCollection<Component> ec = _components.get(eId);
		if (ec == null)
			throw new IllegalArgumentException();
		int cId = componentType.getId();
		if (ec.get(cId) != null)
			throw new ComponentAlreadyExistsException();
		ComponentFactory fac = _factories.get(cId);
		if (fac == null)
			throw new IllegalArgumentException();
		Component c = fac.createNewComponent();
		ec.set(cId, c);
		c.bind(entity);
		_componentMasks.get(eId).add(componentType);
		if (_msgEndpoint != null)
			_msgEndpoint.send(new ComponentAddedMessage(c));
		return c;
	}
public Component addComponent ( Entity entity , ComponentType componentType ) throws IllegalArgumentException , ComponentAlreadyExistsException { int eId = entity . getId ( ) ; IndexedCollection < Component > ec = _components . get ( eId ) ; if ( ec == null ) throw new IllegalArgumentException ( ) ; int cId = componentType . getId ( ) ; if ( ec . get ( cId ) != null ) throw new ComponentAlreadyExistsException ( ) ; ComponentFactory fac = _factories . get ( cId ) ; if ( fac == null ) throw new IllegalArgumentException ( ) ; Component c = fac . createNewComponent ( ) ; ec . set ( cId , c ) ; c . bind ( entity ) ; _componentMasks . get ( eId ) . add ( componentType ) ; if ( _msgEndpoint != null ) _msgEndpoint . send ( new ComponentAddedMessage ( c ) ) ; return c ; }
Adds a new {@link Component} of the specified type to the specified {@link Entity}.
Adds a new { @link Component } of the specified type to the specified { @link Entity } .
// try to get the list of all components for the specified entity
 // check if there is already a component of the same type
 // try to get the factory which constructs components of the specified type
