summaryrefslogtreecommitdiff
path: root/src/main/java/net/transit/network/system
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/transit/network/system')
-rw-r--r--src/main/java/net/transit/network/system/Node.java36
-rw-r--r--src/main/java/net/transit/network/system/swap/AcceptorNode.java31
-rw-r--r--src/main/java/net/transit/network/system/swap/ProviderNode.java20
3 files changed, 59 insertions, 28 deletions
diff --git a/src/main/java/net/transit/network/system/Node.java b/src/main/java/net/transit/network/system/Node.java
index 8e0fcbb..9e9ac10 100644
--- a/src/main/java/net/transit/network/system/Node.java
+++ b/src/main/java/net/transit/network/system/Node.java
@@ -1,50 +1,30 @@
package net.transit.network.system;
-import net.transit.network.swap.Acceptor;
-import net.transit.network.swap.Provider;
-
/**
* @author Kyle Gunger
* @apiNote A node inside or outside a system. Provides acceptors and providers to other nodes.
*/
public interface Node
{
- /**Returns the groupIDs of groups the node provide
+
+ /**Returns the groupIDs of groups the node interacts with
*
* @return String[]
*/
public String[] groupsProvided();
+
/**Get the system managing the node or {@code null} if there isn't one
*
- * @return ISystem
+ * @return System
*/
public System getSystem();
- /**Returns {@code true} if the node provides Acceptors
- *
- * @return boolean
- */
- public boolean isAcceptor();
-
- /**Returns an Acceptor or {@code null} depending on the requester and group
- *
- * @param requester The object requesting the Acceptor
- * @param group
- * @return Acceptor
- */
- public Acceptor<?> requestAcceptor(Object requester, String group);
-
- /**Returns {@code true} if the node provides Providers
- *
- */
- public boolean isProvider();
- /**Returns an Provider or {@code null} depending on the requester and group
+ /** Get the data of one of the TypeGroups the Node supports
*
- * @param requester The object requesting the Provider
- * @param group
- * @return Provider
+ * @param groupID
+ * @return
*/
- public Provider<?> requestProvider(Object requestor, String group);
+ public Object getData(String groupID);
}
diff --git a/src/main/java/net/transit/network/system/swap/AcceptorNode.java b/src/main/java/net/transit/network/system/swap/AcceptorNode.java
new file mode 100644
index 0000000..c583146
--- /dev/null
+++ b/src/main/java/net/transit/network/system/swap/AcceptorNode.java
@@ -0,0 +1,31 @@
+package net.transit.network.system.swap;
+
+import net.transit.network.packet.Packet;
+import net.transit.network.system.Node;
+
+public interface AcceptorNode extends Node
+{
+
+ /** Link another node as a provider
+ *
+ * @param requester The object to be a provider
+ * @param group
+ * @return Provider
+ */
+ public boolean linkProvider(Node requestor, String group);
+
+
+ /**
+ * @return Node[]
+ */
+ public Node[] getProviders();
+
+
+ /** Accept a packet from a provider
+ *
+ * @param packet
+ * @param group
+ * @return
+ */
+ public boolean accept(Packet<?> packet, String group);
+}
diff --git a/src/main/java/net/transit/network/system/swap/ProviderNode.java b/src/main/java/net/transit/network/system/swap/ProviderNode.java
new file mode 100644
index 0000000..4cd9dba
--- /dev/null
+++ b/src/main/java/net/transit/network/system/swap/ProviderNode.java
@@ -0,0 +1,20 @@
+package net.transit.network.system.swap;
+
+import net.transit.network.system.Node;
+
+public interface ProviderNode extends Node{
+
+ /** Link another node as an acceptor
+ *
+ * @param requester The object requesting the Acceptor
+ * @param group
+ * @return boolean
+ */
+ public boolean linkAcceptor(Node requester, String group);
+
+ /**
+ * @return Node[]
+ */
+ public Node[] getAcceptors();
+
+}