|
JML | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jmlspecs.samples.dbc.ComplexOps org.jmlspecs.samples.dbc.Polar
Complex numbers in polar coordinates.
Class Specifications |
Specifications inherited from class Object |
represents objectState <- org.jmlspecs.lang.JMLDataGroup.IT; public represents _getClass <- \typeof(this); |
Specifications inherited from interface Complex |
axiom ( \forall double d, dd; dd > 0.0; d%dd > -dd&&d%dd < dd); axiom ( \forall double d, dd; ; d > -dd ==> d+dd > 0.0); |
Model Field Summary |
Model fields inherited from class java.lang.Object |
_getClass, objectState, theString |
Ghost Field Summary |
Ghost fields inherited from class java.lang.Object |
objectTimesFinalized, owner |
Ghost fields inherited from interface org.jmlspecs.samples.dbc.Complex |
tolerance |
Field Summary | |
private double |
ang
The angle of this number. |
private double |
mag
The magnitude of this number. |
Constructor Summary | |
Polar(double mag,
double ang)
Initialize this polar coordinate number with magnitude mag and angle ang, except that when the magnitude is negative, this is interpreted as magnitude -mag and angle ang+StrictMath.PI. |
Model Method Summary |
Model methods inherited from class java.lang.Object |
hashValue |
Model methods inherited from interface org.jmlspecs.samples.dbc.Complex |
positiveRemainder, similarAngle |
Method Summary | |
double |
angle()
Return the angle of this complex number. |
double |
imaginaryPart()
Return the imaginary part of this complex number. |
double |
magnitude()
Return the magnitude of this complex number. |
double |
realPart()
Return the real part of this complex number. |
static double |
standardizeAngle(double rad)
Standardize the angle so it's between -StrictMath.PI and StrictMath.PI (radians). |
String |
toString()
|
Methods inherited from class org.jmlspecs.samples.dbc.ComplexOps |
add, div, equals, hashCode, mul, sub |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private double mag
private double ang
Constructor Detail |
public Polar(double mag, double ang) throws IllegalArgumentException
mag
- the magnitude desiredang
- the angle in radians, measured
counterclockwise from the positive x axis
IllegalArgumentException
Method Detail |
public static double standardizeAngle(double rad) throws IllegalArgumentException
IllegalArgumentException
public double realPart()
Complex
public double imaginaryPart()
Complex
public double magnitude()
Complex
public double angle()
Complex
public String toString()
toString
in class Object
|
JML | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |