package net.transit.network.packet; import java.util.ArrayList; import net.transit.type.Type; public class ArrayPacket implements Packet { private ArrayList arrayData; private Type type; public ArrayPacket(D startValue, Type t) { arrayData = new ArrayList(0); arrayData.add(startValue); type = t; } @Override public D getData() { if(arrayData.size() > 0) return arrayData.get(0); return null; } public void addData(D data) { arrayData.add(data); } public int dataStored() { return arrayData.size(); } public D popAndShift() { D temp = null; if(arrayData.size() > 0) { temp = arrayData.remove(0); } return temp; } @Override public Type getType() { return type; } }