private java.util.HashMap<Float,java.awt.Color> recalculate(final java.util.List<Float> FRACTION_LIST,final java.util.List<java.awt.Color> COLOR_LIST,final float OFFSET){
  final int MAX_FRACTIONS=FRACTION_LIST.size();
  final java.util.HashMap<Float,java.awt.Color> FRACTION_COLORS=new java.util.HashMap<Float,java.awt.Color>(MAX_FRACTIONS);
  for (int i=0; i < MAX_FRACTIONS; i++) {
    final float TMP_FRACTION=FRACTION_LIST.get(i) + OFFSET;
    final java.awt.Color TMP_COLOR=COLOR_LIST.get(i);
    if (TMP_FRACTION <= 0) {
      FRACTION_COLORS.put(1.0f + TMP_FRACTION + 0.0001f,TMP_COLOR);
      final float NEXT_FRACTION;
      final java.awt.Color NEXT_COLOR;
      if (i < MAX_FRACTIONS - 1) {
        NEXT_FRACTION=FRACTION_LIST.get(i + 1) + OFFSET;
        NEXT_COLOR=COLOR_LIST.get(i + 1);
      }
 else {
        NEXT_FRACTION=1 - FRACTION_LIST.get(0) + OFFSET;
        NEXT_COLOR=COLOR_LIST.get(0);
      }
      if (NEXT_FRACTION > 0) {
        final java.awt.Color NEW_FRACTION_COLOR=getColorFromFraction(TMP_COLOR,NEXT_COLOR,(int)((NEXT_FRACTION - TMP_FRACTION) * 10000),(int)((-TMP_FRACTION) * 10000));
        FRACTION_COLORS.put(0.0f,NEW_FRACTION_COLOR);
        FRACTION_COLORS.put(1.0f,NEW_FRACTION_COLOR);
      }
    }
 else     if (TMP_FRACTION >= 1) {
      FRACTION_COLORS.put(TMP_FRACTION - 1.0f - 0.0001f,TMP_COLOR);
      final float PREVIOUS_FRACTION;
      final java.awt.Color PREVIOUS_COLOR;
      if (i > 0) {
        PREVIOUS_FRACTION=FRACTION_LIST.get(i - 1) + OFFSET;
        PREVIOUS_COLOR=COLOR_LIST.get(i - 1);
      }
 else {
        PREVIOUS_FRACTION=FRACTION_LIST.get(MAX_FRACTIONS - 1) + OFFSET;
        PREVIOUS_COLOR=COLOR_LIST.get(MAX_FRACTIONS - 1);
      }
      if (PREVIOUS_FRACTION < 1) {
        final java.awt.Color NEW_FRACTION_COLOR=getColorFromFraction(TMP_COLOR,PREVIOUS_COLOR,(int)((TMP_FRACTION - PREVIOUS_FRACTION) * 10000),(int)(TMP_FRACTION - 1.0f) * 10000);
        FRACTION_COLORS.put(1.0f,NEW_FRACTION_COLOR);
        FRACTION_COLORS.put(0.0f,NEW_FRACTION_COLOR);
      }
    }
 else {
      FRACTION_COLORS.put(TMP_FRACTION,TMP_COLOR);
    }
  }
  FRACTION_LIST.clear();
  COLOR_LIST.clear();
  return FRACTION_COLORS;
}

private java . util . HashMap < Float , java . awt . Color > recalculate ( final java . util . List < Float > FRACTION_LIST , final java . util . List < java . awt . Color > COLOR_LIST , final float OFFSET ) { final int MAX_FRACTIONS = FRACTION_LIST . size ( ) ; final java . util . HashMap < Float , java . awt . Color > FRACTION_COLORS = new java . util . HashMap < Float , java . awt . Color > ( MAX_FRACTIONS ) ; for ( int i = 0 ; i < MAX_FRACTIONS ; i ++ ) { final float TMP_FRACTION = FRACTION_LIST . get ( i ) + OFFSET ; final java . awt . Color TMP_COLOR = COLOR_LIST . get ( i ) ; if ( TMP_FRACTION <= 0 ) { FRACTION_COLORS . put ( 1.0f + TMP_FRACTION + 0.0001f , TMP_COLOR ) ; final float NEXT_FRACTION ; final java . awt . Color NEXT_COLOR ; if ( i < MAX_FRACTIONS - 1 ) { NEXT_FRACTION = FRACTION_LIST . get ( i + 1 ) + OFFSET ; NEXT_COLOR = COLOR_LIST . get ( i + 1 ) ; } else { NEXT_FRACTION = 1 - FRACTION_LIST . get ( 0 ) + OFFSET ; NEXT_COLOR = COLOR_LIST . get ( 0 ) ; } if ( NEXT_FRACTION > 0 ) { final java . awt . Color NEW_FRACTION_COLOR = getColorFromFraction ( TMP_COLOR , NEXT_COLOR , ( int ) ( ( NEXT_FRACTION - TMP_FRACTION ) * 10000 ) , ( int ) ( ( - TMP_FRACTION ) * 10000 ) ) ; FRACTION_COLORS . put ( 0.0f , NEW_FRACTION_COLOR ) ; FRACTION_COLORS . put ( 1.0f , NEW_FRACTION_COLOR ) ; } } else if ( TMP_FRACTION >= 1 ) { FRACTION_COLORS . put ( TMP_FRACTION - 1.0f - 0.0001f , TMP_COLOR ) ; final float PREVIOUS_FRACTION ; final java . awt . Color PREVIOUS_COLOR ; if ( i > 0 ) { PREVIOUS_FRACTION = FRACTION_LIST . get ( i - 1 ) + OFFSET ; PREVIOUS_COLOR = COLOR_LIST . get ( i - 1 ) ; } else { PREVIOUS_FRACTION = FRACTION_LIST . get ( MAX_FRACTIONS - 1 ) + OFFSET ; PREVIOUS_COLOR = COLOR_LIST . get ( MAX_FRACTIONS - 1 ) ; } if ( PREVIOUS_FRACTION < 1 ) { final java . awt . Color NEW_FRACTION_COLOR = getColorFromFraction ( TMP_COLOR , PREVIOUS_COLOR , ( int ) ( ( TMP_FRACTION - PREVIOUS_FRACTION ) * 10000 ) , ( int ) ( TMP_FRACTION - 1.0f ) * 10000 ) ; FRACTION_COLORS . put ( 1.0f , NEW_FRACTION_COLOR ) ; FRACTION_COLORS . put ( 0.0f , NEW_FRACTION_COLOR ) ; } } else { FRACTION_COLORS . put ( TMP_FRACTION , TMP_COLOR ) ; } } FRACTION_LIST . clear ( ) ; COLOR_LIST . clear ( ) ; return FRACTION_COLORS ; }
recalculates the fractions in the fraction_list and their associated colors in the color_list with a given offset . because the conical gradients always starts with 0 at the top and clockwise direction you could rotate the defined conical gradient from - 180 to 180 degrees which equals values from - 0 . 5 to + 0 . 5
