home *** CD-ROM | disk | FTP | other *** search
- package srd.math;
-
- class ComplexNumber {
- private double m_dReal;
- private double m_dImag;
-
- public ComplexNumber Add(ComplexNumber cn) {
- return new ComplexNumber(this.m_dReal + cn.m_dReal, this.m_dImag + cn.m_dImag);
- }
-
- public ComplexNumber(double dR, double dI) {
- this.m_dReal = dR;
- this.m_dImag = dI;
- }
-
- public ComplexNumber(double dR) {
- this(dR, (double)0.0F);
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append('(').append(this.m_dReal).append(',');
- sb.append(this.m_dImag).append(')');
- return sb.toString();
- }
- }
-