Example usage for org.apache.commons.lang.builder HashCodeBuilder append

List of usage examples for org.apache.commons.lang.builder HashCodeBuilder append

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder HashCodeBuilder append.

Prototype

public HashCodeBuilder append(short[] array) 

Source Link

Document

Append a hashCode for a short array.

Usage

From source file:org.marketcetera.photon.internal.marketdata.DepthOfBookKey.java

@Override
protected void enhanceHashCode(final HashCodeBuilder builder) {
    builder.append(mProduct);
}

From source file:org.nuclos.server.customcode.codegenerator.NuclosJavaCompilerComponent.java

private Manifest getManifest() {
    HashCodeBuilder builder = new HashCodeBuilder(11, 17);
    for (CodeGenerator gen : getAllCurrentGenerators()) {
        builder.append(gen.hashForManifest());
    }//from ww  w .  j  av  a  2 s.c om

    Manifest manifest = new Manifest();
    Attributes mainAttributes = manifest.getMainAttributes();
    mainAttributes.put(Attributes.Name.MANIFEST_VERSION, "1.0");
    mainAttributes.put(NUCLOS_CODE_NUCLET, "default");
    mainAttributes.put(NUCLOS_CODE_HASH, String.valueOf(builder.toHashCode()));
    return manifest;
}

From source file:org.o3project.odenos.core.component.network.flow.ofpflow.OFPFlowMatch.java

@Override
public int hashCode() {

    HashCodeBuilder hsb = new HashCodeBuilder();
    hsb.append(inNode);
    hsb.append(inPort);// w  w w  . j a  v a  2s . com

    hsb.append(inPhyPort);
    hsb.append(metadata);
    hsb.append(metadataMask);
    hsb.append(ethSrc);
    hsb.append(ethSrcMask);
    hsb.append(ethDst);
    hsb.append(ethDstMask);
    hsb.append(vlanVid);
    hsb.append(vlanVidMask);
    hsb.append(vlanPcp);
    hsb.append(ethType);

    hsb.append(ipDscp);
    hsb.append(ipEcn);
    hsb.append(ipProto);
    hsb.append(ipv4Src);
    hsb.append(ipv4SrcMask);
    hsb.append(ipv4Dst);
    hsb.append(ipv4DstMask);

    hsb.append(tcpSrc);
    hsb.append(tcpDst);
    hsb.append(udpSrc);
    hsb.append(udpDst);
    hsb.append(sctpSrc);
    hsb.append(sctpDst);
    hsb.append(icmpv4Type);
    hsb.append(icmpv4Code);
    hsb.append(arpOp);
    hsb.append(arpSpa);
    hsb.append(arpSpaMask);
    hsb.append(arpTpa);
    hsb.append(arpTpaMask);
    hsb.append(arpSha);
    hsb.append(arpShaMask);
    hsb.append(arpTha);
    hsb.append(arpThaMask);

    hsb.append(ipv6Src);
    hsb.append(ipv6SrcMask);
    hsb.append(ipv6Dst);
    hsb.append(ipv6DstMask);
    hsb.append(ipv6Flabel);
    hsb.append(ipv6FlabelMask);
    hsb.append(icmpv6Type);
    hsb.append(icmpv6Code);
    hsb.append(ipv6NdTarget);
    hsb.append(ipv6NdSll);
    hsb.append(ipv6NdTll);
    hsb.append(mplsLabel);
    hsb.append(mplsTc);
    hsb.append(mplsBos);
    hsb.append(pbbIsid);
    hsb.append(pbbIsidMask);
    hsb.append(tunnelId);
    hsb.append(tunnelIdMask);
    hsb.append(ipv6Exthdr);
    hsb.append(ipv6ExthdrMask);

    return hsb.toHashCode();

}

From source file:org.objectstyle.cayenne.ObjectId.java

