Examples of HashtableOfObjectToInt


Examples of org.aspectj.org.eclipse.jdt.internal.compiler.util.HashtableOfObjectToInt

      sourceJavadocParser.categories = CharOperation.NO_CHAR_CHAR;
    }
  }
}
private void reset() {
  this.sourceEnds = new HashtableOfObjectToInt();
  this.nodesToCategories = new HashMap();
  typeNames = new char[4][];
  superTypeNames = new char[4][];
  nestedTypeIndex = 0;
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.util.HashtableOfObjectToInt

    IProgressMonitor monitor) {

    final int length = elements.length;
    final HashMap sourceElementPositions = new HashMap(); // a map from ICompilationUnit to int[] (positions in elements)
    int cuNumber = 0;
    final HashtableOfObjectToInt binaryElementPositions = new HashtableOfObjectToInt(); // a map from String (binding key) to int (position in elements)
    for (int i = 0; i < length; i++) {
      IJavaElement element = elements[i];
      if (!(element instanceof SourceRefElement))
        throw new IllegalStateException(element + " is not part of a compilation unit or class file"); //$NON-NLS-1$
      Object cu = element.getAncestor(IJavaElement.COMPILATION_UNIT);
      if (cu != null) {
        // source member
        IntArrayList intList = (IntArrayList) sourceElementPositions.get(cu);
        if (intList == null) {
          sourceElementPositions.put(cu, intList = new IntArrayList());
          cuNumber++;
        }
        intList.add(i);
      } else {
        // binary member
        try {
          String key = ((BinaryMember) element).getKey(true/*open to get resolved info*/);
          binaryElementPositions.put(key, i);
        } catch (JavaModelException e) {
          throw new IllegalArgumentException(element + " does not exist"); //$NON-NLS-1$
        }
      }
    }
    ICompilationUnit[] cus = new ICompilationUnit[cuNumber];
    sourceElementPositions.keySet().toArray(cus);

    int bindingKeyNumber = binaryElementPositions.size();
    String[] bindingKeys = new String[bindingKeyNumber];
    binaryElementPositions.keysToArray(bindingKeys);

    class Requestor extends ASTRequestor {
      IBinding[] bindings = new IBinding[length];
      public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
        // TODO (jerome) optimize to visit the AST only once
        IntArrayList intList = (IntArrayList) sourceElementPositions.get(source);
        for (int i = 0; i < intList.length; i++) {
          final int index = intList.list[i];
          SourceRefElement element = (SourceRefElement) elements[index];
          DOMFinder finder = new DOMFinder(ast, element, true/*resolve binding*/);
          try {
            finder.search();
          } catch (JavaModelException e) {
            throw new IllegalArgumentException(element + " does not exist"); //$NON-NLS-1$
          }
          this.bindings[index] = finder.foundBinding;
        }
      }
      public void acceptBinding(String bindingKey, IBinding binding) {
        int index = binaryElementPositions.get(bindingKey);
        this.bindings[index] = binding;
      }
    }
    Requestor requestor = new Requestor();
    resolve(cus, bindingKeys, requestor, apiLevel, compilerOptions, javaProject, owner, flags, monitor);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.util.HashtableOfObjectToInt

    private final DataOutputStream out;
    private final HashtableOfObjectToInt stringIds; // Strings -> int

    VariablesAndContainersSaveHelper(DataOutputStream out) {
      super();
      this.classpathEntryIds = new HashtableOfObjectToInt();
      this.out = out;
      this.stringIds = new HashtableOfObjectToInt();
    }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.util.HashtableOfObjectToInt

    // sort in the order of roots and in reverse alphabetical order for .class file
    // since requesting top level types in the process of caching an enclosing type is
    // not supported by the lookup environment
    IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
    int rootsLength = roots.length;
    final HashtableOfObjectToInt indexes = new HashtableOfObjectToInt(openablesLength);
    for (int i = 0; i < openablesLength; i++) {
      IJavaElement root = openables[i].getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
      int index;
      for (index = 0; index < rootsLength; index++) {
        if (roots[index].equals(root))
          break;
      }   
      indexes.put(openables[i], index);
    }
    Arrays.sort(openables, new Comparator() {
      public int compare(Object a, Object b) {
        int aIndex = indexes.get(a);
        int bIndex = indexes.get(b);
        if (aIndex != bIndex)
          return aIndex - bIndex;
        return ((Openable) b).getElementName().compareTo(((Openable) a).getElementName());
      }
    });
