java.lang.Object | +--AView | +--DrawingTool
DrawingTool is like a drawing pen that can be moved around a drawing canvas This is similar to a turtle from the LOGO programming language. Class Invariant parentContainer == window AND up <= direction <= left
Constructor Summary | |
DrawingTool()
postcondition old window != null IMPLIES window == old window AND window.getWidth()==400 AND window.getHeight()==300 AND getX()==195 AND getY()==141 AND getWidth()==getHeight()==9 AND isDrawing AND direction == up AND getColor() == Color.green |
Method Summary | |
void |
dontDraw()
postconditon NOT isDrawing AND getColor == Color.red |
void |
draw()
postconditon isDrawing AND getColor == Color.green |
void |
fill(java.awt.Graphics g)
postconditon this AView is drawn as an arrow using the given getColor() |
void |
finalize()
postconditon window == null |
void |
moveForward()
postconditon (locX, locY) is a point that is 20 units from (old locX, old locY) moving according to direction AND isDrawing IMPLIES a line segment is drawn connecting (locX, locY) with (old locX, old locY) |
void |
moveForwardBy(int d)
postconditon (locX, locY) is a point that is d units from (old locX, old locY) moving according to direction AND isDrawing IMPLIES a line segment is drawn connecting (locX, locY) with (old locX, old locY) |
void |
stroke(java.awt.Graphics g)
postconditon this AView is drawn as an arrow using the given getColor() |
void |
turnClockwise()
postconditon direction == a 90 clockwise rotation from old direction |
void |
turnCounterclockwise()
postconditon direction == a 90 counterclockwise rotation from old direction |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DrawingTool()
Method Detail |
public void dontDraw()
public void draw()
public void fill(java.awt.Graphics g)
public void finalize()
public void moveForward()
public void moveForwardBy(int d)
public void stroke(java.awt.Graphics g)
public void turnClockwise()
public void turnCounterclockwise()