@Test public void testGetPaint() { GrayPaintScale gps = new GrayPaintScale(); Color c = (Color) gps.getPaint(0.0); assertEquals(c, Color.BLACK); c = (Color) gps.getPaint(1.0); assertEquals(c, Color.WHITE); c = (Color) gps.getPaint(-0.5); assertEquals(c, Color.BLACK); c = (Color) gps.getPaint(1.5); assertEquals(c, Color.WHITE); c = (Color) gps.getPaint(Double.NaN); assertEquals(c, Color.BLACK); c = (Color) gps.getPaint(Double.POSITIVE_INFINITY); assertEquals(c, Color.WHITE); c = (Color) gps.getPaint(Double.NEGATIVE_INFINITY); assertEquals(c, Color.BLACK); }
@Override public Paint getPaint(double value) { double v = Math.max(value, this.lowerBound); v = Math.min(v, this.upperBound); int g = (int) ((v - this.lowerBound) / (this.upperBound - this.lowerBound) * 255.0); if (this.shades[g] == null) { this.shades[g] = new Color(g, g, g, this.alpha); } return this.shades[g]; }
GrayPaintScale implements PaintScale, PublicCloneable,
        Serializable { @Override public Paint getPaint(double value) { double v = Math.max(value, this.lowerBound); v = Math.min(v, this.upperBound); int g = (int) ((v - this.lowerBound) / (this.upperBound - this.lowerBound) * 255.0); if (this.shades[g] == null) { this.shades[g] = new Color(g, g, g, this.alpha); } return this.shades[g]; } }
GrayPaintScale implements PaintScale, PublicCloneable,
        Serializable { @Override public Paint getPaint(double value) { double v = Math.max(value, this.lowerBound); v = Math.min(v, this.upperBound); int g = (int) ((v - this.lowerBound) / (this.upperBound - this.lowerBound) * 255.0); if (this.shades[g] == null) { this.shades[g] = new Color(g, g, g, this.alpha); } return this.shades[g]; } GrayPaintScale();  GrayPaintScale(double lowerBound, double upperBound);  GrayPaintScale(double lowerBound, double upperBound, int alpha); }
GrayPaintScale implements PaintScale, PublicCloneable,
        Serializable { @Override public Paint getPaint(double value) { double v = Math.max(value, this.lowerBound); v = Math.min(v, this.upperBound); int g = (int) ((v - this.lowerBound) / (this.upperBound - this.lowerBound) * 255.0); if (this.shades[g] == null) { this.shades[g] = new Color(g, g, g, this.alpha); } return this.shades[g]; } GrayPaintScale();  GrayPaintScale(double lowerBound, double upperBound);  GrayPaintScale(double lowerBound, double upperBound, int alpha); @Override double getLowerBound(); @Override double getUpperBound(); int getAlpha(); @Override Paint getPaint(double value); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); }
GrayPaintScale implements PaintScale, PublicCloneable,
        Serializable { @Override public Paint getPaint(double value) { double v = Math.max(value, this.lowerBound); v = Math.min(v, this.upperBound); int g = (int) ((v - this.lowerBound) / (this.upperBound - this.lowerBound) * 255.0); if (this.shades[g] == null) { this.shades[g] = new Color(g, g, g, this.alpha); } return this.shades[g]; } GrayPaintScale();  GrayPaintScale(double lowerBound, double upperBound);  GrayPaintScale(double lowerBound, double upperBound, int alpha); @Override double getLowerBound(); @Override double getUpperBound(); int getAlpha(); @Override Paint getPaint(double value); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }