mascoptLib.abstractGraph
Class MascoptObject

java.lang.Object
  extended bymascoptLib.util.ObservableObject
      extended bymascoptLib.abstractGraph.MascoptObject
All Implemented Interfaces:
Cloneable, MascoptObjectInterface, Observer
Direct Known Subclasses:
AbstractEdge, AbstractGraph, AbstractVertex, MascoptFixedSet

public abstract class MascoptObject
extends ObservableObject
implements MascoptObjectInterface, Cloneable, Observer

MascoptObject implements the valuation system to store String, Double and Integer.


Constructor Summary
MascoptObject()
          Increase the counter of MascoptObject.
 
Method Summary
 void copyValues(MascoptObject mascoptObject)
          Copy the values into this object The values of mascoptObject are copied to become values of this object.
static int countAllObjects()
          Return the number of sets currently in memory
 boolean deleteValue(String name)
          Delete the value for a category.
 boolean deleteValue(String name, MascoptObjectInterface o)
          Delete the value for a category and a specific context.
 boolean existValue(String name)
          Say if a value exist.
 boolean existValue(String name, MascoptObjectInterface o)
          Say if a value exist.
 void free()
          Free memory when this object is linked.
 Double getDoubleValue(String name)
          Returns the value for a category.
 Double getDoubleValue(String name, MascoptObjectInterface o)
          Returns the value for a category and a specific context.
 double getDouValue(String name)
          Returns the value for a category.
 double getDouValue(String name, MascoptObjectInterface o)
          Returns the value for a category and a specific context.
 String getId()
          Returns the id of the MascoptObject.
 Integer getIntegerValue(String name)
          Returns the value for a category.
 Integer getIntegerValue(String name, MascoptObjectInterface o)
          Returns the value for a category and a specific context.
 int getIntValue(String name)
          Returns the value for a category.
 int getIntValue(String name, MascoptObjectInterface o)
          Returns the value for a category and a specific context.
 String getName()
          Returns the name of the MascoptObject.
 String getValue(String name)
          Returns the value for a category.
 String getValue(String name, MascoptObjectInterface o)
          Returns the value for a category and a specific context.
 Iterator getValueContexts(String name)
          Returns an iterator on all contexts used for a value.
 String getValueDataType(String name)
          Returns the data type of the value associated to this name and context
 String getValueDataType(String name, MascoptObjectInterface o)
          Returns the data type of the value associated to this name and context
 Iterator getValueEntries()
          Give the name of values stored in this object.
 boolean notifyOnValueChange(boolean notify)
          Can be called to notify observers that the user changed the value.
 void removeAllValues(MascoptObjectInterface context)
          Remove all values concerning a category.
 void setDoubleValue(String name, Double value)
          Sets the value for a category.
 void setDoubleValue(String name, MascoptObjectInterface o, Double value)
          Sets the value for a category and a specific context.
 void setDouValue(String name, double value)
          Sets the value for a category.
 void setDouValue(String name, MascoptObjectInterface o, double value)
          Sets the value for a category and a specific context.
 void setIntegerValue(String name, Integer value)
          Sets the value for a category.
 void setIntegerValue(String name, MascoptObjectInterface o, Integer value)
          Sets the value for a category and a specific context.
 void setIntValue(String name, int value)
          Sets the value for a category.
 void setIntValue(String name, MascoptObjectInterface o, int value)
          Sets the value for a category and a specific context.
 boolean setName(String name)
          Sets the name of the MascoptObject.
 void setValue(String name, Double value)
          Sets the value for a category.
 void setValue(String name, Integer value)
          Sets the value for a category.
 void setValue(String name, MascoptObjectInterface o, Double value)
          Sets the value for a category and a specific context.
 void setValue(String name, MascoptObjectInterface o, Integer value)
          Sets the value for a category and a specific context.
 void setValue(String name, MascoptObjectInterface o, String value)
          Sets the value for a category and a specific context.
 void setValue(String name, String value)
          Sets the value for a category.
 void update(Observable observable, Object object)
          Describe update method here.
 
Methods inherited from class mascoptLib.util.ObservableObject
addAddObserver, addRemoveObserver, addValueObserver, countAddObservers, countRemoveObservers, countValueObservers, deleteAddObserver, deleteAddObserver, deleteRemoveObserver, deleteRemoveObserver, deleteValueObserver, deleteValueObserver
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MascoptObject

public MascoptObject()
Increase the counter of MascoptObject.

Method Detail

getId

public String getId()
Returns the id of the MascoptObject.

Specified by:
getId in interface MascoptObjectInterface
Returns:
the id of the MascoptObject.

getName

public String getName()
Returns the name of the MascoptObject.

Specified by:
getName in interface MascoptObjectInterface
Returns:
the name of the MascoptObject.

