summaryrefslogtreecommitdiff
path: root/src/main/java/net/transit/network/packet
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-04-16 15:04:40 -0400
committerKyle Gunger <corechg@gmail.com>2020-04-16 15:04:40 -0400
commit5759e17941c537b7c73867d384cb9e22ce6f2b52 (patch)
tree1cb4cdb245ef9f0eefb85e31cd5514dc746973ce /src/main/java/net/transit/network/packet
parentbbfbb508919459d9885bd9d690c1c483e7e3f70b (diff)
[Update] Version 0.8.1
+ Change domain to an actual website.
Diffstat (limited to 'src/main/java/net/transit/network/packet')
-rw-r--r--src/main/java/net/transit/network/packet/ArrayPacket.java52
-rw-r--r--src/main/java/net/transit/network/packet/IStaticPacket.java23
-rw-r--r--src/main/java/net/transit/network/packet/MetaPacket.java35
-rw-r--r--src/main/java/net/transit/network/packet/Packet.java23
-rw-r--r--src/main/java/net/transit/network/packet/StaticPacket.java36
-rw-r--r--src/main/java/net/transit/network/packet/dynamic/ArrayPacket.java74
-rw-r--r--src/main/java/net/transit/network/packet/dynamic/DynamicPacket.java43
-rw-r--r--src/main/java/net/transit/network/packet/dynamic/IDynamicPacket.java16
-rw-r--r--src/main/java/net/transit/network/packet/dynamic/MetaDynamicPacket.java44
9 files changed, 0 insertions, 346 deletions
diff --git a/src/main/java/net/transit/network/packet/ArrayPacket.java b/src/main/java/net/transit/network/packet/ArrayPacket.java
deleted file mode 100644
index fbea811..0000000
--- a/src/main/java/net/transit/network/packet/ArrayPacket.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package net.transit.network.packet;
-
-import java.util.ArrayList;
-
-import net.transit.type.Type;
-
-public class ArrayPacket<D> implements Packet<D>
-{
- private ArrayList<D> arrayData;
- private Type<D> type;
-
- public ArrayPacket(D startValue, Type<D> t)
- {
- arrayData = new ArrayList<D>(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<D> getType() {
- return type;
- }
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/IStaticPacket.java b/src/main/java/net/transit/network/packet/IStaticPacket.java
deleted file mode 100644
index 01073d3..0000000
--- a/src/main/java/net/transit/network/packet/IStaticPacket.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.transit.network.packet;
-
-import net.transit.type.Type;
-
-/** Interface describing an unchanging packet.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers.
- */
-public interface IStaticPacket<D>
-{
- /**Get the packet's data.
- *
- * @return <D> The packet's data
- */
- public D getData();
-
- /**Get the packet's type.
- *
- * @return IType<<D>> The type of the packet
- */
- public Type<D> getType();
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/MetaPacket.java b/src/main/java/net/transit/network/packet/MetaPacket.java
deleted file mode 100644
index 7e49318..0000000
--- a/src/main/java/net/transit/network/packet/MetaPacket.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package net.transit.network.packet;
-
-import net.transit.type.Type;
-
-/** Static packet with extra data attached.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers
- * @param <M> The type of metadata
-*/
-public class MetaPacket<D, M> extends StaticPacket<D>
-{
- private M metaData;
-
- /** Constructor
- *
- * @param dat The data to store
- * @param t The Type of the data
- * @param meta The metadata to store
- */
- public MetaPacket(D dat, Type<D> t, M meta)
- {
- super(dat, t);
- metaData = meta;
- }
-
- /** Get the metadata of the packet.
- *
- * @return The packet's metadata
- */
- public M getMetaData()
- {
- return metaData;
- }
-}
diff --git a/src/main/java/net/transit/network/packet/Packet.java b/src/main/java/net/transit/network/packet/Packet.java
deleted file mode 100644
index 0b7c832..0000000
--- a/src/main/java/net/transit/network/packet/Packet.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.transit.network.packet;
-
-import net.transit.type.Type;
-
-/**
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers.
- */
-public interface Packet<D>
-{
- /**Get the packet's data
- *
- * @return <D> The packet's data
- */
- public D getData();
-
- /**Get the packet's type
- *
- * @return IType<<D>> The type of the packet
- */
- public Type<D> getType();
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/StaticPacket.java b/src/main/java/net/transit/network/packet/StaticPacket.java
deleted file mode 100644
index eeeae3f..0000000
--- a/src/main/java/net/transit/network/packet/StaticPacket.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package net.transit.network.packet;
-
-import net.transit.type.Type;
-
-/** Simple packet which stores an unchanging value.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers.
- */
-public class StaticPacket<D> implements IStaticPacket<D>
-{
- private D data;
- private Type<D> type;
-
- /** Constructor. Stores the given data and uses the given type.
- *
- * @param dat The packet's data
- * @param t The packet's type
- */
- public StaticPacket(D dat, Type<D> t)
- {
- data = dat;
- type = t;
- }
-
- @Override
- public D getData()
- {
- return data;
- }
-
- @Override
- public Type<D> getType() {
- return type;
- }
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/dynamic/ArrayPacket.java b/src/main/java/net/transit/network/packet/dynamic/ArrayPacket.java
deleted file mode 100644
index 0c27c80..0000000
--- a/src/main/java/net/transit/network/packet/dynamic/ArrayPacket.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package net.transit.network.packet.dynamic;
-
-import java.util.ArrayList;
-
-import net.transit.type.Type;
-
-/** A packet type which stores multiple values which can be accessed. When getting data, pop and shift from the array.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers
- */
-public class ArrayPacket<D> implements IDynamicPacket<D>
-{
- private ArrayList<D> arrayData;
- private Type<D> type;
-
- /** Constructor
- * Create an array packet. Adds the starting value.
- * @param startValue The starting value
- * @param t The type of the packet
- */
- public ArrayPacket(D startValue, Type<D> t)
- {
- arrayData = new ArrayList<D>(0);
- arrayData.add(startValue);
- type = t;
- }
-
- /**
- * Create an empty array packet of the desired type.
- * @param t The type of the packet
- */
- public ArrayPacket(Type<D> t)
- {
- arrayData = new ArrayList<D>(0);
- type = t;
- }
-
- /** Pop and shift data from the array.
- */
- @Override
- public D getData()
- {
- D temp = null;
-
- if(arrayData.size() > 0)
- {
- temp = arrayData.remove(0);
- }
-
- return temp;
- }
-
- /** Add data to the array.
- * @param data The data to push
- */
- public void setData(D data)
- {
- arrayData.add(data);
- }
-
- /**
- * @return The ammount of data the packet holds
- */
- public int dataStored()
- {
- return arrayData.size();
- }
-
- @Override
- public Type<D> getType() {
- return type;
- }
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/dynamic/DynamicPacket.java b/src/main/java/net/transit/network/packet/dynamic/DynamicPacket.java
deleted file mode 100644
index 0860487..0000000
--- a/src/main/java/net/transit/network/packet/dynamic/DynamicPacket.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.transit.network.packet.dynamic;
-
-import net.transit.type.Type;
-
-/**
- * Simple packet which stores a fluid value.
- *
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers
- */
-public class DynamicPacket<D> implements IDynamicPacket<D> {
- private D data;
- private Type<D> type;
-
- /** Constructor. Stores the given data and uses the given type.
- *
- * @param dat The packet's data
- * @param t The packet's type
- */
- public DynamicPacket(D dat, Type<D> t)
- {
- data = dat;
- type = t;
- }
-
- @Override
- public D getData()
- {
- return data;
- }
-
- @Override
- public void setData(D dat)
- {
- data = dat;
- }
-
- @Override
- public Type<D> getType() {
- return type;
- }
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/dynamic/IDynamicPacket.java b/src/main/java/net/transit/network/packet/dynamic/IDynamicPacket.java
deleted file mode 100644
index 51b3c13..0000000
--- a/src/main/java/net/transit/network/packet/dynamic/IDynamicPacket.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package net.transit.network.packet.dynamic;
-
-import net.transit.network.packet.IStaticPacket;
-
-/** Interface describing a fluid packet.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers
- */
-public interface IDynamicPacket<D> extends IStaticPacket<D>{
- /**Set the packet's data.
- *
- * @return <D> The packet's data
- */
- public void setData(D dat);
-} \ No newline at end of file
diff --git a/src/main/java/net/transit/network/packet/dynamic/MetaDynamicPacket.java b/src/main/java/net/transit/network/packet/dynamic/MetaDynamicPacket.java
deleted file mode 100644
index b6a3ec6..0000000
--- a/src/main/java/net/transit/network/packet/dynamic/MetaDynamicPacket.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package net.transit.network.packet.dynamic;
-
-import net.transit.type.Type;
-
-/** Static packet with extra data attached.
- * @author Kyle Gunger
- *
- * @param <D> The data type (Object) that the packet transfers
- * @param <M> The type of metadata
-*/
-public class MetaDynamicPacket<D, M> extends DynamicPacket<D>
-{
- private M metaData;
-
- /** Constructor
- *
- * @param dat The data to store
- * @param t The Type of the data
- * @param meta The metadata to store
- */
- public MetaDynamicPacket(D dat, Type<D> t, M meta)
- {
- super(dat, t);
- metaData = meta;
- }
-
- /** Get the metadata of the packet.
- *
- * @return The packet's metadata
- */
- public M getMetaData()
- {
- return metaData;
- }
-
- /** Set the metadata of the packet.
- *
- * @param meta The packet's new metadata
- */
- public void setMetaData(M meta)
- {
- metaData = meta;
- }
-}