edu.mit.sketch.ddg
Class DomainObjectGraph

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

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

A graph representing a hierarchy of domain objects and shapes. Each shape can have a number of subclasses and superclasses.
A subclass is an object that has the same number of primitives but more constraints between them.
A superclass is an object that has the same number of primitives but fewer constraints between them.

DomainObjectGraph.java Created: Sun Sep 29 21:55:00 2002

Author:
Olya Veselova
See Also:
Serialized Form

Nested Class Summary
 class DomainObjectGraph.MatchIterator
          An iterater for matching objects from the bottom up the graph.
 
Constructor Summary
DomainObjectGraph()
          Constructs an empty graph
 
Method Summary
 void addObject(DomainObjectGraphNode node)
          Add an object for which all the parents have already been found and linked and that has no children // TODO - what if an object already exists
 void addObject(DomainObjectGraphNode addedNode, java.util.Vector parentNames)
          Add an object for finding the parents according to their names // TODO - what if an object already exists
 void clear()
          Clear all the objects
 DomainObjectGraphNode getObject(java.lang.String name)
          Get an object node with a given name
 boolean isEmpty()
          Returns true if there are no objects in the graph
 DomainObjectGraph.MatchIterator matchIterator(DomainObjectGraph graph)
          Return the match iterator for this graph
 java.util.Vector objectList()
          Return a list of all object descriptions in the in level order
 void printNames(java.io.PrintStream out)
          Print the names of the objects in level order not showing the graph structure
 void removeObject(DomainObjectGraphNode removedNode)
          Remove a given object.
 void removeObject(java.lang.String name)
          Remove an object with a given name.
 int size()
          The number of objects in the graph
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainObjectGraph

public DomainObjectGraph()
Constructs an empty graph

Method Detail

isEmpty

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


size

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


clear

public void clear()
Clear all the objects


objectList

public java.util.Vector objectList()
Return a list of all object descriptions in the in level order


getObject

public DomainObjectGraphNode getObject(java.lang.String name)
                                throws ObjectNotFoundException
Get an object node with a given name

Throws:
ObjectNotFoundException

addObject

public void addObject(DomainObjectGraphNode node)
               throws InvalidParameterException
Add an object for which all the parents have already been found and linked and that has no children // TODO - what if an object already exists

Throws:
InvalidParameterException

addObject

public void addObject(DomainObjectGraphNode addedNode,
                      java.util.Vector parentNames)
Add an object for finding the parents according to their names // TODO - what if an object already exists


removeObject

public void removeObject(java.lang.String name)
Remove an object with a given name. If the object is not present do nothing.


removeObject

public void removeObject(DomainObjectGraphNode removedNode)
Remove a given object. If the object is not present do nothing.


printNames

public void printNames(java.io.PrintStream out)
Print the names of the objects in level order not showing the graph structure


matchIterator

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