@Override public IScanListIterator<IEntryCacheInfo> establishScan(K startPos,short relation,K endPos,boolean endPosInclusive,boolean ordered){
  ordered|=FORCE_ORDERED_SCAN;
  long startTime=_recentExtendedIndexUpdates != null ? System.currentTimeMillis() : 0;
  IScanListIterator<IEntryCacheInfo> res=ordered ? establishScanOrdered(startPos,relation,endPos,endPosInclusive) : establishScanUnOrdered(startPos,relation,endPos,endPosInclusive);
  if (_recentExtendedIndexUpdates != null && !_recentExtendedIndexUpdates.isEmpty()) {
    MultiStoredList<IEntryCacheInfo> msl=new MultiStoredList<IEntryCacheInfo>();
    msl.add(res);
    msl.add(_recentExtendedIndexUpdates.iterator(startTime,(ExtendedIndexIterator)res));
    return msl;
  }
 else   return res;
}

@ Override public IScanListIterator < IEntryCacheInfo > establishScan ( K startPos , short relation , K endPos , boolean endPosInclusive , boolean ordered ) { ordered |= FORCE_ORDERED_SCAN ; long startTime = _recentExtendedIndexUpdates != null ? System . currentTimeMillis ( ) : 0 ; IScanListIterator < IEntryCacheInfo > res = ordered ? establishScanOrdered ( startPos , relation , endPos , endPosInclusive ) : establishScanUnOrdered ( startPos , relation , endPos , endPosInclusive ) ; if ( _recentExtendedIndexUpdates != null && ! _recentExtendedIndexUpdates . isEmpty ( ) ) { MultiStoredList < IEntryCacheInfo > msl = new MultiStoredList < IEntryCacheInfo > ( ) ; msl . add ( res ) ; msl . add ( _recentExtendedIndexUpdates . iterator ( startTime , ( ExtendedIndexIterator ) res ) ) ; return msl ; } else return res ; }
establish a scan according to the relation given and startpos : the start - scan object , null means scan all values . the relation is from com . j_spaces . client . templatematchcodes : lt , le , gt , ge ( other codes are not relevant ) endpos - key up to ( or null if no limit in index ) endposinclusive : is the endpos up to ( or down to ) and including ? ordered - according to the condition . gt , ge = = > ascending , lt , le = = = = = > descending . returns an iorderedindexscan object which enables scanning the ordered index , null if no relevant elements to scan
