net.sourceforge.toscanaj.model
Class ConceptualSchema

java.lang.Object
  extended bynet.sourceforge.toscanaj.model.ConceptualSchema
All Implemented Interfaces:
DiagramCollection, org.tockit.events.EventBrokerListener, XMLizable

public class ConceptualSchema
extends java.lang.Object
implements XMLizable, DiagramCollection, org.tockit.events.EventBrokerListener

This is the main interface for the data structures. The class encapsulates (directly or indirectly) the whole data model used in the program. Instances are created by parsing a CSX file with the CSXParser class.

To do:
write test cases, e.g. for testing if the dirty flag is handled properly

Constructor Summary
ConceptualSchema(org.tockit.events.EventBroker broker)
          Creates an empty schema.
ConceptualSchema(org.tockit.events.EventBroker eventBroker, org.jdom.Element element)
           
 
Method Summary
 void addDiagram(Diagram2D diagram)
          Adds a diagram to the schema.
 void addQuery(Query query)
           
 void dataSaved()
           
 void exchangeDiagrams(int from, int to)
           
 ConceptInterpreter getConceptInterpreter()
           
 DatabaseInfo getDatabaseInfo()
          Returns the database information stored.
 DatabaseSchema getDatabaseSchema()
           
 org.jdom.Element getDescription()
           
 Diagram2D getDiagram(int number)
          Returns a diagram from the list using the index.
 Diagram2D getDiagram(java.lang.String title)
          Returns a diagram from the list using the diagram title as key.
 java.util.Iterator getDiagramsIterator()
          returns an iterator of Diagram2D objects
 java.net.URL getLocation()
           
 WritableManyValuedContext getManyValuedContext()
           
 int getNumberOfDiagrams()
          Returns the number of diagrams available.
 java.util.List getQueries()
           
 boolean hasDiagramDescription()
           
 boolean isDataSaved()
           
 void processEvent(org.tockit.events.Event e)
           
 void readXML(org.jdom.Element elem)
          Read this element as the content of elem.
 void removeDiagram(Diagram2D diagram)
           
 void removeDiagram(int diagramIndex)
           
 void replaceDiagram(Diagram2D existingDiagram, Diagram2D newDiagram)
           
protected  void reset()
          Deletes all schema content, rendering the schema empty.
 void setConceptInterpreter(ConceptInterpreter interpreter)
           
 void setDatabaseInfo(DatabaseInfo databaseInfo)
          Sets the database information for the schema.
 void setDatabaseSchema(DatabaseSchema schema)
           
 void setDescription(org.jdom.Element description)
           
 void setLocation(java.net.URL location)
           
 void setManyValuedContext(WritableManyValuedContext context)
           
 org.jdom.Element toXML()
          Write this element as the content of elem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConceptualSchema

public ConceptualSchema(org.tockit.events.EventBroker broker)
Creates an empty schema.


ConceptualSchema

public ConceptualSchema(org.tockit.events.EventBroker eventBroker,
                        org.jdom.Element element)
                 throws XMLSyntaxError
Method Detail

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

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

reset

protected void reset()
Deletes all schema content, rendering the schema empty.


getDatabaseInfo

public DatabaseInfo getDatabaseInfo()
Returns the database information stored. The return value is null if no database is defined in the schema.

To do:
DatabaseInfo should be immutable, then we don't need the defensive copy anymore

setDatabaseInfo

public void setDatabaseInfo(DatabaseInfo databaseInfo)
Sets the database information for the schema.

To do:
DatabaseInfo should be immutable, then we don't need the defensive copy anymore

getNumberOfDiagrams

public int getNumberOfDiagrams()
Returns the number of diagrams available.

Specified by:
getNumberOfDiagrams in interface DiagramCollection

getDiagram

public Diagram2D getDiagram(int number)
Returns a diagram from the list using the index.

Specified by:
getDiagram in interface DiagramCollection

getDiagram

public Diagram2D getDiagram(java.lang.String title)
Returns a diagram from the list using the diagram title as key.

Specified by:
getDiagram in interface DiagramCollection

addDiagram

public void addDiagram(Diagram2D diagram)
Adds a diagram to the schema. The new diagram will be the last one.

Specified by:
addDiagram in interface DiagramCollection

removeDiagram

public void removeDiagram(int diagramIndex)
Specified by:
removeDiagram in interface DiagramCollection

removeDiagram

public void removeDiagram(Diagram2D diagram)

exchangeDiagrams

public void exchangeDiagrams(int from,
                             int to)
Specified by:
exchangeDiagrams in interface DiagramCollection

replaceDiagram

public void replaceDiagram(Diagram2D existingDiagram,
                           Diagram2D newDiagram)
Specified by:
replaceDiagram in interface DiagramCollection

setDescription

public void setDescription(org.jdom.Element description)

getDescription

public org.jdom.Element getDescription()

hasDiagramDescription

public boolean hasDiagramDescription()

getDatabaseSchema

public DatabaseSchema getDatabaseSchema()

setDatabaseSchema

public void setDatabaseSchema(DatabaseSchema schema)

getQueries

public java.util.List getQueries()

addQuery

public void addQuery(Query query)

setManyValuedContext

public void setManyValuedContext(WritableManyValuedContext context)

getManyValuedContext

public WritableManyValuedContext getManyValuedContext()

dataSaved

public void dataSaved()

isDataSaved

public boolean isDataSaved()

processEvent

public void processEvent(org.tockit.events.Event e)
Specified by:
processEvent in interface org.tockit.events.EventBrokerListener

getDiagramsIterator

public java.util.Iterator getDiagramsIterator()
returns an iterator of Diagram2D objects


getConceptInterpreter

public ConceptInterpreter getConceptInterpreter()

setConceptInterpreter

public void setConceptInterpreter(ConceptInterpreter interpreter)

getLocation

public java.net.URL getLocation()

setLocation

public void setLocation(java.net.URL location)


The ToscanaJ project