|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.crwth.systems.Spring
A generic class for a spring.
A Spring is the connector betweem all Mass objects. They
all have a name, a color,
a strength, a visibility and two Masses.
| Constructor Summary | |
Spring()
|
|
Spring(Mass m1,
Mass m2)
|
|
Spring(Mass m1,
Mass m2,
double strength)
|
|
Spring(Spring spring)
|
|
| Method Summary | |
Color |
getColor()
Returns the color of the spring. |
int |
getDimension()
Returns the dimension of the Spring. |
Mass |
getMass1()
Returns the first mass on the spring. |
Mass |
getMass2()
Returns the second mass on the spring. |
String |
getName()
Returns the name of the spring. |
double |
getStrength()
Returns the strength of the spring. |
Vector |
getVector()
Returns the vector from the first mass to the second mass. |
boolean |
isVisible()
Returns whether the spring is visible or not. |
void |
setColor(Color color)
Sets the color of the Spring. |
void |
setMass1(Mass mass)
Sets the first mass on the spring. |
void |
setMass2(Mass mass)
Sets the second mass on the spring. |
void |
setStrength(double strength)
Sets the strength of the spring. |
void |
setVisible(boolean b)
Sets whether the spring is visible or not. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Spring()
public Spring(Mass m1,
Mass m2)
throws WrongDimensionException
public Spring(Mass m1,
Mass m2,
double strength)
throws WrongDimensionException
public Spring(Spring spring)
| Method Detail |
public void setMass1(Mass mass)
throws WrongDimensionException
mass - new first mass.
WrongDimensionException - if mass has a mismatched dimension from the second mass.public Mass getMass1()
public void setMass2(Mass mass)
throws WrongDimensionException
mass - new second mass.
WrongDimensionException - if mass has a mismatched dimension from the first mass.public Mass getMass2()
public Vector getVector()
public void setStrength(double strength)
strength - the new strength.public double getStrength()
public void setVisible(boolean b)
b - true if the spring should be visible.public boolean isVisible()
public void setColor(Color color)
color - the new color.public Color getColor()
public String getName()
public int getDimension()
public String toString()
toString in class Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||