Exemple #1
0
 @Override
 public int compare(long record) throws CoreException {
   IString name = db.getString(db.getRecPtr(record + PDOMFile.LOCATION_REPRESENTATION));
   int cmp = name.compare(rawKey, true);
   if (cmp == 0 && linkageID >= 0) {
     cmp = db.get3ByteUnsignedInt(record + PDOMFile.LINKAGE_ID) - linkageID;
     if (cmp == 0 && rawSignificantMacros != null) {
       IString significantMacrosStr = getString(record + SIGNIFICANT_MACROS);
       if (significantMacrosStr != null) {
         cmp = significantMacrosStr.compare(rawSignificantMacros, true);
       } else {
         cmp = rawSignificantMacros.length > 0 ? -1 : 0;
       }
     }
   }
   return cmp;
 }
Exemple #2
0
 @Override
 public int compare(long record1, long record2) throws CoreException {
   IString name1 = db.getString(db.getRecPtr(record1 + LOCATION_REPRESENTATION));
   IString name2 = db.getString(db.getRecPtr(record2 + LOCATION_REPRESENTATION));
   int cmp = name1.compare(name2, true);
   if (cmp == 0) {
     cmp =
         db.get3ByteUnsignedInt(record1 + LINKAGE_ID)
             - db.get3ByteUnsignedInt(record2 + LINKAGE_ID);
     if (cmp == 0) {
       IString sm1 = getString(record1 + SIGNIFICANT_MACROS);
       IString sm2 = getString(record2 + SIGNIFICANT_MACROS);
       if (sm1 == null) {
         cmp = sm2 == null ? 0 : -1;
       } else if (sm2 == null) {
         cmp = 1;
       } else {
         cmp = sm1.compare(sm2, true);
       }
     }
   }
   return cmp;
 }