add isNodeConnected()
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 5 Apr 2008 16:08:22 +0000 (16:08 +0000)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 5 Apr 2008 16:08:22 +0000 (16:08 +0000)
git-svn-id: http://trooper/svn/projects/jSite/trunk@602 c3eda9e8-030b-0410-8277-bc7414b0a119

src/net/pterodactylus/jsite/core/Core.java

index 3f00678..c2072cb 100644 (file)
@@ -34,7 +34,10 @@ public class Core {
        private final List<CoreListener> coreListeners = new ArrayList<CoreListener>();
 
        /** The node list. */
-       private List<Node> nodeList = new ArrayList<Node>();
+       private List<Node> configuredNodes = new ArrayList<Node>();
+
+       /** List of currently connected nodes. */
+       private List<Node> connectedNodes = new ArrayList<Node>();
 
        /**
         * Creates a new core.
@@ -84,8 +87,20 @@ public class Core {
         * 
         * @return All configured nodes
         */
-       public List<Node> getNodeList() {
-               return nodeList;
+       public List<Node> getNodes() {
+               return configuredNodes;
+       }
+
+       /**
+        * Returns whether the core is currently connected to the given node.
+        * 
+        * @param node
+        *            The node to check
+        * @return <code>true</code> if the core is currently connected to the
+        *         node, <code>false</code> otherwise
+        */
+       public boolean isNodeConnected(Node node) {
+               return connectedNodes.contains(node);
        }
 
        //