public class PigmentColor {
  public PigmentColor mixedWith(PigmentColor other,
                        double ratio) {
    // Wiele wierszy skomplikowanej logiki mieszania farb,
    // kończącej się utworzeniem nowego obiektu PigmentColor
    // z odpowiednimi wartościami atrybutów red, blue oraz yellow
    }
}

public class Paint {
    public void mixIn(Paint other) {
    volume = volume + other.getVolume();
    double ratio = other.getVolume() / volume;
    pigmentColor =
        pigmentColor.mixedWith(other.pigmentColor(), ratio);
    }
}
