List of usage examples for org.apache.commons.lang.builder HashCodeBuilder append
public HashCodeBuilder append(short[] array)
Append a hashCode
for a short
array.
From source file:org.candlepin.model.Content.java
/** * Calculates and returns a version hash for this entity. This method operates much like the * hashCode method, except that it is more accurate and should have fewer collisions. * * @return//w ww . ja v a 2 s. c o m * a version hash for this entity */ public int getEntityVersion() { // This must always be a subset of equals HashCodeBuilder builder = new HashCodeBuilder(37, 7).append(this.id).append(this.type).append(this.label) .append(this.name).append(this.vendor).append(this.contentUrl).append(this.requiredTags) .append(this.releaseVer).append(this.gpgUrl).append(this.metadataExpire).append(this.arches) .append(this.locked); // Impl note: // We need to be certain that the hash code is calculated in a way that's order // independent and not subject to Hibernate's poor hashCode implementation on proxy // collections. This calculation follows that defined by the Set.hashCode method. int accumulator = 0; if (!this.modifiedProductIds.isEmpty()) { for (String pid : this.modifiedProductIds) { accumulator += (pid != null ? pid.hashCode() : 0); } builder.append(accumulator); } // Return return builder.toHashCode(); }
From source file:org.candlepin.model.Product.java
/** * Calculates and returns a version hash for this entity. This method operates much like the * hashCode method, except that it is more accurate and should have fewer collisions. * * @return/*from www . j a v a 2s . c o m*/ * a version hash for this entity */ public int getEntityVersion() { // This must always be a subset of equals HashCodeBuilder builder = new HashCodeBuilder(37, 7).append(this.id).append(this.name) .append(this.multiplier).append(this.locked); // We need to be certain that the hash code is calculated in a way that's order // independent and not subject to Hibernate's poor hashCode implementation on proxy // collections. This calculation follows that defined by the Set.hashCode method. int accumulator = 0; if (this.attributes.size() > 0) { for (ProductAttribute attrib : this.attributes) { accumulator += (attrib != null ? attrib.getEntityVersion() : 0); } builder.append(accumulator); } // Impl note: // Stepping through the collections here is as painful as it looks, but Hibernate, once // again, doesn't implement .hashCode reliably on the proxy collections. So, we have to // manually step through these and add the elements to ensure the hash code is // generated properly. if (!this.dependentProductIds.isEmpty()) { accumulator = 0; for (String pid : this.dependentProductIds) { accumulator += (pid != null ? pid.hashCode() : 0); } builder.append(accumulator); } if (!this.productContent.isEmpty()) { accumulator = 0; for (ProductContent pc : this.productContent) { accumulator += (pc != null ? pc.getEntityVersion() : 0); } builder.append(accumulator); } return builder.toHashCode(); }
From source file:org.carcv.core.model.file.FileEntry.java
@Override public int hashCode() { HashCodeBuilder hcb = new HashCodeBuilder(); hcb.append(getCarData()).append(getCarImages().size()); for (FileCarImage fci : getCarImages()) { hcb.append(fci);/*www . j a v a2s . com*/ } return hcb.toHashCode(); }
From source file:org.codehaus.groovy.grails.web.util.AbstractTypeConvertingMap.java
@Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(23, 31); for (Object entry : wrappedMap.entrySet()) { builder.append(entry); }/*from w w w . j av a 2 s. c o m*/ return builder.toHashCode(); }
From source file:org.diffkit.diff.engine.DKColumnModel.java
public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(23, 71); builder.append(_name); builder.append(_index);// ww w .j av a 2s . c o m builder.append(_type); return builder.toHashCode(); }
From source file:org.drools.planner.examples.cloudbalancing.domain.CloudBalance.java
public int hashCode() { HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(); for (CloudProcess process : processList) { // Notice: we don't use hashCode() hashCodeBuilder.append(process.solutionHashCode()); }/*ww w. jav a 2 s . com*/ return hashCodeBuilder.toHashCode(); }
From source file:org.drools.planner.examples.curriculumcourse.domain.CourseSchedule.java
public int hashCode() { HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(); for (Lecture lecture : lectureList) { // Notice: we don't use hashCode() hashCodeBuilder.append(lecture.solutionHashCode()); }//from www. ja v a 2 s .c o m return hashCodeBuilder.toHashCode(); }
From source file:org.drools.planner.examples.examination.domain.Examination.java
public int hashCode() { HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(); for (Exam exam : examList) { // Notice: we don't use hashCode() hashCodeBuilder.append(exam.solutionHashCode()); }/*from www .j a v a 2s . c o m*/ return hashCodeBuilder.toHashCode(); }
From source file:org.drools.planner.examples.machinereassignment.domain.MachineReassignment.java
public int hashCode() { HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(); for (MrProcessAssignment processAssignment : processAssignmentList) { // Notice: we don't use hashCode() hashCodeBuilder.append(processAssignment.solutionHashCode()); }// ww w. ja v a 2 s .c om return hashCodeBuilder.toHashCode(); }
From source file:org.drools.planner.examples.manners2009.domain.Manners2009.java
public int hashCode() { HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(); for (SeatDesignation seatDesignation : seatDesignationList) { // Notice: we don't use hashCode() hashCodeBuilder.append(seatDesignation.solutionHashCode()); }/*from ww w . ja va 2 s. c o m*/ return hashCodeBuilder.toHashCode(); }