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

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


      monitor.enterRead(); // ask permission to read

      String[] paths = index.queryDocumentNames(""); // all file names //$NON-NLS-1$
      int max = paths == null ? 0 : paths.length;
      final SimpleLookupTable indexedFileNames = new SimpleLookupTable(max == 0 ? 33 : max + 11);
      final String OK = "OK"; //$NON-NLS-1$
      final String DELETED = "DELETED"; //$NON-NLS-1$
      if (paths != null) {
        for (int i = 0; i < max; i++)
          indexedFileNames.put(paths[i], DELETED);
      }
      final long indexLastModified = max == 0 ? 0L : index.getIndexFile().lastModified();

      IWorkspaceRoot root = this.project.getWorkspace().getRoot();
      for (int i = 0; i < sourceEntriesNumber; i++) {
        if (this.isCancelled) return false;

        IClasspathEntry entry = sourceEntries[i];
        IResource sourceFolder = root.findMember(entry.getPath());
        if (sourceFolder != null) {

          // collect output locations if source is project (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=32041)
          final HashSet outputs = new HashSet();
          if (sourceFolder.getType() == IResource.PROJECT) {
            // Do not create marker while getting output location (see bug 41859)
            outputs.add(javaProject.getOutputLocation());
            for (int j = 0; j < sourceEntriesNumber; j++) {
              IPath output = sourceEntries[j].getOutputLocation();
              if (output != null) {
                outputs.add(output);
              }
            }
          }
          final boolean hasOutputs = !outputs.isEmpty();

          final char[][] inclusionPatterns = ((ClasspathEntry) entry).fullInclusionPatternChars();
          final char[][] exclusionPatterns = ((ClasspathEntry) entry).fullExclusionPatternChars();
          if (max == 0) {
            sourceFolder.accept(
              new IResourceProxyVisitor() {
                public boolean visit(IResourceProxy proxy) {
                  if (IndexAllProject.this.isCancelled) return false;
                  switch(proxy.getType()) {
                    case IResource.FILE :
                      if (org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(proxy.getName())) {
                        IFile file = (IFile) proxy.requestResource();
                        if (exclusionPatterns != null || inclusionPatterns != null)
                          if (Util.isExcluded(file, inclusionPatterns, exclusionPatterns))
                            return false;
                        indexedFileNames.put(Util.relativePath(file.getFullPath(), 1/*remove project segment*/), file);
                      }
                      return false;
                    case IResource.FOLDER :
                      if (exclusionPatterns != null && inclusionPatterns == null) {
                        // if there are inclusion patterns then we must walk the children
                        if (Util.isExcluded(proxy.requestFullPath(), inclusionPatterns, exclusionPatterns, true))
                            return false;
                      }
                      if (hasOutputs && outputs.contains(proxy.requestFullPath()))
                        return false;
                  }
                  return true;
                }
              },
              IResource.NONE
            );
          } else {
            sourceFolder.accept(
              new IResourceProxyVisitor() {
                public boolean visit(IResourceProxy proxy) throws CoreException {
                  if (IndexAllProject.this.isCancelled) return false;
                  switch(proxy.getType()) {
                    case IResource.FILE :
                      if (org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(proxy.getName())) {
                        IFile file = (IFile) proxy.requestResource();
                        URI location = file.getLocationURI();
                        if (location == null) return false;
                        if (exclusionPatterns != null || inclusionPatterns != null)
                          if (Util.isExcluded(file, inclusionPatterns, exclusionPatterns))
                            return false;
                        String relativePathString = Util.relativePath(file.getFullPath(), 1/*remove project segment*/);
                        indexedFileNames.put(relativePathString,
                          indexedFileNames.get(relativePathString) == null
                              || indexLastModified < EFS.getStore(location).fetchInfo().getLastModified()
                            ? (Object) file
                            : (Object) OK);
                      }
                      return false;
View Full Code Here


  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

    if (result == null)
      results.putUnsafely(word, new EntryResult(word, docs));
    else
      result.addDocumentTable(docs);
  } else {
    SimpleLookupTable docsToRefs = memoryIndex.docsToReferences;
    if (result == null) result = new EntryResult(word, null);
    int[] docNumbers = readDocumentNumbers(docs);
    for (int i = 0, l = docNumbers.length; i < l; i++) {
      String docName = readDocumentName(docNumbers[i]);
      if (!docsToRefs.containsKey(docName))
        result.addDocumentName(docName);
    }
    if (!result.isEmpty())
      results.put(word, result);
  }
View Full Code Here

   // assume write lock is held
  // compute & write out new docNames
  String[] docNames = readAllDocumentNames();
  int previousLength = docNames.length;
  int[] positions = new int[previousLength]; // keeps track of the position of each document in the new sorted docNames
  SimpleLookupTable indexedDocuments = new SimpleLookupTable(3); // for each new/changed document in the memoryIndex
  docNames = computeDocumentNames(docNames, positions, indexedDocuments, memoryIndex);
  if (docNames.length == 0) {
    if (previousLength == 0) return this; // nothing to do... memory index contained deleted documents that had never been saved

    // index is now empty since all the saved documents were removed
View Full Code Here

  }
  // map the additional source files by qualified type name
  if (additionalFiles == null) {
    this.additionalUnits = null;
  } else {
    this.additionalUnits = new SimpleLookupTable(additionalFiles.length);
    for (int i = 0, l = additionalFiles.length; i < l; i++) {
      SourceFile additionalUnit = additionalFiles[i];
      if (additionalUnit != null)
        this.additionalUnits.put(additionalUnit.initialTypeName, additionalFiles[i]);
    }
View Full Code Here

  }
  // map the additional source files by qualified type name
  if (additionalFiles == null) {
    this.additionalUnits = null;
  } else {
    this.additionalUnits = new SimpleLookupTable(additionalFiles.length);
    for (int i = 0, l = additionalFiles.length; i < l; i++) {
      SourceFile additionalUnit = additionalFiles[i];
      if (additionalUnit != null)
        this.additionalUnits.put(additionalUnit.initialTypeName, additionalFiles[i]);
    }
View Full Code Here

AccessRuleSet accessRuleSet;

ClasspathDirectory(IContainer binaryFolder, boolean isOutputFolder, AccessRuleSet accessRuleSet) {
  this.binaryFolder = binaryFolder;
  this.isOutputFolder = isOutputFolder || binaryFolder.getProjectRelativePath().isEmpty(); // if binaryFolder == project, then treat it as an outputFolder
  this.directoryCache = new SimpleLookupTable(5);
  this.accessRuleSet = accessRuleSet;
}
View Full Code Here

public boolean isPackage(String qualifiedPackageName) {
  return directoryList(qualifiedPackageName) != null;
}

public void reset() {
  this.directoryCache = new SimpleLookupTable(5);
}
View Full Code Here

  this.previousStructuralBuildTime = -1;
  this.structurallyChangedTypes = null;
  this.javaProjectName = javaBuilder.currentProject.getName();
  this.sourceLocations = javaBuilder.nameEnvironment.sourceLocations;
  this.binaryLocations = javaBuilder.nameEnvironment.binaryLocations;
  this.references = new SimpleLookupTable(7);
  this.typeLocators = new SimpleLookupTable(7);

  this.buildNumber = 0; // indicates a full build
  this.lastStructuralBuildTime = computeStructuralBuildTime(javaBuilder.lastState == null ? 0 : javaBuilder.lastState.lastStructuralBuildTime);
  this.structuralBuildTimes = new SimpleLookupTable(3);
}
View Full Code Here

  try {
    this.references = (SimpleLookupTable) lastState.references.clone();
    this.typeLocators = (SimpleLookupTable) lastState.typeLocators.clone();
  } catch (CloneNotSupportedException e) {
    this.references = new SimpleLookupTable(lastState.references.elementSize);
    Object[] keyTable = lastState.references.keyTable;
    Object[] valueTable = lastState.references.valueTable;
    for (int i = 0, l = keyTable.length; i < l; i++)
      if (keyTable[i] != null)
        this.references.put(keyTable[i], valueTable[i]);

    this.typeLocators = new SimpleLookupTable(lastState.typeLocators.elementSize);
    keyTable = lastState.typeLocators.keyTable;
    valueTable = lastState.typeLocators.valueTable;
    for (int i = 0, l = keyTable.length; i < l; i++)
      if (keyTable[i] != null)
        this.typeLocators.put(keyTable[i], valueTable[i]);
View Full Code Here

TOP

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

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.