setName

public boolean setName(String name)
Sets the name of the MascoptObject.

Specified by:
setName in interface MascoptObjectInterface
Parameters:
name - the name of the MascoptObject.

notifyOnValueChange

public boolean notifyOnValueChange(boolean notify)
Can be called to notify observers that the user changed the value. If some objects are listening this objects and can be affected by a modification of a value, the user may notify them. It's used in the graphical interface for example where value x or y change and are notifiyed to the GUI.

Specified by:
notifyOnValueChange in interface MascoptObjectInterface
Parameters:
notify - true if we want to notify that a value has changed.
Returns:
the old notify boolean.

getValue

public String getValue(String name)
Returns the value for a category. The category is identified by a string name. It returns the value with a string.

Specified by:
getValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
Returns:
the string representing the value.

getDoubleValue

public Double getDoubleValue(String name)
Returns the value for a category. The category is identified by a string name. It returns the value with a double.

Specified by:
getDoubleValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
Returns:
the double representing the value.

getDouValue

public double getDouValue(String name)
Returns the value for a category. The category is identified by a string name. It returns the value with a Double.

Parameters:
name - the category of value to get.
Returns:
the Double value.

getIntegerValue

public Integer getIntegerValue(String name)
Returns the value for a category. The category is identified by a string name. It returns the value with an Integer.

Specified by:
getIntegerValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
Returns:
the Integer representing the value.

getIntValue

public int getIntValue(String name)
Returns the value for a category. The category is identified by a string name. It returns the value with a int.

Parameters:
name - the category of value to get.
Returns:
the int value.

getValueDataType

public String getValueDataType(String name)
Returns the data type of the value associated to this name and context

Specified by:
getValueDataType in interface MascoptObjectInterface
Parameters:
name - the name of the value we are interested in
Returns:
a string containing the data type of the value. The returned string is one of the following: "String", "Integer", "Double" or "null".

getValueDataType

public String getValueDataType(String name,
                               MascoptObjectInterface o)
Returns the data type of the value associated to this name and context

Specified by:
getValueDataType in interface MascoptObjectInterface
Parameters:
name - the name of the value we are interested in
o - the object representing the context.
Returns:
a string containing the data type of the value. The returned string is one of the following: "String", "Integer", "Double" or "null".

getValue

public String getValue(String name,
                       MascoptObjectInterface o)
Returns the value for a category and a specific context. The category is identified by a string name. It returns the value with a string. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Specified by:
getValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
o - the object, context of the value.
Returns:
the string representing the value.

getDoubleValue

public Double getDoubleValue(String name,
                             MascoptObjectInterface o)
Returns the value for a category and a specific context. The category is identified by a string name. It returns the value with a double. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Specified by:
getDoubleValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
o - the object, context of the value.
Returns:
the double representing the value.

getDouValue

public double getDouValue(String name,
                          MascoptObjectInterface o)
Returns the value for a category and a specific context. The category is identified by a string name. It returns the value with a double. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Parameters:
name - the category of value to get.
o - the object, context of the value.
Returns:
the double representing the value.

getIntegerValue

public Integer getIntegerValue(String name,
                               MascoptObjectInterface o)
Returns the value for a category and a specific context. The category is identified by a string name. It returns the value with a integer. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Specified by:
getIntegerValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
o - the object, context of the value.
Returns:
the integer representing the value.

getIntValue

public int getIntValue(String name,
                       MascoptObjectInterface o)
Returns the value for a category and a specific context. The category is identified by a string name. It returns the value with an int. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Parameters:
name - the category of value to get.
o - the object, context of the value.
Returns:
the integer representing the value.

setValue

public void setValue(String name,
                     String value)
Sets the value for a category. The category is identified by a string name. It sets the value with a string.

Specified by:
setValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
value - is the value to store.

setValue

public void setValue(String name,
                     Integer value)
Sets the value for a category. The category is identified by a string name. It sets the value with a string.

Specified by:
setValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
value - is the value to store.

setValue

public void setValue(String name,
                     Double value)
Sets the value for a category. The category is identified by a string name. It sets the value with a string.

Specified by:
setValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
value - is the value to store.

setDoubleValue

public void setDoubleValue(String name,
                           Double value)
Sets the value for a category. The category is identified by a string name. It sets the value with a Double.

Parameters:
name - the category of value to get.
value - is the value to store.

setDouValue

public void setDouValue(String name,
                        double value)
Sets the value for a category. The category is identified by a string name. It sets the value with a double.

Parameters:
name - the category of value to get.
value - is the value to store.

setIntegerValue

public void setIntegerValue(String name,
                            Integer value)
Sets the value for a category. The category is identified by a string name. It sets the value with an Integer.

