net.pacbell.jfai.toh.ui
Class PinView

java.lang.Object
  extended by net.pacbell.jfai.toh.ui.PinView

public class PinView
extends Object

Visualizes a pin of the Tower Of Hanoi puzzle.


Constructor Summary
PinView(Pin aModel, Point3f baseLocation, Appearance anAppearance)
          Create a new instance given a Pin as the model and the location of the base cap of the pin.
 
Method Summary
 Point3f diskLocation(Disk disk)
          Answer a point for the center of the disk view of the given disk.
 Point3f diskLocation(int topPosition)
          Answer a point for the center of the disk view that represents the disk in the tower with the given 1-based position.
 Appearance getAppearance()
          Gets the appearance.
 Point3f getBaseLocation()
          Gets the point where the pin and the base meet.
 BranchGroup getGroup()
          Gets the branch group.
 Pin getModel()
          Gets the model.
 Point3f getTopLocation()
          Gets the position of the pin's top.
static float height()
          Answers the pin height.
static float stackHeight()
          Answers the maximum height of a stack of disks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PinView

public PinView(Pin aModel,
               Point3f baseLocation,
               Appearance anAppearance)
Create a new instance given a Pin as the model and the location of the base cap of the pin.

Parameters:
aModel - a Pin
baseLocation - the absolute position where the pin meets the base
anAppearance - the Appearance
Method Detail

height

public static final float height()
Answers the pin height.

Returns:
the total height of the pin

stackHeight

public static final float stackHeight()
Answers the maximum height of a stack of disks.

Returns:
the maximum height

diskLocation

public Point3f diskLocation(Disk disk)
Answer a point for the center of the disk view of the given disk. If the disk is not in the receiver's tower, the location above the top of the tower is returned.

Parameters:
disk - a Disk
Returns:
The absolute coordinates of the disk's center point corresponding to the given position.

diskLocation

public Point3f diskLocation(int topPosition)
Answer a point for the center of the disk view that represents the disk in the tower with the given 1-based position. The position is relative to the top of the tower.

Parameters:
topPosition - This is 1 for the disk at the top. It increases by 1 for each disk in the stack (if any).
Returns:
The absolute coordinates of the disk's center point corresponding to the given position.

getAppearance

public Appearance getAppearance()
Gets the appearance.

Returns:
the Appearance

getBaseLocation

public Point3f getBaseLocation()
Gets the point where the pin and the base meet.

Returns:
the absolute position of the pin's bottom

getGroup

public BranchGroup getGroup()
Gets the branch group.

Returns:
the BranchGroup

getModel

public Pin getModel()
Gets the model.

Returns:
the Pin

getTopLocation

public Point3f getTopLocation()
Gets the position of the pin's top.

Returns:
the absolute position of the top