package com.snail.exam;

public class ColorBean {
  private int pRed;
  private int pGreen;
  private int pBlue;
  private String pName;
  public ColorBean(){
    super();
  }
  public ColorBean(String rgbString,String name){
    int rgb = Integer.parseInt(rgbString,16);
    pRed = ( rgb & 0xff0000 ) >>> 16;
    pGreen = ( rgb & 0xff00 ) >>> 8;
    pBlue = rgb & 0xff;
    pName = name;
  }
  public int getRed() {
    return pRed;
  }
  public void setRed(int red) {
    pRed = red;
  }
  public int getGreen() {
    return pGreen;
  }
  public void setGreen(int green) {
    pGreen = green;
  }
  public int getBlue() {
    return pBlue;
  }
  public void setBlue(int blue) {
    pBlue = blue;
  }
  public String getName() {
    return pName;
  }
  public void setName(String name) {
    pName = name;
  }
  public int distance(int red,int green,int blue){
    return Math.abs(red-pRed)+Math.abs(green-pGreen)+Math.abs(blue-pBlue);
  }
}