Parameters:
name - the category of value to get.
value - is the value to store.

setIntValue

public void setIntValue(String name,
                        int value)
Sets the value for a category. The category is identified by a string name. It sets the value with an int.

Parameters:
name - the category of value to get.
value - is the value to store.

setValue

public void setValue(String name,
                     MascoptObjectInterface o,
                     String value)
Sets the value for a category and a specific context. The category is identified by a string name. It sets the value with a string. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Specified by:
setValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
o - the object, context of the value.
value - is the value to store.

setValue

public void setValue(String name,
                     MascoptObjectInterface o,
                     Integer value)
Sets the value for a category and a specific context. The category is identified by a string name. It sets the value with a string. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Specified by:
setValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
o - the object, context of the value.
value - is the value to store.

setValue

public void setValue(String name,
                     MascoptObjectInterface o,
                     Double value)
Sets the value for a category and a specific context. The category is identified by a string name. It sets the value with a string. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Specified by:
setValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
o - the object, context of the value.
value - is the value to store.

setIntegerValue

public void setIntegerValue(String name,
                            MascoptObjectInterface o,
                            Integer value)
Sets the value for a category and a specific context. The category is identified by a string name. It sets the value with an integer. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Parameters:
name - the category of value to get.
o - the object, context of the value.
value - is the value to store.

setIntValue

public void setIntValue(String name,
                        MascoptObjectInterface o,
                        int value)
Sets the value for a category and a specific context. The category is identified by a string name. It sets the value with an int. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Parameters:
name - the category of value to get.
o - the object, context of the value.
value - is the value to store.

setDoubleValue

public void setDoubleValue(String name,
                           MascoptObjectInterface o,
                           Double value)
Sets the value for a category and a specific context. The category is identified by a string name. It sets the value with a double. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Parameters:
name - the category of value to get.
o - the object, context of the value.
value - is the value to store.

setDouValue

public void setDouValue(String name,
                        MascoptObjectInterface o,
                        double value)
Sets the value for a category and a specific context. The category is identified by a string name. It sets the value with a double. The value is specific for the object o which is the context. This parameter is usefull for setting/getting values specific to a context (a layer, a graph, a set).

Parameters:
name - the category of value to get.
o - the object, context of the value.
value - is the value to store.

deleteValue

public boolean deleteValue(String name)
Delete the value for a category. The category is identified by a string name.

Specified by:
deleteValue in interface MascoptObjectInterface
Parameters:
name - the category of value to delete.
Returns:
true if successfull

deleteValue

public boolean deleteValue(String name,
                           MascoptObjectInterface o)
Delete the value for a category and a specific context.

Specified by:
deleteValue in interface MascoptObjectInterface
Parameters:
name - the category of value to get.
o - the object, context of the value.
Returns:
true if successfull

getValueEntries

public Iterator getValueEntries()
Give the name of values stored in this object. It returns an iterator on Strings where each String is the name of the value in this object. You can use this function when you have object with values wich you don't know the name

Specified by:
getValueEntries in interface MascoptObjectInterface
Returns:
an iterator on Strings

getValueContexts

public Iterator getValueContexts(String name)
Returns an iterator on all contexts used for a value. When a value with a given name is stored in an object, different contexts can be used to know to what context is attached a value. When the user doesn't know the different contexts it can ask for an iterator on these contexts (AbstractGraph in general).

Specified by:
getValueContexts in interface MascoptObjectInterface
Parameters:
name - the name of the value
Returns:
an iterator on the contexts

removeAllValues

public void removeAllValues(MascoptObjectInterface context)
Remove all values concerning a category. This method is usefull when some values used in an algorithm are no more needed. If you omit to remove the values, the object continues to have a pointer on the context. Then the context cannot be destroyed because a value points on it. Think about be sure to remove all values pointing on a context to free memory.

Parameters:
context - the oject context

countAllObjects

public static int countAllObjects()
Return the number of sets currently in memory


free

public void free()
Free memory when this object is linked.


copyValues

public void copyValues(MascoptObject mascoptObject)
Copy the values into this object The values of mascoptObject are copied to become values of this object. It must be remarked that values relative to a context are not copied and the name is also preserved.

Parameters:
mascoptObject - - the reference object from which we copy the values.

existValue

public boolean existValue(String name)
Say if a value exist.

Parameters:
name - the name of the value to search.
Returns:
a boolean.

existValue

public boolean existValue(String name,
                          MascoptObjectInterface o)
Say if a value exist.

Parameters:
name - the name of the value to search.
o - the object context of the value.
Returns:
a boolean.

update

public void update(Observable observable,
                   Object object)
Describe update method here.

Specified by:
update in interface Observer
Parameters:
observable - an Observable value
object - an Object value