Public Member Functions | Static Private Attributes

jscicalc.OObject Class Reference

This class represents any output token that can be handled by Parser. More...

Collaboration diagram for jscicalc.OObject:
Collaboration graph
[legend]

List of all members.

Public Member Functions

boolean isNegative ()
 Indicate whether or not expression is negative.
Error function (OObject x)
 Generic function of one parameter.
Error function (OObject x, OObject y)
 Generic function of two parameters.
OObject inverse ()
 Calculate the inverse.
OObject square ()
 Calculate the square.
OObject cube ()
 Calculate the cube.
OObject factorial ()
 Calculate the factorial.
OObject negate ()
 Negate x.
OObject add (OObject x)
 Add an OObject to this.
OObject subtract (OObject x)
 Subtract an OObject from this.
OObject multiply (OObject x)
 Multiply this by an OObject.
OObject divide (OObject x)
 Divide this by an OObject.
OObject exp ()
 Exponential function.
OObject combination (OObject x)
 Combination function applied to x and this.
OObject permutation (OObject x)
 Permutation function applied to x and this.
OObject pow (OObject y)
 Power function applied to x.
OObject root (OObject y)
 Root function applied to y.
OObject sin (AngleType angleType)
 Calculate the sine.
OObject asin (AngleType angleType)
 Calculate the inverse sine.
OObject cos (AngleType angleType)
 Calculate the cosine.
OObject acos (AngleType angleType)
 Calculate the inverse cosine.
OObject tan (AngleType angleType)
 Calculate the tangent.
OObject atan (AngleType angleType)
 Calculate the inverse tangent.
OObject log10 ()
 Calculate the log (base 10).
OObject log ()
 Calculate the natural logarithm.
OObject sqrt ()
 Calculate the square root.
OObject cuberoot ()
 Calculate the cube root.
OObject tenx ()
 Calculate ten to the power of x.
OObject conjugate ()
 Calculate the conjugate.
OObject and (OObject z)
 And with another OObject.
OObject or (OObject z)
 Or with another OObject.
OObject xor (OObject z)
 Xor with another OObject.
boolean isZero ()
 Test for equality to zero.
StringArray toHTMLStringVector (int maxChars, int precision, final Base base, final Notation notation, double polarFactor)
 Function to create an HTML string representation of the OObject.
String toHTMLString (int maxChars, int precision, final Base base, final Notation notation, double polarFactor)
 Function to create an HTML string representation of the OObject.
StringArray toHTMLSubString (int maxChars, int precision, final Base base, final Notation notation, double polarFactor)
 Function to create an HTML string representation of the expression.
StringArray toHTMLParenString (int maxChars, int precision, final Base base, final Notation notation, double polarFactor)
 Function to create an HTML string representation of the expression.
int compareTo (OObject o)
 The comparison operator.
void sort ()
 Sort the class.
OObject auto_simplify ()
 Carry out automatic simplifications on the OObject.
OObject substitute (Substitution substitution)
 Carry out substitutions as specified by a Substitution object.

Static Private Attributes

static final Complex LOG10INV = new Complex( 1 / StrictMath.log( 10 ) )
 Used internally.

Detailed Description

This class represents any output token that can be handled by Parser.

See also:
Parser, GObject
Author:
J. D. Lamb
Version:
Revision:
1.7

Member Function Documentation

OObject jscicalc.OObject.acos ( AngleType  angleType  ) 

Calculate the inverse cosine.

Parameters:
angleType The AngleType
Returns:
The result of the operation

Referenced by jscicalc.pobject.ACos.function().

OObject jscicalc.OObject.add ( OObject  x  ) 
OObject jscicalc.OObject.and ( OObject  z  ) 

And with another OObject.

Parameters:
z The number to AND with this.
Returns:
The bitwise result of a logical and operation on this and z.

References jscicalc.OObject.and().

Referenced by jscicalc.OObject.and(), and jscicalc.pobject.And.function().

OObject jscicalc.OObject.asin ( AngleType  angleType  ) 

Calculate the inverse sine.

Parameters:
angleType The AngleType
Returns:
The result of the operation

Referenced by jscicalc.pobject.ASin.function().

OObject jscicalc.OObject.atan ( AngleType  angleType  ) 

Calculate the inverse tangent.

Parameters:
angleType The AngleType
Returns:
The result of the operation

Referenced by jscicalc.pobject.ATan.function().

OObject jscicalc.OObject.auto_simplify (  ) 
OObject jscicalc.OObject.combination ( OObject  x  ) 

Combination function applied to x and this.

Parameters:
x The value (right of symbol)
Returns:
The result of this choose x

References jscicalc.OObject.combination().

Referenced by jscicalc.OObject.combination(), and jscicalc.pobject.Combination.function().

int jscicalc.OObject.compareTo ( OObject  o  ) 

The comparison operator.

By default returns 0 (Errors are equivalent).

Parameters:
o The Expression to be compared.
Returns:
integer indicating how expression is compared to this.

Referenced by jscicalc.expression.Product.auto_simplify().

OObject jscicalc.OObject.conjugate (  ) 

