diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2019-11-21 18:35:14 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2019-11-21 18:35:14 -0500 |
commit | d08cbf6b8705df234077c49608de3c2f7ff0e3fa (patch) | |
tree | 6e8705d65e4e0f0c1cafe9736980504b5b6f9cde /src/main/java/net/transit/network/packet | |
parent | df044930bca4252ff6e4814c654a612c6aee2136 (diff) |
[Update] Codebase updated to 0.2.8
~ Rewrote files and documentation for cohesion
~ Removed I from the start of interface names
Diffstat (limited to 'src/main/java/net/transit/network/packet')
-rw-r--r-- | src/main/java/net/transit/network/packet/ArrayPacket.java | 11 | ||||
-rw-r--r-- | src/main/java/net/transit/network/packet/MetaPacket.java | 2 | ||||
-rw-r--r-- | src/main/java/net/transit/network/packet/Packet.java (renamed from src/main/java/net/transit/network/packet/IPacket.java) | 2 | ||||
-rw-r--r-- | src/main/java/net/transit/network/packet/StaticPacket.java | 2 |
4 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/net/transit/network/packet/ArrayPacket.java b/src/main/java/net/transit/network/packet/ArrayPacket.java index 9cbd300..fbea811 100644 --- a/src/main/java/net/transit/network/packet/ArrayPacket.java +++ b/src/main/java/net/transit/network/packet/ArrayPacket.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import net.transit.type.Type; -public class ArrayPacket<D> implements IPacket<D> +public class ArrayPacket<D> implements Packet<D> { private ArrayList<D> arrayData; private Type<D> type; @@ -13,8 +13,10 @@ public class ArrayPacket<D> implements IPacket<D> { arrayData = new ArrayList<D>(0); arrayData.add(startValue); + type = t; } - + + @Override public D getData() { if(arrayData.size() > 0) return arrayData.get(0); @@ -25,6 +27,11 @@ public class ArrayPacket<D> implements IPacket<D> { arrayData.add(data); } + + public int dataStored() + { + return arrayData.size(); + } public D popAndShift() { diff --git a/src/main/java/net/transit/network/packet/MetaPacket.java b/src/main/java/net/transit/network/packet/MetaPacket.java index e4cffdf..0240519 100644 --- a/src/main/java/net/transit/network/packet/MetaPacket.java +++ b/src/main/java/net/transit/network/packet/MetaPacket.java @@ -2,7 +2,7 @@ package net.transit.network.packet; import net.transit.type.Type; -public class MetaPacket<D, M> implements IPacket<D> +public class MetaPacket<D, M> implements Packet<D> { private D data; diff --git a/src/main/java/net/transit/network/packet/IPacket.java b/src/main/java/net/transit/network/packet/Packet.java index deafdf8..0b7c832 100644 --- a/src/main/java/net/transit/network/packet/IPacket.java +++ b/src/main/java/net/transit/network/packet/Packet.java @@ -7,7 +7,7 @@ import net.transit.type.Type; * * @param <D> The data type (Object) that the packet transfers. */ -public interface IPacket<D> +public interface Packet<D> { /**Get the packet's data * diff --git a/src/main/java/net/transit/network/packet/StaticPacket.java b/src/main/java/net/transit/network/packet/StaticPacket.java index 8399041..b14e442 100644 --- a/src/main/java/net/transit/network/packet/StaticPacket.java +++ b/src/main/java/net/transit/network/packet/StaticPacket.java @@ -2,7 +2,7 @@ package net.transit.network.packet; import net.transit.type.Type; -public class StaticPacket<D> implements IPacket<D> +public class StaticPacket<D> implements Packet<D> { private D data; private Type<D> type; |