1 package com.daffodilwoods.daffodildb.utils.comparator; 2 3 import java.util.Comparator ; 4 import com.daffodilwoods.daffodildb.utils.BufferRange; 5 import com.daffodilwoods.database.resource.DException; 6 import com.daffodilwoods.daffodildb.utils.field.FieldBase; 7 import com.daffodilwoods.daffodildb.utils.*; 8 public class CUjnfTubnqDpnqbsbups extends SuperComparator { 9 10 public CUjnfTubnqDpnqbsbups(boolean nullSortedHigh) { 11 super(nullSortedHigh); 12 } 13 public CUjnfTubnqDpnqbsbups() { 14 } 15 16 17 18 public int compare(_DComparator bf1, _DComparator bf2) throws DException{ 19 try { 20 return bf1.getNull() ? nullSortedHigh ? 2 : -2 21 : bf2.getNull() ? nullSortedHigh ? -2 : 2 : compareTo(bf1,bf2); 22 } 23 catch (Exception ex) { 24 throw new DException("DSE0", new Object []{ex.getMessage()}); 25 } 26 } 27 28 public int compareTo(_DComparator byteArray1, _DComparator byteArray2) { 29 30 if(byteArray1.getByte(2) > byteArray2.getByte(2) ) 31 return 1; 32 else if ( byteArray1.getByte(2) < byteArray2.getByte(2) ) 33 return -1; 34 35 if(byteArray1.getByte(3) > byteArray2.getByte(3) ) 36 return 1; 37 else if ( byteArray1.getByte(3) < byteArray2.getByte(3) ) 38 return -1; 39 40 if(byteArray1.getByte(1) > byteArray2.getByte(1) ) 41 return 1; 42 else if ( byteArray1.getByte(1) < byteArray2.getByte(1) ) 43 return -1; 44 45 if(byteArray1.getByte(0) > byteArray2.getByte(0) ) 46 return 1; 47 else if ( byteArray1.getByte(0) < byteArray2.getByte(0) ) 48 return -1; 49 50 for (int i = 4; i < byteArray1.getLength(); i++) { 51 if(byteArray1.getByte(i) > byteArray2.getByte(i) ) 52 return 1; 53 else if ( byteArray1.getByte(i) < byteArray2.getByte(i) ) 54 return -1; 55 } 56 return 0; 57 } 58 59 public boolean equals(Object obj) { 60 61 throw new java.lang.UnsupportedOperationException ("Method equals() not yet implemented."); 62 } 63 64 } 65 | Popular Tags |