Example #1
0
 public static PDOMFile recreateFile(PDOM pdom, final long record) throws CoreException {
   final Database db = pdom.getDB();
   final int linkageID = db.get3ByteUnsignedInt(record + LINKAGE_ID);
   PDOMLinkage linkage = pdom.getLinkage(linkageID);
   if (linkage == null)
     throw new CoreException(createStatus("Invalid linkage ID in database")); // $NON-NLS-1$
   return new PDOMFile(linkage, record);
 }
Example #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;
 }
Example #3
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;
 }
Example #4
0
 @Override
 public int getLinkageID() throws CoreException {
   Database db = fLinkage.getDB();
   return db.get3ByteUnsignedInt(record + LINKAGE_ID);
 }