X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FCore.java;h=e6cad12fd02e05fd72553ada2634f0ffb98796a7;hb=4be8c6526b4e80d5b8f8df8598da128be766ced7;hp=3f0067868b286c0b15ef64a2ef19508229ebe108;hpb=b735dd79e051542c424419474798a006039b2cfc;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/Core.java b/src/net/pterodactylus/jsite/core/Core.java index 3f00678..e6cad12 100644 --- a/src/net/pterodactylus/jsite/core/Core.java +++ b/src/net/pterodactylus/jsite/core/Core.java @@ -19,93 +19,65 @@ package net.pterodactylus.jsite.core; -import java.util.ArrayList; import java.util.List; /** - * The core of jSite. - * + * Interface for the core. + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> * @version $Id$ */ -public class Core { - - /** The core listeners. */ - private final List coreListeners = new ArrayList(); - - /** The node list. */ - private List nodeList = new ArrayList(); - - /** - * Creates a new core. - */ - public Core() { - } - - // - // LISTENER MANAGEMENT - // +public interface Core { /** * Adds the given listener to the list of registered listeners. - * + * * @param coreListener * The listener to add */ - public void addCoreListener(CoreListener coreListener) { - coreListeners.add(coreListener); - } + public void addCoreListener(CoreListener coreListener); /** * Removes the given listener from the list of registered listeners. - * + * * @param coreListener * The listener to remove */ - public void removeCoreListener(CoreListener coreListener) { - coreListeners.remove(coreListener); - } - - /** - * Notifies all core listeners that the core has loaded and is ready to run. - */ - private void fireCoreLoaded() { - for (CoreListener coreListener: coreListeners) { - coreListener.coreLoaded(); - } - } - - // - // ACCESSORS - // + public void removeCoreListener(CoreListener coreListener); /** * Returns the list of all configured nodes. - * + * * @return All configured nodes */ - public List getNodeList() { - return nodeList; - } + public List getNodes(); - // - // ACTIONS - // + /** + * Returns whether the core is currently connected to the given node. + * + * @param node + * The node to check + * @return true if the core is currently connected to the + * node, false otherwise + */ + public boolean isNodeConnected(Node node); /** * Starts the core. */ - public void start() { - fireCoreLoaded(); - } + public void start(); + + /** + * Stops the core. + */ + public void stop(); /** * Connects to the given node. - * + * * @param node * The node to connect to */ - public void connectToNode(Node node) { - } + public void connectToNode(Node node); -} +} \ No newline at end of file