package br.ufrj.cos.redes.fileAccess;

import java.io.Serializable;

public class Chunk implements Comparable<Chunk>, Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private long seqNum;
	private byte[] bytes;
	private int actualChunkLength;
	private boolean available;
	private long transTimeStamp;
	private long recTimeStamp;
	private long playedTimeStamp;
	
	

	public Chunk(int chunkLength) {
		bytes = new byte[chunkLength];
	}
	
	public Chunk(int chunkLength, boolean available) {
		bytes = new byte[chunkLength];
		this.available = available;
	}
	
	public long getSeqNum() {
		return seqNum;
	}
	public void setSeqNum(long seqNum) {
		this.seqNum = seqNum;
	}
	public byte[] getBytes() {
		return bytes;
	}

	public int getActualChunkLength() {
		return actualChunkLength;
	}

	public void setActualChunkLength(int actualChunkLength) {
		this.actualChunkLength = actualChunkLength;
	}

	@Override
	public int compareTo(Chunk otherChunk) {
		if (this.seqNum < otherChunk.getSeqNum()) {
			return -1;
		} else if (this.seqNum > otherChunk.getSeqNum()) {
			return 1;
		} else {
			return 0;
		}
	}
	
	public boolean isAvailable() {
		return available;
	}
	
	public void setAvailable(boolean available) {
		this.available = available;
	}
	
	public long getTransTimeStamp() {
		return transTimeStamp;
	}
	
	public void setTransTimeStamp(long transTimeStamp) {
		this.transTimeStamp = transTimeStamp;
	}
	
	public long getRecTimeStamp() {
		return recTimeStamp;
	}
	
	public void setRecTimeStamp(long recTimeStamp) {
		this.recTimeStamp = recTimeStamp;
	}
	
	public long getPlayedTimeStamp() {
		return playedTimeStamp;
	}
	
	public void setPlayedTimeStamp(long playedTimeStamp) {
		this.playedTimeStamp = playedTimeStamp;
	}
}


@@ -62,16 +62,113 @@
 zable;%0A%0A
+import br.ufrj.cos.redes.timeInfo.LatencyInfo;%0Aimport br.ufrj.cos.redes.timeInfo.TimestampInfo;%0A%0A
 public c
@@ -393,16 +393,18 @@
 ilable;%0A
+%09%0A
 %09private
@@ -404,35 +404,39 @@
 private 
-long transTimeStamp
+LatencyInfo latencyInfo
 ;%0A%09priva
@@ -442,60 +442,36 @@
 ate 
-long rec
 Time
-S
+s
 tamp
-;%0A%09private long playedTimeS
+Info times
 tamp
-;%0A%09%0A
+Info;
 %09%0A%0A%09
@@ -504,33 +504,21 @@
 th) %7B%0A%09%09
-bytes = new byte%5B
+this(
 chunkLen
@@ -520,17 +520,24 @@
 nkLength
-%5D
+, false)
 ;%0A%09%7D%0A%09%0A%09
@@ -642,32 +642,109 @@
 le = available;%0A
+%09%09%0A%09%09latencyInfo = new LatencyInfo();%0A%09%09timestampInfo = new TimestampInfo();%0A
 %09%7D%0A%09%0A%09public lon
@@ -1411,33 +1411,32 @@
 = available;%0A%09%7D%0A
-%09
 %0A%09public long ge
@@ -1432,64 +1432,64 @@
 lic 
-long getTransTimeStamp() %7B%0A%09%09return transTimeStamp
+LatencyInfo getLatencyInfo() %7B%0A%09%09return latencyInfo
 ;%0A%09%7D%0A
-%09
 %0A%09pu
@@ -1505,90 +1505,84 @@
  set
-TransTimeStamp(long transTimeStamp) %7B%0A%09%09this.transTimeStamp = transTimeStamp
+LatencyInfo(LatencyInfo latencyInfo) %7B%0A%09%09this.latencyInfo = latencyInfo
 ;%0A%09%7D%0A
-%09
 %0A%09pu
@@ -1590,28 +1590,38 @@
 lic 
-long
+TimestampInfo
  get
-Rec
 Time
-S
+s
 tamp
+Info
 () %7B
@@ -1630,34 +1630,34 @@
 %09return 
-recTimeS
+times
 tamp
+Info
 ;%0A%09%7D%0A
-%09
 %0A%09public
@@ -1669,202 +1669,49 @@
  set
-Rec
 Time
-Stamp(long recTimeStamp) %7B%0A%09%09this.recTimeStamp = recTimeStamp;%0A%09%7D%0A%09%0A%09public long getPlayedTimeStamp() %7B%0A%09%09return played
+stampInfo(
 Time
-S
+s
 tamp
-;%0A%09%7D%0A%09%0A%09public void setPlayedTimeStamp(long playedTimeStamp
+Info timestamoInfo
 ) %7B%0A
@@ -1721,41 +1721,37 @@
 his.
-playedTimeS
+times
 tamp
- = playedTimeStamp
+Info = timestamoInfo
 ;%0A%09%7D

add TimestampInfo and LatencyInfo dependencies