From df044930bca4252ff6e4814c654a612c6aee2136 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Wed, 20 Nov 2019 12:45:16 -0500 Subject: [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 --- .../java/net/transit/network/swap/IAcceptor.java | 31 ++++++++++++++++++ .../java/net/transit/network/swap/IProvider.java | 37 ++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 src/main/java/net/transit/network/swap/IAcceptor.java create mode 100644 src/main/java/net/transit/network/swap/IProvider.java (limited to 'src/main/java/net/transit/network/swap') diff --git a/src/main/java/net/transit/network/swap/IAcceptor.java b/src/main/java/net/transit/network/swap/IAcceptor.java new file mode 100644 index 0000000..6966b9a --- /dev/null +++ b/src/main/java/net/transit/network/swap/IAcceptor.java @@ -0,0 +1,31 @@ +package net.transit.network.swap; + +import net.transit.network.packet.IPacket; + +/** + * @author Kyle Gunger + * + * @param The type of data accepted (in IPacket<> form) + */ +public interface IAcceptor +{ + /** + * @return True if the acceptor can accept packets. + */ + public boolean canAccept(); + + /** + * @param provided The packet provided. + * @return True if the acceptor accepted the packet. + */ + public boolean accept(IPacket provided); + + /** + * @return True if the acceptor has a provider assigned to it. + */ + public boolean hasProvider(); + + /**Set the provider of the acceptor. The acceptor can decide if it wants to adopt the provider. + */ + public void setProvider(IProvider provider); +} \ No newline at end of file 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 The type of data provided (in IPacket<> form) + */ +public interface IProvider +{ + /** + * @return True if the provider can provide a packet. + */ + public boolean canProvide(); + + /**Get the next packet from the provider + * + * @return IPacket<> + */ + public IPacket provide(); + + /**Retain the packet if the acceptor did not accept the packet. + * + * @param rejected The rejected packet + */ + public void retain(IPacket rejected); + + /** + * @return True 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 -- cgit v1.2.3