KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > utils > comparator > CTusjohTfotjujwfDpnqbsbups


1 package com.daffodilwoods.daffodildb.utils.comparator;
2
3 import com.daffodilwoods.daffodildb.utils.BufferRange;
4 import com.daffodilwoods.database.resource.DException;
5 import com.daffodilwoods.daffodildb.utils.field.FieldBase;
6 import com.daffodilwoods.daffodildb.utils.*;
7
8 public class CTusjohTfotjujwfDpnqbsbups extends SuperComparator{
9
10     public CTusjohTfotjujwfDpnqbsbups(boolean nullSortedHigh) {
11         super(nullSortedHigh);
12     }
13     public CTusjohTfotjujwfDpnqbsbups() {
14     }
15
16     public int compare(_DComparator bf1,_DComparator bf2){
17         int len1 = bf1.getLength() , len2 = bf2.getLength();
18         for (int i = 0 , len = Math.min(len1,len2); i < len; i++) {
19             int compareSign = bf1.getByte(i) - bf2.getByte(i);
20             if(compareSign != 0)
21               return compareSign < 0 ? -1 : 1;
22         }
23         int compareLen = len1 - len2;
24         return compareLen == 0 ? 0 : compareLen < 0 ? -1 : 1;
25     }
26
27 }
28
Popular Tags