summaryrefslogtreecommitdiff
path: root/src/main/java/net/transit/network/packet
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/transit/network/packet')
-rw-r--r--src/main/java/net/transit/network/packet/ArrayPacket.java11
-rw-r--r--src/main/java/net/transit/network/packet/MetaPacket.java2
-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.java2
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;