Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Member Functions | Public Attributes | Static Package Attributes | Private Attributes
fr.ove.openmath.jome.model.Formula Class Reference

The formula. More...

Inheritance diagram for fr.ove.openmath.jome.model.Formula:
Inheritance graph
[legend]
Collaboration diagram for fr.ove.openmath.jome.model.Formula:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Formula ()
 The Constructor.
boolean isOperator ()
 To check is the instance is an operator.
FormulaTreeStructure insert (FormulaTreeStructure current)
 Inserts the operator instance in the formula tree, from the current insertion position.
String createLinear (String linear)
 The Creation of the corresponding linear expression of the formula.
void clear ()
 clears the formula.
String getLinear ()
 Returns the linear expression of the formula.
String evaluate ()
 Returns the OpenMath representation of the formula.
void consumeLinearParserEvent (LinearParserEvent linearParserEvent)
 Treats the event received.
void setDoProcessing (boolean doProcessing)
 Sets if we had to process the instance before rendering.
boolean getDoProcessing ()
 Returns true if the instance needs a processing.
void setProcessor (Processor processor)
 Sets the processor of the instance.
Processor getProcessor ()
 Returns the processor of the instance.
void doProcess ()
 Processes the instance.
boolean isTemplate ()
 Returns true if it is a template.
void addModelListener (ModelListener modelListener)
 Registers another listener to be informed of changes of the FTS.
void removeModelListener (ModelListener modelListener)
 Removes a listener.
void removeAllModelListener ()
 Removes all the listeners.
void fireModelEvent (ModelEvent modelEvent)
 Fires a ModelEvent event to registered listeners.
Vector getListeners ()
 Returns all the registered listener of the instance.
void setResourceIdentifier (String resourceIdentifier)
 Sets the resource identifier of the instance.
String getResourceIdentifier ()
 Returns the resource identifier of the instance.
void setAsOperatorPriority (int asOperatorPriority)
 Sets the as operator priority.
int getAsOperatorPriority ()
 Returns the priority of the instance viewed as an operator.
void setAsOperandPriority (int asOperandPriority)
 Sets the as operand priority.
int getAsOperandPriority ()
 Returns the priority of the instance viewed as an operand.
void setIsTemplate (boolean isTemplate)
 Sets the instance as a template.
FormulaTreeStructure findLocation (FormulaTreeStructure current)
 Returns the node (operator), which is the position in the formula tree, where the instance have to be inserted.
FormulaTreeStructure goTo (int priority)
 Returns the father of the node which, from the current instance, have the specified priority.
void setAreOperandsMovable (boolean areOperandsMovable)
boolean getAreOperandsMovable ()
void moveOperands (Vector list, int rank)
 Moves the specified list of the instance children to the specified rank.
boolean isEqual (fr.ove.utils.Comparable toCompare)
 Tests if the instance is equal to the specified one.
boolean isGreater (fr.ove.utils.Comparable toCompare)
 Tests if the instance is greater than the specified one.
boolean isGreaterOrEqual (fr.ove.utils.Comparable toCompare)
 Tests if the instance is greater or equal than the specified one.
boolean isLesser (fr.ove.utils.Comparable toCompare)
 Tests if the instance is lesser than the specified one.
boolean isLesserOrEqual (fr.ove.utils.Comparable toCompare)
 Tests if the instance is lesser or equal than the specified one.
void setIconName (String iconName)
 Associates an icon name to the instance.
String getIconName ()
 Returns the name of the icon associated to the instance.
boolean isIcon ()
void iconify ()
 Iconifies the instance.
void uniconify ()
 Uniconifies the instance.
void uniconifyAll ()
 Uniconifies all the iconified parts of the instance.
void setIsIconifiable (boolean isIconifiable)
 Sets the instance as iconifiable.
boolean isIconifiable ()
 Returns true if the instance is iconifiable.
