javalib.worldimages
Class CircleImage

java.lang.Object
  extended by javalib.worldimages.AImage
      extended by javalib.worldimages.ColoredImage
          extended by javalib.worldimages.RectangularImage
              extended by javalib.worldimages.EllipseImage
                  extended by javalib.worldimages.CircleImage
All Implemented Interfaces:
Drawable, WorldImage, tester.ISame<WorldImage>

 class CircleImage
extends EllipseImage

An outlined circle

Version:
Dec. 2, 2012
Author:
Stephen Bloch

Field Summary
 
Fields inherited from class javalib.worldimages.ColoredImage
defaultColor
 
Fields inherited from interface javalib.worldimages.WorldImage
LOOKS_SAME
 
Method Summary
 boolean equals(Object other)
          Is this the same as another WorldImage, as expression trees? Define this at every level that has instance variables.
 int getBottom()
          Produce the bottom of the bounding box.
 int getRadius()
           
 int getRight()
          Produce the bottom of the bounding box.
 int hashCode()
          Get a hash code for the WorldImage.
(package private) static CircleImage make(int radius)
          Another pseudo-constructor, with default color and mode.
(package private) static CircleImage make(int radius, Color color)
          Another pseudo-constructor, with a Color and a default mode.
(package private) static CircleImage make(int radius, Color color, Mode mode)
          Pseudo-constructor.
(package private) static CircleImage make(int radius, IColor color)
          Another pseudo-constructor, with an IColor and a default mode.
(package private) static CircleImage make(int radius, IColor color, Mode mode)
          Pseudo-constructor.
(package private) static CircleImage make(int radius, Mode mode)
          Another pseudo-constructor, with a default color.
(package private) static WorldImage makeCentered(Posn center, int radius)
           
(package private) static WorldImage makeCentered(Posn center, int radius, Color color)
           
(package private) static WorldImage makeCentered(Posn center, int radius, Color color, Mode mode)
           
(package private) static WorldImage makeCentered(Posn center, int radius, IColor color)
           
(package private) static WorldImage makeCentered(Posn center, int radius, IColor color, Mode mode)
           
(package private) static WorldImage makeCentered(Posn center, int radius, Mode mode)
           
(package private)  ColoredImage replaceColor(Color newColor)
          Functional setter for the color field Define this in all concrete subclasses.
(package private)  ColoredImage replaceMode(Mode newMode)
          Functional setter for the mode field Define this in all concrete subclasses.
(package private)  CircleImage replaceRadius(int newRadius)
           
 String toIndentedString(String indent)
          Produce a String that represents this image, indented by the given indent.
 
Methods inherited from class javalib.worldimages.EllipseImage
draw, make, make, make, make, make, make, replaceDimensions
 
Methods inherited from class javalib.worldimages.RectangularImage
replaceHeight, replaceWidth
 
Methods inherited from class javalib.worldimages.ColoredImage
getColor, getMode, replaceColor
 
Methods inherited from class javalib.worldimages.AImage
above, aboveCentered, beside, besideCentered, build, build, centerMoved, centerMoved, cornerString, cropped, frozen, getCenter, getHeight, getLeft, getPixelColor, getTop, getWidth, isApplet, makeCenteredCircle, makeCenteredCircle, makeCenteredCircle, makeCenteredCircle, makeCenteredCircle, makeCenteredCircle, makeCircle, makeCircle, makeCircle, makeCircle, makeCircle, makeCircle, makeEllipse, makeEllipse, makeEllipse, makeEllipse, makeEllipse, makeEllipse, makeFromFile, makeFromURL, makeImage, makeLine, makeLine, makeLine, makePolygon, makePolygon, makePolygon, makePolygon, makePolygon, makePolygon, makeRectangle, makeRectangle, makeRectangle, makeRectangle, makeRectangle, makeRectangle, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeText, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, makeTriangle, map, map, moved, moved, normalized, overlay, overlayCentered, overlayImages, overlayXY, place, rotate, rotated, rotated, rotatedAround, rotatedAround, rotatedInPlace, rotatedInPlace, same, sameClass, save, scaled, scaled, show, toString, xReflected, yReflected
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

