mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Refactor - change use of 31 prime in various hash to 92821
This commit is contained in:
@@ -210,7 +210,7 @@ public class CacheChangeSet {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 31 * desc.hashCode() + manyProperty.hashCode();
|
||||
return 92821 * desc.hashCode() + manyProperty.hashCode();
|
||||
}
|
||||
|
||||
void cacheClear() {
|
||||
|
||||
@@ -19,7 +19,7 @@ public class DefaultCallStackFactory implements CallStackFactory {
|
||||
|
||||
int hc = 0;
|
||||
for (int i = 1; i < callStack.length; i++) {
|
||||
hc = 31 * hc + callStack[i].hashCode();
|
||||
hc = 92821 * hc + callStack[i].hashCode();
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
private Integer getBeanHash() {
|
||||
if (beanHash == null) {
|
||||
Object id = beanDescriptor.getId(entityBean);
|
||||
int hc = 31 * bean.getClass().getName().hashCode();
|
||||
int hc = 92821 * bean.getClass().getName().hashCode();
|
||||
if (id != null) {
|
||||
hc += id.hashCode();
|
||||
}
|
||||
@@ -1015,12 +1015,12 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
BeanProperty versionProperty = beanDescriptor.getVersionProperty();
|
||||
if (versionProperty != null) {
|
||||
if (intercept.isLoadedProperty(versionProperty.getPropertyIndex())) {
|
||||
hash = hash * 31 + 7;
|
||||
hash = hash * 92821 + 7;
|
||||
}
|
||||
}
|
||||
|
||||
if (publish) {
|
||||
hash = hash * 31;
|
||||
hash = hash * 92821;
|
||||
}
|
||||
|
||||
return hash;
|
||||
|
||||
@@ -56,9 +56,9 @@ public final class TableJoin {
|
||||
*/
|
||||
private int calcQueryHash() {
|
||||
int hc = type.hashCode();
|
||||
hc = hc * 31 + (table == null ? 0 : table.hashCode());
|
||||
hc = hc * 92821 + (table == null ? 0 : table.hashCode());
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
hc = hc * 31 + columns[i].queryHash();
|
||||
hc = hc * 92821 + columns[i].queryHash();
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ public class TableJoinColumn {
|
||||
|
||||
int hash() {
|
||||
int result = localDbColumn != null ? localDbColumn.hashCode() : 0;
|
||||
result = 31 * result + (foreignDbColumn != null ? foreignDbColumn.hashCode() : 0);
|
||||
result = 31 * result + (insertable ? 1 : 0);
|
||||
result = 31 * result + (updateable ? 1 : 0);
|
||||
result = 92821 * result + (foreignDbColumn != null ? foreignDbColumn.hashCode() : 0);
|
||||
result = 92821 * result + (insertable ? 1 : 0);
|
||||
result = 92821 * result + (updateable ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ class RawSqlQueryPlanKey implements CQueryPlanKey {
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = sql.hashCode();
|
||||
result = 31 * result + (rawSql ? 1 : 0);
|
||||
result = 31 * result + (rowNumberIncluded ? 1 : 0);
|
||||
result = 31 * result + logWhereSql.hashCode();
|
||||
result = 92821 * result + (rawSql ? 1 : 0);
|
||||
result = 92821 * result + (rowNumberIncluded ? 1 : 0);
|
||||
result = 92821 * result + logWhereSql.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -866,7 +866,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
*/
|
||||
private int calculateOriginQueryHash() {
|
||||
int hc = beanType.getName().hashCode();
|
||||
hc = hc * 31 + (type == null ? 0 : type.ordinal());
|
||||
hc = hc * 92821 + (type == null ? 0 : type.ordinal());
|
||||
return hc;
|
||||
}
|
||||
|
||||
@@ -916,12 +916,12 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
@Override
|
||||
public int queryBindHash() {
|
||||
int hc = (id == null ? 0 : id.hashCode());
|
||||
hc = hc * 31 + (whereExpressions == null ? 0 : whereExpressions.queryBindHash());
|
||||
hc = hc * 31 + (havingExpressions == null ? 0 : havingExpressions.queryBindHash());
|
||||
hc = hc * 31 + (bindParams == null ? 0 : bindParams.queryBindHash());
|
||||
hc = hc * 31 + (asOf == null ? 0 : asOf.hashCode());
|
||||
hc = hc * 31 + (versionsStart == null ? 0 : versionsStart.hashCode());
|
||||
hc = hc * 31 + (versionsEnd == null ? 0 : versionsEnd.hashCode());
|
||||
hc = hc * 92821 + (whereExpressions == null ? 0 : whereExpressions.queryBindHash());
|
||||
hc = hc * 92821 + (havingExpressions == null ? 0 : havingExpressions.queryBindHash());
|
||||
hc = hc * 92821 + (bindParams == null ? 0 : bindParams.queryBindHash());
|
||||
hc = hc * 92821 + (asOf == null ? 0 : asOf.hashCode());
|
||||
hc = hc * 92821 + (versionsStart == null ? 0 : versionsStart.hashCode());
|
||||
hc = hc * 92821 + (versionsEnd == null ? 0 : versionsEnd.hashCode());
|
||||
return hc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user