示例#1
0
 private final int getHashCode() {
   // 31 * x == (x << 5) - x
   int hash = 31 + getId();
   hash = ((hash << 5) - hash) + sizeAndRRate.hashCode();
   hash = ((hash << 5) - hash) + getRotation();
   return hash;
 }
示例#2
0
 /**
  * Compares {@link SizeAndRRate#compareTo(SizeAndRRate) sizeAndRRate} 1st, then {@link #rotation}.
  *
  * <p>Rotation is compared inverted, i.e. <code>360 - rotation</code>, so the lowest rotation
  * reflects a higher value.
  *
  * <p>Order of comparing MonitorMode:
  *
  * <ul>
  *   <li>resolution
  *   <li>bits per pixel
  *   <li>flags
  *   <li>refresh rate
  *   <li>rotation
  * </ul>
  *
  * {@inheritDoc}
  */
 @Override
 public int compareTo(final MonitorMode mm) {
   final int c = sizeAndRRate.compareTo(mm.sizeAndRRate);
   if (0 != c) {
     return c;
   }
   final int trot = 360 - rotation; // normalize rotation
   final int xrot = 360 - mm.rotation; // normalize rotation
   if (trot > xrot) {
     return 1;
   } else if (trot < xrot) {
     return -1;
   }
   return 0;
 }