Exemple #1
0
 @Override
 public ISignificantMacros getSignificantMacros() throws CoreException {
   if (sigMacros == null) {
     Database db = fLinkage.getDB();
     final IString encoded = db.getString(db.getRecPtr(record + SIGNIFICANT_MACROS));
     sigMacros =
         encoded == null ? ISignificantMacros.NONE : new SignificantMacros(encoded.getChars());
   }
   return sigMacros;
 }
Exemple #2
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 #3
0
 public PDOMFile(
     PDOMLinkage linkage, IIndexFileLocation location, int linkageID, ISignificantMacros macros)
     throws CoreException {
   fLinkage = linkage;
   this.location = location;
   Database db = fLinkage.getDB();
   record = db.malloc(RECORD_SIZE);
   String locationString = fLinkage.getPDOM().getLocationConverter().toInternalFormat(location);
   if (locationString == null)
     throw new CoreException(
         CCorePlugin.createStatus(
             Messages.getString("PDOMFile.toInternalProblem") + location.getURI())); // $NON-NLS-1$
   IString locationDBString = db.newString(locationString);
   db.putRecPtr(record + LOCATION_REPRESENTATION, locationDBString.getRecord());
   db.put3ByteUnsignedInt(record + LINKAGE_ID, linkageID);
   db.putRecPtr(record + SIGNIFICANT_MACROS, db.newString(macros.encode()).getRecord());
   setTimestamp(-1);
 }
Exemple #4
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;
 }
 private int compare(IString rhsName) throws CoreException {
   return rhsName.compareCompatibleWithIgnoreCase(fName);
 }