NAME
Math::Expr::Opp - Represents one operation in the parsed expression
tree
SYNOPSIS
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";
DESCRIPTION
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).
METHODS
$e=new Math::Expr::Opp($name,$db)
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.
$e->SetOpp($i, $v)
Sets operand number $i to $v.
$e->Opp($i)
Returns operand to number $i.
$e->tostr
Returns a string representation of the entire expression to be
used for debugging.
$e->strtype
Returns a string representation of this expressions entire type,
without simplifying it. In the same notation as the tostr method.
$n->Simplify
Simplifys the expression to some normal from.
$n->BaseType
Returns a string type of this expression simplifyed as much as
possible.
$n->SubMatch($rules,$match)
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.
$n->Match($rules)
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.
$n->Subs($vars)
Substitues all variables in the expretion with there vaules in $vars.
$n->Copy
Returns a copy of this object.
$n->Breakable
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.
$n->Find($pos)
Returns an object pointer to the subexpression represented by the
string $pos.
$n->Set($pos, $val)
Replaces the subexpression at position $pos with $val.
AUTHOR
Hakan Ardo <hakan@debian.org>
SEE ALSO
L<Math::Expr>