@Test public void decreaseFactor1() { assertThat(LogValueScale.decreaseFactor(200), equalTo(100)); }
static int decreaseFactor(int factor) { if (factor == 1) { return 1; } int order = 1; while (factor >= 10) { factor /= 10; order *= 10; } if (factor == 1) { return order / 2; } if (factor == 5) { return order * 2; } if (factor == 2) { return order; } throw new IllegalStateException("Logic error: this should be unreachable"); }
LogValueScale implements ValueScale { static int decreaseFactor(int factor) { if (factor == 1) { return 1; } int order = 1; while (factor >= 10) { factor /= 10; order *= 10; } if (factor == 1) { return order / 2; } if (factor == 5) { return order * 2; } if (factor == 2) { return order; } throw new IllegalStateException("Logic error: this should be unreachable"); } }
LogValueScale implements ValueScale { static int decreaseFactor(int factor) { if (factor == 1) { return 1; } int order = 1; while (factor >= 10) { factor /= 10; order *= 10; } if (factor == 1) { return order / 2; } if (factor == 5) { return order * 2; } if (factor == 2) { return order; } throw new IllegalStateException("Logic error: this should be unreachable"); }  }
LogValueScale implements ValueScale { static int decreaseFactor(int factor) { if (factor == 1) { return 1; } int order = 1; while (factor >= 10) { factor /= 10; order *= 10; } if (factor == 1) { return order / 2; } if (factor == 5) { return order * 2; } if (factor == 2) { return order; } throw new IllegalStateException("Logic error: this should be unreachable"); }  @Override double scaleValue(double value, double minValue, double maxValue, double newMinValue, double newMaxValue); @Override double invScaleValue(double scaleValue, double actualMinValue, double actualMaxValue, double scaleMinValue, double scaleMaxValue); @Override ValueAxis references(Range range, int minRefs, int maxRefs); }
LogValueScale implements ValueScale { static int decreaseFactor(int factor) { if (factor == 1) { return 1; } int order = 1; while (factor >= 10) { factor /= 10; order *= 10; } if (factor == 1) { return order / 2; } if (factor == 5) { return order * 2; } if (factor == 2) { return order; } throw new IllegalStateException("Logic error: this should be unreachable"); }  @Override double scaleValue(double value, double minValue, double maxValue, double newMinValue, double newMaxValue); @Override double invScaleValue(double scaleValue, double actualMinValue, double actualMaxValue, double scaleMinValue, double scaleMaxValue); @Override ValueAxis references(Range range, int minRefs, int maxRefs);  }