equals

public boolean equals(Object other)
Description copied from interface: WorldImage
Is this the same as another WorldImage, as expression trees? Define this at every level that has instance variables.

Specified by:
equals in interface WorldImage
Overrides:
equals in class RectangularImage
Parameters:
other - the object to compare with this
Returns:
true iff the images are isomorphic expression trees, with equal fields.

getBottom

public int getBottom()
Description copied from interface: WorldImage
Produce the bottom of the bounding box.

Specified by:
getBottom in interface WorldImage
Overrides:
getBottom in class RectangularImage
Returns:
the y coordinate of the bottom of the bounding box

getRadius

public int getRadius()

getRight

public int getRight()
Description copied from interface: WorldImage
Produce the bottom of the bounding box.

Specified by:
getRight in interface WorldImage
Overrides:
getRight in class RectangularImage
Returns:
the x coordinate of the right edge of the bounding box

hashCode

public int hashCode()
Description copied from interface: WorldImage
Get a hash code for the WorldImage. Needs to agree with equals(). In our case, "equals" means they're the same as expression trees.

Specified by:
hashCode in interface WorldImage
Overrides:
hashCode in class RectangularImage

make

static CircleImage make(int radius)
Another pseudo-constructor, with default color and mode.


make

static CircleImage make(int radius,
                        Color color)
Another pseudo-constructor, with a Color and a default mode.


make

static CircleImage make(int radius,
                        Color color,
                        Mode mode)
Pseudo-constructor.

Parameters:
radius -
color -
mode -

make

static CircleImage make(int radius,
                        IColor color)
Another pseudo-constructor, with an IColor and a default mode.


make

static CircleImage make(int radius,
                        IColor color,
                        Mode mode)
Pseudo-constructor.


make

static CircleImage make(int radius,
                        Mode mode)
Another pseudo-constructor, with a default color.


makeCentered

static WorldImage makeCentered(Posn center,
                               int radius)

makeCentered

static WorldImage makeCentered(Posn center,
                               int radius,
                               Color color)

makeCentered

static WorldImage makeCentered(Posn center,
                               int radius,
                               Color color,
                               Mode mode)

makeCentered

static WorldImage makeCentered(Posn center,
                               int radius,
                               IColor color)

makeCentered

static WorldImage makeCentered(Posn center,
                               int radius,
                               IColor color,
                               Mode mode)

makeCentered

static WorldImage makeCentered(Posn center,
                               int radius,
                               Mode mode)

replaceColor

ColoredImage replaceColor(Color newColor)
Description copied from class: ColoredImage
Functional setter for the color field Define this in all concrete subclasses. (I HATE this! Every one of these definitions will consist of calling the constructor with exactly the same fields but newColor plugged in as the color. Why do I have to write that over and over in every concrete subclass?)

Overrides:
replaceColor in class EllipseImage
Returns:
a new image just like this one but with a different color

replaceMode

ColoredImage replaceMode(Mode newMode)
Description copied from class: ColoredImage
Functional setter for the mode field Define this in all concrete subclasses.

Overrides:
replaceMode in class EllipseImage
Returns:
a new image just like this one but with a different mode

replaceRadius

CircleImage replaceRadius(int newRadius)

toIndentedString

public String toIndentedString(String indent)
Description copied from interface: WorldImage
Produce a String that represents this image, indented by the given indent.

Define this in all concrete subclasses.

Convention: The result of toIndentedString() will neither begin nor end with a newline; the specified indent will immediately follow each internal newline.

Specified by:
toIndentedString in interface WorldImage
Overrides:
toIndentedString in class EllipseImage
Parameters:
indent - the given prefix representing the desired indentation
Returns:
the String representation of this image