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

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


    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


    throw new IOException("Pre-built index file not writeable")//$NON-NLS-1$
  }
  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

  char[][] fullExclusionPatternChars;
  char[][] fulInclusionPatternChars;

ClasspathSourceDirectory(IContainer sourceFolder, char[][] fullExclusionPatternChars, char[][] fulInclusionPatternChars) {
  this.sourceFolder = sourceFolder;
  this.directoryCache = new SimpleLookupTable(5);
  this.fullExclusionPatternChars = fullExclusionPatternChars;
  this.fulInclusionPatternChars = fulInclusionPatternChars;
}
View Full Code Here

public void cleanup() {
  this.directoryCache = null;
}

SimpleLookupTable directoryTable(String qualifiedPackageName) {
  SimpleLookupTable dirTable = (SimpleLookupTable) this.directoryCache.get(qualifiedPackageName);
  if (dirTable == this.missingPackageHolder) return null; // package exists in another classpath directory or jar
  if (dirTable != null) return dirTable;

  try {
    IResource container = this.sourceFolder.findMember(qualifiedPackageName); // this is a case-sensitive check
    if (container instanceof IContainer) {
      IResource[] members = ((IContainer) container).members();
      dirTable = new SimpleLookupTable();
      for (int i = 0, l = members.length; i < l; i++) {
        IResource m = members[i];
        String name;
        if (m.getType() == IResource.FILE) {
          int index = Util.indexOfJavaLikeExtension(name = m.getName());
          if (index >= 0) {
            String fullPath = m.getFullPath().toString();
            if (!org.eclipse.jdt.internal.compiler.util.Util.isExcluded(fullPath.toCharArray(), this.fulInclusionPatternChars, this.fullExclusionPatternChars, false/*not a folder path*/)) {
              dirTable.put(name.substring(0, index), m);
            }
          }
        }
      }
      // look for secondary types, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=382778
      IJavaProject project = JavaCore.create(container.getProject());
      Map secondaryTypePaths = JavaModelManager.getJavaModelManager().secondaryTypes(project, false, null);
      if (secondaryTypePaths.size() > 0) {
        Map typesInPackage = (Map) secondaryTypePaths.get(qualifiedPackageName);
        if (typesInPackage != null && typesInPackage.size() > 0) {
          for (Iterator j = typesInPackage.keySet().iterator(); j.hasNext();) {
            String secondaryTypeName = (String) j.next();
            IType secondaryType = (IType) typesInPackage.get(secondaryTypeName);
            IJavaElement parent = secondaryType.getParent();
            String fullPath = parent.getResource().getFullPath().toString();
            if (!org.eclipse.jdt.internal.compiler.util.Util.isExcluded(fullPath.toCharArray(), this.fulInclusionPatternChars, this.fullExclusionPatternChars, false/*not a folder path*/)) {
              dirTable.put(secondaryTypeName, parent.getResource());
            }
          }
        }
      }
      this.directoryCache.put(qualifiedPackageName, dirTable);
View Full Code Here

  return this.sourceFolder.equals(((ClasspathSourceDirectory) o).sourceFolder);
}

public NameEnvironmentAnswer findClass(String sourceFileWithoutExtension, String qualifiedPackageName, String qualifiedSourceFileWithoutExtension) {
  SimpleLookupTable dirTable = directoryTable(qualifiedPackageName);
  if (dirTable != null && dirTable.elementSize > 0) {
    IFile file = (IFile) dirTable.get(sourceFileWithoutExtension);
    if (file != null) {
      return new NameEnvironmentAnswer(new ResourceCompilationUnit(file, file.getLocationURI()), null /* no access restriction */);
    }
  }
  return null;
View Full Code Here

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

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

    return true;
  if (otherType.id == TypeIds.T_JavaLangObject)
    return true;
  Object result;
  if (this.compatibleCache == null) {
    this.compatibleCache = new SimpleLookupTable(3);
    result = null;
  } else {
    result = this.compatibleCache.get(otherType); // [dbg reset] this.compatibleCache.put(otherType,null)
    if (result != null) {
      return result == Boolean.TRUE;
View Full Code Here

  }
  return readableName;
}

public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization) {
  SimpleLookupTable store = storedAnnotations(forceInitialization);
  return store == null ? null : (AnnotationHolder) store.get(binding);
}
View Full Code Here

  return this.sourceName;
}

void storeAnnotationHolder(Binding binding, AnnotationHolder holder) {
  if (holder == null) {
    SimpleLookupTable store = storedAnnotations(false);
    if (store != null)
      store.removeKey(binding);
  } else {
    SimpleLookupTable store = storedAnnotations(true);
    if (store != null)
      store.put(binding, holder);
  }
}
View Full Code Here

}

void storeAnnotations(Binding binding, AnnotationBinding[] annotations) {
  AnnotationHolder holder = null;
  if (annotations == null || annotations.length == 0) {
    SimpleLookupTable store = storedAnnotations(false);
    if (store != null)
      holder = (AnnotationHolder) store.get(binding);
    if (holder == null) return; // nothing to delete
  } else {
    SimpleLookupTable store = storedAnnotations(true);
    if (store == null) return; // not supported
    holder = (AnnotationHolder) store.get(binding);
    if (holder == null)
      holder = new AnnotationHolder();
  }
  storeAnnotationHolder(binding, holder.setAnnotations(annotations));
}
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.