mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
Implement Common Cause
This commit is contained in:
parent
e8c96ad83f
commit
d9649fd54c
4 changed files with 111 additions and 1 deletions
|
|
@ -99,6 +99,23 @@ public class ObjectColor implements Serializable, Copyable<ObjectColor>, Compara
|
|||
return newColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new color which contains the intersection of the colors of this
|
||||
* ObjectColor and the other ObjectColor.
|
||||
*
|
||||
* @param other The other ObjectColor to intersect with
|
||||
* @return A new color which is the intersection of this and other
|
||||
*/
|
||||
public ObjectColor intersection(ObjectColor other) {
|
||||
ObjectColor newColor = new ObjectColor();
|
||||
newColor.white = white && other.white;
|
||||
newColor.blue = blue && other.blue;
|
||||
newColor.black = black && other.black;
|
||||
newColor.red = red && other.red;
|
||||
newColor.green = green && other.green;
|
||||
return newColor;
|
||||
}
|
||||
|
||||
public int getColorCount() {
|
||||
int count = 0;
|
||||
if (white) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue