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
|
* @param alpha3 angle of the third elementary rotation
|
||||||
*/
|
*/
|
||||||
public static Rotation computeRotation(RotationOrder order,
|
public static Rotation computeRotation(RotationOrder order,
|
||||||
double alpha1,
|
double alpha1,
|
||||||
double alpha2,
|
double alpha2,
|
||||||
double alpha3) {
|
double alpha3) {
|
||||||
if (order == RotationOrder.XYZ) {
|
if (order == RotationOrder.XYZ) {
|
||||||
return compose(new Rotation(Vector3D.plusI, alpha1),
|
return compose(new Rotation(Vector3D.plusI, alpha1),
|
||||||
new Rotation(Vector3D.plusJ, alpha2),
|
new Rotation(Vector3D.plusJ, alpha2),
|
||||||
|
|
|
@ -202,12 +202,12 @@ public class Vector3D implements Serializable {
|
||||||
* @exception ArithmeticException if the norm of the instance is null
|
* @exception ArithmeticException if the norm of the instance is null
|
||||||
*/
|
*/
|
||||||
public static Vector3D normalize(Vector3D v) {
|
public static Vector3D normalize(Vector3D v) {
|
||||||
double norm = v.getNorm();
|
double norm = v.getNorm();
|
||||||
if (norm == 0) {
|
if (norm == 0) {
|
||||||
throw new ArithmeticException("null norm");
|
throw new ArithmeticException("null norm");
|
||||||
}
|
}
|
||||||
double inv = 1.0 / norm;
|
double inv = 1.0 / norm;
|
||||||
return new Vector3D(inv * v.x, inv * v.y, inv * v.z);
|
return new Vector3D(inv * v.x, inv * v.y, inv * v.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add two vectors.
|
/** Add two vectors.
|
||||||
|
|
|
@ -108,8 +108,8 @@ public class FractionFormatTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testParseInteger() {
|
public void testParseInteger() {
|
||||||
String source = "10";
|
String source = "10";
|
||||||
try {
|
try {
|
||||||
Fraction c = properFormat.parse(source);
|
Fraction c = properFormat.parse(source);
|
||||||
assertNotNull(c);
|
assertNotNull(c);
|
||||||
assertEquals(10, c.getNumerator());
|
assertEquals(10, c.getNumerator());
|
||||||
|
@ -117,7 +117,7 @@ public class FractionFormatTest extends TestCase {
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
fail(ex.getMessage());
|
fail(ex.getMessage());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Fraction c = improperFormat.parse(source);
|
Fraction c = improperFormat.parse(source);
|
||||||
assertNotNull(c);
|
assertNotNull(c);
|
||||||
assertEquals(10, c.getNumerator());
|
assertEquals(10, c.getNumerator());
|
||||||
|
@ -128,36 +128,36 @@ public class FractionFormatTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testParseInvalid() {
|
public void testParseInvalid() {
|
||||||
String source = "a";
|
String source = "a";
|
||||||
String msg = "should not be able to parse '10 / a'.";
|
String msg = "should not be able to parse '10 / a'.";
|
||||||
try {
|
try {
|
||||||
properFormat.parse(source);
|
properFormat.parse(source);
|
||||||
fail(msg);
|
fail(msg);
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
// success
|
// success
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
improperFormat.parse(source);
|
improperFormat.parse(source);
|
||||||
fail(msg);
|
fail(msg);
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
// success
|
// success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testParseInvalidDenominator() {
|
public void testParseInvalidDenominator() {
|
||||||
String source = "10 / a";
|
String source = "10 / a";
|
||||||
String msg = "should not be able to parse '10 / a'.";
|
String msg = "should not be able to parse '10 / a'.";
|
||||||
try {
|
try {
|
||||||
properFormat.parse(source);
|
properFormat.parse(source);
|
||||||
fail(msg);
|
fail(msg);
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
// success
|
// success
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
improperFormat.parse(source);
|
improperFormat.parse(source);
|
||||||
fail(msg);
|
fail(msg);
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
// success
|
// success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,45 +247,45 @@ public class FractionFormatTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNumeratorFormat() {
|
public void testNumeratorFormat() {
|
||||||
NumberFormat old = properFormat.getNumeratorFormat();
|
NumberFormat old = properFormat.getNumeratorFormat();
|
||||||
NumberFormat nf = NumberFormat.getInstance();
|
NumberFormat nf = NumberFormat.getInstance();
|
||||||
nf.setParseIntegerOnly(true);
|
nf.setParseIntegerOnly(true);
|
||||||
properFormat.setNumeratorFormat(nf);
|
properFormat.setNumeratorFormat(nf);
|
||||||
assertEquals(nf, properFormat.getNumeratorFormat());
|
assertEquals(nf, properFormat.getNumeratorFormat());
|
||||||
properFormat.setNumeratorFormat(old);
|
properFormat.setNumeratorFormat(old);
|
||||||
|
|
||||||
old = improperFormat.getNumeratorFormat();
|
old = improperFormat.getNumeratorFormat();
|
||||||
nf = NumberFormat.getInstance();
|
nf = NumberFormat.getInstance();
|
||||||
nf.setParseIntegerOnly(true);
|
nf.setParseIntegerOnly(true);
|
||||||
improperFormat.setNumeratorFormat(nf);
|
improperFormat.setNumeratorFormat(nf);
|
||||||
assertEquals(nf, improperFormat.getNumeratorFormat());
|
assertEquals(nf, improperFormat.getNumeratorFormat());
|
||||||
improperFormat.setNumeratorFormat(old);
|
improperFormat.setNumeratorFormat(old);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDenominatorFormat() {
|
public void testDenominatorFormat() {
|
||||||
NumberFormat old = properFormat.getDenominatorFormat();
|
NumberFormat old = properFormat.getDenominatorFormat();
|
||||||
NumberFormat nf = NumberFormat.getInstance();
|
NumberFormat nf = NumberFormat.getInstance();
|
||||||
nf.setParseIntegerOnly(true);
|
nf.setParseIntegerOnly(true);
|
||||||
properFormat.setDenominatorFormat(nf);
|
properFormat.setDenominatorFormat(nf);
|
||||||
assertEquals(nf, properFormat.getDenominatorFormat());
|
assertEquals(nf, properFormat.getDenominatorFormat());
|
||||||
properFormat.setDenominatorFormat(old);
|
properFormat.setDenominatorFormat(old);
|
||||||
|
|
||||||
old = improperFormat.getDenominatorFormat();
|
old = improperFormat.getDenominatorFormat();
|
||||||
nf = NumberFormat.getInstance();
|
nf = NumberFormat.getInstance();
|
||||||
nf.setParseIntegerOnly(true);
|
nf.setParseIntegerOnly(true);
|
||||||
improperFormat.setDenominatorFormat(nf);
|
improperFormat.setDenominatorFormat(nf);
|
||||||
assertEquals(nf, improperFormat.getDenominatorFormat());
|
assertEquals(nf, improperFormat.getDenominatorFormat());
|
||||||
improperFormat.setDenominatorFormat(old);
|
improperFormat.setDenominatorFormat(old);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWholeFormat() {
|
public void testWholeFormat() {
|
||||||
ProperFractionFormat format = (ProperFractionFormat)properFormat;
|
ProperFractionFormat format = (ProperFractionFormat)properFormat;
|
||||||
|
|
||||||
NumberFormat old = format.getWholeFormat();
|
NumberFormat old = format.getWholeFormat();
|
||||||
NumberFormat nf = NumberFormat.getInstance();
|
NumberFormat nf = NumberFormat.getInstance();
|
||||||
nf.setParseIntegerOnly(true);
|
nf.setParseIntegerOnly(true);
|
||||||
format.setWholeFormat(nf);
|
format.setWholeFormat(nf);
|
||||||
assertEquals(nf, format.getWholeFormat());
|
assertEquals(nf, format.getWholeFormat());
|
||||||
format.setWholeFormat(old);
|
format.setWholeFormat(old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue