Back to index

wims  3.65+svn20090927
Public Member Functions | Static Package Attributes | Private Attributes
fr.ove.openmath.jome.model.KaryOperator Class Reference
Inheritance diagram for fr.ove.openmath.jome.model.KaryOperator:
Inheritance graph
[legend]
Collaboration diagram for fr.ove.openmath.jome.model.KaryOperator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void setOperatorArity (int operatorArity)
 Sets the operator arity.
int getOperatorArity ()
 Returns the operator arity.
FormulaTreeStructure addElement ()
 Adds a new element (template) to the end of the list.
void setValue (String value)
 Sets the value.
String getValue ()
 Returns the value.
String getEnding ()
 Returns the ending of the operator.
void setEnding (String ending)
 Sets the ending of the operator.
FormulaTreeStructure insert (FormulaTreeStructure current)
 Inserts the instance in the formula tree structure.
String createLinear (String linear)
 The Creation of the corresponding linear expression of the formula.
String evaluate ()
 Evaluates the instance.
String getTheOperator ()
 Returns the name of the operator.
void setTheOperator (String theOperator)
 Sets the name of the operator.
boolean isOperator ()
 To check is the instance is an operator.
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.
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 Package Attributes

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

Private Attributes

int operatorArity
 The arity of the operator.

Detailed Description

Author:
© 2000 DIRAT Laurent
Version:
2.1 10/01/2000

Definition at line 36 of file KaryOperator.java.


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:

Adds a new element (template) to the end of the list.

Returns the new element.

Reimplemented from fr.ove.openmath.jome.model.NaryOperator2.

Reimplemented in fr.ove.openmath.jome.model.Mfd2SubstitutionElement, fr.ove.openmath.jome.model.ComplexPolar, fr.ove.openmath.jome.model.ComplexCartesian, fr.ove.openmath.jome.model.Integral, fr.ove.openmath.jome.model.Limit, and fr.ove.openmath.jome.model.Rational.

Definition at line 60 of file KaryOperator.java.

                                             {
        if (getNbChildren() < operatorArity)
            return super.addElement();
        else 
            return this;
        // faudra faire des exceptions pour dire que l'arité n'est pas respéctée
    }

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:

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:

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

The Creation of the corresponding linear expression of the formula.

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

Reimplemented in fr.ove.openmath.jome.model.Differentiation, fr.ove.openmath.jome.model.ComplexPolar, and fr.ove.openmath.jome.model.ComplexCartesian.

Definition at line 129 of file NaryOperator2.java.

                                              {
        FormulaTreeStructure child;
        
        // Là encore, avec ce genre d'opérateur, la saisie se fait globalement comme la saisie
        // d'une fonction. Ex : sum(i=0,n,i^n).
        // Ou alors c'est qque chose qui est encadré par des symboles par exemple une liste {1, 2, 3}.
        // Donc, l'opérateur est ce qui "ouvre" la syntaxe et l'ending, ce qui "ferme" la syntaxe.        
        linear += getTheOperator();
        for (int i = 0; i < getNbChildren(); i++) {
            child = (FormulaTreeStructure) getChild(i);
            if (i == 0)
                linear += child.createLinear(linear);
            else {
                linear += "," + child.createLinear(linear);
            }
        }
        return linear + ending;
    }

Here is the call graph for this function:

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.NaryOperator2.evaluate ( ) [inline, virtual, inherited]

Evaluates the instance.

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

Definition at line 151 of file NaryOperator2.java.

                             {
        return "";
    }

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 the ending of the operator.

Definition at line 50 of file NaryOperator2.java.

                              {
        return ending;
    }

Here is the caller graph for this function:

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 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 operator arity.

Definition at line 52 of file KaryOperator.java.

                                  {
        return operatorArity;
    }
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 name of the operator.

Definition at line 49 of file Operator.java.

                                   {
        return value;
    }

Here is the caller graph for this function:

Returns the value.

Reimplemented from fr.ove.openmath.jome.model.Operator.

Definition at line 81 of file KaryOperator.java.

                             {
        return getTheOperator();
    }

Here is the call 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 instance in the formula tree structure.


Parameters:
currentthe position in the formula tree where the operator is to be insert.
Returns:
the new current position int hte formula tree.

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

Reimplemented in fr.ove.openmath.jome.model.Differentiation, fr.ove.openmath.jome.model.LambdaExpression, fr.ove.openmath.jome.model.Mfd2SubstitutionElement, fr.ove.openmath.jome.model.Integral, fr.ove.openmath.jome.model.Limit, fr.ove.openmath.jome.model.ComplexCartesian, fr.ove.openmath.jome.model.ComplexPolar, fr.ove.openmath.jome.model.Mfd2Substitution, and fr.ove.openmath.jome.model.Rational.

Definition at line 67 of file NaryOperator2.java.

                                                                     {
        ModelEvent modelEvent;
        
        if ((current.getFather() == null) && (current.getNbChildren() == 0)) {
            // On est dans ce cas là, seulement au tout début de la saisie de la 
            // formule. On est obligé de faire ce test à cause de la multiplication
            // implicite avec les parenthèses (Ex: (a+b)c ==> (a+b)*c, dans ce cas là,
            // current.getNbChildren() est != de 0)
            //On insère directement à la position courante
            current.addChild(this);
        } 
        else if ((current.getAsOperatorPriority() == resourcesManager.getAsOperatorPriority("constantPriorities")) &&
            current.isTemplate()) {
            // Le cas classique (on va même dire normal !!!)
            // La position d'insertion est un template.
            // On doit remplacer le template par l'instance courante
            int rank = current.getRank();
            FormulaTreeStructure father = (FormulaTreeStructure) current.getFather();
            father.addChild(this, rank);
            father.removeChild(current);
        }
        else { 
           // On est dans aucun des cas précédents, on créé donc une
            // multiplication implicite.
            current = (new Multiplication()).insert(current);
            current = insert(current);
            return current;
        }
        
        // Maintenant, on va rajouter un slot comme élément de l'opérateur
        Slot aSlot = new Slot();
        addChild(aSlot);
        aSlot.setNextSlot(this);
        
        // ...puis un template comme élément de ce slot
        VariableOrNumber template = new VariableOrNumber();
        aSlot.addChild(template);
        
        return template;
    }

Here is the call graph for this function:

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;
    }
boolean fr.ove.openmath.jome.model.Operator.isOperator ( ) [inline, virtual, inherited]

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 65 of file Operator.java.

                                {
        return true;
    }

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;
    }
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:

void fr.ove.openmath.jome.model.NaryOperator2.setEnding ( String  ending) [inline, inherited]

Sets the ending of the operator.

Parameters:
theending of the operator.

Definition at line 58 of file NaryOperator2.java.

                                         {
        this.ending = ending;
    }

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.KaryOperator.setOperatorArity ( int  operatorArity) [inline]

Sets the operator arity.

Definition at line 45 of file KaryOperator.java.

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.Operator.setTheOperator ( String  theOperator) [inline, inherited]

Sets the name of the operator.

Parameters:
theOperatorthe name of the operator.

Definition at line 57 of file Operator.java.

                                                   {
        value = theOperator;
    }

Here is the caller graph for this function:

void fr.ove.openmath.jome.model.KaryOperator.setValue ( String  value) [inline]

Sets the value.

Reimplemented from fr.ove.openmath.jome.model.Operator.

Definition at line 74 of file KaryOperator.java.

                                       {
        setTheOperator(value + "(");
    }

Here is the call graph for this function:

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 arity of the operator.

(in fact the number max of operands the operator must have)

Definition at line 40 of file KaryOperator.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: