fr.ove.openmath.jome.model
Class FormulaTreeStructure

java.lang.Object
  extended byfr.ove.openmath.jome.model.Node
      extended byfr.ove.openmath.jome.model.FormulaTreeStructure
All Implemented Interfaces:
java.lang.Cloneable, Comparable, ControlListener, java.util.EventListener, Iconifiable, Maskable, Modifiable, java.io.Serializable
Direct Known Subclasses:
Constant, Formula, Icon, Operator, Slot

public abstract class FormulaTreeStructure
extends Node
implements ControlListener, Iconifiable, Comparable, Maskable, Modifiable

Version:
2.1 10/01/2000
Author:
© 2000 DIRAT Laurent
See Also:
Serialized Form

Constructor Summary
FormulaTreeStructure()
           
 
Method Summary
 void addModelListener(ModelListener modelListener)
          Registers another listener to be informed of changes of the FTS.
 void consumeControlEvent(ControlEvent controlEvent)
          Consumes (i.e. treats) the event received.
abstract  java.lang.String createLinear(java.lang.String linear)
          The Creation of the corresponding linear expression of the formula.
abstract  java.lang.String evaluate()
          Evaluates the instance.
 FormulaTreeStructure findLocation(FormulaTreeStructure current)
          Returns the node (operator), which is the position in the formula tree, where the instance have to be inserted.
 void fireModelEvent(ModelEvent modelEvent)
          Fires a ModelEvent event to registered listeners.
 boolean getAreOperandsMovable()
           
 int getAsOperandPriority()
          Returns the priority of the instance viewed as an operand.
 int getAsOperatorPriority()
          Returns the priority of the instance viewed as an operator.
 boolean getCrossRef()
           
 java.lang.String getIconName()
          Returns the name of the icon associated to the instance.
 java.util.Vector getListeners()
          Returns all the registered listener of the instance.
 java.lang.String getResourceIdentifier()
          Returns the resource identifier of the instance.
 java.lang.String getValue()
          Returns the value.
 FormulaTreeStructure goTo(int priority)
          Returns the father of the node which, from the current instance, have the specified priority.
 void iconify()
          Iconifies the instance.
abstract  FormulaTreeStructure insert(FormulaTreeStructure current)
          Inserts the instance in the formula tree, from the current insertion position.
 boolean isEqual(Comparable toCompare)
          Tests if the instance is equal to the specified one.
 boolean isGreater(Comparable toCompare)
          Tests if the instance is greater than the specified one.
 boolean isGreaterOrEqual(Comparable toCompare)
          Tests if the instance is greater or equal than the specified one.
 boolean isIcon()
           
 boolean isIconifiable()
          Returns true if the instance is iconifiable.
 boolean isLesser(Comparable toCompare)
          Tests if the instance is lesser than the specified one.
 boolean isLesserOrEqual(Comparable toCompare)
          Tests if the instance is lesser or equal than the specified one.
abstract  boolean isOperator()
          To check is the instance is an operator.
 boolean isTemplate()
          Returns true if it is a template.
 boolean isVisible()
          Checks if the instance is visible.
 void moveOperands(java.util.Vector list, int rank)
          Moves the specified list of the instance children to the specified rank.
 void removeAllModelListener()
          Removes all the listeners.
 void removeModelListener(ModelListener modelListener)
          Removes a listener.
 void setAreOperandsMovable(boolean areOperandsMovable)
           
 void setAsOperandPriority(int asOperandPriority)
          Sets the as operand priority
 void setAsOperatorPriority(int asOperatorPriority)
          Sets the as operator priority
 void setCrossRef(boolean ref)
           
 void setIconName(java.lang.String iconName)
          Associates an icon name to the instance.
 void setIsIconifiable(boolean isIconifiable)
          Sets the instance as iconifiable.
 void setIsTemplate(boolean isTemplate)
          Sets the instance as a template.
 void setIsVisble(boolean isVisible)
          Sets the instance as vissible or not.
 void setResourceIdentifier(java.lang.String resourceIdentifier)
          Sets the resource identifier of the instance.
 void setValue(java.lang.String value)
          Sets the value.
 void uniconify()
          Uniconifies the instance.
 void uniconifyAll()
          Uniconifies all the iconified parts of the instance.
 
Methods inherited from class fr.ove.openmath.jome.model.Node
addChild, addChild, clone, computeDepth, computeNbStrahler, duplicate, getChild, getChildren, getDepth, getFather, getNbChildren, getNbStrahler, getRank, hasChild, moveChildren, removeAll, removeChild, removeChild, setFather, setNbStrahler
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormulaTreeStructure

public FormulaTreeStructure()
Method Detail

setCrossRef

public void setCrossRef(boolean ref)

getCrossRef

public boolean getCrossRef()

addModelListener

public void addModelListener(ModelListener modelListener)
Registers another listener to be informed of changes of the FTS.

Parameters:
modelListener - a listener to add.

removeModelListener

public void removeModelListener(ModelListener modelListener)
Removes a listener.

Parameters:
modelListener - a listener to remove.

removeAllModelListener

public void removeAllModelListener()
Removes all the listeners.


fireModelEvent

public void fireModelEvent(ModelEvent modelEvent)
Fires a ModelEvent event to registered listeners.

Parameters:
modelEvent - event encapsulating relevant information.

getListeners

public java.util.Vector getListeners()
Returns all the registered listener of the instance.


setResourceIdentifier

public void setResourceIdentifier(java.lang.String resourceIdentifier)
Sets the resource identifier of the instance.


getResourceIdentifier

public java.lang.String getResourceIdentifier()
Returns the resource identifier of the instance.


setAsOperatorPriority

public void setAsOperatorPriority(int asOperatorPriority)
Sets the as operator priority

Parameters:
asOperatorPriority - the priority

getAsOperatorPriority

public int getAsOperatorPriority()
Returns the priority of the instance viewed as an operator.

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

setAsOperandPriority

public void setAsOperandPriority(int asOperandPriority)
Sets the as operand priority

Parameters:
asOperandPriority - the priority

getAsOperandPriority

public int getAsOperandPriority()
Returns the priority of the instance viewed as an operand.

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

isTemplate

public boolean isTemplate()
Returns true if it is a template.
false otherwise.


setIsTemplate

public void setIsTemplate(boolean isTemplate)
Sets the instance as a template.


findLocation

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

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

goTo

public FormulaTreeStructure goTo(int priority)
Returns the father of the node which, from the current instance, have the specified priority.

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

setAreOperandsMovable

public void setAreOperandsMovable(boolean areOperandsMovable)

getAreOperandsMovable

public boolean getAreOperandsMovable()

moveOperands

public void moveOperands(java.util.Vector list,
                         int rank)
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:
list - the list of the instance operands to move.
rank - the specified rank.

isEqual

public boolean isEqual(Comparable toCompare)
Tests if the instance is equal to the specified one.

Specified by:
isEqual in interface Comparable
Parameters:
toCompare - the instance to compare with the current instance.

isGreater

public boolean isGreater(Comparable toCompare)
Tests if the instance is greater than the specified one.

Specified by:
isGreater in interface Comparable
Parameters:
toCompare - the instance to compare with the current instance.

isGreaterOrEqual

public boolean isGreaterOrEqual(Comparable toCompare)
Tests if the instance is greater or equal than the specified one.

Specified by:
isGreaterOrEqual in interface Comparable
Parameters:
toCompare - the instance to compare with the current instance.

isLesser

public boolean isLesser(Comparable toCompare)
Tests if the instance is lesser than the specified one.

Specified by:
isLesser in interface Comparable
Parameters:
toCompare - the instance to compare with the current instance.

isLesserOrEqual

public boolean isLesserOrEqual(Comparable toCompare)
Tests if the instance is lesser or equal than the specified one.

Specified by:
isLesserOrEqual in interface Comparable
Parameters:
toCompare - the instance to compare with the current instance.

setIconName

public void setIconName(java.lang.String iconName)
Associates an icon name to the instance.

Specified by:
setIconName in interface Iconifiable
Parameters:
iconName - the name of the icon

getIconName

public java.lang.String getIconName()
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.

Specified by:
getIconName in interface Iconifiable

isIcon

public boolean isIcon()
Specified by:
isIcon in interface Iconifiable
Returns:
true if the instance is an icon. false otherwise.

iconify

public void iconify()
Iconifies the instance.

Specified by:
iconify in interface Iconifiable

uniconify

public void uniconify()
Uniconifies the instance.

Specified by:
uniconify in interface Iconifiable

uniconifyAll

public void uniconifyAll()
Uniconifies all the iconified parts of the instance.

Specified by:
uniconifyAll in interface Iconifiable

setIsIconifiable

public void setIsIconifiable(boolean isIconifiable)
Sets the instance as iconifiable.

Specified by:
setIsIconifiable in interface Iconifiable
Parameters:
isIconifiable - true if the instance is iconifiable. false otherwise.

isIconifiable

public boolean isIconifiable()
Returns true if the instance is iconifiable. false otherwise.

Specified by:
isIconifiable in interface Iconifiable

consumeControlEvent

public void consumeControlEvent(ControlEvent controlEvent)
Consumes (i.e. treats) the event received.

Specified by:
consumeControlEvent in interface ControlListener
Parameters:
controlEvent - the event to consume.

setIsVisble

public void setIsVisble(boolean isVisible)
Sets the instance as vissible or not.

Specified by:
setIsVisble in interface Maskable
Parameters:
isVisible - true if the instance is visible. false otherwise.

isVisible

public boolean isVisible()
Checks if the instance is visible.

Specified by:
isVisible in interface Maskable

setValue

public void setValue(java.lang.String value)
Sets the value.

Specified by:
setValue in interface Modifiable
Parameters:
value - the value to set.

getValue

public java.lang.String getValue()
Returns the value.

Specified by:
getValue in interface Modifiable

isOperator

public abstract boolean isOperator()
To check is the instance is an operator.

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

insert

public abstract FormulaTreeStructure insert(FormulaTreeStructure current)
Inserts the instance in the formula tree, from the current insertion position. (checks the priorities and goes up in the tree if necessary).

Parameters:
current - the current insertion position.
Returns:
the new insertion position.

createLinear

public abstract java.lang.String createLinear(java.lang.String linear)
The Creation of the corresponding linear expression of the formula.


evaluate

public abstract java.lang.String evaluate()
Evaluates the instance.



Copyright © 1999-2007 Universit?© de Nice Sophia-Antipolis, I3S, Ove SARL, DFKI and Universit?§t des Saarlandes. All Rights Reserved.