Class Operator

java.lang.Object
  |
  +--Operator
All Implemented Interfaces:
ArithExpr
Direct Known Subclasses:
Addition, Division, Modulo, Multiplication, Puissance, Substraction

abstract class Operator
extends Object
implements ArithExpr

Opérateur binaire d'une expression arithmétique. Cette classe abstraite regroupe ce qui commun aux différentes opérateurs binaires. Toutes les classes des opérateurs dérivent de cette classe.


Field Summary
private  ArithExpr left
          Fils gauche
private  ArithExpr right
          Fils droit
 
Constructor Summary
(package private) Operator(ArithExpr left, ArithExpr right)
          Création d'un opérateur à partir de ses deux fils
 
Method Summary
 double eval()
          Évaluation sans environnement
 double eval(Environment e)
          Évaluation avec environnement
protected abstract  double operation(double x, double y)
          Opération entre nombres flottants associée à ce nœud.
protected abstract  String symbol()
          Chaîne représentant l'opération en infixe
protected abstract  String tag()
          Chaîne représentant l'opération en MathML
 String toMathML()
          Représentation infixe de l'expression
 String toString()
          Représentation infixe de l'expression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

left

private ArithExpr left
Fils gauche


right

private ArithExpr right
Fils droit

Constructor Detail

Operator

Operator(ArithExpr left,
         ArithExpr right)
Création d'un opérateur à partir de ses deux fils

Parameters:
left - fils gauche
right - fils droit
Method Detail

operation

protected abstract double operation(double x,
                                    double y)
Opération entre nombres flottants associée à ce nœud.

Parameters:
x - premier nombre flottant
y - deuxième nombre flottant
Returns:
résultat de l'opération

eval

public double eval()
Évaluation sans environnement

Specified by:
eval in interface ArithExpr
Returns:
valeur de l'évaluation

eval

public double eval(Environment e)
            throws UnboundVariableException
Évaluation avec environnement

Specified by:
eval in interface ArithExpr
Returns:
valeur de l'évaluation
Throws:
UnboundVariableException - si aucune expression n'est affectée à une variable apparaissant dans l'expression.

symbol

protected abstract String symbol()
Chaîne représentant l'opération en infixe

Returns:
chaîne

toString

public String toString()
Représentation infixe de l'expression

Overrides:
toString in class Object
Returns:
représentation

tag

protected abstract String tag()
Chaîne représentant l'opération en MathML

Returns:
chaîne

toMathML

public String toMathML()
Représentation infixe de l'expression

Specified by:
toMathML in interface ArithExpr
Returns:
représentation