org.openuat.util
Class IntervalList

java.lang.Object
  extended by org.openuat.util.IntervalList

public class IntervalList
extends java.lang.Object

This class represents a list of time intervals (in milliseconds).

Version:
1.0
Author:
Lukas Huser

Constructor Summary
IntervalList()
          Creates an empty IntervalList.
 
Method Summary
 void add(int interval)
          Appends a new interval to the end of the list.
 void addFirst(int interval)
          Prepends a new interval to the beginning of the list.
 boolean equals(java.lang.Object obj)
           
 int getTotalIntervalLength()
          Returns the total length (sum) of all intervals in this list.
 int hashCode()
           
 int item(int i)
          Returns the interval at a given index.
 void remove(int i)
          Removes an interval from this list at a given index.
 int size()
          Returns the number intervals in this list.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntervalList

public IntervalList()
Creates an empty IntervalList.

Method Detail

add

public void add(int interval)
Appends a new interval to the end of the list. The inserted interval becomes the last interval in the list.

Parameters:
interval - A new interval which is appended to the list.

addFirst

public void addFirst(int interval)
Prepends a new interval to the beginning of the list. The inserted interval becomes the first interval in the list.

Parameters:
interval - A new interval which is prepended to the list.

item

public int item(int i)
Returns the interval at a given index.

Parameters:
i - index into the list
Returns:
interval at index i

remove

public void remove(int i)
Removes an interval from this list at a given index.

Parameters:
i - index into the list

size

public int size()
Returns the number intervals in this list.

Returns:
number of intervals

getTotalIntervalLength

public int getTotalIntervalLength()
Returns the total length (sum) of all intervals in this list.

Returns:
total interval length

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


2005-2009, Rene Mayrhofer.