lrs.visitor
Class InsertInOrder<T>
java.lang.Object
   lrs.visitor.InsertInOrder<T>
lrs.visitor.InsertInOrder<T>
- All Implemented Interfaces: 
- IAlgo<T,LRStruct<T>,T>
- public class InsertInOrder<T> 
- extends java.lang.Object- implements IAlgo<T,LRStruct<T>,T>
Algorithm for inserting elements into an LRStruct in order.
| Field Summary | 
| private  java.util.Comparator<T> | _order
 | 
 
 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
_order
private java.util.Comparator<T> _order
InsertInOrder
public InsertInOrder(java.util.Comparator<T> ord)
emptyCase
public LRStruct<T> emptyCase(LRStruct<T> host,
                             T... n)
- Simply inserts the given parameter n at the front.
 
- 
- Specified by:
- emptyCasein interface- IAlgo<T,LRStruct<T>,T>
 
- 
- Parameters:
- host- an empty LRStruct.
- n- n[0] is an Object to be inserted in order into host,
   based on the given Comparator.
- Returns:
- LRStruct
 
nonEmptyCase
public LRStruct<T> nonEmptyCase(LRStruct<T> host,
                                T... n)
- Based on the comparison between first and n,
 inserts at the front or recurs!
 
- 
- Specified by:
- nonEmptyCasein interface- IAlgo<T,LRStruct<T>,T>
 
- 
- Parameters:
- host- a non-empty LRStruct.
- n- n[0] is an Object to be inserted in order into host,
   based on the given Comparator.
- Returns:
- LRStruct