legos
Class Body

java.lang.Object
  extended by objectdraw.ObjectDrawObject
      extended by objectdraw.ObjectDrawShape
          extended by legos.LegoPiece
              extended by legos.Body
All Implemented Interfaces:
Dependent, DrawableInterface, LocatableInterface

public class Body
extends LegoPiece

A Body is a LegoPiece representing the body of a lego person. It has four subunits:

Author:
Russell Zahniser (russell@zahniser.net)

Constructor Summary
Body(Color color, DrawingCanvas canvas)
          Construct just the torso of a lego person, placing it on the given canvas.
Body(DrawingCanvas canvas)
          Construct just the torso of a lego person, placing it on the given canvas.
Body(Head head, Legs legs, Arm rightArm, Arm leftArm, Color color, DrawingCanvas canvas)
          Construct a lego person, placing it on the given canvas.
Body(Head head, Legs legs, Arm rightArm, Arm leftArm, DrawingCanvas canvas)
          Construct a lego person, placing it on the given canvas.
 
Method Summary
 Head getHead()
          Return the Head.
 Arm getLeftArm()
          Return the left Arm.
 Legs getLegs()
          Return the Head.
 Arm getRightArm()
          Return the right Arm.
 void setHead(Head head)
          Replace the Head with a different Head.
 void setLeftArm(Arm arm)
          Replace the left Arm with a different Arm.
 void setLegs(Legs legs)
          Replace the Legs with a different Legs.
 void setRightArm(Arm arm)
          Replace the right Arm with a different Arm.
 
Methods inherited from class legos.LegoPiece
addToCanvas, canAttach, contains, detach, getAttachmentPoint, getCanvas, getColor, getDoubleX, getDoubleY, getLocation, getOwner, getSubunit, getSubunitCount, getX, getY, hide, isHidden, move, moveTo, moveTo, removeFromCanvas, removeSubunit, removeSubunit, sendBackward, sendForward, sendToBack, sendToFront, setColor, setSubunit, show, toString
 
Methods inherited from class objectdraw.ObjectDrawShape
clearCanvas, draw, draw, getDrawables, getShape, makeShape, removeCanvas, setMyShape, update
 
Methods inherited from class objectdraw.ObjectDrawObject
deferUpdates, depend, runUpdates, undepend
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface objectdraw.DrawableInterface
draw, getShape
 

Constructor Detail

Body

public Body(Color color,
            DrawingCanvas canvas)
Construct just the torso of a lego person, placing it on the given canvas.

Parameters:
color - the color of the torso.
canvas - the canvas to add this person to.

Body

public Body(DrawingCanvas canvas)
Construct just the torso of a lego person, placing it on the given canvas. The torso will be colored red.

Parameters:
canvas - the canvas to add this person to.

Body

public Body(Head head,
            Legs legs,
            Arm rightArm,
            Arm leftArm,
            Color color,
            DrawingCanvas canvas)
Construct a lego person, placing it on the given canvas.

Parameters:
head - the person's Head.
legs - the person's Legs.
rightArm - the person's right Arm.
leftArm - the person's left Arm.
color - the color of the person's torso.
canvas - the canvas to add this person to.

Body

public Body(Head head,
            Legs legs,
            Arm rightArm,
            Arm leftArm,
            DrawingCanvas canvas)
Construct a lego person, placing it on the given canvas. The torso of the person will be colored red.

Parameters:
head - the person's Head.
legs - the person's Legs.
rightArm - the person's right Arm.
leftArm - the person's left Arm.
canvas - the canvas to add this person to.
Method Detail

getHead

public Head getHead()
Return the Head.

Returns:
the Head.

getLeftArm

public Arm getLeftArm()
Return the left Arm.

Returns:
the left Arm.

getLegs

public Legs getLegs()
Return the Head.

Returns:
the Head.

getRightArm

public Arm getRightArm()
Return the right Arm.

Returns:
the right Arm.

setHead

public void setHead(Head head)
Replace the Head with a different Head.

Parameters:
head - new Head to replace the old one with.

setLeftArm

public void setLeftArm(Arm arm)
Replace the left Arm with a different Arm.

Parameters:
arm - new Arm to replace the old one with.

setLegs

public void setLegs(Legs legs)
Replace the Legs with a different Legs.

Parameters:
legs - new Legs to replace the old one with.

setRightArm

public void setRightArm(Arm arm)
Replace the right Arm with a different Arm.

Parameters:
arm - new Arm to replace the old one with.