net.sourceforge.toscanaj.model.context
Class FCAElementImplementation

java.lang.Object
  extended bynet.sourceforge.toscanaj.model.context.FCAElementImplementation
All Implemented Interfaces:
java.lang.Comparable, FCAElement, WritableFCAElement, XMLizable

public class FCAElementImplementation
extends java.lang.Object
implements WritableFCAElement, XMLizable, java.lang.Comparable

To do:
consider using a cache to reuse existing FCAObjects, i.e. don't have two FCAObjects with the same data (and description). Should descriptions be functionally dependend on the data? How to model this in CSX?

Constructor Summary
FCAElementImplementation(org.jdom.Element xmlelement)
           
FCAElementImplementation(java.lang.Object data)
           
FCAElementImplementation(java.lang.Object data, org.jdom.Element description)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          Determines order based on the context position stored.
 boolean equals(java.lang.Object other)
           
 int getContextPosition()
          Return the position in a context if available.
 java.lang.Object getData()
          Returns the data stored in this FCAElement.
 org.jdom.Element getDescription()
          Returns the description of the FCAElement.
 int hashCode()
           
 void readXML(org.jdom.Element elem)
          Read this element as the content of elem.
 void setContextPosition(int contextPosition)
          Sets an index within a context.
 void setData(java.lang.Object data)
          Changes the data stored in this FCAElement.
 void setDescription(org.jdom.Element description)
          Sets a description for the FCAElement.
 java.lang.String toString()
           
 org.jdom.Element toXML()
          Write this element as the content of elem.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FCAElementImplementation

public FCAElementImplementation(java.lang.Object data)

FCAElementImplementation

public FCAElementImplementation(java.lang.Object data,
                                org.jdom.Element description)

FCAElementImplementation

public FCAElementImplementation(org.jdom.Element xmlelement)
                         throws XMLSyntaxError
Method Detail

getData

public java.lang.Object getData()
Description copied from interface: FCAElement
Returns the data stored in this FCAElement. This is not allowed to be null.

Specified by:
getData in interface FCAElement

getDescription

public org.jdom.Element getDescription()
Description copied from interface: FCAElement
Returns the description of the FCAElement. The return value of this method can be null.

Specified by:
getDescription in interface FCAElement

toString

public java.lang.String toString()

setData

public void setData(java.lang.Object data)
Description copied from interface: WritableFCAElement
Changes the data stored in this FCAElement. Note that this most likely changes the identity of the object.

Specified by:
setData in interface WritableFCAElement
Parameters:
data - The new data, must not be null.

setDescription

public void setDescription(org.jdom.Element description)
Description copied from interface: WritableFCAElement
Sets a description for the FCAElement.

Specified by:
setDescription in interface WritableFCAElement
Parameters:
description - The new description, can be null.
To do:
in ConceptualSchema.setDescription(Element) we clone the parameter, here we don't --> check why, notify schema that something has changed

getContextPosition

public int getContextPosition()
Description copied from interface: FCAElement
Return the position in a context if available. The return value is either the position in the according context (i.e. in the list of objects or attributes, depending on the usage of this element), or -1 if no position in a context is known.

Specified by:
getContextPosition in interface FCAElement

setContextPosition

public void setContextPosition(int contextPosition)
Description copied from interface: WritableFCAElement
Sets an index within a context. This method can be used to add an order to the FCAElements in a context.

Specified by:
setContextPosition in interface WritableFCAElement
Parameters:
contextPosition - The position of the object or attribute in the context or -1 if there is no such order.

equals

public boolean equals(java.lang.Object other)

hashCode

public int hashCode()

toXML

public org.jdom.Element toXML()
Description copied from interface: XMLizable
Write this element as the content of elem.

Specified by:
toXML in interface XMLizable
To do:
think about base64 encoding for serializable data objects, currently works only for String and XMLizable data objects

readXML

public void readXML(org.jdom.Element elem)
             throws XMLSyntaxError
Description copied from interface: XMLizable
Read this element as the content of elem.

Specified by:
readXML in interface XMLizable
Throws:
XMLSyntaxError

compareTo

public int compareTo(java.lang.Object o)
Determines order based on the context position stored. If the context position has not been set on the objects, all objects will be considered equal. Objects with a context position are always considered greater than those without.

Specified by:
compareTo in interface java.lang.Comparable


The ToscanaJ project