package ch.bisi.jbesticon.colorfinder;

import java.awt.Color;

/**
 * Class representing a {@link Color} shifted by N pixels.
 */
public class ShiftedColor {

  private int shift;
  private Color color;

  public ShiftedColor(final int shift, final Color color) {
    this.shift = shift;
    this.color = color;
  }

  public int getShift() {
    return shift;
  }

  public Color getColor() {
    return color;
  }

  public int getRed() {
    return this.color.getRed();
  }

  public int getGreen() {
    return this.color.getGreen();
  }

  public int getBlue() {
    return this.getColor().getBlue();
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    ShiftedColor that = (ShiftedColor) o;

    if (shift != that.shift) {
      return false;
    }

    return color != null ? color.equals(that.color) : that.color == null;
  }

  @Override
  public int hashCode() {
    int result = shift;
    result = 31 * result + (color != null ? color.hashCode() : 0);
    return result;
  }

  @Override
  public String toString() {
    return "ShiftedColor{" +
        "shift=" + shift +
        ", color=" + color +
        '}';
  }
}

@@ -609,32 +609,80 @@
  %7D%0A%0A  @Override%0A
+  @SuppressWarnings(%22PMD.CyclomaticComplexity%22)%0A
   public boolean
@@ -693,16 +693,22 @@
 als(
+final 
 Object o
 ) %7B%0A
@@ -703,16 +703,20 @@
 Object o
+ther
 ) %7B%0A    
@@ -728,16 +728,20 @@
 his == o
+ther
 ) %7B%0A    
@@ -770,16 +770,20 @@
    if (o
+ther
  == null
@@ -801,16 +801,20 @@
 s() != o
+ther
 .getClas
@@ -851,16 +851,22 @@
  %7D%0A%0A    
+final 
 ShiftedC
@@ -893,16 +893,20 @@
 Color) o
+ther
 ;%0A%0A    i
@@ -1257,26 +1257,24 @@
 dColor%7B%22
- +
 %0A       
  %22shift=
@@ -1265,16 +1265,18 @@
 %0A       
+ +
  %22shift=
@@ -1284,26 +1284,24 @@
  + shift
- +
 %0A       
  %22, colo
@@ -1292,16 +1292,18 @@
 %0A       
+ +
  %22, colo
@@ -1317,18 +1317,16 @@
 olor
- +
 %0A       
  '%7D'
@@ -1321,16 +1321,18 @@
 %0A       
+ +
  '%7D';%0A  

Fix ShiftedColor PMD and Checkstyle warnings