1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.imaging.color;
18
19
20
21
22
23
24
25
26
27
28
29 public final class ColorCieLuv {
30
31
32
33
34
35
36
37
38
39
40 public static final ColorCieLuv BLACK = new ColorCieLuv(0, 0, 0);
41
42
43
44
45
46
47
48
49
50
51 public static final ColorCieLuv WHITE = new ColorCieLuv(100, 0, -0.017);
52
53
54
55
56
57
58
59
60
61
62 public static final ColorCieLuv RED = new ColorCieLuv(53.233, 175.053, 37.751);
63
64
65
66
67
68
69
70
71
72
73 public static final ColorCieLuv GREEN = new ColorCieLuv(87.737, -83.080, 107.401);
74
75
76
77
78
79
80
81
82
83
84 public static final ColorCieLuv BLUE = new ColorCieLuv(32.303, -9.400, -130.358);
85
86 public final double l;
87 public final double u;
88 public final double v;
89
90 public ColorCieLuv(final double l, final double u, final double v) {
91 this.l = l;
92 this.u = u;
93 this.v = v;
94 }
95
96 @Override
97 public boolean equals(final Object o) {
98 if (this == o) {
99 return true;
100 }
101 if (o == null || getClass() != o.getClass()) {
102 return false;
103 }
104
105 final ColorCieLuv that = (ColorCieLuv) o;
106 if (Double.compare(that.l, l) != 0) {
107 return false;
108 }
109 if (Double.compare(that.u, u) != 0) {
110 return false;
111 }
112 if (Double.compare(that.v, v) != 0) {
113 return false;
114 }
115
116 return true;
117 }
118
119 @Override
120 public int hashCode() {
121 int result;
122 long temp;
123 temp = Double.doubleToLongBits(l);
124 result = (int) (temp ^ temp >>> 32);
125 temp = Double.doubleToLongBits(u);
126 result = 31 * result + (int) (temp ^ temp >>> 32);
127 temp = Double.doubleToLongBits(v);
128 return 31 * result + (int) (temp ^ temp >>> 32);
129 }
130
131 @Override
132 public String toString() {
133 return "{L: " + l + ", u: " + u + ", v: " + v + "}";
134 }
135 }