01: /*
02: * Created on Mar 11, 2005
03: *
04: * TODO To change the template for this generated file go to
05: * Window - Preferences - Java - Code Style - Code Templates
06: */
07: package net.refractions.udig.project.ui.internal;
08:
09: import java.awt.Color;
10:
11: /**
12: * @author ptozer TODO To change the template for this generated type comment go to Window -
13: * Preferences - Java - Code Style - Code Templates
14: */
15: public class AWTColor {
16: // List<Color> allColours = new ArrayList();
17: private Color colour;
18:
19: /**
20: *
21: */
22: public AWTColor(Color colour) {
23: super ();
24: this .colour = colour;
25: }
26:
27: /**
28: * @return Returns the colour.
29: */
30: public Color getColour() {
31: return colour;
32: }
33:
34: /**
35: * @param colour The colour to set.
36: */
37: public void setColour(Color colour) {
38: this .colour = colour;
39: }
40:
41: //
42: // /**
43: // * An AWTCOlor is equal to another when the red, green, blue and alpha for each colour are
44: // * identical.
45: // *
46: // * @param otherColour
47: // * @return
48: // */
49: // public boolean equals( Object otherColour ) {
50: // if (this.colour.getRed() == otherColour.getColour().getRed()
51: // && this.colour.getGreen() == otherColour.getColour().getGreen()
52: // && this.colour.getBlue() == otherColour.getColour().getBlue()) {
53: // return true;
54: // }
55: // return false;
56: // }
57:
58: @Override
59: public int hashCode() {
60: final int PRIME = 31;
61: int result = 1;
62: result = PRIME * result
63: + ((colour == null) ? 0 : colour.hashCode());
64: return result;
65: }
66:
67: @Override
68: public boolean equals(Object obj) {
69: if (this == obj)
70: return true;
71: if (obj == null)
72: return false;
73: if (getClass() != obj.getClass())
74: return false;
75: final AWTColor other = (AWTColor) obj;
76: if (colour == null) {
77: if (other.colour != null)
78: return false;
79: } else if (!colour.equals(other.colour))
80: return false;
81: return true;
82: }
83:
84: }
|