/**
* Computes a hash code for a {@link StrokeList}. In the latest version
* of JCommon, the {@link StrokeList} class should implement the hashCode()
* method correctly, but we compute it here anyway so that we can work with
* older versions of JCommon (back to 1.0.0).
*
* @param pre the seed value.
* @param list the list (<code>null</code> permitted).
*
* @return The hash code.
*
* @since 1.0.9
*/
/**
* Computes a hash code for a {@link PaintList}. In the latest version
* of JCommon, the {@link PaintList} class should implement the hashCode()
* method correctly, but we compute it here anyway so that we can work with
* older versions of JCommon (back to 1.0.0).
*
* @param pre the seed value.
* @param list the list (<code>null</code> permitted).
*
* @return The hash code.
*
* @since 1.0.9
*/
/**
* Computes a hash code for a {@link BooleanList}. In the latest version
* of JCommon, the {@link BooleanList} class should implement the hashCode()
* method correctly, but we compute it here anyway so that we can work with
* older versions of JCommon (back to 1.0.0).
*
* @param pre the seed value.
* @param list the list (<code>null</code> permitted).
*
* @return The hash code.
*
* @since 1.0.9
*/
public static int hashCode(int pre, [[#variable1aafd440]] list) {
if (list == null) {
return pre;
}
int result = 127;
int size = list.size();
result = HashUtilities.hashCode(result, size);
// for efficiency, we just use the first, last and middle items to
// compute a hashCode...
if (size > 0) {
result = HashUtilities.hashCode(result, list. [[#variable1aafd5c0]](0));
if (size > 1) {
result = HashUtilities.hashCode(result, list. [[#variable1aafd5c0]](size - 1));
if (size > 2) {
result = HashUtilities.hashCode(result, list. [[#variable1aafd5c0]](size / 2));
}
}
}
return 37 * pre + result;
}
|