edu.mit.sketch.ddg
Class DomainDescription

java.lang.Object
  extended by edu.mit.sketch.ddg.DomainDescription
All Implemented Interfaces:
java.io.Serializable

public class DomainDescription
extends java.lang.Object
implements java.io.Serializable

DomainDescription stores the description of all symbols in the domain.
The domain description stores the information on whether some objects are special cases of other objects (i.e. have same constraints plus some additional constraints). For example an isosceles triangle is a subclass of triangle. There may be multiple inheritance, so the object dependencies are represented by a graph (sorted in topological order) rather than by a hierarchy tree. For example a right triangle with 90-45-45 degree angles is a subclass of both a right triangle and an isosceles triangle.
The class also stores the graphical look of objects for each description, that were shown to ther user to demonstrate understanding of the system.
The name of the object should be a unique identifier of the object in the domain.

DomainDescription.java Created: Wed Mar 06 18:35:00 2002

Author:
Olya Veselova
See Also:
Serialized Form

Constructor Summary
DomainDescription()
          Constructs an empty domain description
 
Method Summary
 void addObject(ObjectDescription object, DescribedDrawnObject describedDrawnObject)
          Adds an object description to the domain without any connections to the other objects.
 void addObject(ObjectDescription object, java.util.Vector parentNames, DescribedDrawnObject describedDrawnObject)
          Adds an object description to the domain with the information that the objects listed in parentNames are superclasses of this object (i.e.
 void clear()
          Clear all the objects
 boolean containsObject(java.lang.String objectName)
          Whether an object with a given name is in the domain.
 DescribedDrawnObject getDescribedDrawnObject(java.lang.String objectName)
          Get the graphical view of the object with a given name.
 ObjectDescription getObject(java.lang.String objectName)
          Get the object with a given name.
 boolean isEmpty()
          Returns true if there are no objects in the domain
 DomainObjectGraph.MatchIterator matchIterator()
          Return the match iterator for this domain
 java.util.Vector objectList()
          Return a list of all object descriptions in the domain in level order starting with the most generic objects.
 void printObjectNames(java.io.PrintStream out)
          Print the names of the objects in the domain to a given output stream.
 int size()
          The number of objects in the domain
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainDescription

public DomainDescription()
Constructs an empty domain description

Method Detail

isEmpty

public boolean isEmpty()
Returns true if there are no objects in the domain


size

public int size()
The number of objects in the domain


clear

public void clear()
Clear all the objects


objectList

public java.util.Vector objectList()
Return a list of all object descriptions in the domain in level order starting with the most generic objects.


addObject

public void addObject(ObjectDescription object,
                      DescribedDrawnObject describedDrawnObject)
               throws ObjectAlreadyExistsException
Adds an object description to the domain without any connections to the other objects. Also takes in what the object looks like. Throws an exception if the object with the name already exists in the domain.

Throws:
ObjectAlreadyExistsException

addObject

public void addObject(ObjectDescription object,
                      java.util.Vector parentNames,
                      DescribedDrawnObject describedDrawnObject)
               throws ObjectAlreadyExistsException
Adds an object description to the domain with the information that the objects listed in parentNames are superclasses of this object (i.e. have a subset of this object's constraints) Type of Vector: String Also takes in what the object looks like. Throws an exception if the object with the name already exists in the domain.

Throws:
ObjectAlreadyExistsException

containsObject

public boolean containsObject(java.lang.String objectName)
Whether an object with a given name is in the domain.


getObject

public ObjectDescription getObject(java.lang.String objectName)
                            throws ObjectNotFoundException
Get the object with a given name. Throws an exception if the object is not found.

Throws:
ObjectNotFoundException

getDescribedDrawnObject

public DescribedDrawnObject getDescribedDrawnObject(java.lang.String objectName)
                                             throws ObjectNotFoundException
Get the graphical view of the object with a given name. Throws an exception if the object is not found.

Throws:
ObjectNotFoundException

printObjectNames

public void printObjectNames(java.io.PrintStream out)
Print the names of the objects in the domain to a given output stream. Each name is on its own line.


matchIterator

public DomainObjectGraph.MatchIterator matchIterator()
Return the match iterator for this domain