|
1 | 1 | package network;
|
2 | 2 |
|
| 3 | +import java.util.Stack; |
| 4 | +import java.util.UUID; |
| 5 | + |
| 6 | +/** |
| 7 | + * An object that describes a packet that can be send between |
| 8 | + * <code>{@link Routable}</code> objects. |
| 9 | + * |
| 10 | + * @author Ahmet Uysal @ahmetuysal |
| 11 | + * |
| 12 | + */ |
3 | 13 | public class Packet {
|
4 | 14 |
|
5 |
| - //TODO Implement. |
6 |
| - |
| 15 | + /** |
| 16 | + * Universally unique identifier of the requested service. |
| 17 | + */ |
| 18 | + private UUID sid; |
| 19 | + |
| 20 | + /** |
| 21 | + * Universally unique identifier of the packet source <code>Routable</code>. |
| 22 | + */ |
| 23 | + private UUID sourceId; |
| 24 | + |
| 25 | + /** |
| 26 | + * Stack of <code>UUID</code> that represents <code>Route</code> objects that |
| 27 | + * this packet traveled through. |
| 28 | + */ |
| 29 | + private Stack<UUID> pidStack; |
| 30 | + |
| 31 | + /** |
| 32 | + * @param _sid Universally unique identifier of the requested service. |
| 33 | + * @param _sourceId Universally unique identifier of the packet source |
| 34 | + * <code>Routable</code>. |
| 35 | + * @param _pidStack Stack of <code>UUID</code> that represents |
| 36 | + * <code>Route</code> objects that this packet traveled |
| 37 | + * through. |
| 38 | + */ |
| 39 | + public Packet(UUID _sid, UUID _sourceId, Stack<UUID> _pidStack) { |
| 40 | + this.sid = _sid; |
| 41 | + this.sourceId = _sourceId; |
| 42 | + this.pidStack = _pidStack; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * @return the universally unique identifier of the requested service of this |
| 47 | + * <code>Packet</code>. |
| 48 | + */ |
| 49 | + public UUID getSid() { |
| 50 | + return this.sid; |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * @param _sid the universally unique identifier of the requested service of |
| 55 | + * this <code>Packet</code> to set. |
| 56 | + */ |
| 57 | + public void setSid(UUID _sid) { |
| 58 | + this.sid = _sid; |
| 59 | + } |
| 60 | + |
| 61 | + /** |
| 62 | + * @return Universally unique identifier of the packet source |
| 63 | + * <code>Routable</code>. |
| 64 | + */ |
| 65 | + public UUID getSourceId() { |
| 66 | + return this.sourceId; |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * @param _sourceId Universally unique identifier of the packet source |
| 71 | + * <code>Routable</code> to set. |
| 72 | + */ |
| 73 | + public void setSourceId(UUID _sourceId) { |
| 74 | + this.sourceId = _sourceId; |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * @return Stack of <code>UUID</code> that represents <code>Route</code> objects |
| 79 | + * that this packet traveled through. |
| 80 | + */ |
| 81 | + public Stack<UUID> getPidStack() { |
| 82 | + return this.pidStack; |
| 83 | + } |
| 84 | + |
| 85 | + /** |
| 86 | + * @param _pidStack Stack of <code>UUID</code> that represents |
| 87 | + * <code>Route</code> objects that this packet traveled through |
| 88 | + * to set. |
| 89 | + */ |
| 90 | + public void setPidStack(Stack<UUID> _pidStack) { |
| 91 | + this.pidStack = _pidStack; |
| 92 | + } |
| 93 | + |
7 | 94 | }
|
0 commit comments