-- File: GeneralExpression.cdl -- Created: Thu Jan 10 11:57:22 1991 -- Author: Arnaud BOUZY -- ---Copyright: Matra Datavision 1991 deferred class GeneralExpression from Expr inherits TShared from MMgt ---Purpose: Defines the general purposes of any expression. uses NamedUnknown from Expr, Array1OfNamedUnknown from Expr, Array1OfReal from TColStd, AsciiString from TCollection raises OutOfRange from Standard, NumericError from Standard, NotEvaluable from Expr, InvalidOperand from Expr is NbSubExpressions(me) ---Purpose: Returns the number of sub-expressions contained -- in ( >= 0) ---Level: Internal returns Integer is deferred; SubExpression(me; I : Integer) ---Purpose: Returns the -th sub-expression of -- raises OutOfRange if > NbSubExpressions(me) ---C++: return const & ---Level: Internal returns any GeneralExpression raises OutOfRange is deferred; Simplified(me) ---Purpose: Returns a GeneralExpression after replacement of -- NamedUnknowns by an associated expression and after -- values computation. ---Level: Advanced returns any GeneralExpression raises NumericError is deferred; ShallowSimplified(me) ---Purpose: Returns a GeneralExpression after a simplification -- of the arguments of . ---Level: Internal returns any GeneralExpression raises NumericError is deferred; Copy(me) ---Purpose: Returns a copy of having the same unknowns and -- functions. ---Level: Advanced returns mutable like me is deferred; ContainsUnknowns(me) ---Purpose: Tests if contains NamedUnknowns. ---Level: Advanced returns Boolean is deferred; Contains(me; exp : GeneralExpression) ---Purpose: Tests if is contained in . ---Level: Advanced returns Boolean is deferred; IsLinear(me) ---Purpose: Tests if is linear on every NamedUnknown it -- contains. ---Level: Internal returns Boolean is deferred; IsShareable(me) ---Purpose: Tests if can be shared by one or more expressions -- or must be copied. This method returns False as a -- default value. To be redefined ( especially for -- NamedUnknown). ---Level: Internal returns Boolean is virtual; IsIdentical(me; Other : GeneralExpression) ---Purpose: Tests if and define the same expression. -- Warning: This method does not include any simplification before -- testing. It could also be very slow; to be used -- carefully. ---Level: Internal returns Boolean is deferred; Derivative(me; X : NamedUnknown) ---Purpose: Returns the derivative on unknown of ---Level: Advanced returns any GeneralExpression is deferred; NDerivative(me; X : NamedUnknown; N : Integer) ---Purpose: Returns the -th derivative on unknown of . -- Raise OutOfRange if N <= 0 ---Level: Advanced returns any GeneralExpression raises OutOfRange is virtual; Replace(me : mutable ; var : NamedUnknown ; with : GeneralExpression) ---Purpose: Replaces all occurences of with copies of -- in . Copies of are made with the Copy() method. -- Raises InvalidOperand if contains . ---Level: Internal raises InvalidOperand is deferred; Evaluate(me; vars : Array1OfNamedUnknown; vals : Array1OfReal) ---Purpose: Returns the value of (as a Real) by -- replacement of by . -- Raises NotEvaluable if contains NamedUnknown not -- in or NumericError if result cannot be computed. ---Level: Advanced returns Real raises NotEvaluable,NumericError is deferred; EvaluateNumeric(me) ---Purpose: Returns the value of (as a Real) by -- replacement of by . -- Raises NotEvaluable if contains NamedUnknown not -- in or NumericError if result cannot be computed. ---Level: Internal returns Real raises NotEvaluable,NumericError; String(me) ---Purpose: returns a string representing in a readable way. ---Level: Public returns AsciiString is deferred; end GeneralExpression;