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

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


      case INTERNAL_JAR :
        newState.binaryLocations[i] = ClasspathLocation.forLibrary(root.getFile(new Path(in.readUTF())), readRestriction(in));
    }
  }

  newState.structuralBuildTimes = new SimpleLookupTable(length = in.readInt());
  for (int i = 0; i < length; i++)
    newState.structuralBuildTimes.put(in.readUTF(), new Long(in.readLong()));

  String[] internedTypeLocators = new String[length = in.readInt()];
  for (int i = 0; i < length; i++)
    internedTypeLocators[i] = in.readUTF();

  newState.typeLocators = new SimpleLookupTable(length = in.readInt());
  for (int i = 0; i < length; i++)
    newState.recordLocatorForType(in.readUTF(), internedTypeLocators[in.readInt()]);

  char[][] internedRootNames = ReferenceCollection.internSimpleNames(readNames(in), false);
  char[][] internedSimpleNames = ReferenceCollection.internSimpleNames(readNames(in), false);
  char[][][] internedQualifiedNames = new char[length = in.readInt()][][];
  for (int i = 0; i < length; i++) {
    int qLength = in.readInt();
    char[][] qName = new char[qLength][];
    for (int j = 0; j < qLength; j++)
      qName[j] = internedSimpleNames[in.readInt()];
    internedQualifiedNames[i] = qName;
  }
  internedQualifiedNames = ReferenceCollection.internQualifiedNames(internedQualifiedNames, false);

  newState.references = new SimpleLookupTable(length = in.readInt());
  for (int i = 0; i < length; i++) {
    String typeLocator = internedTypeLocators[in.readInt()];
    ReferenceCollection collection = null;
    switch (in.readByte()) {
      case 1 :
View Full Code Here


/*
* String[]  Interned type locators
*/
  out.writeInt(length = this.references.elementSize);
  SimpleLookupTable internedTypeLocators = new SimpleLookupTable(length);
  if (length > 0) {
    keyTable = this.references.keyTable;
    for (int i = 0, l = keyTable.length; i < l; i++) {
      if (keyTable[i] != null) {
        length--;
        String key = (String) keyTable[i];
        out.writeUTF(key);
        internedTypeLocators.put(key, new Integer(internedTypeLocators.elementSize));
      }
    }
    if (JavaBuilder.DEBUG && length != 0)
      System.out.println("references table is inconsistent"); //$NON-NLS-1$
  }

/*
* Type locators table
* String    type name
* int      interned locator id
*/
  out.writeInt(length = this.typeLocators.elementSize);
  if (length > 0) {
    keyTable = this.typeLocators.keyTable;
    valueTable = this.typeLocators.valueTable;
    for (int i = 0, l = keyTable.length; i < l; i++) {
      if (keyTable[i] != null) {
        length--;
        out.writeUTF((String) keyTable[i]);
        Integer index = (Integer) internedTypeLocators.get(valueTable[i]);
        out.writeInt(index.intValue());
      }
    }
    if (JavaBuilder.DEBUG && length != 0)
      System.out.println("typeLocators table is inconsistent"); //$NON-NLS-1$
  }

/*
* char[][]  Interned root names
* char[][][]  Interned qualified names
* char[][]  Interned simple names
*/
  SimpleLookupTable internedRootNames = new SimpleLookupTable(3);
  SimpleLookupTable internedQualifiedNames = new SimpleLookupTable(31);
  SimpleLookupTable internedSimpleNames = new SimpleLookupTable(31);
  valueTable = this.references.valueTable;
  for (int i = 0, l = valueTable.length; i < l; i++) {
    if (valueTable[i] != null) {
      ReferenceCollection collection = (ReferenceCollection) valueTable[i];
      char[][] rNames = collection.rootReferences;
      for (int j = 0, m = rNames.length; j < m; j++) {
        char[] rName = rNames[j];
        if (!internedRootNames.containsKey(rName)) // remember the names have been interned
          internedRootNames.put(rName, new Integer(internedRootNames.elementSize));
      }
      char[][][] qNames = collection.qualifiedNameReferences;
      for (int j = 0, m = qNames.length; j < m; j++) {
        char[][] qName = qNames[j];
        if (!internedQualifiedNames.containsKey(qName)) { // remember the names have been interned
          internedQualifiedNames.put(qName, new Integer(internedQualifiedNames.elementSize));
          for (int k = 0, n = qName.length; k < n; k++) {
            char[] sName = qName[k];
            if (!internedSimpleNames.containsKey(sName)) // remember the names have been interned
              internedSimpleNames.put(sName, new Integer(internedSimpleNames.elementSize));
          }
        }
      }
      char[][] sNames = collection.simpleNameReferences;
      for (int j = 0, m = sNames.length; j < m; j++) {
        char[] sName = sNames[j];
        if (!internedSimpleNames.containsKey(sName)) // remember the names have been interned
          internedSimpleNames.put(sName, new Integer(internedSimpleNames.elementSize));
      }
    }
  }
  char[][] internedArray = new char[internedRootNames.elementSize][];
  Object[] rootNames = internedRootNames.keyTable;
  Object[] positions = internedRootNames.valueTable;
  for (int i = positions.length; --i >= 0; ) {
    if (positions[i] != null) {
      int index = ((Integer) positions[i]).intValue();
      internedArray[index] = (char[]) rootNames[i];
    }
  }
  writeNames(internedArray, out);
  // now write the interned simple names
  internedArray = new char[internedSimpleNames.elementSize][];
  Object[] simpleNames = internedSimpleNames.keyTable;
  positions = internedSimpleNames.valueTable;
  for (int i = positions.length; --i >= 0; ) {
    if (positions[i] != null) {
      int index = ((Integer) positions[i]).intValue();
      internedArray[index] = (char[]) simpleNames[i];
    }
  }
  writeNames(internedArray, out);
  // now write the interned qualified names as arrays of interned simple names
  char[][][] internedQArray = new char[internedQualifiedNames.elementSize][][];
  Object[] qualifiedNames = internedQualifiedNames.keyTable;
  positions = internedQualifiedNames.valueTable;
  for (int i = positions.length; --i >= 0; ) {
    if (positions[i] != null) {
      int index = ((Integer) positions[i]).intValue();
      internedQArray[index] = (char[][]) qualifiedNames[i];
    }
  }
  out.writeInt(length = internedQArray.length);
  for (int i = 0; i < length; i++) {
    char[][] qName = internedQArray[i];
    int qLength = qName.length;
    out.writeInt(qLength);
    for (int j = 0; j < qLength; j++) {
      Integer index = (Integer) internedSimpleNames.get(qName[j]);
      out.writeInt(index.intValue());
    }
  }

/*
* References table
* int    interned locator id
* ReferenceCollection
*/
  out.writeInt(length = this.references.elementSize);
  if (length > 0) {
    keyTable = this.references.keyTable;
    for (int i = 0, l = keyTable.length; i < l; i++) {
      if (keyTable[i] != null) {
        length--;
        Integer index = (Integer) internedTypeLocators.get(keyTable[i]);
        out.writeInt(index.intValue());
        ReferenceCollection collection = (ReferenceCollection) valueTable[i];
        if (collection instanceof AdditionalTypeCollection) {
          out.writeByte(1);
          AdditionalTypeCollection atc = (AdditionalTypeCollection) collection;
          writeNames(atc.definedTypeNames, out);
        } else {
          out.writeByte(2);
        }
        char[][][] qNames = collection.qualifiedNameReferences;
        int qLength = qNames.length;
        out.writeInt(qLength);
        for (int j = 0; j < qLength; j++) {
          index = (Integer) internedQualifiedNames.get(qNames[j]);
          out.writeInt(index.intValue());
        }
        char[][] sNames = collection.simpleNameReferences;
        int sLength = sNames.length;
        out.writeInt(sLength);
        for (int j = 0; j < sLength; j++) {
          index = (Integer) internedSimpleNames.get(sNames[j]);
          out.writeInt(index.intValue());
        }
        char[][] rNames = collection.rootReferences;
        int rLength = rNames.length;
        out.writeInt(rLength);
View Full Code Here

SimpleWordSet allWords; // save space by locally interning the referenced words, since an indexer can generate numerous duplicates
String lastDocumentName;
HashtableOfObject lastReferenceTable;

MemoryIndex() {
  this.docsToReferences = new SimpleLookupTable(7);
  this.allWords = new SimpleWordSet(7);
}
View Full Code Here

          if (DEBUG)
            System.out.println("JavaBuilder: Performing full build since classpath has changed"); //$NON-NLS-1$
          buildAll();
        } else if (this.nameEnvironment.sourceLocations.length > 0) {
          // if there is no source to compile & no classpath changes then we are done
          SimpleLookupTable deltas = findDeltas();
          if (deltas == null) {
            if (DEBUG)
              System.out.println("JavaBuilder: Performing full build since deltas are missing after incremental request"); //$NON-NLS-1$
            buildAll();
          } else if (deltas.elementSize > 0) {
View Full Code Here

}

private SimpleLookupTable findDeltas() {
  this.notifier.subTask(Messages.bind(Messages.build_readingDelta, this.currentProject.getName()));
  IResourceDelta delta = getDelta(this.currentProject);
  SimpleLookupTable deltas = new SimpleLookupTable(3);
  if (delta != null) {
    if (delta.getKind() != IResourceDelta.NO_CHANGE) {
      if (DEBUG)
        System.out.println("JavaBuilder: Found source delta for: " + this.currentProject.getName()); //$NON-NLS-1$
      deltas.put(this.currentProject, delta);
    }
  } else {
    if (DEBUG)
      System.out.println("JavaBuilder: Missing delta for: " + this.currentProject.getName()); //$NON-NLS-1$
    this.notifier.subTask(""); //$NON-NLS-1$
    return null;
  }

  Object[] keyTable = this.binaryLocationsPerProject.keyTable;
  Object[] valueTable = this.binaryLocationsPerProject.valueTable;
  nextProject : for (int i = 0, l = keyTable.length; i < l; i++) {
    IProject p = (IProject) keyTable[i];
    if (p != null && p != this.currentProject) {
      State s = getLastState(p);
      if (!this.lastState.wasStructurallyChanged(p, s)) { // see if we can skip its delta
        if (s.wasNoopBuild())
          continue nextProject; // project has no source folders and can be skipped
        ClasspathLocation[] classFoldersAndJars = (ClasspathLocation[]) valueTable[i];
        boolean canSkip = true;
        for (int j = 0, m = classFoldersAndJars.length; j < m; j++) {
          if (classFoldersAndJars[j].isOutputFolder())
            classFoldersAndJars[j] = null; // can ignore output folder since project was not structurally changed
          else
            canSkip = false;
        }
        if (canSkip) continue nextProject; // project has no structural changes in its output folders
      }

      this.notifier.subTask(Messages.bind(Messages.build_readingDelta, p.getName()));
      delta = getDelta(p);
      if (delta != null) {
        if (delta.getKind() != IResourceDelta.NO_CHANGE) {
          if (DEBUG)
            System.out.println("JavaBuilder: Found binary delta for: " + p.getName()); //$NON-NLS-1$
          deltas.put(p, delta);
        }
      } else {
        if (DEBUG)
          System.out.println("JavaBuilder: Missing delta for: " + p.getName());   //$NON-NLS-1$
        this.notifier.subTask(""); //$NON-NLS-1$
View Full Code Here

      builtProjects = new ArrayList();
    }
    builtProjects.add(projectName);
  }

  this.binaryLocationsPerProject = new SimpleLookupTable(3);
  this.nameEnvironment = new NameEnvironment(this.workspaceRoot, this.javaProject, this.binaryLocationsPerProject, this.notifier);

  if (forBuild) {
    String filterSequence = this.javaProject.getOption(JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, true);
    char[][] filters = filterSequence != null && filterSequence.length() > 0
View Full Code Here

    if (packagePath == null) {
      int count = sourceFile.sourceLocation.sourceFolder.getFullPath().segmentCount();
      packagePath = sourceFile.resource.getFullPath().removeFirstSegments(count).removeLastSegments(1);
    }
    if (this.secondaryTypesToRemove == null)
      this.secondaryTypesToRemove = new SimpleLookupTable();
    ArrayList types = (ArrayList) this.secondaryTypesToRemove.get(sourceFile.sourceLocation.binaryFolder);
    if (types == null)
      types = new ArrayList(definedTypeNames.size());
    types.add(packagePath.append(new String(previous)));
    this.secondaryTypesToRemove.put(sourceFile.sourceLocation.binaryFolder, types);
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(false);
  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

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.