blob: 9cbd300d38509bbd7d3e823fb8cb7e695ff870fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package net.transit.network.packet;
import java.util.ArrayList;
import net.transit.type.Type;
public class ArrayPacket<D> implements IPacket<D>
{
private ArrayList<D> arrayData;
private Type<D> type;
public ArrayPacket(D startValue, Type<D> t)
{
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;
}
@Override
public Type<D> getType() {
return type;
}
}
|