Calculate the conjugate.

Returns:
The result of the operation

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.Conjugate.function().

OObject jscicalc.OObject.cos ( AngleType  angleType  ) 

Calculate the cosine.

Parameters:
angleType The AngleType
Returns:
The result of the operation

Referenced by jscicalc.pobject.Cos.function().

OObject jscicalc.OObject.cube (  ) 

Calculate the cube.

Returns:
The result of the operation

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.Cube.function().

OObject jscicalc.OObject.cuberoot (  ) 

Calculate the cube root.

Returns:
The result of the operation

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.CubeRoot.function().

OObject jscicalc.OObject.divide ( OObject  x  ) 

Divide this by an OObject.

Parameters:
x The divisor.
Returns:
The result of this divided by x

References jscicalc.OObject.divide(), jscicalc.expression.Product.divide(), and jscicalc.expression.Product.multiply().

Referenced by jscicalc.OObject.divide(), and jscicalc.pobject.Divide.function().

OObject jscicalc.OObject.exp (  ) 

Exponential function.

Returns:
The exponential function applied to x

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.Exp.function().

OObject jscicalc.OObject.factorial (  ) 

Calculate the factorial.

Returns:
The result of the operation

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.Factorial.function().

Error jscicalc.OObject.function ( OObject  x,
OObject  y 
)

Generic function of two parameters.

Parameters:
x The first parameter
y The second parameter
Returns:
An error unless subclass defines something
Error jscicalc.OObject.function ( OObject  x  ) 

Generic function of one parameter.

Parameters:
x The value
Returns:
An error unless subclass defines something

Referenced by jscicalc.expression.Dyadic< E extends jscicalc.pobject.PObject >.substitute().

OObject jscicalc.OObject.inverse (  ) 

Calculate the inverse.

Returns:
The result of the operation

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.Inverse.function(), and jscicalc.OObject.root().

boolean jscicalc.OObject.isNegative (  ) 

Indicate whether or not expression is negative.

The default is not negative.

Reimplemented in jscicalc.complex.Complex, jscicalc.expression.Product, and jscicalc.expression.Sum.

Referenced by jscicalc.expression.Product.isNegative(), and jscicalc.expression.Sum.toHTMLSubString().

boolean jscicalc.OObject.isZero (  ) 

Test for equality to zero.

Returns:
false.

Reimplemented in jscicalc.complex.Complex, and jscicalc.expression.SumOrProduct.

Referenced by jscicalc.expression.Product.isNegative(), and jscicalc.ExtraPanel.paintComponent().

OObject jscicalc.OObject.log (  ) 

Calculate the natural logarithm.

Returns:
The result of the operation

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.Ln.function().

OObject jscicalc.OObject.log10 (  ) 

Calculate the log (base 10).

Returns:
The result of the operation

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.Log.function().

OObject jscicalc.OObject.multiply ( OObject  x  ) 
OObject jscicalc.OObject.negate (  ) 
OObject jscicalc.OObject.or ( OObject  z  ) 

Or with another OObject.

Parameters:
z The number to AND with this.
Returns:
The bitwise result of a logical or operation on this and z.

References jscicalc.OObject.or().

Referenced by jscicalc.pobject.Or.function(), and jscicalc.OObject.or().

OObject jscicalc.OObject.permutation ( OObject  x  ) 

Permutation function applied to x and this.

Parameters:
x The value (right of symbol)
Returns:
The result of this P x.

References jscicalc.OObject.permutation().

Referenced by jscicalc.pobject.Permutation.function(), and jscicalc.OObject.permutation().

OObject jscicalc.OObject.pow ( OObject  y  ) 

Power function applied to x.

Parameters:
y The value (right of symbol)
Returns:
The result of this to the power of y

References jscicalc.OObject.pow().

Referenced by jscicalc.pobject.Power.function(), and jscicalc.OObject.pow().

OObject jscicalc.OObject.root ( OObject  y  ) 

Root function applied to y.

Parameters:
y The value (right of symbol)
Returns:
The result of this to the power of 1/y

References jscicalc.OObject.inverse(), and jscicalc.OObject.root().

Referenced by jscicalc.pobject.Root.function(), and jscicalc.OObject.root().

OObject jscicalc.OObject.sin ( AngleType  angleType  ) 

Calculate the sine.

Parameters:
angleType The AngleType
Returns:
The result of the operation

Referenced by jscicalc.pobject.Sin.function().

void jscicalc.OObject.sort (  ) 

Sort the class.

Does nothing, but subclasses will override.

Reimplemented in jscicalc.expression.Product, and jscicalc.expression.SumOrProduct.

OObject jscicalc.OObject.sqrt (  ) 

Calculate the square root.

Returns:
The result of the operation

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.SquareRoot.function().

OObject jscicalc.OObject.square (  ) 

Calculate the square.

Returns:
The result of the operation

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.Square.function().

OObject jscicalc.OObject.substitute ( Substitution  substitution  ) 

Carry out substitutions as specified by a Substitution object.

Parameters:
substitution The object specifying the substitutions
Returns:
The OObject after the substitution

