summaryrefslogtreecommitdiff
path: root/src/main/java/net/transit/network/swap/IProvider.java
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2019-11-20 12:45:16 -0500
committerKyle Gunger <kgunger12@gmail.com>2019-11-20 12:45:16 -0500
commitdf044930bca4252ff6e4814c654a612c6aee2136 (patch)
tree906eddbbfdecb63e3525657cd4e6f75c8ba91bc3 /src/main/java/net/transit/network/swap/IProvider.java
parentebc33c58c8a3669822a0dba99cbfe8a451782813 (diff)
[0.1.7 REWRITE] Codebase overhaul.
~ Codebase split into two sub-packages ~ net.transit.network for transfering between objects ~ net.transit.type for type registering and conversion + Added new interfaces (INode and ISystem) + More documentation + (Kinda) Working build - Removed unnessairy interfaces (IGenerator and IConsumer) - Removed base types ~ Restructured type system
Diffstat (limited to 'src/main/java/net/transit/network/swap/IProvider.java')
-rw-r--r--src/main/java/net/transit/network/swap/IProvider.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/net/transit/network/swap/IProvider.java b/src/main/java/net/transit/network/swap/IProvider.java
new file mode 100644
index 0000000..03c9ca9
--- /dev/null
+++ b/src/main/java/net/transit/network/swap/IProvider.java
@@ -0,0 +1,37 @@
+package net.transit.network.swap;
+
+import net.transit.network.packet.IPacket;
+
+/**
+ * @author Kyle Gunger
+ *
+ * @param <T> The type of data provided (in IPacket<<T>> form)
+ */
+public interface IProvider<T>
+{
+ /**
+ * @return <b>True</b> if the provider can provide a packet.
+ */
+ public boolean canProvide();
+
+ /**Get the next packet from the provider
+ *
+ * @return IPacket<<T>>
+ */
+ public IPacket<T> provide();
+
+ /**Retain the packet if the acceptor did not accept the packet.
+ *
+ * @param rejected The rejected packet
+ */
+ public void retain(IPacket<T> rejected);
+
+ /**
+ * @return <b>True</b> if the acceptor has a provider assigned to it
+ */
+ public boolean hasAcceptor();
+
+ /**Set the acceptor of the provider. The provider can decide if it wants to adopt the acceptor.
+ */
+ public void setAcceptor();
+} \ No newline at end of file