sPFLib/src/main/java/it/polimi/spf/lib/SPF.java
@SuppressWarnings("unchecked")
	public synchronized <E> E getComponent(int code) {
		switch (code) {
		case REMOTE_PROFILE:
			if (spfRemoteProfile == null) {
				spfRemoteProfile = new SPFRemoteProfile(getContext(), this);
			}
			return (E) spfRemoteProfile;

		case SEARCH:
			if (spfSearch == null) {
				spfSearch = new SPFSearch(getContext(), this);
			}
			return (E) spfSearch;
		case SERVICE_EXECUTION:
			if (spfServiceExecutor == null) {
				spfServiceExecutor = new SPFServiceExecutor(getContext(), this);
			}
			return (E) spfServiceExecutor;
		default:
			throw new IllegalArgumentException("Component code " + code + " not found.");
		}
	}
@SuppressWarnings("unchecked")
	public synchronized <E> E getComponent(int code) {
		switch (code) {
		case REMOTE_PROFILE:
			if (spfRemoteProfile == null) {
				spfRemoteProfile = new SPFRemoteProfile(getContext(), this);
			}
			return (E) spfRemoteProfile;

		case SEARCH:
			if (spfSearch == null) {
				spfSearch = new SPFSearch(getContext(), this);
			}
			return (E) spfSearch;
		case SERVICE_EXECUTION:
			if (spfServiceExecutor == null) {
				spfServiceExecutor = new SPFServiceExecutor(getContext(), this);
			}
			return (E) spfServiceExecutor;
		default:
			throw new IllegalArgumentException("Component code " + code + " not found.");
		}
	}
@ SuppressWarnings ( "unchecked" ) public synchronized < E > E getComponent ( int code ) { switch ( code ) { case REMOTE_PROFILE : if ( spfRemoteProfile == null ) { spfRemoteProfile = new SPFRemoteProfile ( getContext ( ) , this ) ; } return ( E ) spfRemoteProfile ; case SEARCH : if ( spfSearch == null ) { spfSearch = new SPFSearch ( getContext ( ) , this ) ; } return ( E ) spfSearch ; case SERVICE_EXECUTION : if ( spfServiceExecutor == null ) { spfServiceExecutor = new SPFServiceExecutor ( getContext ( ) , this ) ; } return ( E ) spfServiceExecutor ; default : throw new IllegalArgumentException ( "Component code " + code + " not found." ) ; } }
Provides access to the different components of SPF. The components are
identified by static constants available in this class, and all share a
common superclass, {@link SPFComponent}; the instances returned vy this
method should be casted to the right class. Available services are:
<ul>
<li>{@link #SEARCH}: Searching of people in proximity. Returned
instance should be casted to {@link SPFSearch}</li>
<li>{@link #SERVICE_EXECUTION}: Execution of remote methods.
Returned instance should be casted to {@link SPFServiceExecutor}</li>
<li>{@link #REMOTE_PROFILE}: Retrieval of information from
remote profiles. Returned instances should be casted to
{@link SPFRemoteProfile}</li>
</ul>

@param code
@return
Provides access to the different components of SPF . The components are identified by static constants available in this class and all share a common superclass { @link SPFComponent } ; the instances returned vy this method should be casted to the right class . Available services are : <ul > <li > { @link #SEARCH } : Searching of people in proximity . Returned instance should be casted to { @link SPFSearch } < / li > <li > { @link #SERVICE_EXECUTION } : Execution of remote methods . Returned instance should be casted to { @link SPFServiceExecutor } < / li > <li > { @link #REMOTE_PROFILE } : Retrieval of information from remote profiles . Returned instances should be casted to { @link SPFRemoteProfile } < / li > < / ul >