|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdbrown.RTModel
public class RTModel
The right triangle model. Allows users to update the base and height separately.
Field Summary | |
---|---|
private double |
base
The inital size of the base. |
private double |
height
The initial size of the height. |
static double |
MAX_SIDE
The maximum size of each of the two non-hypotenuse sides of the triangle. |
private java.util.ArrayList<IView> |
views
A collection of views of the model. |
Constructor Summary | |
---|---|
RTModel()
|
Method Summary | |
---|---|
void |
addView(IView newView)
Adds a view to the model's collection of views. |
void |
deleteView(IView oldView)
Removes a view from the model's collection of views. |
double |
getBase()
Returns the value of the model's base. |
double |
getHeight()
Returns the value of the model's height. |
double |
getHypotenuse()
Calculates and returns the hypotenuse. |
void |
setBase(double newBase)
Assigns a value to the model's base and updates all views accordingly. |
void |
setHeight(double newHeight)
Assigns a value to the model's height and updates all views accordingly. |
private void |
updateViews()
Updates all views attached to the model. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double MAX_SIDE
private double base
private double height
private java.util.ArrayList<IView> views
Constructor Detail |
---|
public RTModel()
Method Detail |
---|
public void addView(IView newView)
newView
- The view to add to the model's collection of views.public void deleteView(IView oldView)
oldView
- The view to be removed from the model's collection of views.public double getBase()
public double getHeight()
public double getHypotenuse()
public void setBase(double newBase)
newBase
- The base value to set.public void setHeight(double newHeight)
newHeight
- The height value to set.private void updateViews()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |