Package org.eclipse.jdt.internal.compiler.util

Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet


  this.indexLocation = location;
}
SimpleSet addDocumentNames(String substring, MemoryIndex memoryIndex) throws IOException {
  // must skip over documents which have been added/changed/deleted in the memory index
  String[] docNames = readAllDocumentNames();
  SimpleSet results = new SimpleSet(docNames.length);
  if (substring == null) {
    if (memoryIndex == null) {
      for (int i = 0, l = docNames.length; i < l; i++)
        results.add(docNames[i]);
    } else {
      SimpleLookupTable docsToRefs = memoryIndex.docsToReferences;
      for (int i = 0, l = docNames.length; i < l; i++) {
        String docName = docNames[i];
        if (!docsToRefs.containsKey(docName))
          results.add(docName);
      }
    }
  } else {
    if (memoryIndex == null) {
      for (int i = 0, l = docNames.length; i < l; i++)
        if (docNames[i].startsWith(substring, 0))
          results.add(docNames[i]);
    } else {
      SimpleLookupTable docsToRefs = memoryIndex.docsToReferences;
      for (int i = 0, l = docNames.length; i < l; i++) {
        String docName = docNames[i];
        if (docName.startsWith(substring, 0) && !docsToRefs.containsKey(docName))
          results.add(docName);
      }
    }
  }
  return results;
}
View Full Code Here


      for (int i = 0, l = this.javaBuilder.participants.length; i < l; i++) {
        if (this.javaBuilder.participants[i].isAnnotationProcessor()) {
          // initialize this set so the builder knows to gather CUs that define Annotation types
          // each Annotation processor participant is then asked to process these files AFTER
          // the compile loop. The normal dependency loop will then recompile all affected types
          this.filesWithAnnotations = new SimpleSet(1);
          break;
        }
      }
    }
  }
