From ebc33c58c8a3669822a0dba99cbfe8a451782813 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Tue, 19 Nov 2019 11:40:07 -0500 Subject: [Update] Publish changes to 0.0.3 --- src/main/java/net/transit/packet/ArrayPacket.java | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/main/java/net/transit/packet/ArrayPacket.java (limited to 'src/main/java/net/transit/packet/ArrayPacket.java') diff --git a/src/main/java/net/transit/packet/ArrayPacket.java b/src/main/java/net/transit/packet/ArrayPacket.java new file mode 100644 index 0000000..09ef5f1 --- /dev/null +++ b/src/main/java/net/transit/packet/ArrayPacket.java @@ -0,0 +1,37 @@ +package net.transit.packet; + +import java.util.ArrayList; + +public class ArrayPacket implements IPacket +{ + private ArrayList arrayData; + + public ArrayPacket(D startValue) + { + arrayData = new ArrayList(0); + arrayData.add(startValue); + } + + public D getData() + { + if(arrayData.size() > 0) return arrayData.get(0); + return null; + } + + public void addData(D data) + { + arrayData.add(data); + } + + public D popAndShift() + { + D temp = null; + + if(arrayData.size() > 0) + { + temp = arrayData.remove(0); + } + + return temp; + } +} \ No newline at end of file -- cgit v1.2.3