org.jscience.mathematics.analysis.expressions
Class BinaryOperator

java.lang.Object
  extended by org.jscience.mathematics.analysis.expressions.OperatorExpression
      extended by org.jscience.mathematics.analysis.expressions.BinaryOperator
All Implemented Interfaces:
java.io.Serializable, Expression, JavaExpressible, XMLExpressible
Direct Known Subclasses:
Addition, Atan2, Diff, Division, Gauss, Max, Min, Multiplication, Pow, Rand, Subtraction

public abstract class BinaryOperator
extends OperatorExpression

Abstract class used as superclass for binary operators.

See Also:
UnaryOperator, OperatorExpression, Serialized Form

Field Summary
protected  double[] deriv
          DOCUMENT ME!
protected  boolean evalValid
          DOCUMENT ME!
protected  double evalValue
          DOCUMENT ME!
protected  Expression secondOperand
          The second Expression this BinaryOperator works on.
protected  boolean[] valid
          DOCUMENT ME!
 
Fields inherited from class org.jscience.mathematics.analysis.expressions.OperatorExpression
firstOperand
 
Constructor Summary
BinaryOperator(Expression e1, Expression e2)
          Creates a BinaryOperator object working on two given Expression objects.
 
Method Summary
 Expression diff(NamedDataExpression x)
          Class BinaryOperator provides a default diff method for use by nondifferentiable objects.
 java.util.List getElements()
          The getElements method must return a java.util.List whose elements are all the subexpressions of the Expression.
 Expression getSecondOperand()
          Returns the second operand that the BinaryOperator object works on.
 boolean isDifferentiable()
          Default implementation of method isDifferentiable which assumes that the BinaryOperator object is differentiable.
 boolean isExpandable()
          Default implementation of method isExpandable which assumes that the BinaryOperator object is expandable.
 void resetNumDiff(int i)
          DOCUMENT ME!
 void resetNumEval()
          DOCUMENT ME!
 void setIndex(int i)
          DOCUMENT ME!
 void setNumberOfIndependents(int n)
          DOCUMENT ME!
 void setSecondOperand(Expression e2)
          Assigns the second operand that the BinaryOperator object works on to a given Expression object.
 java.lang.String toTaylorMap()
          Dummy implementation for classes that are not expandable.
 
Methods inherited from class org.jscience.mathematics.analysis.expressions.OperatorExpression
contains, factor, getFirstOperand, isolate, isolate, setFirstOperand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jscience.mathematics.analysis.expressions.Expression
eval, optimize, replace, toJava, toXML
 

Field Detail

secondOperand

protected Expression secondOperand
The second Expression this BinaryOperator works on.

Since:
1.0
See Also:
OperatorExpression.firstOperand

evalValid

protected boolean evalValid
DOCUMENT ME!


evalValue

protected double evalValue
DOCUMENT ME!


valid

protected boolean[] valid
DOCUMENT ME!


deriv

protected double[] deriv
DOCUMENT ME!

Constructor Detail

BinaryOperator

public BinaryOperator(Expression e1,
                      Expression e2)
Creates a BinaryOperator object working on two given Expression objects.

Parameters:
e1 - An Expression object.
e2 - Another Expression object.
Since:
1.0
Method Detail

setSecondOperand

public void setSecondOperand(Expression e2)
Assigns the second operand that the BinaryOperator object works on to a given Expression object.

Parameters:
e2 - An Expression object.
Since:
1.0
See Also:
OperatorExpression.setFirstOperand(org.jscience.mathematics.analysis.expressions.Expression)

getSecondOperand

public Expression getSecondOperand()
Returns the second operand that the BinaryOperator object works on.

Returns:
An Expression object that represents the second operand that the BinaryOperator object works on.
Since:
1.0
See Also:
OperatorExpression.getFirstOperand(), setSecondOperand(org.jscience.mathematics.analysis.expressions.Expression)

isDifferentiable

public boolean isDifferentiable()
Default implementation of method isDifferentiable which assumes that the BinaryOperator object is differentiable. All nondifferentiable BinaryOperators must overrride this implementation.

See Also:
Expression.isDifferentiable()

isExpandable

public boolean isExpandable()
Default implementation of method isExpandable which assumes that the BinaryOperator object is expandable. All nonexpandable BinaryOperators must overrride this implementation.

Returns:
DOCUMENT ME!
See Also:
Expression.isExpandable()

diff

public Expression diff(NamedDataExpression x)
Class BinaryOperator provides a default diff method for use by nondifferentiable objects. All differentiable objects must override this diff method.

Parameters:
x - DOCUMENT ME!
Returns:
DOCUMENT ME!

toTaylorMap

public java.lang.String toTaylorMap()
Dummy implementation for classes that are not expandable.

Returns:
DOCUMENT ME!

getElements

public java.util.List getElements()
Description copied from interface: Expression
The getElements method must return a java.util.List whose elements are all the subexpressions of the Expression. For example the expression "acos(ct)" should return a java.util.List with six subexpressions: "[,a,cos,,c,t]" (the order of which is unspecified).

Returns:
DOCUMENT ME!

resetNumEval

public void resetNumEval()
DOCUMENT ME!


resetNumDiff

public void resetNumDiff(int i)
DOCUMENT ME!

Parameters:
i - DOCUMENT ME!

setNumberOfIndependents

public void setNumberOfIndependents(int n)
DOCUMENT ME!

Parameters:
n - DOCUMENT ME!

setIndex

public void setIndex(int i)
DOCUMENT ME!

Parameters:
i - DOCUMENT ME!