Example usage for org.eclipse.jdt.core.compiler CharOperation hashCode

List of usage examples for org.eclipse.jdt.core.compiler CharOperation hashCode

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.compiler CharOperation hashCode.

Prototype

public static final int hashCode(char[] array) 

Source Link

Document

Answers a hashcode for the array

Usage

From source file:com.codenvy.ide.ext.java.emul.clasfmt.AnnotationInfo.java

License:Open Source License

public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + Util.hashCode(this.pairs);
    result = prime * result + CharOperation.hashCode(this.typename);
    return result;
}

From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.PossibleMatch.java

License:Open Source License

public int hashCode() {
    if (this.compoundName == null)
        return super.hashCode();

    int hashCode = 0;
    for (int i = 0, length = this.compoundName.length; i < length; i++)
        hashCode += CharOperation.hashCode(this.compoundName[i]);
    return hashCode;
}

From source file:net.sf.j2s.core.builder.NameSet.java

License:Open Source License

public char[] add(char[] name) {
    int length = this.names.length;
    int index = CharOperation.hashCode(name) % length;
    char[] current;
    while ((current = this.names[index]) != null) {
        if (CharOperation.equals(current, name))
            return current;
        if (++index == length)
            index = 0;//from  w  ww.  j  a va2  s .c  o  m
    }
    this.names[index] = name;

    // assumes the threshold is never equal to the size of the table
    if (++this.elementSize > this.threshold)
        rehash();
    return name;
}

From source file:net.sf.j2s.core.builder.QualifiedNameSet.java

License:Open Source License

public char[][] add(char[][] qualifiedName) {
    int qLength = qualifiedName.length;
    if (qLength == 0)
        return CharOperation.NO_CHAR_CHAR;

    int length = this.qualifiedNames.length;
    int index = CharOperation.hashCode(qualifiedName[qLength - 1]) % length;
    char[][] current;
    while ((current = this.qualifiedNames[index]) != null) {
        if (CharOperation.equals(current, qualifiedName))
            return current;
        if (++index == length)
            index = 0;//from w  w  w  . j av a2  s  . co  m
    }
    this.qualifiedNames[index] = qualifiedName;

    // assumes the threshold is never equal to the size of the table
    if (++this.elementSize > this.threshold)
        rehash();
    return qualifiedName;
}

From source file:org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.java

License:Open Source License

public int hashCode() {
    // ensure ReferenceBindings hash to the same posiiton as UnresolvedReferenceBindings so they can be replaced without rehashing
    // ALL ReferenceBindings are unique when created so equals() is the same as ==
    return (this.compoundName == null || this.compoundName.length == 0) ? super.hashCode()
            : CharOperation.hashCode(this.compoundName[this.compoundName.length - 1]);
}