edu.mit.ll.group43.surfaceoptimization.network.dp
Class Subsequence<T extends java.lang.Comparable<T>>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<T>
              extended by edu.mit.ll.group43.surfaceoptimization.network.dp.Subsequence<T>
Type Parameters:
T -
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Subsequence<T>>, java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>, java.util.RandomAccess

public class Subsequence<T extends java.lang.Comparable<T>>
extends java.util.ArrayList<T>
implements java.lang.Comparable<Subsequence<T>>

Represents a subsequence contained within a network node. Mostly used in an attempt to order how nodes are set in a network stage to minimize the number of unnecessary shifts that are made in an optimal sequence.

Author:
William Hawkins
See Also:
Serialized Form

Constructor Summary
Subsequence()
           
Subsequence(java.util.List<T> init)
           
 
Method Summary
 boolean add(T element)
          Only allows elements that are not already in the Subsequence to be added to it.
 int compareTo(Subsequence<T> s)
           
 T last()
          Returns the last element of this sequence.
 java.lang.String toString()
           
 
Methods inherited from class java.util.ArrayList
add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

Subsequence

public Subsequence()

Subsequence

public Subsequence(java.util.List<T> init)
Method Detail

add

public boolean add(T element)
Only allows elements that are not already in the Subsequence to be added to it.

Specified by:
add in interface java.util.Collection<T extends java.lang.Comparable<T>>
Specified by:
add in interface java.util.List<T extends java.lang.Comparable<T>>
Overrides:
add in class java.util.ArrayList<T extends java.lang.Comparable<T>>

last

public T last()
Returns the last element of this sequence.

Returns:

compareTo

public int compareTo(Subsequence<T> s)
Specified by:
compareTo in interface java.lang.Comparable<Subsequence<T extends java.lang.Comparable<T>>>

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection<T extends java.lang.Comparable<T>>