#916 - Refactor internals - bump use of 31 in hashes to 92821

This commit is contained in:
Rob Bygrave
2016-12-08 23:28:58 +13:00
parent ad0e085ff5
commit e75b5e8b30
9 changed files with 29 additions and 29 deletions
+3 -3
View File
@@ -255,9 +255,9 @@ public final class OrderBy<T> implements Serializable {
@Override
public int hashCode() {
int hc = property.hashCode();
hc = hc * 31 + (ascending ? 0 : 1);
hc = hc * 31 + (nulls == null ? 0 : nulls.hashCode());
hc = hc * 31 + (highLow == null ? 0 : highLow.hashCode());
hc = hc * 92821 + (ascending ? 0 : 1);
hc = hc * 92821 + (nulls == null ? 0 : nulls.hashCode());
hc = hc * 92821 + (highLow == null ? 0 : highLow.hashCode());
return hc;
}
+5 -5
View File
@@ -636,9 +636,9 @@ public final class RawSql implements Serializable {
@Override
public int hashCode() {
int result = indexPos;
result = 31 * result + dbColumn.hashCode();
result = 31 * result + (dbAlias != null ? dbAlias.hashCode() : 0);
result = 31 * result + (propertyName != null ? propertyName.hashCode() : 0);
result = 92821 * result + dbColumn.hashCode();
result = 92821 * result + (dbAlias != null ? dbAlias.hashCode() : 0);
result = 92821 * result + (propertyName != null ? propertyName.hashCode() : 0);
return result;
}
@@ -724,8 +724,8 @@ public final class RawSql implements Serializable {
@Override
public int hashCode() {
int result = (parsed ? 1 : 0);
result = 31 * result + columnMapping.hashCode();
result = 31 * result + unParsedSql.hashCode();
result = 92821 * result + columnMapping.hashCode();
result = 92821 * result + unParsedSql.hashCode();
return result;
}
}
@@ -35,7 +35,7 @@ public final class CallStack implements Serializable {
public int hashCode() {
int hc = 0;
for (StackTraceElement aCallStack : callStack) {
hc = 31 * hc + aCallStack.hashCode();
hc = 92821 * hc + aCallStack.hashCode();
}
return hc;
}
@@ -68,8 +68,8 @@ public final class ObjectGraphNode implements Serializable {
}
public int hashCode() {
int hc = 31 * originQueryPoint.hashCode();
hc = 31 * hc + (path == null ? 0 : path.hashCode());
int hc = 92821 * originQueryPoint.hashCode();
hc = 92821 * hc + (path == null ? 0 : path.hashCode());
return hc;
}
@@ -62,9 +62,9 @@ public final class ObjectGraphOrigin implements Serializable {
}
public int hashCode() {
int hc = 31 * callStack.hashCode();
hc = 31 * hc + beanType.hashCode();
hc = 31 * hc + queryHash;
int hc = 92821 * callStack.hashCode();
hc = 92821 * hc + beanType.hashCode();
hc = 92821 * hc + queryHash;
return hc;
}
@@ -89,8 +89,8 @@ public class ReadAuditQueryPlan {
@Override
public int hashCode() {
int result = beanType.hashCode();
result = 31 * result + queryKey.hashCode();
result = 31 * result + sql.hashCode();
result = 92821 * result + queryKey.hashCode();
result = 92821 * result + sql.hashCode();
return result;
}
}
@@ -43,7 +43,7 @@ public class BindParams implements Serializable {
public int queryBindHash() {
int hc = namedParameters.hashCode();
for (Param positionedParameter : positionedParameters) {
hc = hc * 31 + positionedParameter.hashCode();
hc = hc * 92821 + positionedParameter.hashCode();
}
return hc;
}
@@ -67,18 +67,18 @@ public class BindParams implements Serializable {
public int[] calcQueryPlanHash() {
int tempBindCount;
int bc = 0;
int hc = 31;
int hc = 92821;
for (Param param : positionedParameters) {
tempBindCount = param.queryBindCount();
bc += tempBindCount;
hc = hc * 31 + tempBindCount;
hc = hc * 92821 + tempBindCount;
}
for (Map.Entry<String, Param> entry : namedParameters.entrySet()) {
tempBindCount = entry.getValue().queryBindCount();
bc += tempBindCount;
hc = hc * 31 + entry.getKey().hashCode();
hc = hc * 31 + tempBindCount;
hc = hc * 92821 + entry.getKey().hashCode();
hc = hc * 92821 + tempBindCount;
}
return new int[]{hc, bc};
@@ -399,10 +399,10 @@ public class BindParams implements Serializable {
public int hashCode() {
int hc = getClass().hashCode();
hc = hc * 31 + (isInParam ? 0 : 1);
hc = hc * 31 + (isOutParam ? 0 : 1);
hc = hc * 31 + (type);
hc = hc * 31 + (inValue == null ? 0 : inValue.hashCode());
hc = hc * 92821 + (isInParam ? 0 : 1);
hc = hc * 92821 + (isOutParam ? 0 : 1);
hc = hc * 92821 + (type);
hc = hc * 92821 + (inValue == null ? 0 : inValue.hashCode());
return hc;
}
@@ -22,8 +22,8 @@ public class HashQuery {
}
public int hashCode() {
int hc = 31 * planHash.hashCode();
hc = 31 * hc + bindHash;
int hc = 92821 * planHash.hashCode();
hc = 92821 * hc + bindHash;
return hc;
}
@@ -32,8 +32,8 @@ public class HashQueryPlan {
public int hashCode() {
int hc = planHash;
hc = hc * 31 + bindCount;
hc = hc * 31 + (rawSql == null ? 0 : rawSql.hashCode());
hc = hc * 92821 + bindCount;
hc = hc * 92821 + (rawSql == null ? 0 : rawSql.hashCode());
return hc;
}