Referenced by jscicalc.expression.Sum.substitute(), jscicalc.expression.Product.substitute(), jscicalc.expression.Monadic.substitute(), and jscicalc.graph.Locus.substitute().

OObject jscicalc.OObject.subtract ( OObject  x  ) 

Subtract an OObject from this.

Parameters:
x The subtrahend
Returns:
This minus x.

References jscicalc.OObject.add(), and jscicalc.OObject.negate().

Referenced by jscicalc.button.MminusButton.actionPerformed(), and jscicalc.pobject.Subtract.function().

OObject jscicalc.OObject.tan ( AngleType  angleType  ) 

Calculate the tangent.

Parameters:
angleType The AngleType
Returns:
The result of the operation

Referenced by jscicalc.pobject.Tan.function().

OObject jscicalc.OObject.tenx (  ) 

Calculate ten to the power of x.

Returns:
The result of the operation

Reimplemented in jscicalc.complex.Complex.

Referenced by jscicalc.pobject.TenX.function().

StringArray jscicalc.OObject.toHTMLParenString ( int  maxChars,
int  precision,
final Base  base,
final Notation  notation,
double  polarFactor 
)

Function to create an HTML string representation of the expression.

This has six arguments. See Complex for a definition of the arguments.

This version may put parentheses round the expression.

The default function simply returns ‘Error’ to indicate that no result is known.

This function does not include the html tags.

Parameters:
maxChars The maximum number of (visible) characters we can use
precision The desired number of significant figures
base The required base
notation The notation to use to display this value
polarFactor Not used
Returns:
a String of at most maxChars HTML characters representing the expression

References jscicalc.StringArray.add(), and jscicalc.OObject.toHTMLSubString().

Referenced by jscicalc.expression.Product.toHTMLSubString(), jscicalc.expression.Monadic.toHTMLSubString(), and jscicalc.expression.Factorial.toHTMLSubString().

String jscicalc.OObject.toHTMLString ( int  maxChars,
int  precision,
final Base  base,
final Notation  notation,
double  polarFactor 
)

Function to create an HTML string representation of the OObject.

This has six arguments. See Complex for a definition of the arguments.

The default function simply returns ‘Error’ to indicate that no result is known.

The result is really a string. But we want to scroll over it; so we separate (1) HTML tags, (2) special characters like minus signs, so that each substring represents what will appear on the screen as a single character. When we scroll, we also sometimes want to jump across several characters at once. So we use another level of indirection. Thus, at the first level we get the entities between which we can move the caret. And at the second level, we get a representation of each ‘character’ on the screen (which may correspond to more than one character of HTML code.

Parameters:
maxChars The maximum number of (visible) characters we can use
precision The desired number of significant figures
base The required base
notation The notation to use to display this value
polarFactor Not used
Returns:
a String of at most maxChars HTML characters representing the expression

References jscicalc.OObject.toHTMLSubString().

Referenced by jscicalc.complex.Test.checkNumber(), and jscicalc.DataTransfer.copy().

StringArray jscicalc.OObject.toHTMLStringVector ( int  maxChars,
int  precision,
final Base  base,
final Notation  notation,
double  polarFactor 
)

Function to create an HTML string representation of the OObject.

This has six arguments. See Complex for a definition of the arguments.

The default function simply returns ‘Error’ to indicate that no result is known.

Parameters:
maxChars The maximum number of (visible) characters we can use
precision The desired number of significant figures
base The required base
notation The notation to use to display this value
polarFactor Not used
Returns:
a String of at most maxChars HTML characters representing the expression

References jscicalc.OObject.toHTMLSubString().

Referenced by jscicalc.DisplayLabel.setExpression().

StringArray jscicalc.OObject.toHTMLSubString ( int  maxChars,
int  precision,
final Base  base,
final Notation  notation,
double  polarFactor 
)

Function to create an HTML string representation of the expression.

This has six arguments. See Complex for a definition of the arguments.

The default function simply returns ‘Error’ to indicate that no result is known.

This function does not include the html tags.

Parameters:
maxChars The maximum number of (visible) characters we can use
precision The desired number of significant figures
base The required base
notation The notation to use to display this value
polarFactor Not used
Returns:
a String of at most maxChars HTML characters representing the expression

References jscicalc.StringArray.add().

Referenced by jscicalc.OObject.toHTMLParenString(), jscicalc.OObject.toHTMLString(), jscicalc.OObject.toHTMLStringVector(), jscicalc.expression.Sum.toHTMLSubString(), and jscicalc.expression.Product.toHTMLSubString().

OObject jscicalc.OObject.xor ( OObject  z  ) 

Xor with another OObject.

Parameters:
z The number to AND with this.
Returns:
The bitwise result of a logical xor operation on this and z.

References jscicalc.OObject.xor().

Referenced by jscicalc.pobject.Xor.function(), and jscicalc.OObject.xor().


Member Data Documentation

final Complex jscicalc.OObject.LOG10INV = new Complex( 1 / StrictMath.log( 10 ) ) [static, private]

Used internally.


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