diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2019-11-19 11:40:07 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2019-11-19 11:40:07 -0500 |
commit | ebc33c58c8a3669822a0dba99cbfe8a451782813 (patch) | |
tree | 88e85586911af572bd21c01e98ad16a2c2cc4591 /src/main/java/net/transit/packet | |
parent | 42545b542a1814e66c257e77f5b566b65d48ccfd (diff) |
[Update] Publish changes to 0.0.3
Diffstat (limited to 'src/main/java/net/transit/packet')
-rw-r--r-- | src/main/java/net/transit/packet/ArrayPacket.java | 37 | ||||
-rw-r--r-- | src/main/java/net/transit/packet/IPacket.java | 6 | ||||
-rw-r--r-- | src/main/java/net/transit/packet/StaticPacket.java | 16 |
3 files changed, 59 insertions, 0 deletions
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<D> implements IPacket<D> +{ + private ArrayList<D> arrayData; + + public ArrayPacket(D startValue) + { + arrayData = new ArrayList<D>(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 diff --git a/src/main/java/net/transit/packet/IPacket.java b/src/main/java/net/transit/packet/IPacket.java new file mode 100644 index 0000000..2b1753b --- /dev/null +++ b/src/main/java/net/transit/packet/IPacket.java @@ -0,0 +1,6 @@ +package net.transit.packet; + +public interface IPacket<D> +{ + public D getData(); +}
\ No newline at end of file diff --git a/src/main/java/net/transit/packet/StaticPacket.java b/src/main/java/net/transit/packet/StaticPacket.java new file mode 100644 index 0000000..fb11dd7 --- /dev/null +++ b/src/main/java/net/transit/packet/StaticPacket.java @@ -0,0 +1,16 @@ +package net.transit.packet; + +public class StaticPacket<D> implements IPacket<D> +{ + private D data; + + public StaticPacket(D dat) + { + data = dat; + } + + public D getData() + { + return data; + } +}
\ No newline at end of file |