View Full Code Here

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

      sourceJavadocParser.categories = CharOperation.NO_CHAR_CHAR;
    }
  }
}
private void reset() {
  this.sourceEnds = new HashtableOfObjectToInt();
  this.nodesToCategories = new HashMap();
}
View Full Code Here

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

  this.reportSyntaxErrorIsRequired = false;
  this.javadocParser.checkDocComment = true;
  this.annotationRecoveryActivated = false;
  if (storeExtraSourceEnds) {
    this.storeSourceEnds = true;
    this.sourceEnds = new HashtableOfObjectToInt();
  }
}
View Full Code Here

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

public void reset() {
  super.reset();
  this.cursorLocation = 0;
  if (this.storeSourceEnds) {
    this.sourceEnds = new HashtableOfObjectToInt();
  }
}
View Full Code Here

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

    private final DataOutputStream out;
    private final HashtableOfObjectToInt stringIds; // Strings -> int

    VariablesAndContainersSaveHelper(DataOutputStream out) {
      super();
      this.classpathEntryIds = new HashtableOfObjectToInt();
      this.out = out;
      this.stringIds = new HashtableOfObjectToInt();
    }
View Full Code Here

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

    IProgressMonitor monitor) {

    final int length = elements.length;
    final HashMap sourceElementPositions = new HashMap(); // a map from ICompilationUnit to int[] (positions in elements)
    int cuNumber = 0;
    final HashtableOfObjectToInt binaryElementPositions = new HashtableOfObjectToInt(); // a map from String (binding key) to int (position in elements)
    for (int i = 0; i < length; i++) {
      IJavaElement element = elements[i];
      if (!(element instanceof SourceRefElement))
        throw new IllegalStateException(element + " is not part of a compilation unit or class file"); //$NON-NLS-1$
      Object cu = element.getAncestor(IJavaElement.COMPILATION_UNIT);
      if (cu != null) {
        // source member
        IntArrayList intList = (IntArrayList) sourceElementPositions.get(cu);
        if (intList == null) {
          sourceElementPositions.put(cu, intList = new IntArrayList());
          cuNumber++;
        }
        intList.add(i);
      } else {
        // binary member
        try {
          String key = ((BinaryMember) element).getKey(true/*open to get resolved info*/);
          binaryElementPositions.put(key, i);
        } catch (JavaModelException e) {
          throw new IllegalArgumentException(element + " does not exist"); //$NON-NLS-1$
        }
      }
    }
    ICompilationUnit[] cus = new ICompilationUnit[cuNumber];
    sourceElementPositions.keySet().toArray(cus);

    int bindingKeyNumber = binaryElementPositions.size();
    String[] bindingKeys = new String[bindingKeyNumber];
    binaryElementPositions.keysToArray(bindingKeys);

    class Requestor extends ASTRequestor {
      IBinding[] bindings = new IBinding[length];
      public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
        // TODO (jerome) optimize to visit the AST only once
        IntArrayList intList = (IntArrayList) sourceElementPositions.get(source);
        for (int i = 0; i < intList.length; i++) {
          final int index = intList.list[i];
          SourceRefElement element = (SourceRefElement) elements[index];
          DOMFinder finder = new DOMFinder(ast, element, true/*resolve binding*/);
          try {
            finder.search();
          } catch (JavaModelException e) {
            throw new IllegalArgumentException(element + " does not exist"); //$NON-NLS-1$
          }
          this.bindings[index] = finder.foundBinding;
        }
      }
      public void acceptBinding(String bindingKey, IBinding binding) {
        int index = binaryElementPositions.get(bindingKey);
        this.bindings[index] = binding;
      }
    }
    Requestor requestor = new Requestor();
    resolve(cus, bindingKeys, requestor, apiLevel, compilerOptions, javaProject, owner, flags, monitor);
