For details read Perl NOC. After June 25

Hakan Ardo >
Math-Expr >
Math::Expr::Opp

Math::Expr::Opp - Represents one operation in the parsed expression tree

require Math::Expr::Opp; require Math::Expr::Var; require Math::Expr::Num; # To represent the expression "x+7": $n=new Math::Expr::Opp("+"); $n->SetOpp(0,new Math::Expr::Var("x")); $n->SetOpp(1,new Math::Expr::Num(7)); print $n->tostr . "\n";

Used by the Math::Expr to represent algebraic expressions. This class represents one operation or function with a set of operands, which in turn can be other Math::Expr::Opp objects. And in that way we are able to represent entire expression. Operations like a+b and functions like sin(a) or f(a,b) are all represented by this kind of objects with "+", "sin" and "f" as the operation- or function names and Math::Expr::Var(a) and Math::Expr::Var(b) as operands (only a in the sin example).

Creates a new operation object with the operation- or function-name $name. Using the operations defined in $db. See L<Math::Expr::OpperationDB> for more info.

Sets operand number $i to $v.

Returns operand to number $i.

Returns a string representation of the entire expression to be used for debugging.

Returns a string representation of this expressions entire type, without simplifying it. In the same notation as the tostr method.

Simplifys the expression to some normal from.

Returns a string type of this expression simplifyed as much as possible.

Tries to match $rules to this expretions and adds the substitutions needed to $match.Returns 1 if the match excists and the substitutions needed can coexcist with those already in $match otherwise 0.

Tries to match $rules to this expretions and to all its subexpretions. Returns a MatchSet object specifying where the matches ocored and what substitutions they represent.

Substitues all variables in the expretion with there vaules in $vars.

Returns a copy of this object.

Used by the parser to indikate if this object was created using parantesis or if he should break it up to preserve the rules of order between the diffrent opperations.

Returns an object pointer to the subexpression represented by the string $pos.

Replaces the subexpression at position $pos with $val.

Hakan Ardo <hakan@debian.org>

L<Math::Expr>

syntax highlighting: