Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hartmath.expression
Class HComplex  view HComplex download HComplex.java

java.lang.Object
  extended bycom.hartmath.expression.HComplex
All Implemented Interfaces:
HNumber, HObject

public class HComplex
extends java.lang.Object
implements HObject, HNumber

Immutable arbitrary-precision complex.


Field Summary
(package private)  HFraction imag
           
(package private)  HFraction real
           
 
Fields inherited from interface com.hartmath.expression.HObject
COMPLEXFILEID, COMPLEXID, DOUBLECOMPLEXFILEID, DOUBLECOMPLEXID, DOUBLEFILEID, DOUBLEID, FRACTIONFILEID, FRACTIONID, FUNCTIONFILEID, FUNCTIONID, INTEGERFILEID, INTEGERID, OBJECTID, PATTERNFILEID, PATTERNID, STRINGFILEID, STRINGID, SYMBOLFILEID, SYMBOLID
 
Constructor Summary
  HComplex(HFraction r, HFraction i)
          Class Constructor.
  HComplex(HFraction r, HInteger d)
          Class Constructor.
  HComplex(HInteger n, HFraction d)
          Class Constructor.
  HComplex(HInteger n, HInteger d)
          Class Constructor.
(package private) HComplex(java.lang.String strrn, int rin, java.lang.String strrd, int rid, java.lang.String strin, int iin, java.lang.String strid, int iid)
          Class Constructor.
(package private) HComplex(java.lang.String strrn, java.lang.String strrd, java.lang.String strin, java.lang.String strid)
          Class Constructor.
 
Method Summary
 HObject abs(com.hartmath.lib.Session session)
          Returns the absolute value.
 HComplex add(HComplex parm1)
          Method Declaration.
 HObject apply(HObject head, com.hartmath.lib.Session session)
          Description of the Method
 int compSignum()
          0 for this == 0; +1 for re(this) > 0 or ( re(this)==0 and im(this)>0 ); -1 for re(this) < 0 or ( re(this)==0 and im(this)<0 );
 HObject conjugate()
          returns the conjugate complex of a number
 HComplex divide(HComplex parm1)
          Method Declaration.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 HObject evaluate(com.hartmath.lib.Session session)
          Returns true if this can be evaluated.
 boolean greater(com.hartmath.lib.Session session, java.lang.Object obj)
          Method Declaration.
 int hashCode()
          Returns a hash code value for the object.
 HSymbol head()
          Method Declaration.
 int hierarchy()
          Returns an specific integer value for each class in the math-objects hierarchy
 HObject im()
          returns the imaginary part of a number
 boolean isEqual(HComplex b)
          Method Declaration.
 boolean isHeadMember(HSymbol sym)
          Method Declaration.
 boolean isList()
          Method Declaration.
 boolean isMember(HObject obj)
          Method Declaration.
 boolean isNonZero()
          Method Declaration.
 boolean isNumber()
          Method Declaration.
 boolean isRational()
          Method Declaration.
 boolean isUnequal(HComplex b)
          Method Declaration.
 boolean isZero()
          Method Declaration.
 boolean less(com.hartmath.lib.Session session, java.lang.Object obj)
          Method Declaration.
 boolean matches(HObject obj, com.hartmath.lib.Session session)
          Method Declaration.
 HComplex multiply(HComplex parm1)
          Method Declaration.
 HComplex negate()
          Method Declaration.
 HComplex pow(int parm1)
          Method Declaration.
 int precedence()
          Method Declaration.
 com.hartmath.prettyprint.PrettyPrintBox prettyPrint(java.lang.String font, int fontSize)
          Description of the Method
 com.hartmath.prettyprint.PrettyPrintBox prettyPrint(java.lang.String font, int fontSize, int precedence)
          Description of the Method
private  void prettyPrintNumber(HFraction num, boolean imaginary, com.hartmath.prettyprint.HorizontalBox box, java.lang.String font, int fontSize)
          Description of the Method
 HObject re()
          returns the real part of a number
 HObject substitute(HObject obj, HObject subst)
          Returns true if this is (pattern-) matches the object obj
 HObject substitutePattern(com.hartmath.lib.Session session)
          Method Declaration.
 HComplex subtract(HComplex parm1)
          Method Declaration.
 java.lang.String toString()
          Method Declaration.
 void toStringBuffer(java.lang.StringBuffer buf, com.hartmath.lib.Session session)
          Description of the Method
 boolean unequals(java.lang.Object obj)
          Method Declaration.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

real

final HFraction real

imag

final HFraction imag
Constructor Detail

HComplex

public HComplex(HFraction r,
                HFraction i)
Class Constructor.


HComplex

public HComplex(HInteger n,
                HInteger d)
Class Constructor.


HComplex

public HComplex(HFraction r,
                HInteger d)
Class Constructor.


HComplex

public HComplex(HInteger n,
                HFraction d)
Class Constructor.


HComplex

HComplex(java.lang.String strrn,
         java.lang.String strrd,
         java.lang.String strin,
         java.lang.String strid)
Class Constructor.


HComplex

HComplex(java.lang.String strrn,
         int rin,
         java.lang.String strrd,
         int rid,
         java.lang.String strin,
         int iin,
         java.lang.String strid,
         int iid)
Class Constructor.

Method Detail

isEqual

public boolean isEqual(HComplex b)
Method Declaration.


isUnequal

public boolean isUnequal(HComplex b)
Method Declaration.


isZero

public boolean isZero()
Method Declaration.

Specified by:
isZero in interface HNumber

isNonZero

public boolean isNonZero()
Method Declaration.


isList

public boolean isList()
Method Declaration.

Specified by:
isList in interface HObject

isNumber

public boolean isNumber()
Method Declaration.

Specified by:
isNumber in interface HObject

isRational

public boolean isRational()
Method Declaration.

Specified by:
isRational in interface HObject

isMember

public boolean isMember(HObject obj)
Method Declaration.

Specified by:
isMember in interface HObject

isHeadMember

public boolean isHeadMember(HSymbol sym)
Method Declaration.

Specified by:
isHeadMember in interface HObject

matches

public boolean matches(HObject obj,
                       com.hartmath.lib.Session session)
Method Declaration.

Specified by:
matches in interface HObject

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.


unequals

public boolean unequals(java.lang.Object obj)
Method Declaration.

Specified by:
unequals in interface HObject

less

public boolean less(com.hartmath.lib.Session session,
                    java.lang.Object obj)
Method Declaration.

Specified by:
less in interface HObject

greater

public boolean greater(com.hartmath.lib.Session session,
                       java.lang.Object obj)
Method Declaration.

Specified by:
greater in interface HObject

evaluate

public HObject evaluate(com.hartmath.lib.Session session)
Returns true if this can be evaluated. obj is the evaluation result.

Specified by:
evaluate in interface HObject

substitute

public HObject substitute(HObject obj,
                          HObject subst)
Returns true if this is (pattern-) matches the object obj

Specified by:
substitute in interface HObject

substitutePattern

public HObject substitutePattern(com.hartmath.lib.Session session)
Method Declaration.

Specified by:
substitutePattern in interface HObject

hierarchy

public final int hierarchy()
Returns an specific integer value for each class in the math-objects hierarchy

Specified by:
hierarchy in interface HObject

head

public HSymbol head()
Method Declaration. Method Declaration. Method Declaration. Method Declaration. Method Declaration. Method Declaration.

Specified by:
head in interface HObject

apply

public HObject apply(HObject head,
                     com.hartmath.lib.Session session)
Description of the Method

Specified by:
apply in interface HObject

toString

public java.lang.String toString()
Method Declaration.


toStringBuffer

public void toStringBuffer(java.lang.StringBuffer buf,
                           com.hartmath.lib.Session session)
Description of the Method

Specified by:
toStringBuffer in interface HObject

prettyPrint

public com.hartmath.prettyprint.PrettyPrintBox prettyPrint(java.lang.String font,
                                                           int fontSize)
Description of the Method


prettyPrint

public com.hartmath.prettyprint.PrettyPrintBox prettyPrint(java.lang.String font,
                                                           int fontSize,
                                                           int precedence)
Description of the Method


abs

public HObject abs(com.hartmath.lib.Session session)
Returns the absolute value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

Specified by:
abs in interface HNumber

add

public HComplex add(HComplex parm1)
             throws java.lang.ArithmeticException
Method Declaration.


divide

public HComplex divide(HComplex parm1)
                throws java.lang.ArithmeticException
Method Declaration.


hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.


multiply

public HComplex multiply(HComplex parm1)
Method Declaration.


negate

public HComplex negate()
Method Declaration.


pow

public HComplex pow(int parm1)
             throws java.lang.ArithmeticException
Method Declaration.


subtract

public HComplex subtract(HComplex parm1)
Method Declaration.


precedence

public int precedence()
Method Declaration.

Specified by:
precedence in interface HObject

compSignum

public int compSignum()
0 for this == 0; +1 for re(this) > 0 or ( re(this)==0 and im(this)>0 ); -1 for re(this) < 0 or ( re(this)==0 and im(this)<0 );

Specified by:
compSignum in interface HNumber

conjugate

public HObject conjugate()
returns the conjugate complex of a number

Specified by:
conjugate in interface HNumber

re

public HObject re()
returns the real part of a number

Specified by:
re in interface HNumber

im

public HObject im()
returns the imaginary part of a number

Specified by:
im in interface HNumber

prettyPrintNumber

private void prettyPrintNumber(HFraction num,
                               boolean imaginary,
                               com.hartmath.prettyprint.HorizontalBox box,
                               java.lang.String font,
                               int fontSize)
Description of the Method