From 80fe25bcb811508a5fe826c37513a8a63239cb55 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sat, 19 Jun 2021 20:41:15 -0400 Subject: [Release] version 2.0.0 --- src/main/java/net/cshift/transit/network/Channel.java | 8 +++----- src/main/java/net/cshift/transit/network/INode.java | 9 ++++----- .../java/net/cshift/transit/network/PoolManifest.java | 16 ++++++++++------ 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/main/java/net/cshift/transit/network') diff --git a/src/main/java/net/cshift/transit/network/Channel.java b/src/main/java/net/cshift/transit/network/Channel.java index c7be552..e5c64da 100644 --- a/src/main/java/net/cshift/transit/network/Channel.java +++ b/src/main/java/net/cshift/transit/network/Channel.java @@ -109,12 +109,10 @@ public final class Channel { /** Send a packet to the recieving node * * @param packet the packet to send - * @return {@code true} if the recieving node accepts the packet + * @return The overflow data if the packet is only partially accepted. {@code null} otherwise. */ - public boolean send(IStaticPacket packet) + public IStaticPacket send(IStaticPacket packet) { - if(!this.isTerminated()) - return to.accept(packet, this); - return false; + return to.accept(packet, this); } } diff --git a/src/main/java/net/cshift/transit/network/INode.java b/src/main/java/net/cshift/transit/network/INode.java index 8f74dd6..7cbb1cc 100644 --- a/src/main/java/net/cshift/transit/network/INode.java +++ b/src/main/java/net/cshift/transit/network/INode.java @@ -8,14 +8,13 @@ import net.cshift.transit.network.packet.*; */ public interface INode { - /** Returns a channel manifest for the INode + /** Returns a pool manifest for the INode * */ public PoolManifest getManifest(); /** Get the system managing the node or {@code null} if there isn't one * - * @return System */ public ISystem getSystem(); @@ -28,7 +27,7 @@ public interface INode /** Call this function to establish a connection with a node. * * @param The type of connection being asked for - * @param group The group of connection being asked for + * @param poolID The ID of the pool the channel will interface with (see PoolManifest) * @param asker The asking node * @return A channel if the node accepts the request, {@code null} otherwise */ @@ -40,9 +39,9 @@ public interface INode * @param The type of the packet and channel * @param packet The packet to be vetted * @param channel The channel which the packet is coming through - * @return true if the node accepts the packet + * @return The overflow data if the packet is only partially accepted. {@code null} otherwise. */ - public boolean accept(IStaticPacket packet, Channel channel); + public IStaticPacket accept(IStaticPacket packet, Channel channel); /** Pressure * diff --git a/src/main/java/net/cshift/transit/network/PoolManifest.java b/src/main/java/net/cshift/transit/network/PoolManifest.java index d6bec43..e23d47f 100644 --- a/src/main/java/net/cshift/transit/network/PoolManifest.java +++ b/src/main/java/net/cshift/transit/network/PoolManifest.java @@ -2,35 +2,39 @@ package net.cshift.transit.network; /** * @author Kyle Gunger - * @apiNote A channel manifest represents a set of possible data/resource pools that another node can request a channel to. + * @apiNote A pool manifest represents a set of possible data/resource pools that another node can request a channel to. */ -public interface PoolManifest { +public abstract class PoolManifest { /** Represents the number of pools that the node has access to for the specified resource. * @apiNote A "pool" in this context represents an independant network of resources. * Pool zero should be the default group that simple nodes will attempt to connect to. * @param group The TypeGroup that the pool belongs to */ - public int poolCount(String group); + public abstract int poolCount(String group); /** The ID of the pool. The INode will use this in a connection attempt with the other INode. * * @param group The TypeGroup the pool belongs to * @param pool Array-like index for pool (gotten from poolCount) */ - public int poolID(String group, int pool); + public abstract int poolID(String group, int pool); /** If the mod supports named pools, the names can be querried through this function. * * @param group The TypeGroup the pool belongs to * @param pool Array-like index for pool (gotten from poolCount) */ - public String poolName(String group, int pool); + public String poolName(String group, int pool) { + return ""; + } /** If the mod supports pool descriptions, they can be accessed by this method. * * @param group The TypeGroup the pool belongs to * @param pool Array-like index for pool (gotten from poolCount) */ - public String poolDescription(String group, int pool); + public String poolDescription(String group, int pool) { + return ""; + } } -- cgit v1.2.3