| 1 package com.daffodilwoods.daffodildb.utils.comparator; 2 3 import com.daffodilwoods.daffodildb.utils.BufferRange; 4 import java.util.Comparator ; 5 import com.daffodilwoods.database.resource.DException; 6 import com.daffodilwoods.daffodildb.utils.field.FieldBase; 7 import com.daffodilwoods.daffodildb.utils._DComparator; 8 9 public abstract class SuperComparator { 10 11 protected boolean nullSortedHigh; 12 13 public SuperComparator(boolean nullSortedHigh0){ 14 nullSortedHigh = nullSortedHigh0; 15 } 16 17 public SuperComparator(){ 18 nullSortedHigh = true; 19 } 20 21 22 23 public int compare(FieldBase bf1,FieldBase bf2) throws DException{ 24 return compare(bf1.getBufferRange(),bf2.getBufferRange()); 25 } 26 27 public int compare(_DComparator o1, _DComparator o2) throws DException{ 28 throw new UnsupportedOperationException ("METHOD NOT IMPLEMENTED"); 29 } 30 31 public int compare(Object o1, Object o2) throws DException{ 32 _DComparator bf1 = (_DComparator)o1; 33 _DComparator bf2 = (_DComparator)o2; 34 return bf1.getNull() ? nullSortedHigh ? 2 : -2 35 : bf2.getNull() ? nullSortedHigh ? -2 : 2 : compare(bf1,bf2); 36 } 37 } 38 | Popular Tags |