Back to project page SmartCocktailShaker.
The source code is released under:
MIT License
If you think the Android project SmartCocktailShaker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.tonydicola.smartshaker.factories; /*from w w w. j a v a2s . c o m*/ import com.tonydicola.smartshaker.interfaces.ConnectionProvider; import com.tonydicola.smartshaker.interfaces.DeviceConnection; import java.util.ArrayList; import java.util.List; public enum ConnectionFactory { INSTANCE; private DeviceConnection connection = null; private ArrayList<ConnectionProvider> sources = new ArrayList<ConnectionProvider>(); public DeviceConnection getConnection() { return connection; } public void setConnection(DeviceConnection connection) { this.connection = connection; } public List<DeviceConnection> getConnections() { // Return a list of all connections from all sources. ArrayList<DeviceConnection> devices = new ArrayList<DeviceConnection>(); for (ConnectionProvider source : sources) { devices.addAll(source.getConnections()); } return devices; } public void addSource(ConnectionProvider source) { sources.add(source); } }