/**
 * @see java.lang.Object#hashCode()/*from  ww  w.  ja v  a 2  s .  c  o m*/
 */
public int hashCode() {
    if (this.hashCode == Integer.MIN_VALUE) {
        // build and cache hashCode

        HashCodeBuilder builder = new HashCodeBuilder(3, 5);

        // use the class name because two Objectid's should be equal
        // even if their objClass'es were loaded by different class loaders.
        builder.append(objectClass.getName().hashCode());

        if (objectIdKeys != null) {
            int len = objectIdKeys.size();

            // handle cheap and most common case - single key
            if (len == 1) {
                Iterator entries = objectIdKeys.entrySet().iterator();
                Map.Entry entry = (Map.Entry) entries.next();
                builder.append(entry.getKey()).append(entry.getValue());
            }
            // handle multiple keys - must sort the keys to use with HashCodeBuilder
            else {
                Object[] keys = objectIdKeys.keySet().toArray();
                Arrays.sort(keys);

                for (int i = 0; i < len; i++) {
                    // HashCodeBuilder will take care of processing object if it 
                    // happens to be a primitive array such as byte[]

                    // also we don't have to append the key hashcode, its index will work
                    builder.append(i).append(objectIdKeys.get(keys[i]));
                }
            }
        }

        this.hashCode = builder.toHashCode();
    }

    return this.hashCode;
}

From source file:org.objectstyle.cayenne.util.Util.java

/**
 * Builds a hashCode of Collection./*from   w ww  .j  av  a2s .  co m*/
 */
public static int hashCode(Collection c) {
    HashCodeBuilder builder = new HashCodeBuilder();
    for (Iterator i = c.iterator(); i.hasNext();)
        builder.append(i.next());
    return builder.toHashCode();
}

From source file:org.openanzo.combus.realtime.DestinationDatasetTracker.java

@Override
public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder(1035, 263167);
    builder.append(getDestination());
    builder.append(getUserUri());// w  w  w .  j a va2  s  . c  o  m
    builder.append(getDefaultGraphs());
    builder.append(getNamedGraphs());
    builder.append(getNamedDatasets());
    return builder.toHashCode();
}

From source file:org.openanzo.glitter.syntax.abstrakt.FunctionCall.java

@Override
public int hashCode() {
    if (hashCode == -1) {
        HashCodeBuilder hcb = new HashCodeBuilder();
        hcb.append(this.function);
        hcb.append(this.arguments);
        hcb.append(this.distinct);
        hcb.append(this.star);
        hcb.append(this.argumentsAsVariables);
        hcb.append(this.attributes);
        hashCode = hcb.toHashCode();/*  w w  w .  j  a va 2s .  c om*/
    }
    return hashCode;
}

From source file:org.openanzo.rdf.Statement.java

@Override
public int hashCode() {
    if (hashCode == -1) {
        if (namedGraphUri == null)
            hashCode = super.hashCode();
        else {/*from   w  w  w . j a v a2  s.  co m*/
            HashCodeBuilder builder = new HashCodeBuilder();
            builder.append(this.subject);
            builder.append(this.predicate);
            builder.append(this.object);
            builder.append(this.namedGraphUri);
            hashCode = builder.toHashCode();
        }
    }
    return hashCode;
}

From source file:org.openanzo.rdf.utils.Pair.java

@Override
public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();
    builder.append(first);
    builder.append(second);/*from  w ww. j a v  a 2  s.c o  m*/
    return builder.toHashCode();
}

From source file:org.opencustomer.db.vo.calendar.EventCalendarVO.java

@Override
public int hashCode() {
    HashCodeBuilder builder = new HashCodeBuilder();

    if (getCalendar() != null)
        builder.append(getCalendar().getId());
    else/*from   w  w w.  j a va  2s.co  m*/
        builder.append(0);

    if (getEvent() != null)
        builder.append(getEvent().getId());
    else
        builder.append(0);

    return builder.toHashCode();
}