org.eigenbase.jmi
Class JmiModelView

java.lang.Object
  extended by org.eigenbase.jmi.JmiModelView

public class JmiModelView
extends Object

JmiModelView represents an annotated view of a JMI model. Instances are immutable and can be accessed concurrently by multiple threads.

TODO: support transformations such as ignoring or reversing edges.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/jmi/JmiModelView.java#10 $
Author:
John V. Sichi

Nested Class Summary
private static class JmiModelView.ClassAttributes
           
 
Field Summary
private  Map<JmiClassVertex,JmiModelView.ClassAttributes> classVertexAttributes
          Map from JmiClassVertex to ClassAttributes.
private  JmiModelGraph modelGraph
          Graph of the underlying model we are querying.
 
Constructor Summary
JmiModelView(JmiModelGraph modelGraph)
          Creates a new view of a model.
 
Method Summary
private  void deriveAttributes()
           
 Set<JmiAssocEdge> getAllIncomingAssocEdges(JmiClassVertex vertex)
          Gets the union of getInheritedIncomingAssocEdges() for all classes returned by getAllSubclassVertices(vertex).
 Set<JmiAssocEdge> getAllOutgoingAssocEdges(JmiClassVertex vertex)
          Gets the union of getInheritedOutgoingAssocEdges() for all classes returned by getAllSubclassVertices(vertex).
 Set<JmiClassVertex> getAllSubclassVertices(JmiClassVertex vertex)
          Gets all JmiClassVertexes representing subclasses of a class (including the class itself).
 Set<JmiClassVertex> getAllSuperclassVertices(JmiClassVertex vertex)
          Gets all JmiClassVertexes representing superclasses of a class (including the class itself).
private  JmiModelView.ClassAttributes getClassAttributes(JmiClassVertex classVertex)
           
 Set<JmiAssocEdge> getInheritedIncomingAssocEdges(JmiClassVertex vertex)
          Gets all JmiAssocEdges representing associations incoming to any class vertex returned by getAllSuperclassVertices(vertex).
 Set<JmiAssocEdge> getInheritedOutgoingAssocEdges(JmiClassVertex vertex)
          Gets all JmiAssocEdges representing associations outgoing from any class vertex returned by getAllSuperclassVertices(vertex).
 JmiModelGraph getModelGraph()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modelGraph

private final JmiModelGraph modelGraph
Graph of the underlying model we are querying.


classVertexAttributes

private Map<JmiClassVertex,JmiModelView.ClassAttributes> classVertexAttributes
Map from JmiClassVertex to ClassAttributes.

Constructor Detail

JmiModelView

public JmiModelView(JmiModelGraph modelGraph)
Creates a new view of a model.

Parameters:
modelGraph - graph for the underlying model
Method Detail

getModelGraph

public JmiModelGraph getModelGraph()
Returns:
graph for the underlying model

getAllSuperclassVertices

public Set<JmiClassVertex> getAllSuperclassVertices(JmiClassVertex vertex)
Gets all JmiClassVertexes representing superclasses of a class (including the class itself).

Parameters:
vertex - vertex representing class of interest
Returns:
Set of JmiClassVertex

getAllSubclassVertices

public Set<JmiClassVertex> getAllSubclassVertices(JmiClassVertex vertex)
Gets all JmiClassVertexes representing subclasses of a class (including the class itself).

Parameters:
vertex - vertex representing class of interest
Returns:
Set of JmiClassVertex

getInheritedOutgoingAssocEdges

public Set<JmiAssocEdge> getInheritedOutgoingAssocEdges(JmiClassVertex vertex)
Gets all JmiAssocEdges representing associations outgoing from any class vertex returned by getAllSuperclassVertices(vertex).

Parameters:
vertex - vertex representing class of interest
Returns:
Set of JmiAssocEdge

getInheritedIncomingAssocEdges

public Set<JmiAssocEdge> getInheritedIncomingAssocEdges(JmiClassVertex vertex)
Gets all JmiAssocEdges representing associations incoming to any class vertex returned by getAllSuperclassVertices(vertex).

Parameters:
vertex - vertex representing class of interest
Returns:
Set of JmiAssocEdge

getAllOutgoingAssocEdges

public Set<JmiAssocEdge> getAllOutgoingAssocEdges(JmiClassVertex vertex)
Gets the union of getInheritedOutgoingAssocEdges() for all classes returned by getAllSubclassVertices(vertex).

Parameters:
vertex - vertex representing class of interest
Returns:
Set of JmiAssocEdge

getAllIncomingAssocEdges

public Set<JmiAssocEdge> getAllIncomingAssocEdges(JmiClassVertex vertex)
Gets the union of getInheritedIncomingAssocEdges() for all classes returned by getAllSubclassVertices(vertex).

Parameters:
vertex - vertex representing class of interest
Returns:
Set of JmiAssocEdge

getClassAttributes

private JmiModelView.ClassAttributes getClassAttributes(JmiClassVertex classVertex)

deriveAttributes

private void deriveAttributes()