import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/** class to store a leg of ownship data
 * 
 * @author ian
 *
 */
public class LegOfData
{
	final List<Long> _times = new ArrayList<Long>();
	
	final private String _myName;
	
	public LegOfData(final String name)
	{
		_myName = name;
	}
	public Long getEnd() {
		return _times.get(_times.size()-1);
	}
	public Long getStart() {
		return _times.get(0);
	}
	public String getName() {
		return _myName;
	}
	public void add(long time)
	{
		_times.add(time);
	}
	public int size()
	{
		return _times.size();
	}
	@Override
	public String toString()
	{
		SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
		return getName() + " " + sdf.format(new Date(_times.get(0))) + "-" + sdf.format(new Date(_times.get(_times.size()-1)));
	}
	
}
@@ -49,63 +49,12 @@
 til.
-ArrayList;%0Aimport java.util.Date;%0Aimport java.util.List
+Date
 ;%0A%0A%0A
@@ -150,55 +150,65 @@
 %0A%7B%0A%09
-final List%3CLong%3E _times = new ArrayList%3CLong%3E()
+long tStart = Long.MAX_VALUE;%0A%09long tEnd = Long.MIN_VALUE
 ;%0A%09%0A
@@ -314,59 +314,220 @@
 ic L
-ong getEnd() %7B%0A%09%09return _times.get(_times.size()-1)
+egOfData(String name, long tStart2, long tEnd2)%0A%09%7B%0A%09%09this(name);%0A%09%09tStart = tStart2;%0A%09%09tEnd = tEnd2;%0A%09%7D%0A%09public boolean initialised()%0A%09%7B%0A%09%09return tStart != Long.MAX_VALUE;%0A%09%7D%0A%09public Long getEnd() %7B%0A%09%09return tEnd
 ;%0A%09%7D
@@ -562,29 +562,22 @@
 %09return 
-_times.get(0)
+tStart
 ;%0A%09%7D%0A%09pu
@@ -658,72 +658,69 @@
 %7B%0A%09%09
-_times.add(time);%0A%09%7D%0A%09public int size()%0A%09%7B%0A%09%09return _times.size(
+tStart = Math.min(tStart, time);%0A%09%09tEnd = Math.max(tEnd, time
 );%0A%09
@@ -871,21 +871,14 @@
 ate(
-_times.get(0)
+tStart
 )) +
@@ -908,35 +908,12 @@
 ate(
-_times.get(_times.size()-1)
+tEnd
 ));%0A

simplify implementation