View Full Code Here

  // and if so should we pass the generated files from the each processor to the others to process?
  // and what happens if some participants do not expect to be called with only a few files, after seeing 'all' the files?
  for (int i = 0, l = this.javaBuilder.participants.length; i < l; i++)
    this.javaBuilder.participants[i].buildStarting(results, this instanceof BatchImageBuilder);

  SimpleSet uniqueFiles = null;
  CompilationParticipantResult[] toAdd = null;
  int added = 0;
  for (int i = results.length; --i >= 0;) {
    CompilationParticipantResult result = results[i];
    if (result == null) continue;

    IFile[] deletedGeneratedFiles = result.deletedFiles;
    if (deletedGeneratedFiles != null)
      deleteGeneratedFiles(deletedGeneratedFiles);

    IFile[] addedGeneratedFiles = result.addedFiles;
    if (addedGeneratedFiles != null) {
      for (int j = addedGeneratedFiles.length; --j >= 0;) {
        SourceFile sourceFile = findSourceFile(addedGeneratedFiles[j], true);
        if (sourceFile == null) continue;
        if (uniqueFiles == null) {
          uniqueFiles = new SimpleSet(unitsAboutToCompile.length + 3);
          for (int f = unitsAboutToCompile.length; --f >= 0;)
            uniqueFiles.add(unitsAboutToCompile[f]);
        }
        if (uniqueFiles.addIfNotIncluded(sourceFile) == sourceFile) {
          CompilationParticipantResult newResult = new CompilationParticipantResult(sourceFile);
          // is there enough room to add all the addedGeneratedFiles.length ?
          if (toAdd == null) {
            toAdd = new CompilationParticipantResult[addedGeneratedFiles.length];
          } else {
View Full Code Here

}
/**
* Returns the document names that contain the given substring, if null then returns all of them.
*/
public String[] queryDocumentNames(String substring) throws IOException {
  SimpleSet results;
  if (this.memoryIndex.hasChanged()) {
    results = this.diskIndex.addDocumentNames(substring, this.memoryIndex);
    this.memoryIndex.addDocumentNames(substring, results);
  } else {
    results = this.diskIndex.addDocumentNames(substring, null);
View Full Code Here

  super.matchLevelAndReportImportRef(importRef, refBinding, locator);
}
protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException {
  if (this.isDeclarationOfReferencedTypesPattern) {
    if ((element = findElement(element, accuracy)) != null) {
      SimpleSet knownTypes = ((DeclarationOfReferencedTypesPattern) this.pattern).knownTypes;
      while (binding instanceof ReferenceBinding) {
        ReferenceBinding typeBinding = (ReferenceBinding) binding;
        reportDeclaration(typeBinding, 1, locator, knownTypes);
        binding = typeBinding.enclosingType();
      }
View Full Code Here

}
public void findIndexMatches(Index index, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope, IProgressMonitor progressMonitor) throws IOException {
  if (progressMonitor != null && progressMonitor.isCanceled()) throw new OperationCanceledException();

  resetQuery();
  SimpleSet intersectedNames = null;
  try {
    index.startQuery();
    do {
      SearchPattern pattern = currentPattern();
      EntryResult[] entries = pattern.queryIn(index);
      if (entries == null) return;

      SearchPattern decodedResult = pattern.getBlankPattern();
      SimpleSet newIntersectedNames = new SimpleSet(3);
      for (int i = 0, l = entries.length; i < l; i++) {
        if (progressMonitor != null && progressMonitor.isCanceled()) throw new OperationCanceledException();

        EntryResult entry = entries[i];
        decodedResult.decodeIndexKey(entry.getWord());
        if (pattern.matchesDecodedKey(decodedResult)) {
          String[] names = entry.getDocumentNames(index);
          if (intersectedNames != null) {
            for (int j = 0, n = names.length; j < n; j++)
              if (intersectedNames.includes(names[j]))
                newIntersectedNames.add(names[j]);
          } else {
            for (int j = 0, n = names.length; j < n; j++)
              newIntersectedNames.add(names[j]);
          }
        }
      }

      if (newIntersectedNames.elementSize == 0) return;
View Full Code Here

public DeclarationOfReferencedMethodsPattern(IJavaElement enclosingElement) {
  super(null, null, null, null, null, null, null, null, IJavaSearchConstants.REFERENCES, R_PATTERN_MATCH);

  this.enclosingElement = enclosingElement;
  this.knownMethods = new SimpleSet();
  this.mustResolve = true;
}
View Full Code Here

}
/*
* Removes unused indexes from disk.
*/
public void cleanUpIndexes() {
  SimpleSet knownPaths = new SimpleSet();
  IJavaSearchScope scope = BasicSearchEngine.createWorkspaceScope();
  PatternSearchJob job = new PatternSearchJob(null, SearchEngine.getDefaultSearchParticipant(), scope, null);
  Index[] selectedIndexes = job.getIndexes(null);
  for (int i = 0, l = selectedIndexes.length; i < l; i++) {
    IndexLocation IndexLocation = selectedIndexes[i].getIndexLocation();
    knownPaths.add(IndexLocation);
  }

  if (this.indexStates != null) {
    Object[] keys = this.indexStates.keyTable;
    IndexLocation[] locations = new IndexLocation[this.indexStates.elementSize];
    int count = 0;
    for (int i = 0, l = keys.length; i < l; i++) {
      IndexLocation key = (IndexLocation) keys[i];
      if (key != null && !knownPaths.includes(key))
        locations[count++] = key;
    }
    if (count > 0)
      removeIndexesState(locations);
  }
View Full Code Here

public DeclarationOfAccessedFieldsPattern(IJavaElement enclosingElement) {
  super(null, null, null, null, null, IJavaSearchConstants.REFERENCES, R_PATTERN_MATCH);

  this.enclosingElement = enclosingElement;
  this.knownFields = new SimpleSet();
  this.mustResolve = true;
}
View Full Code Here

public DeclarationOfReferencedTypesPattern(IJavaElement enclosingElement) {
  super(null, null, R_PATTERN_MATCH);

  this.enclosingElement = enclosingElement;
  this.knownTypes = new SimpleSet();
  this.mustResolve = true;
}
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.util.SimpleSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.