Author: erans
Date: Wed Jul 13 10:10:56 2011
New Revision: 1145945
URL: http://svn.apache.org/viewvc?rev=1145945&view=rev
Log:
MATH-577
Replaced function calls by direct reference to the instance variable.
Removed redundant prefix for static fields.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java?rev=1145945&r1=1145944&r2=1145945&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java
Wed Jul 13 10:10:56 2011
@@ -107,7 +107,7 @@ public class Complex implements FieldEle
* @return the absolute value
*/
public double abs() {
- if (isNaN()) {
+ if (isNaN) {
return Double.NaN;
}
@@ -169,7 +169,7 @@ public class Complex implements FieldEle
* @return the conjugate of this Complex object
*/
public Complex conjugate() {
- if (isNaN()) {
+ if (isNaN) {
return NaN;
}
return createComplex(real, -imaginary);
@@ -213,7 +213,7 @@ public class Complex implements FieldEle
public Complex divide(Complex rhs)
throws NullArgumentException {
MathUtils.checkNotNull(rhs);
- if (isNaN() || rhs.isNaN()) {
+ if (isNaN || rhs.isNaN) {
return NaN;
}
@@ -265,8 +265,8 @@ public class Complex implements FieldEle
}
if (other instanceof Complex){
Complex rhs = (Complex)other;
- if (rhs.isNaN()) {
- return this.isNaN();
+ if (rhs.isNaN) {
+ return isNaN;
} else {
return (real == rhs.real) && (imaginary == rhs.imaginary);
}
@@ -283,7 +283,7 @@ public class Complex implements FieldEle
*/
@Override
public int hashCode() {
- if (isNaN()) {
+ if (isNaN) {
return 7;
}
return 37 * (17 * MathUtils.hash(imaginary) +
@@ -362,7 +362,7 @@ public class Complex implements FieldEle
public Complex multiply(Complex rhs)
throws NullArgumentException {
MathUtils.checkNotNull(rhs);
- if (isNaN() || rhs.isNaN()) {
+ if (isNaN || rhs.isNaN) {
return NaN;
}
if (Double.isInfinite(real) || Double.isInfinite(imaginary) ||
@@ -401,7 +401,7 @@ public class Complex implements FieldEle
* @return the complex number product
*/
public Complex multiply(double rhs) {
- if (isNaN() || Double.isNaN(rhs)) {
+ if (isNaN || Double.isNaN(rhs)) {
return NaN;
}
if (Double.isInfinite(real) || Double.isInfinite(imaginary) ||
@@ -421,7 +421,7 @@ public class Complex implements FieldEle
* @return the negation of this complex number
*/
public Complex negate() {
- if (isNaN()) {
+ if (isNaN) {
return NaN;
}
@@ -449,7 +449,7 @@ public class Complex implements FieldEle
public Complex subtract(Complex rhs)
throws NullArgumentException {
MathUtils.checkNotNull(rhs);
- if (isNaN() || rhs.isNaN()) {
+ if (isNaN || rhs.isNaN) {
return NaN;
}
@@ -472,8 +472,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex acos() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
return this.add(this.sqrt1z().multiply(Complex.I)).log()
@@ -495,8 +495,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex asin() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
return sqrt1z().add(this.multiply(Complex.I)).log()
@@ -518,8 +518,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex atan() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
return this.add(Complex.I).divide(Complex.I.subtract(this)).log()
@@ -553,8 +553,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex cos() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
return createComplex(FastMath.cos(real) * MathUtils.cosh(imaginary),
@@ -587,8 +587,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex cosh() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
return createComplex(MathUtils.cosh(real) * FastMath.cos(imaginary),
@@ -622,8 +622,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex exp() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
double expReal = FastMath.exp(real);
@@ -660,8 +660,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex log() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
return createComplex(FastMath.log(abs()),
@@ -718,8 +718,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex sin() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
return createComplex(FastMath.sin(real) * MathUtils.cosh(imaginary),
@@ -752,8 +752,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex sinh() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
return createComplex(MathUtils.sinh(real) * FastMath.cos(imaginary),
@@ -794,8 +794,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex sqrt() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
if (real == 0.0 && imaginary == 0.0) {
@@ -860,8 +860,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex tan() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
double real2 = 2.0 * real;
@@ -898,8 +898,8 @@ public class Complex implements FieldEle
* @since 1.2
*/
public Complex tanh() {
- if (isNaN()) {
- return Complex.NaN;
+ if (isNaN) {
+ return NaN;
}
double real2 = 2.0 * real;
@@ -957,13 +957,13 @@ public class Complex implements FieldEle
List<Complex> result = new ArrayList<Complex>();
- if (isNaN()) {
- result.add(Complex.NaN);
+ if (isNaN) {
+ result.add(NaN);
return result;
}
if (isInfinite()) {
- result.add(Complex.INF);
+ result.add(INF);
return result;
}