@Test public void testGetValidIndex_WithEmptySymbol() throws Exception { assertEquals(0, SpectrumShapeProvider.getValidIndex(0, true)); assertEquals(1, SpectrumShapeProvider.getValidIndex(1, true)); assertEquals(2, SpectrumShapeProvider.getValidIndex(2, true)); assertEquals(3, SpectrumShapeProvider.getValidIndex(3, true)); assertEquals(4, SpectrumShapeProvider.getValidIndex(4, true)); assertEquals(5, SpectrumShapeProvider.getValidIndex(5, true)); assertEquals(6, SpectrumShapeProvider.getValidIndex(6, true)); assertEquals(7, SpectrumShapeProvider.getValidIndex(7, true)); assertEquals(8, SpectrumShapeProvider.getValidIndex(8, true)); assertEquals(9, SpectrumShapeProvider.getValidIndex(9, true)); assertEquals(10, SpectrumShapeProvider.getValidIndex(10, true)); assertEquals(0, SpectrumShapeProvider.getValidIndex(11, true)); assertEquals(1, SpectrumShapeProvider.getValidIndex(12, true)); }
public static int getValidIndex(int i, boolean allowEmptySymbol) { if(allowEmptySymbol) { return i % shapes.length; } else { return i % (shapes.length - 1) + 1; } }
SpectrumShapeProvider { public static int getValidIndex(int i, boolean allowEmptySymbol) { if(allowEmptySymbol) { return i % shapes.length; } else { return i % (shapes.length - 1) + 1; } } }
SpectrumShapeProvider { public static int getValidIndex(int i, boolean allowEmptySymbol) { if(allowEmptySymbol) { return i % shapes.length; } else { return i % (shapes.length - 1) + 1; } }  }
SpectrumShapeProvider { public static int getValidIndex(int i, boolean allowEmptySymbol) { if(allowEmptySymbol) { return i % shapes.length; } else { return i % (shapes.length - 1) + 1; } }  static Shape getScaledShape(int shapeIndex, int scaleGrade); static int getValidIndex(int i, boolean allowEmptySymbol); static ImageIcon getShapeIcon(int symbolIndex); static ImageIcon[] getShapeIcons(); static Integer[] getScaleGrades(); static int getShape(ImageIcon shapeIcon); }
SpectrumShapeProvider { public static int getValidIndex(int i, boolean allowEmptySymbol) { if(allowEmptySymbol) { return i % shapes.length; } else { return i % (shapes.length - 1) + 1; } }  static Shape getScaledShape(int shapeIndex, int scaleGrade); static int getValidIndex(int i, boolean allowEmptySymbol); static ImageIcon getShapeIcon(int symbolIndex); static ImageIcon[] getShapeIcons(); static Integer[] getScaleGrades(); static int getShape(ImageIcon shapeIcon); static final int DEFAULT_SCALE_GRADE; static final int EMPTY_SHAPE_INDEX; }