Formatting only. Eliminated tabs.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@479144 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1d1e19921c
commit
b209e197b3
|
@ -494,9 +494,9 @@ public class Rotation implements Serializable {
|
|||
* @param alpha3 angle of the third elementary rotation
|
||||
*/
|
||||
public static Rotation computeRotation(RotationOrder order,
|
||||
double alpha1,
|
||||
double alpha2,
|
||||
double alpha3) {
|
||||
double alpha1,
|
||||
double alpha2,
|
||||
double alpha3) {
|
||||
if (order == RotationOrder.XYZ) {
|
||||
return compose(new Rotation(Vector3D.plusI, alpha1),
|
||||
new Rotation(Vector3D.plusJ, alpha2),
|
||||
|
|
|
@ -202,12 +202,12 @@ public class Vector3D implements Serializable {
|
|||
* @exception ArithmeticException if the norm of the instance is null
|
||||
*/
|
||||
public static Vector3D normalize(Vector3D v) {
|
||||
double norm = v.getNorm();
|
||||
if (norm == 0) {
|
||||
double norm = v.getNorm();
|
||||
if (norm == 0) {
|
||||
throw new ArithmeticException("null norm");
|
||||
}
|
||||
double inv = 1.0 / norm;
|
||||
return new Vector3D(inv * v.x, inv * v.y, inv * v.z);
|
||||
}
|
||||
double inv = 1.0 / norm;
|
||||
return new Vector3D(inv * v.x, inv * v.y, inv * v.z);
|
||||
}
|
||||
|
||||
/** Add two vectors.
|
||||
|
|
|
@ -108,8 +108,8 @@ public class FractionFormatTest extends TestCase {
|
|||
}
|
||||
|
||||
public void testParseInteger() {
|
||||
String source = "10";
|
||||
try {
|
||||
String source = "10";
|
||||
try {
|
||||
Fraction c = properFormat.parse(source);
|
||||
assertNotNull(c);
|
||||
assertEquals(10, c.getNumerator());
|
||||
|
@ -117,7 +117,7 @@ public class FractionFormatTest extends TestCase {
|
|||
} catch (ParseException ex) {
|
||||
fail(ex.getMessage());
|
||||
}
|
||||
try {
|
||||
try {
|
||||
Fraction c = improperFormat.parse(source);
|
||||
assertNotNull(c);
|
||||
assertEquals(10, c.getNumerator());
|
||||
|
@ -128,36 +128,36 @@ public class FractionFormatTest extends TestCase {
|
|||
}
|
||||
|
||||
public void testParseInvalid() {
|
||||
String source = "a";
|
||||
String source = "a";
|
||||
String msg = "should not be able to parse '10 / a'.";
|
||||
try {
|
||||
try {
|
||||
properFormat.parse(source);
|
||||
fail(msg);
|
||||
fail(msg);
|
||||
} catch (ParseException ex) {
|
||||
// success
|
||||
// success
|
||||
}
|
||||
try {
|
||||
try {
|
||||
improperFormat.parse(source);
|
||||
fail(msg);
|
||||
fail(msg);
|
||||
} catch (ParseException ex) {
|
||||
// success
|
||||
// success
|
||||
}
|
||||
}
|
||||
|
||||
public void testParseInvalidDenominator() {
|
||||
String source = "10 / a";
|
||||
String source = "10 / a";
|
||||
String msg = "should not be able to parse '10 / a'.";
|
||||
try {
|
||||
try {
|
||||
properFormat.parse(source);
|
||||
fail(msg);
|
||||
fail(msg);
|
||||
} catch (ParseException ex) {
|
||||
// success
|
||||
// success
|
||||
}
|
||||
try {
|
||||
try {
|
||||
improperFormat.parse(source);
|
||||
fail(msg);
|
||||
fail(msg);
|
||||
} catch (ParseException ex) {
|
||||
// success
|
||||
// success
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,45 +247,45 @@ public class FractionFormatTest extends TestCase {
|
|||
}
|
||||
|
||||
public void testNumeratorFormat() {
|
||||
NumberFormat old = properFormat.getNumeratorFormat();
|
||||
NumberFormat old = properFormat.getNumeratorFormat();
|
||||
NumberFormat nf = NumberFormat.getInstance();
|
||||
nf.setParseIntegerOnly(true);
|
||||
properFormat.setNumeratorFormat(nf);
|
||||
assertEquals(nf, properFormat.getNumeratorFormat());
|
||||
properFormat.setNumeratorFormat(old);
|
||||
properFormat.setNumeratorFormat(nf);
|
||||
assertEquals(nf, properFormat.getNumeratorFormat());
|
||||
properFormat.setNumeratorFormat(old);
|
||||
|
||||
old = improperFormat.getNumeratorFormat();
|
||||
old = improperFormat.getNumeratorFormat();
|
||||
nf = NumberFormat.getInstance();
|
||||
nf.setParseIntegerOnly(true);
|
||||
improperFormat.setNumeratorFormat(nf);
|
||||
assertEquals(nf, improperFormat.getNumeratorFormat());
|
||||
improperFormat.setNumeratorFormat(old);
|
||||
improperFormat.setNumeratorFormat(nf);
|
||||
assertEquals(nf, improperFormat.getNumeratorFormat());
|
||||
improperFormat.setNumeratorFormat(old);
|
||||
}
|
||||
|
||||
public void testDenominatorFormat() {
|
||||
NumberFormat old = properFormat.getDenominatorFormat();
|
||||
NumberFormat old = properFormat.getDenominatorFormat();
|
||||
NumberFormat nf = NumberFormat.getInstance();
|
||||
nf.setParseIntegerOnly(true);
|
||||
properFormat.setDenominatorFormat(nf);
|
||||
assertEquals(nf, properFormat.getDenominatorFormat());
|
||||
properFormat.setDenominatorFormat(old);
|
||||
properFormat.setDenominatorFormat(nf);
|
||||
assertEquals(nf, properFormat.getDenominatorFormat());
|
||||
properFormat.setDenominatorFormat(old);
|
||||
|
||||
old = improperFormat.getDenominatorFormat();
|
||||
old = improperFormat.getDenominatorFormat();
|
||||
nf = NumberFormat.getInstance();
|
||||
nf.setParseIntegerOnly(true);
|
||||
improperFormat.setDenominatorFormat(nf);
|
||||
assertEquals(nf, improperFormat.getDenominatorFormat());
|
||||
improperFormat.setDenominatorFormat(old);
|
||||
improperFormat.setDenominatorFormat(nf);
|
||||
assertEquals(nf, improperFormat.getDenominatorFormat());
|
||||
improperFormat.setDenominatorFormat(old);
|
||||
}
|
||||
|
||||
public void testWholeFormat() {
|
||||
ProperFractionFormat format = (ProperFractionFormat)properFormat;
|
||||
|
||||
NumberFormat old = format.getWholeFormat();
|
||||
ProperFractionFormat format = (ProperFractionFormat)properFormat;
|
||||
|
||||
NumberFormat old = format.getWholeFormat();
|
||||
NumberFormat nf = NumberFormat.getInstance();
|
||||
nf.setParseIntegerOnly(true);
|
||||
format.setWholeFormat(nf);
|
||||
assertEquals(nf, format.getWholeFormat());
|
||||
format.setWholeFormat(old);
|
||||
format.setWholeFormat(nf);
|
||||
assertEquals(nf, format.getWholeFormat());
|
||||
format.setWholeFormat(old);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue