class EdgeColor {

    private final Mode mode;
    private final Color customColor;

    public EdgeColor(Mode mode) {
        customColor = mode.equals(Mode.CUSTOM) ? Color.BLACK : null;
        this.mode = mode;
    }

    public EdgeColor(Color customColor) {
        this.customColor = customColor;
        this.mode = Mode.CUSTOM;
    }

    public Mode getMode() {
        return mode;
    }

    public Color getCustomColor() {
        return customColor;
    }

    public Color getColor(Color edgeColor, Color sourceColor, Color targetColor) {<FILL_FUNCTION_BODY>}

    public enum Mode {

        SOURCE, TARGET, MIXED, CUSTOM, ORIGINAL
    }
}

        switch (mode) {
            case ORIGINAL:
                return edgeColor != null ? edgeColor : Color.BLACK;
            case SOURCE:
                return sourceColor;
            case TARGET:
                return targetColor;
            case MIXED:
                return new Color((int) ((sourceColor.getRed() + targetColor.getRed()) / 2f),
                    (int) ((sourceColor.getGreen() + targetColor.getGreen()) / 2f),
                    (int) ((sourceColor.getBlue() + targetColor.getBlue()) / 2f),
                    (int) ((sourceColor.getAlpha() + targetColor.getAlpha()) / 2f));
            case CUSTOM:
                return customColor;
        }
        return null;
    
<no_super_class>