Skip to content

Commit 3d2b604

Browse files
committed
added equality check for other color scheme. TODO, transform in RGBA for proper comparisonorg/w3c/css/values/DeviceCMYK.java
1 parent b88e0c1 commit 3d2b604

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

org/w3c/css/values/DeviceCMYK.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ public final void setFallbackColor(ApplContext ac, CssValue val)
104104
}
105105
}
106106

107+
public boolean equals(DeviceCMYK other) {
108+
if (other != null) {
109+
return (vc.equals(other.vc) && vm.equals(other.vm) && vy.equals(other.vy) && vk.equals(other.vk) &&
110+
((alpha == null && other.alpha == null) || (alpha != null && alpha.equals(other.alpha))));
111+
}
112+
return false;
113+
}
114+
107115
/**
108116
* Returns a string representation of the object.
109117
*/

org/w3c/css/values/HWB.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ public void normalize() {
100100
}
101101
}
102102

103+
public boolean equals(HWB other) {
104+
if (other != null) {
105+
return (vh.equals(other.vh) && vw.equals(other.vw) && vb.equals(other.vb) &&
106+
((va == null && other.va == null) || (va != null && va.equals(other.va))));
107+
}
108+
return false;
109+
}
110+
103111
/**
104112
* Returns a string representation of the object.
105113
*/

org/w3c/css/values/LAB.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ public final boolean setGray(boolean isGray) {
8383
return isGray;
8484
}
8585

86+
public boolean equals(LAB other) {
87+
if (other != null) {
88+
return (vl.equals(other.vl) && va.equals(other.va) && vb.equals(other.vb) &&
89+
((alpha == null && other.alpha == null) || (alpha != null && alpha.equals(other.alpha))));
90+
}
91+
return false;
92+
}
8693

8794
/**
8895
* Returns a string representation of the object.

org/w3c/css/values/LCH.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ public final void setAlpha(ApplContext ac, CssValue val)
9595
alpha = RGBA.filterAlpha(ac, val);
9696
}
9797

98+
public boolean equals(LCH other) {
99+
if (other != null) {
100+
return (vl.equals(other.vl) && vc.equals(other.vc) && vh.equals(other.vh) &&
101+
((alpha == null && other.alpha == null) || (alpha != null && alpha.equals(other.alpha))));
102+
}
103+
return false;
104+
}
98105

99106
/**
100107
* Returns a string representation of the object.

0 commit comments

Comments
 (0)