|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.crwth.systems.Mass
A generic class for a mass.
A Mass is the basis for all objects within the Space. They all have
a name, a color,
a mass, a vector,
and a force associated with them.
| Constructor Summary | |
Mass()
|
|
Mass(double mass)
|
|
Mass(double mass,
Vector vector)
|
|
Mass(Mass mass)
|
|
Mass(String name,
double mass,
Vector vector)
|
|
Mass(Vector vector)
|
|
| Method Summary | |
void |
addForce(Vector force)
Add force to the object's current total of exerted force upon it. |
Color |
getColor()
Returns the color of the object. |
int |
getDimension()
Returns the dimension of the Mass. |
double |
getDistance(Mass mass)
Returns the distance from the object to the given Mass. |
Vector |
getForce()
Get the current force being exerted on the object. |
double |
getMass()
Returns the mass of the object. |
String |
getName()
Returns the name of the object. |
Vector |
getVector()
Returns the vector of the object. |
Vector |
getVector(Mass mass)
Returns a vector from the object to the given Mass. |
boolean |
isStationary()
Returns whether an object is fixed in space. |
boolean |
isVisible()
Returns whether an object is visible. |
void |
setColor(Color color)
Sets the color of the object. |
void |
setForce(Vector force)
Set the force exerted on the object. |
void |
setMass(double mass)
Sets the mass of the object. |
void |
setName(String name)
Sets the name of the object. |
void |
setStationary(boolean b)
Sets whether the object is fixed in space. |
void |
setVector(Vector vector)
Sets the vector of the object. |
void |
setVisible(boolean b)
Sets whether the object is visible. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Mass()
public Mass(double mass)
public Mass(Vector vector)
public Mass(double mass,
Vector vector)
public Mass(String name,
double mass,
Vector vector)
public Mass(Mass mass)
| Method Detail |
public void setMass(double mass)
mass - the new mass.public double getMass()
public void setName(String name)
name - the new name.public String getName()
public void setStationary(boolean b)
b - true if the object should not move.public boolean isStationary()
public void setVisible(boolean b)
b - true if the object should be visible.public boolean isVisible()
public void setColor(Color color)
color - the new color.public Color getColor()
public int getDimension()
Vector is used to determine
this value.
public double getDistance(Mass mass)
throws WrongDimensionException
mass - The Mass to find the distance to.
mass.
WrongDimensionException - if masshas a mismatched dimension.public void setVector(Vector vector)
vector - the new vector.public Vector getVector()
public Vector getVector(Mass mass)
throws WrongDimensionException
mass - the Mass to find the Vector to.
mass.
WrongDimensionException - if mass has a mismatched dimension.
public void addForce(Vector force)
throws WrongDimensionException
force - the force to be added
WrongDimensionException - if force has a mismatched dimension.public Vector getForce()
public void setForce(Vector force)
throws WrongDimensionException
force - the object's new force.
WrongDimensionException - if force has a mismatched dimension.public String toString()
toString in class Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||