Classes | Public Types | Public Member Functions | Static Public Member Functions | Package Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes

jscicalc.complex.Format Class Reference

Collaboration diagram for jscicalc.complex.Format:
Collaboration graph
[legend]

List of all members.

Classes

class  DoubleFormat
 A private inner class that is similar in structure to ParseBase.Number. More...

Public Types

enum  Notation { STANDARD, SCIENTIFIC, SCIENTIFICB, NONE }
 

This is an enumerated type representing the possible notations that we can use.

More...

Public Member Functions

 Format (Complex z, Base b)
 Constructor.
String formatStandard (Base base, int sigDigits, int maxLength, boolean showComplex, boolean rectangularComplex)
 Method that creates a string (ideally in standard notation) representation of a number to sigDigits significant digits.

Static Public Member Functions

static void main (String[] args)
 Test function.

Package Attributes

boolean realSign
 Sign of real part (true for negative).
boolean imaginarySign
 Sign of imaginary part (true for negative).

Static Private Member Functions

static String correctMinus (String s)
 Used to replace hyphens with true minus signs.

Private Attributes

final Complex z
 This is where the number is stored.
DoubleFormat real
 The real part.
DoubleFormat imaginary
 The imaginary part.
DoubleFormat abs
 The absoulte value.
DoubleFormat argument
 The argument.

Static Private Attributes

static final double SMALLIMAGINARY = 0.00005
 A calculation (e.g.

Detailed Description

Author:
J. D. Lamb
Version:
Revision:
1.5

Member Enumeration Documentation

This is an enumerated type representing the possible notations that we can use.

Author:
J. D. Lamb
Version:
1.0
Enumerator:
STANDARD 
SCIENTIFIC 
SCIENTIFICB 
NONE 

Constructor & Destructor Documentation

jscicalc.complex.Format.Format ( Complex  z,
Base  b 
)

Member Function Documentation

static String jscicalc.complex.Format.correctMinus ( String  s  )  [static, private]

Used to replace hyphens with true minus signs.

Parameters:
s A String
Returns:
The same String with hyphens replaced by minus signs

Referenced by jscicalc.complex.Format.formatStandard().

String jscicalc.complex.Format.formatStandard ( Base  base,
int  sigDigits,
int  maxLength,
boolean  showComplex,
boolean  rectangularComplex 
)

Method that creates a string (ideally in standard notation) representation of a number to sigDigits significant digits.

If maxLength is exceeded it resorts to scientific notation.

Parameters:
base Base: mut be 2, 8, 10 or 16
sigDigits Desired number of significant digits
maxLength The maximum number of characters in the string produced
showComplex Set to true if you want to show imaginary part even when smaller than smallImaginary.
rectangularComplex Set to true if you want complex numbers in rectangular notation.
Returns:
a string representation of d

References jscicalc.complex.Complex.abs(), jscicalc.complex.Format.abs, jscicalc.complex.Complex.arg(), jscicalc.complex.Format.argument, jscicalc.complex.Format.correctMinus(), jscicalc.complex.Complex.imaginary(), jscicalc.complex.Format.imaginary, jscicalc.complex.Format.imaginarySign, jscicalc.complex.Format.DoubleFormat.precision(), jscicalc.complex.Complex.real(), jscicalc.complex.Format.real, jscicalc.complex.Format.realSign, jscicalc.complex.Format.DoubleFormat.round(), jscicalc.complex.Format.DoubleFormat.scientific(), jscicalc.complex.Format.DoubleFormat.scientificB(), jscicalc.complex.Format.DoubleFormat.scientificBPrecision(), jscicalc.complex.Format.DoubleFormat.scientificPrecision(), jscicalc.complex.Format.DoubleFormat.standard(), and jscicalc.complex.Format.z.

Referenced by jscicalc.complex.Format.main().

static void jscicalc.complex.Format.main ( String[]  args  )  [static]

Member Data Documentation

Sign of imaginary part (true for negative).

Referenced by jscicalc.complex.Format.Format(), and jscicalc.complex.Format.formatStandard().

Sign of real part (true for negative).

Referenced by jscicalc.complex.Format.Format(), and jscicalc.complex.Format.formatStandard().

final double jscicalc.complex.Format.SMALLIMAGINARY = 0.00005 [static, private]

A calculation (e.g.

sin) might create a small imaginary part. If it is smaller than this number in size AND showComplex == false, don’t show it.


The documentation for this class was generated from the following file: