public Color getColorAt(final double POSITION_OF_COLOR) {
        if (stops.isEmpty()) return Color.BLACK;

        final double POSITION = Helper.clamp(0.0, 1.0, POSITION_OF_COLOR);
        final Color COLOR;
        if (stops.size() == 1) {
            final Map<Double, Color> ONE_ENTRY = (Map<Double, Color>) stops.entrySet().iterator().next();
            COLOR = stops.get(ONE_ENTRY.keySet().iterator().next()).getColor();
        } else {
            Stop lowerBound = stops.get(0.0);
            Stop upperBound = stops.get(1.0);
            for (Double fraction : stops.keySet()) {
                if (Double.compare(fraction,POSITION) < 0) {
                    lowerBound = stops.get(fraction);
                }
                if (Double.compare(fraction, POSITION) > 0) {
                    upperBound = stops.get(fraction);
                    break;
                }
            }
            COLOR = interpolateColor(lowerBound, upperBound, POSITION);
        }
        return COLOR;
    }
public Color getColorAt ( final double POSITION_OF_COLOR ) { if ( stops . isEmpty ( ) ) return Color . BLACK ; final double POSITION = Helper . clamp ( 0.0 , 1.0 , POSITION_OF_COLOR ) ; final Color COLOR ; if ( stops . size ( ) == 1 ) { final Map < Double , Color > ONE_ENTRY = ( Map < Double , Color > ) stops . entrySet ( ) . iterator ( ) . next ( ) ; COLOR = stops . get ( ONE_ENTRY . keySet ( ) . iterator ( ) . next ( ) ) . getColor ( ) ; } else { Stop lowerBound = stops . get ( 0.0 ) ; Stop upperBound = stops . get ( 1.0 ) ; for ( Double fraction : stops . keySet ( ) ) { if ( Double . compare ( fraction , POSITION ) < 0 ) { lowerBound = stops . get ( fraction ) ; } if ( Double . compare ( fraction , POSITION ) > 0 ) { upperBound = stops . get ( fraction ) ; break ; } } COLOR = interpolateColor ( lowerBound , upperBound , POSITION ) ; } return COLOR ; }
******************** Methods *******************************************