View Full Code Here

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

        this.packageFragments = (HashtableOfArrayToObject) packageFragments.clone();
      } catch (CloneNotSupportedException e1) {
        // ignore (implementation of HashtableOfArrayToObject supports cloning)
      }
      this.typesInWorkingCopies = new HashMap();
      HashtableOfObjectToInt rootPositions = new HashtableOfObjectToInt();
      for (int i = 0, length = packageFragmentRoots.length; i < length; i++) {
        rootPositions.put(packageFragmentRoots[i], i);
      }
      for (int i = 0, length = workingCopies.length; i < length; i++) {
        ICompilationUnit workingCopy = workingCopies[i];
        PackageFragment pkg = (PackageFragment) workingCopy.getParent();
        IPackageFragmentRoot root = (IPackageFragmentRoot) pkg.getParent();
        int rootPosition = rootPositions.get(root);
        if (rootPosition == -1)
          continue; // working copy is not visible from this project (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=169970)
        HashMap typeMap = (HashMap) this.typesInWorkingCopies.get(pkg);
        if (typeMap == null) {
          typeMap = new HashMap();
          this.typesInWorkingCopies.put(pkg, typeMap);
        }
        try {
          IType[] types = workingCopy.getTypes();
          int typeLength = types.length;
          if (typeLength == 0) {
            String typeName = Util.getNameWithoutJavaLikeExtension(workingCopy.getElementName());
            typeMap.put(typeName, NO_TYPES);
          } else {
            for (int j = 0; j < typeLength; j++) {
              IType type = types[j];
              String typeName = type.getElementName();
              Object existing = typeMap.get(typeName);
              if (existing == null) {
                typeMap.put(typeName, type);
              } else if (existing instanceof IType) {
                typeMap.put(typeName, new IType[] {(IType) existing, type});
              } else {
                IType[] existingTypes = (IType[]) existing;
                int existingTypeLength = existingTypes.length;
                System.arraycopy(existingTypes, 0, existingTypes = new IType[existingTypeLength+1], 0, existingTypeLength);
                existingTypes[existingTypeLength] = type;
                typeMap.put(typeName, existingTypes);
              }
            }
          }
        } catch (JavaModelException e) {
          // working copy doesn't exist -> ignore
        }

        // add root of package fragment to cache
        String[] pkgName = pkg.names;
        Object existing = this.packageFragments.get(pkgName);
        if (existing == null || existing == JavaProjectElementInfo.NO_ROOTS) {
          this.packageFragments.put(pkgName, root);
          // ensure super packages (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=119161)
          // are also in the map
          JavaProjectElementInfo.addSuperPackageNames(pkgName, this.packageFragments);
        } else {
          if (existing instanceof PackageFragmentRoot) {
            int exisitingPosition = rootPositions.get(existing);
            if (rootPosition != exisitingPosition) { // if not equal
              this.packageFragments.put(
                pkgName,
                exisitingPosition < rootPosition ?
                  new IPackageFragmentRoot[] {(PackageFragmentRoot) existing, root} :
                  new IPackageFragmentRoot[] {root, (PackageFragmentRoot) existing});
            }
          } else {
            // insert root in the existing list
            IPackageFragmentRoot[] roots = (IPackageFragmentRoot[]) existing;
            int rootLength = roots.length;
            int insertionIndex = 0;
            for (int j = 0; j < rootLength; j++) {
              int existingPosition = rootPositions.get(roots[j]);
              if (rootPosition > existingPosition) {
                // root is after this index
                insertionIndex = j;
              } else if (rootPosition == existingPosition) {
                 // root already in the existing list
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.