inpro.incremental.unit
Class IUList<IUType extends IU>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<IUType>
              extended by inpro.incremental.unit.IUList<IUType>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<IUType>, java.util.Collection<IUType>, java.util.List<IUType>, java.util.RandomAccess

public class IUList<IUType extends IU>
extends java.util.ArrayList<IUType>

See Also:
Serialized Form

Field Summary
(package private)  IUType firstIU
           
private static org.apache.log4j.Logger logger
           
private  boolean temporallySorted
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
IUList()
           
IUList(IUType firstIU)
           
IUList(java.util.List<IUType> base)
           
 
Method Summary
 void add(IUType e, boolean deepSLL)
          adds an element and connects its same-level link, if that's not yet set.
 void apply(EditMessage<IUType> edit)
           
 void apply(java.util.List<EditMessage<IUType>> edits)
           
private  java.util.List<EditMessage<IUType>> calculateDiff(java.util.List<IUType> other, boolean relaxedEquality)
           
 void clear()
           
 void connectSLLs()
          connect the IUs in the list via their SLLs.
 java.util.List<EditMessage<IUType>> diff(java.util.List<IUType> other)
          Calculate the difference (in edits) between an other and this list.
 java.util.List<EditMessage<IUType>> diffByPayload(java.util.List<IUType> other)
          similar in spirit to diff, this method allows differences in IU identity, but not in IU payload
 IUType getLast()
           
 boolean isTemporallySorted()
          Checks if IUs in this list are in strict linear temporal order.
 void sortTemporally(boolean sort)
          Enforces that IUs in this list be in strict linear temporal order or not.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, 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, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

logger

private static final org.apache.log4j.Logger logger

temporallySorted

private boolean temporallySorted

firstIU

IUType extends IU firstIU
Constructor Detail

IUList

public IUList()

IUList

public IUList(java.util.List<IUType> base)

IUList

public IUList(IUType firstIU)
Method Detail

apply

public void apply(EditMessage<IUType> edit)

apply

public void apply(java.util.List<EditMessage<IUType>> edits)

calculateDiff

private java.util.List<EditMessage<IUType>> calculateDiff(java.util.List<IUType> other,
                                                          boolean relaxedEquality)

diff

public java.util.List<EditMessage<IUType>> diff(java.util.List<IUType> other)
Calculate the difference (in edits) between an other and this list. return the edits that are necessary to turn this list into the other list. the following holds: other.equals(this.apply(this.diff(other))); (except that apply does not return a value but changes its argument...)

Parameters:
other - the reference list
Returns:
returns the list of edits that have to be applied to this

diffByPayload

public java.util.List<EditMessage<IUType>> diffByPayload(java.util.List<IUType> other)
similar in spirit to diff, this method allows differences in IU identity, but not in IU payload


add

public void add(IUType e,
                boolean deepSLL)
adds an element and connects its same-level link, if that's not yet set.

Parameters:
e - the element to add to the list
deepSLL - determines whether same-level links should be set only on the element, or also on unconnected IUs in the grounded-in hierarchy.

getLast

public IUType getLast()

clear

public void clear()
Specified by:
clear in interface java.util.Collection<IUType extends IU>
Specified by:
clear in interface java.util.List<IUType extends IU>
Overrides:
clear in class java.util.ArrayList<IUType extends IU>

isTemporallySorted

public boolean isTemporallySorted()
Checks if IUs in this list are in strict linear temporal order.

Returns:
true if so, false if not

sortTemporally

public void sortTemporally(boolean sort)
Enforces that IUs in this list be in strict linear temporal order or not.

Parameters:
sort - whether to assert temporal sorting of this list or not.

connectSLLs

public void connectSLLs()
connect the IUs in the list via their SLLs. any older SLL asignment will be overwritten