void consumeControlEvent (ControlEvent controlEvent)
 Consumes (i.e.
void setIsVisble (boolean isVisible)
 Sets the instance as vissible or not.
boolean isVisible ()
 Checks if the instance is visible.
void setValue (String value)
 Sets the value.
String getValue ()
 Returns the value.
Node getFather ()
 Returns the father of the instance.
int getRank ()
 Returns the rank of the instance in the set of its father's children.
Node getChild (int rank)
 Returns the child of the instance at the specified rank.
int getNbChildren ()
 Returns the number of children of the instance.
Vector getChildren ()
 Returns the list of children of the instance.
void setFather (Node father)
 Sets a father to instance.
void addChild (Node child)
 Adds a child to the instance.
void addChild (Node child, int rank)
 Adds a child to the instance.
void removeChild (int rank)
 Removes the child of the current node at the specified rank.
void removeChild (Node node)
 Removes the specified child of the instance.
void removeAll ()
 Remove all the children of the instance.
void moveChildren (Vector list, int rank)
 Moves the specified list of the instance children to the specified rank.
boolean hasChild (Node node)
 Checks if the specified node is a child of the current instance.
synchronized Object clone ()
 Clones (copies) the instance.
synchronized Object duplicate ()
 Duplicates (copies) the instance.
int getDepth ()
 Returns the depth of the node.
void computeDepth ()
 Compute the depth of the node.
int getNbStrahler ()
 Returns the strahler number of the node.
void setNbStrahler (int nbStrahler)
 Sets the Strahler number of the instance.
void computeNbStrahler ()
 Computes the strahler number of the tree whose the instance is the root.

Static Public Member Functions

static void main (String args[])

Public Attributes

FormulaTreeStructure current
 The current insertion position in the formula (tree structure).

Static Package Attributes

static FormulaResourcesManager resourcesManager = new FormulaResourcesManager("fr.ove.openmath.jome.model.resources2")
 The resources manager.

Private Attributes

Stack openingStack = new Stack()
 The OpenMath formater for exportation of the formula as an OpenMath object.
boolean doProcessing = false
 Flag to deal with a possible processing of the model of the formula before rendering.
Processor processor = null
 The processor which will process the model of the formula before rendering if wanted.

Detailed Description

The formula.


The root of the formula tree structure.

Author:
© 2000 DIRAT Laurent
Version:
2.0 28/06/99

Definition at line 49 of file Formula.java.


Constructor & Destructor Documentation

The Constructor.

Definition at line 84 of file Formula.java.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

void fr.ove.openmath.jome.model.Node.addChild ( Node  child) [inline, inherited]

Adds a child to the instance.


The child added is the last of the list.

Parameters:
childthe child to add.

Definition at line 163 of file Node.java.

                                     {
        if (children == null)
            children = new Vector(0, 1);
            
        children.addElement(child);
        child.setFather(this);
        adjustRank();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.Node.addChild ( Node  child,
int  rank 
) [inline, inherited]

Adds a child to the instance.


The child is added at the specified rank.

Parameters:
childthe child to add.
rankthe specified rank.

Definition at line 179 of file Node.java.

                                               {
        if (children == null)
            children = new Vector(0, 1);
            
        children.insertElementAt(child, rank);
        child.setFather(this);
        adjustRank();
    }

Here is the call graph for this function:

void fr.ove.openmath.jome.model.FormulaTreeStructure.addModelListener ( ModelListener  modelListener) [inline, inherited]

Registers another listener to be informed of changes of the FTS.

Parameters:
modelListenera listener to add.

Definition at line 90 of file FormulaTreeStructure.java.

                                                              {
        listeners.addElement(modelListener);
    }

Here is the caller graph for this function:

clears the formula.

Definition at line 124 of file Formula.java.

                        {
        // On enlève tous les enfants de la FTS.
        removeAll();
        // On remet la position courante d'insertion sur la racine de la FTS
        current = this;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

synchronized Object fr.ove.openmath.jome.model.Node.clone ( ) [inline, inherited]

Clones (copies) the instance.


Make a deep clone, i.e. the children of the instance are also cloned.
Nevertheless, the father of the clone is set to null.

Definition at line 309 of file Node.java.

                                      {
        Node theClone = null;
        try {
            //return super.clone();
            
            // On clone l'instance.
            theClone = (Node) super.clone();
            // Le père du clone est null
            theClone.father = null;
            if (children != null) {
                // On clone les enfants
                Vector theChildren = new Vector();
                int count = children.size();
                for (int i = 0; i < count; i++)
                    theChildren.addElement(((Node) children.elementAt(i)).clone());
                theClone.children = theChildren;
            }
            
        } catch (CloneNotSupportedException e) {
            System.out.println("clone failed !!");
        }
        
        return theClone;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.Node.computeDepth ( ) [inline, inherited]

Compute the depth of the node.

Definition at line 376 of file Node.java.

                               {
        int theDepth = 0;
        Node theFather = father;
        
        while (theFather != null) {
            theDepth++;
            theFather = theFather.father;
        }
        
        depth = theDepth;
        
        // On met à jour maintenant la profondeur des fils éventuels.
        if (children != null)
            adjustChildrenDepth();
    }

Here is the call graph for this function:

Computes the strahler number of the tree whose the instance is the root.

Definition at line 491 of file Node.java.

                                    {
        if (children != null) {
            int count = children.size();
            for (int i = 0; i < count; i++)
                ((Node) children.elementAt(i)).computeNbStrahler();
                
            computeNodeNbStrahler();
        }
    }

Here is the call graph for this function:

void fr.ove.openmath.jome.model.FormulaTreeStructure.consumeControlEvent ( ControlEvent  controlEvent) [inline, inherited]

Consumes (i.e.

treats) the event received.

Parameters:
controlEventthe event to consume.

Definition at line 452 of file FormulaTreeStructure.java.

                                                               {
        ModelEvent modelEvent;
        int action = controlEvent.getAction();
        FormulaTreeStructure fts = null;
        
        switch (action) {
            case ControlEvent.ADD :
                //System.out.println("ControlEvent.ADD : on ajoute un nouveau display");
                break;
            case ControlEvent.REMOVE :
                //System.out.println("ControlEvent.REMOVE : on enleve un display");
                break;
            case ControlEvent.ICONIFY :
                //System.out.println("ControlEvent.ICONIFY : on iconifie");
                Vector toIconify = (Vector) controlEvent.getArgument();
                Icon icon = null;
                if (toIconify.size() == 1) {
                    fts = (FormulaTreeStructure) toIconify.elementAt(0);
                    // une seule fts à iconifier.
                    if (fts.isIconifiable()) {
                        // Ce n'est pas déjà une icone et fts est iconifiable, on peut en créer une.
                        icon = new Icon(fts);
                        // On ajoute notre fts à iconifier dans Icon (<=> on iconfie fts)
                        icon.addIconified(fts);
                        // On insère maintenant notre icon à la place de fts.
                        icon.insert(fts);
                    }
                    // fts = icon.father pour que l'on puisse ajouter le display de notre icone dans icon.father
                    fts = (FormulaTreeStructure) icon.getFather();
                }
                else {
                    // Plusieurs fts sont à iconifier. Il faut donc récupérer la fts
                    // dont elles sont les filles, pour pouvoir créer l'icone adéquate.
                    fts = (FormulaTreeStructure) ((FormulaTreeStructure) toIconify.elementAt(0)).getFather();
                    // On crée une nouvelle icone
                    icon = new Icon(fts);
                    // On ajoute maintenant tous les fts à iconifier.
                    int countToIconify = toIconify.size();
                    for (int i = 0; i < countToIconify; i++)
                        icon.addIconified((FormulaTreeStructure) toIconify.elementAt(i));
                    // On insère maintenant notre icon à la place de la 1-ère fts.
                    icon.insert(icon.getIconified(0));
                }
                
                // On ajoute un display pour notre icon.
                modelEvent = new ModelEvent(fts);
                modelEvent.setAction(ModelEvent.ADD, icon);
                fts.fireModelEvent(modelEvent);
                
                // On met à jour l'affichage de la fts.
                modelEvent.setAction(ModelEvent.UPDATE, null);
                fts.fireModelEvent(modelEvent);
                
                break;
                
            case ControlEvent.UNICONIFY :
                //System.out.println("ControlEvent.UNICONIFY : on desiconifie");
                Icon anIcon = (Icon) controlEvent.getArgument();
                fts = (FormulaTreeStructure) anIcon.getFather();
                anIcon.uniconify();
                
                // On envoie maintenant un événement comme quoi il faut reconstruire
                // l'affichage.
                modelEvent = new ModelEvent(fts);
                modelEvent.setAction(ModelEvent.REBUILD, null);
                fts.fireModelEvent(modelEvent);
                // On envoie maintenant un événement comme quoi il faut mettre à
                // jour l'affichage.
                modelEvent.setAction(ModelEvent.UPDATE, null);
                // On envoie l'événement.
                fts.fireModelEvent(modelEvent);
                break;
                
            case ControlEvent.UNICONIFY_ALL :
                // On remonte dans la FTS jusqu'à tomber sur la racine de la formule.
                fts = this;
                while (fts.getFather() != null)
                    fts = (FormulaTreeStructure) getFather();
                    
                // On est sur la racine de la formule.
                // A partir de là, on demande de tout désiconifier
                fts.uniconifyAll();
                
                // On envoie maintenant un événement comme quoi il faut mettre à
                // jour l'affichage.
                modelEvent = new ModelEvent(fts);
                modelEvent.setAction(ModelEvent.UPDATE, null);
                // On envoie l'événement.
                fts.fireModelEvent(modelEvent);
                break;
                
            case ControlEvent.SUBSTITUTE :
                //System.out.println("ControlEvent.ICONIFY : on iconifie");
                // ### ATTENTION, le premier élément sera le nom pour la substitution
                Vector toSubstitute = (Vector) controlEvent.getArgument();
                fts = (FormulaTreeStructure) toSubstitute.elementAt(1);
                // On crée une nouvelle icone
                Icon substitution = new Icon((String) toSubstitute.elementAt(0));
                // On ajoute maintenant tous les fts à iconifier.
                int countToIconify = toSubstitute.size();
                
                if ((countToIconify == 2) && !fts.isIconifiable())
                    break;
                
                for (int i = 1; i < countToIconify; i++)
                    substitution.addIconified((FormulaTreeStructure) toSubstitute.elementAt(i));

                // On insère maintenant notre icon à la place de la 1-ère fts.
                substitution.insert(fts);

                // fts = substitution.father pour que l'on puisse ajouter le display de notre icone
                // dans substitution.father
                fts = (FormulaTreeStructure) substitution.getFather();

                // On ajoute un display pour notre icon.
                modelEvent = new ModelEvent(fts);
                modelEvent.setAction(ModelEvent.ADD, substitution);
                fts.fireModelEvent(modelEvent);
                // On met à jour l'affichage de la fts.
                modelEvent.setAction(ModelEvent.UPDATE, null);
                fts.fireModelEvent(modelEvent);
                break;
        }
    }

Here is the call graph for this function:

void fr.ove.openmath.jome.model.Formula.consumeLinearParserEvent ( LinearParserEvent  linearParserEvent) [inline]

Treats the event received.

Parameters:
linearParserEventthe event received.

Definition at line 160 of file Formula.java.

                                                                              {
        int identifier = linearParserEvent.getIdentifier();
        String value = linearParserEvent.getValue();
        ModelEvent modelEvent;
        
        switch (identifier) {
            case LinearParserEvent.START_EXPRESSION :
                clear();
                openingStack.setSize(0);
                modelEvent = new ModelEvent(this);
                modelEvent.setAction(ModelEvent.CLEAR, null);
                fireModelEvent(modelEvent);
                break;
                
            case LinearParserEvent.END_EXPRESSION :
                // Le modèle de la formule est entièrement construit.
                // On regarde d'abord les éventuels traitements à effectuer sur le modèle
                // avant la construction des displays.
                if (doProcessing && (processor != null)) {
                         // Initialisation du processeur si besoin est.
                         processor.init();
                    processor.doProcess();
                }
                
                modelEvent = new ModelEvent(this);
                modelEvent.setAction(ModelEvent.CREATE, null);
                fireModelEvent(modelEvent);
                break;
                
            default :
                String strIdentifier = linearParserEvent.getIdentifierAsString();
                String className = resourcesManager.getClassName(strIdentifier);
                FormulaTreeStructure newFts = null;

                if (className.equals("null")) {
                    if (identifier == linearParserEvent.SEPARATOR) {
                        //current = current.goTo(FormulaTreeStructure.SLOT_AS_OPERATOR_PRIORITY);
                        current = current.goTo(resourcesManager.getAsOperatorPriority("slotPriorities"));
                        
                        // current est maintenant une instance de Slot, on récupère son père pour lui
                        // ajouter un nouvel élément.
                        NaryOperator2 currentFather = (NaryOperator2) current.getFather();
                        current = currentFather.addElement();
                    }
                    else {
                        // Alors c'est forcément un linearParserEvent.CLOSE_*
                        if (!openingStack.isEmpty()) {
                            current = (FormulaTreeStructure) openingStack.pop();
                            // Et remonte encore d'un cran à cause des priorités des opérateurs
                            // (surtout en ce qui concerne les parenthèses)
                            current = (FormulaTreeStructure) current.getFather();
                        }
                    }
                }
                else {
                    if (className.equals("refine")) {
                        String[] properties = resourcesManager.getResourceStrings(value);
                        if (properties.length != 0)
                            strIdentifier = value; // On a trouvé qque chose correspondant à value
                        else {
                            if (identifier == linearParserEvent.RESERVED) 
                                // Il n'existe pas de mot réservé défini dans le modèle correspondant à value.
                                // On considère donc value comme une variable.
                                strIdentifier = "VARIABLE";
                            else
                                // Si ce n'est pas un mot réservé, c'est une fonction.
                                // Il n'existe pas de fonction spéciale définie correspondant à value.
                                // On considère donc value comme une fonction par défaut ayant pour nom value.
                                strIdentifier = "defaultFunction";
                        }
                    }
                    
                    newFts = (FormulaTreeStructure) Factory.getClassInstance(resourcesManager.getClassName(strIdentifier));
                    newFts.setResourceIdentifier(strIdentifier);
                    String prioritiesId = resourcesManager.getPrioritiesIdentifier(strIdentifier);
                    newFts.setAsOperatorPriority(resourcesManager.getAsOperatorPriority(prioritiesId));
                    newFts.setAsOperandPriority(resourcesManager.getAsOperandPriority(prioritiesId));
                    
                    if (value != null)
                        newFts.setValue(value);
                        
                    Integer arity = resourcesManager.getArity(strIdentifier);
                    if (arity != null)
                        ((KaryOperator) newFts).setOperatorArity(arity.intValue());
                    
                    switch (identifier) {
                        case LinearParserEvent.FUNCTION :
                        case LinearParserEvent.OPEN_PAREN :
                        case LinearParserEvent.OPEN_BRACKET :
                        case LinearParserEvent.OPEN_CURLY :
                            openingStack.push(newFts);
                    }
                    
                    current = newFts.insert(current);
                }
        }
    }

Here is the call graph for this function:

String fr.ove.openmath.jome.model.Formula.createLinear ( String  linear) [inline, virtual]

The Creation of the corresponding linear expression of the formula.

Implements fr.ove.openmath.jome.model.FormulaTreeStructure.

Definition at line 114 of file Formula.java.

                                              {
        if (getNbChildren() > 0)
            linear = ((FormulaTreeStructure) getChild(0)).createLinear(linear);
            
        return linear;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Processes the instance.

Definition at line 293 of file Formula.java.

                            {
        if (doProcessing && (processor != null))
            processor.doProcess();
    }
synchronized Object fr.ove.openmath.jome.model.Node.duplicate ( ) [inline, inherited]

Duplicates (copies) the instance.


The difference with clone, is a deep copy is not performed.
The father of the duplicate is set to null.

Definition at line 339 of file Node.java.

                                          {
        Node theClone = null;
        try {
            // On clone l'instance.
            theClone = (Node) super.clone();
            // Le père du clone est null
            theClone.father = null;
            // Pas de fils
            theClone.children = new Vector();
        } catch (CloneNotSupportedException e) {
            System.out.println("duplicate failed !!");
        }
        
        return theClone;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String fr.ove.openmath.jome.model.Formula.evaluate ( ) [inline, virtual]

Returns the OpenMath representation of the formula.

Returns the MathML representation of the formula. Evaluates the instance.

Implements fr.ove.openmath.jome.model.FormulaTreeStructure.

Definition at line 149 of file Formula.java.

                             {
        if (getNbChildren() > 0)
            return ((FormulaTreeStructure) getChild(0)).evaluate();
        else
            return "";
    }

Here is the call graph for this function:

Returns the node (operator), which is the position in the formula tree, where the instance have to be inserted.

Parameters:
currentthe current insert position in the formula tree.
Returns:
the insert position in the formula tree for the instance.

Definition at line 198 of file FormulaTreeStructure.java.

                                                                           {
        //while (this.asOperandPriority < current.asOperatorPriority)
        while (asOperandPriority < current.getAsOperatorPriority())
            current = (FormulaTreeStructure) current.getFather();

        return current;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Fires a ModelEvent event to registered listeners.

Parameters:
modelEventevent encapsulating relevant information.

Definition at line 113 of file FormulaTreeStructure.java.

                                                      {
        for (int i = 0; i < listeners.size(); i++)
          ((ModelListener)listeners.elementAt(i)).consumeModelEvent(modelEvent);
    }

Here is the caller graph for this function:

Definition at line 242 of file FormulaTreeStructure.java.

                                           {
        return areOperandsMovable;
    }

Here is the caller graph for this function:

Returns the priority of the instance viewed as an operand.

Returns:
the priority of the instance viewed as an operand.

Definition at line 172 of file FormulaTreeStructure.java.

                                      {
        return asOperandPriority;
    }

Here is the caller graph for this function:

Returns the priority of the instance viewed as an operator.

Returns:
the priority of the instance viewed as an operator.

Definition at line 156 of file FormulaTreeStructure.java.

                                       {
        return asOperatorPriority;
    }

Here is the caller graph for this function:

Node fr.ove.openmath.jome.model.Node.getChild ( int  rank) [inline, inherited]

Returns the child of the instance at the specified rank.

Parameters:
rankthe specified rank.
Returns:
the child at the specified rank.

Definition at line 105 of file Node.java.

                                   {
        Node child = null;
        
        if (children != null) {
            try {
                child = (Node) children.elementAt(rank);
            }
            catch (ArrayIndexOutOfBoundsException e) {
                return null;
            }
        }
        
        return child;
    }

Here is the call graph for this function:

Vector fr.ove.openmath.jome.model.Node.getChildren ( ) [inline, inherited]

Returns the list of children of the instance.

Returns:
the list of children

Definition at line 137 of file Node.java.

                                {
        return children;
    }

Here is the caller graph for this function:

int fr.ove.openmath.jome.model.Node.getDepth ( ) [inline, inherited]

Returns the depth of the node.

Definition at line 369 of file Node.java.

                          {
        return depth;
    }

Here is the caller graph for this function:

Returns true if the instance needs a processing.

false otherwise.

Definition at line 271 of file Formula.java.

                                     {
        return doProcessing;
    }

Returns the father of the instance.

Returns:
the father of the node.

Definition at line 86 of file Node.java.

                            {
        return father;
    }

Returns the name of the icon associated to the instance.


The icon name is the name of the ressource identifier where "_Ico" added to the end.

Returns:
The name of the icon, or null if there is no name associated.

Reimplemented in fr.ove.openmath.jome.model.Icon, fr.ove.openmath.jome.model.Bracket, and fr.ove.openmath.jome.model.Slot.

Definition at line 343 of file FormulaTreeStructure.java.

                                {
        return resourceIdentifier + "_Ico"; //resourcesManager.getIconName(resourceIdentifier);
    }

Here is the caller graph for this function:

Returns the linear expression of the formula.

Definition at line 134 of file Formula.java.

                              {
        return createLinear("");
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Returns all the registered listener of the instance.

Definition at line 121 of file FormulaTreeStructure.java.

                                 {
        return listeners;
    }

Here is the caller graph for this function:

int fr.ove.openmath.jome.model.Node.getNbChildren ( ) [inline, inherited]

Returns the number of children of the instance.

Definition at line 123 of file Node.java.

                               {
        int size = 0;
        
        if (children != null)
            size = children.size();
            
        return size;
    }

Here is the caller graph for this function:

int fr.ove.openmath.jome.model.Node.getNbStrahler ( ) [inline, inherited]

Returns the strahler number of the node.

Definition at line 416 of file Node.java.

                               {
        return nbStrahler;
    }

Returns the processor of the instance.

Definition at line 286 of file Formula.java.

                                    {
        return processor;
    }
int fr.ove.openmath.jome.model.Node.getRank ( ) [inline, inherited]

Returns the rank of the instance in the set of its father's children.

Returns:
the rank of the node.

Definition at line 95 of file Node.java.

                         {
        return rank;
    }

Here is the caller graph for this function:

Returns the resource identifier of the instance.

Definition at line 140 of file FormulaTreeStructure.java.

                                          {
        return resourceIdentifier;
    }

Here is the caller graph for this function:

Returns the father of the node which, from the current instance, have the specified priority.

Parameters:
prioritythe specified priority.
Returns:
the desired father.

Reimplemented in fr.ove.openmath.jome.model.Slot, and fr.ove.openmath.jome.model.Bracket.

Definition at line 213 of file FormulaTreeStructure.java.

                                                   {
        FormulaTreeStructure current = this;

        // Si le test est vrai, c'est qu'on est déjà sur un tel noeud.
        // On retourne un noeud identique placé au-dessus dans l'arbre
        int prio = current.asOperatorPriority;
        if (current.asOperatorPriority == priority)
            current = (FormulaTreeStructure) current.getFather();

        while ((current.asOperatorPriority != priority) &&
                (((FormulaTreeStructure)current.getFather()).asOperatorPriority != 0))
            current = (FormulaTreeStructure) current.getFather();

        return (FormulaTreeStructure) current.getFather();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

boolean fr.ove.openmath.jome.model.Node.hasChild ( Node  node) [inline, inherited]

Checks if the specified node is a child of the current instance.

Parameters:
nodethe specified node.
Returns:
true if the specified node is a child of the current instance. false otherwise.

Definition at line 295 of file Node.java.

                                       {
        boolean hasChild = false;
        
        if (children != null) 
            hasChild = children.contains(node);
            
        return hasChild;
    }

Here is the caller graph for this function:

Iconifies the instance.

Reimplemented in fr.ove.openmath.jome.model.Icon.

Definition at line 357 of file FormulaTreeStructure.java.

                          {
        if (isIconifiable()) {
            Icon icon = new Icon(this);
            // On ajoute l'instance à iconifier dans Icon (<=> on iconfie l'instance)
            icon.addIconified(this);
            // On insère maintenant notre icon à la place de l'instance.
            icon.insert(this);
        }
    }

Here is the call graph for this function:

Inserts the operator instance in the formula tree, from the current insertion position.

(checks the priorities and goes up in the tree if necessary).
At the moment, we can't insert a formula in an another formula.

Parameters:
currentthe current insertion position.

Implements fr.ove.openmath.jome.model.FormulaTreeStructure.

Definition at line 105 of file Formula.java.

                                                                     {
        // On ne devrait pas insérer de formule !!
        // A voir, peut être utile pour le drag'n drop d'une nouvelle formule;
        return null;
    }

Tests if the instance is equal to the specified one.

Parameters:
toComparethe instance to compare with the current instance.

Implements fr.ove.utils.Comparable.

Definition at line 280 of file FormulaTreeStructure.java.

                                                              {
        // On verra plus tard
        return false;
    }

Tests if the instance is greater than the specified one.

Parameters:
toComparethe instance to compare with the current instance.

Implements fr.ove.utils.Comparable.

Definition at line 289 of file FormulaTreeStructure.java.

                                                                {
        // On s'en fout, seule l'égalité nous intéresse
        return false;
    }

Tests if the instance is greater or equal than the specified one.

Parameters:
toComparethe instance to compare with the current instance.

Implements fr.ove.utils.Comparable.

Definition at line 298 of file FormulaTreeStructure.java.

                                                                       {
        // On s'en fout, seule l'égalité nous intéresse
        return false;
    }
Returns:
true if the instance is an icon. false otherwise.

Reimplemented in fr.ove.openmath.jome.model.Icon.

Definition at line 350 of file FormulaTreeStructure.java.

                            {
        return false;
    }

Here is the caller graph for this function:

Returns true if the instance is iconifiable.

false otherwise.

Reimplemented in fr.ove.openmath.jome.model.Icon, and fr.ove.openmath.jome.model.Constant.

Definition at line 436 of file FormulaTreeStructure.java.

                                   {
        return true;  // Très peu ne sont pas iconifiables. Les concernés surchargeront cette méthode.
    }

Here is the caller graph for this function:

Tests if the instance is lesser than the specified one.

Parameters:
toComparethe instance to compare with the current instance.

Implements fr.ove.utils.Comparable.

Definition at line 307 of file FormulaTreeStructure.java.

                                                               {
        // On s'en fout, seule l'égalité nous intéresse
        return false;
    }

Tests if the instance is lesser or equal than the specified one.

Parameters:
toComparethe instance to compare with the current instance.

Implements fr.ove.utils.Comparable.

Definition at line 316 of file FormulaTreeStructure.java.

                                                                      {
        // On s'en fout, seule l'égalité nous intéresse
        return false;
    }

To check is the instance is an operator.

Returns:
true if it is an operator. false otherwise.

Implements fr.ove.openmath.jome.model.FormulaTreeStructure.

Definition at line 95 of file Formula.java.

                                {
        return false;
    }

Returns true if it is a template.


false otherwise.

Definition at line 180 of file FormulaTreeStructure.java.

                                {
        return isTemplate;
    }

Here is the caller graph for this function:

Checks if the instance is visible.

Returns:
true if the instance is visible. false otherwise.

Reimplemented in fr.ove.openmath.jome.model.Bracket, and fr.ove.openmath.jome.model.Liste.

Definition at line 596 of file FormulaTreeStructure.java.

                               {
        // Tout les opérateurs sont visibles à de rares exceptions près.
        // Ce sont ces exceptions qui maintiendront cette propriété correctement en la surchargeant
        return true;
    }
static void fr.ove.openmath.jome.model.Formula.main ( String  args[]) [inline, static]

Definition at line 298 of file Formula.java.

                                           {
        String exp = "sum(i^n,0,sum(i^n,0,5))t";
        Formula formula = new Formula();
        fr.ove.openmath.jome.ctrl.linear.LinearParser linearParser = new fr.ove.openmath.jome.ctrl.linear.LinearParser();
        linearParser.addLinearParserListener(formula);
        linearParser.parse(exp);
        System.out.println("la formule saisie est : \t\t" + exp);
        System.out.println("la formule construite est : \t\t" + formula.getLinear());
        
        try {
            Thread.sleep(5000);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

Here is the call graph for this function:

void fr.ove.openmath.jome.model.Node.moveChildren ( Vector  list,
int  rank 
) [inline, inherited]

Moves the specified list of the instance children to the specified rank.

The first child in the list has its rank setted to the specified one, the second to the first+1, ...and so on.

Parameters:
listthe list of the instance children.
rankthe specified rank.

Definition at line 269 of file Node.java.

                                                    {
        // Puisque list contient des fils de l'instance, on peut partir du prérequis que
        // children est non null.
        int NbChildren = children.size();
        Node child = null;
        Node first = null;
        
        for (int i = 0; i < list.size(); i++) {
            child = (Node) list.elementAt(i);
            if (i == 0)
                first = child;
            if (rank > NbChildren)
                child.changeRank(rank + (i+1));
            else {
                child.changeRank(rank);
                rank = first.getRank() + (i+1);
            }
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.FormulaTreeStructure.moveOperands ( Vector  list,
int  rank 
) [inline, inherited]

Moves the specified list of the instance children to the specified rank.

The first child in the list has its rank setted to the specified one, the second to the first+1, ...and so on.

Parameters:
listthe list of the instance operands to move.
rankthe specified rank.

Definition at line 253 of file FormulaTreeStructure.java.

                                                    {
        // On fait la permutation dans la FTS
        moveChildren(list, rank);
        
        ModelEvent modelEvent = new ModelEvent(this);
        // On a fait les déplacements nécéssaires, on reconstruit le display
        modelEvent.setAction(ModelEvent.REBUILD, null);
        // On envoie l'événement.
        fireModelEvent(modelEvent);
        // On envoie maintenant un événement comme quoi il faut mettre à
        // jour l'affichage.
        modelEvent.setAction(ModelEvent.UPDATE, null);
        // On envoie l'événement.
        fireModelEvent(modelEvent);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.Node.removeAll ( ) [inline, inherited]

Remove all the children of the instance.

Definition at line 215 of file Node.java.

                            {
        if (children != null) {
            int count = children.size();
            for (int i = 0; i < count; i++)
                ((Node) children.elementAt(rank)).father = null;
                
            children.setSize(0);
            children.trimToSize();
        }
    }

Here is the caller graph for this function:

Removes all the listeners.

Definition at line 105 of file FormulaTreeStructure.java.

                                         {
        listeners.setSize(0);
    }
void fr.ove.openmath.jome.model.Node.removeChild ( int  rank) [inline, inherited]

Removes the child of the current node at the specified rank.

Parameters:
rankthe rank of the child to remove.

Definition at line 193 of file Node.java.

                                      {
        if (children != null) {
            children.removeElementAt(rank);
            adjustRank();
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.Node.removeChild ( Node  node) [inline, inherited]

Removes the specified child of the instance.

Parameters:
nodethe child to remove.

Definition at line 205 of file Node.java.

                                       {
        if (children != null) {
            children.removeElement(node);
            adjustRank();
        }
    }

Here is the call graph for this function:

void fr.ove.openmath.jome.model.FormulaTreeStructure.removeModelListener ( ModelListener  modelListener) [inline, inherited]

Removes a listener.

Parameters:
modelListenera listener to remove.

Definition at line 98 of file FormulaTreeStructure.java.

                                                                 {
        listeners.removeElement(modelListener);
    }

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.FormulaTreeStructure.setAreOperandsMovable ( boolean  areOperandsMovable) [inline, inherited]

Definition at line 234 of file FormulaTreeStructure.java.

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.FormulaTreeStructure.setAsOperandPriority ( int  asOperandPriority) [inline, inherited]

Sets the as operand priority.

Parameters:
asOperandPrioritythe priority

Definition at line 164 of file FormulaTreeStructure.java.

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.FormulaTreeStructure.setAsOperatorPriority ( int  asOperatorPriority) [inline, inherited]

Sets the as operator priority.

Parameters:
asOperatorPrioritythe priority

Definition at line 148 of file FormulaTreeStructure.java.

Here is the caller graph for this function:

Sets if we had to process the instance before rendering.

Parameters:
doProcessingtrue if the instance needs a processing. false otherwise.

Definition at line 263 of file Formula.java.

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.Node.setFather ( Node  father) [inline, inherited]

Sets a father to instance.

Parameters:
fatherthe father to set

Definition at line 148 of file Node.java.

                                       {
        this.father = father;
        depth = father.depth + 1;
        
        // On met à jour maintenant la profondeur des fils éventuels.
        if (children != null)
            adjustChildrenDepth();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.FormulaTreeStructure.setIconName ( String  iconName) [inline, inherited]

Associates an icon name to the instance.

Parameters:
iconNamethe name of the icon

Reimplemented in fr.ove.openmath.jome.model.Icon.

Definition at line 332 of file FormulaTreeStructure.java.

                                             {
        // On ne fait rien, c'est dans les classes dérivées qu'on va implémenter getIconName().
        // Ca évite de stocker une String pour pas grand chose.
    }

Sets the instance as iconifiable.

Parameters:
isIconifiabletrue if the instance is iconifiable. false otherwise.

Definition at line 427 of file FormulaTreeStructure.java.

                                                        {
        // On ne fait rien, les classes héritières retourneront la valeur qui leur correspond.
        // On évite de stocker un booléen pour pas grand chose puisque peu ne seront pas iconifiables
    }

Sets the instance as a template.

Definition at line 187 of file FormulaTreeStructure.java.

                                                  {
        this.isTemplate = isTemplate;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Sets the instance as vissible or not.

Parameters:
isVisibletrue if the instance is visible. false otherwise.

Definition at line 587 of file FormulaTreeStructure.java.

                                               {
        // Ne fait rien par défaut. Tout les opérateurs sont visibles à de rares exceptions près.
        // Ce sont ces exceptions qui maintiendront cette propriété correctement en la surchargeant
    }
void fr.ove.openmath.jome.model.Node.setNbStrahler ( int  nbStrahler) [inline, inherited]

Sets the Strahler number of the instance.


!!! ATTENTION !!! : should not be called at any time. Just specific cases only, above all, when you know what you are doing.

Parameters:
nbStrahlerthe Strahler number value to set.

Definition at line 426 of file Node.java.

                                              {
        this.nbStrahler = nbStrahler;
    }
void fr.ove.openmath.jome.model.Formula.setProcessor ( Processor  processor) [inline]

Sets the processor of the instance.

Parameters:
processorthe processor.

Definition at line 279 of file Formula.java.

                                                  {
        this.processor = processor;
    }

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.FormulaTreeStructure.setResourceIdentifier ( String  resourceIdentifier) [inline, inherited]

Sets the resource identifier of the instance.

Parameters:
theresource identifier.

Definition at line 133 of file FormulaTreeStructure.java.

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.FormulaTreeStructure.setValue ( String  value) [inline, inherited]

Uniconifies the instance.

Reimplemented in fr.ove.openmath.jome.model.Icon.

Definition at line 370 of file FormulaTreeStructure.java.

                            {
        // Par défaut on ne fait rien, on ne peut désiconifier qu'une icone
    }

Here is the caller graph for this function:

Uniconifies all the iconified parts of the instance.

Definition at line 378 of file FormulaTreeStructure.java.

                               {
        if (getNbChildren() != 0) {
            boolean rebuildDisplay = false;
            // On parcourre tous les enfants de l'instance et si on trouve une icone, on la
            // désiconifie
            FormulaTreeStructure fts = null;
            
            /*
            for (Enumeration e = getChildren().elements(); e.hasMoreElements(); ) {
                fts = (FormulaTreeStructure) e.nextElement();
                if (fts.isIcon()) {
                    fts.uniconify();
                    rebuildDisplay = true;
                }
            }
            */
            for (int i = 0; i < getNbChildren(); i++) {
                fts = (FormulaTreeStructure) getChild(i);
                if (fts.isIcon()) {
                    fts.uniconify();
                    rebuildDisplay = true;
                    i = -1; // On repart à zéro car la désiconification a pu en refaire apparaître.
                }
            }
            
            // l'instance n'a plus de d'icone fille, on s'occupe de la descendance
            for (Enumeration e = getChildren().elements(); e.hasMoreElements(); )
                ((FormulaTreeStructure) e.nextElement()).uniconifyAll();
        
            // Reconstruction du display que si y a eu désiconification
            if (rebuildDisplay) {
                // On part du principe que si l'on a une icone, c'est que l'on a le display qui lui est
                // associé, donc reconstruction du display.
                // Faire gaffe à appeler le ModelEvent.UPDATE quand nécessaire
                
                // On envoie maintenant un événement comme quoi il faut reconstruire
                // l'affichage.
                ModelEvent modelEvent = new ModelEvent(this);
                modelEvent.setAction(ModelEvent.REBUILD, null);
                fireModelEvent(modelEvent);
            }
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

The current insertion position in the formula (tree structure).

Definition at line 53 of file Formula.java.

Flag to deal with a possible processing of the model of the formula before rendering.


The default is false, i.e. we want the formula to be displayed normally (no processing).

Definition at line 73 of file Formula.java.

Stack fr.ove.openmath.jome.model.Formula.openingStack = new Stack() [private]

The OpenMath formater for exportation of the formula as an OpenMath object.

The MathML formater for exportation of the formula as a MathML object

Definition at line 66 of file Formula.java.

The processor which will process the model of the formula before rendering if wanted.


By default, no processor is set. One processor has to added when desired.

Definition at line 79 of file Formula.java.

FormulaResourcesManager fr.ove.openmath.jome.model.FormulaTreeStructure.resourcesManager = new FormulaResourcesManager("fr.ove.openmath.jome.model.resources2") [static, package, inherited]

The resources manager.

Definition at line 76 of file FormulaTreeStructure.java.


The documentation for this class was generated from the following file: