JIVE Platform
Release 0.3.1

edu.bsu.cs.jive.contour
Interface ContourModel

All Superinterfaces:
Iterable<Contour>
All Known Subinterfaces:
InteractiveContourModel

public interface ContourModel
extends Iterable<Contour>

A contour model is a representation of program execution state.


Nested Class Summary
static interface ContourModel.Exporter
          An exporter for a contour model.
static interface ContourModel.Importer
          A builder interface for a contour model.
static interface ContourModel.Listener
          Listener interface for contour model changes.
static interface ContourModel.Visitor
          A visitor interface for the contour model.
 
Method Summary
 void addListener(ContourModel.Listener listener)
          Register a listener.
 boolean contains(Contour contour)
          Check if the contour model contains a specific contour.
 boolean contains(ContourID id)
          Check if the contour model contains a specific contour by ID.
 int countChildren(Contour parent)
          Count the number of children of a specific contour.
 int countChildren(ContourID parent)
          Count the number of children of a specific contour.
 void export(ContourModel.Exporter exporter)
          Export this contour model (a snapshot of program execution) to a reverse-builder.
 List<Contour> getChildren(Contour parent)
          Get the children of a specific contour.
 List<ContourID> getChildren(ContourID parentID)
          Get the children of a specific contour.
 List<ContourID> getChildren(ContourID parentID, List<ContourID> result)
          Get the children of a specific contour.
 List<Contour> getChildren(Contour parent, List<Contour> result)
          Get the children of a specific contour.
 Contour getContour(ContourID id)
          Get the contour associated with a specific contour ID.
 ReentrantLock getModelLock()
          Get the lock object for synchronized reading and writing to the model.
 Contour getParent(Contour contour)
          Get the parent (enclosing contour) of a specific contour.
 ContourID getParent(ContourID id)
          Get the parent (enclosing contour) of a specific contour, by its id.
 List<Contour> getRoots()
          Get the root contours.
 List<Contour> getRoots(List<Contour> result)
          Get the root contours.
 void removeListener(ContourModel.Listener listener)
          Unregister a listener
 int size()
          Count the number of contours in this model.
 void visitBreadthFirst(ContourModel.Visitor visitor)
          Process a visitor in breadth-first order.
 void visitDepthFirst(ContourModel.Visitor visitor)
          Process a visitor in depth-first order.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

visitDepthFirst

void visitDepthFirst(ContourModel.Visitor visitor)
Process a visitor in depth-first order.

Parameters:
visitor - a visitor

visitBreadthFirst

void visitBreadthFirst(ContourModel.Visitor visitor)
Process a visitor in breadth-first order.

Parameters:
visitor - a visitor

export

void export(ContourModel.Exporter exporter)
Export this contour model (a snapshot of program execution) to a reverse-builder.

Parameters:
exporter - an exporter; a reverse-builder

getModelLock

ReentrantLock getModelLock()
Get the lock object for synchronized reading and writing to the model. TODO: complete comments here. (Only owning thread can modify, etc.)

Returns:
lock

contains

boolean contains(Contour contour)
Check if the contour model contains a specific contour.

Parameters:
contour -
Returns:
true iff the contour is in the model

contains

boolean contains(ContourID id)
Check if the contour model contains a specific contour by ID.

Parameters:
id - the ID of the contour
Returns:
true iff a contour with the given ID is in the model

getContour

Contour getContour(ContourID id)
Get the contour associated with a specific contour ID.

Parameters:
id - a contour identifier
Returns:
the contour with that ID, or null if it is not in the model

getParent

ContourID getParent(ContourID id)
Get the parent (enclosing contour) of a specific contour, by its id.

Parameters:
id - the contour identifier for a contour
Returns:
the identifier of the parent of the parameter contour or null if it is a root contour
See Also:
getParent(Contour), getContour(ContourID)

getParent

Contour getParent(Contour contour)
Get the parent (enclosing contour) of a specific contour.

Parameters:
contour - the query contour
Returns:
the contour's parent or null if it is a root contour
See Also:
getParent(ContourID)

countChildren

int countChildren(ContourID parent)
Count the number of children of a specific contour.

Parameters:
parent - a parent contour
Returns:
the number of immediate children (not total descendents) of the given contour

countChildren

int countChildren(Contour parent)
Count the number of children of a specific contour.

Parameters:
parent - a parent contour
Returns:
the number of immediate children (not total descendents) of the given contour

getChildren

List<ContourID> getChildren(ContourID parentID)
Get the children of a specific contour. The returned list must not be a reference to any internal data model of this contour model.

Parameters:
parentID - the contour whose children are sought
Returns:
list of children (possibly empty, not null)

getChildren

List<ContourID> getChildren(ContourID parentID,
                            List<ContourID> result)
Get the children of a specific contour.

Parameters:
parentID - the contour whose children are sought
result - the list into which the result is put (may be null)
Returns:
the result list (or a new list if it is null)

getChildren

List<Contour> getChildren(Contour parent)
Get the children of a specific contour. The returned list must not be a reference to any internal data model of this contour model.

Parameters:
parent - the contour whose children are sought
Returns:
list of children (possibly empty, not null)

getChildren

List<Contour> getChildren(Contour parent,
                          List<Contour> result)
Get the children of a specific contour.

Parameters:
parent - the contour whose children are sought
result - the list into which the result is put (may be null)
Returns:
the result list (or a new list if it is null)

getRoots

List<Contour> getRoots()
Get the root contours. The returned list must not be a reference to any internal data model of this contour model.

Returns:
list of roots (possibly empty, not null)

getRoots

List<Contour> getRoots(List<Contour> result)
Get the root contours.

Parameters:
result - the list into which the result is put (may be null)
Returns:
the result list (or a new list if it is null)

size

int size()
Count the number of contours in this model.

Returns:
the number of contours in the model

addListener

void addListener(ContourModel.Listener listener)
Register a listener.

Parameters:
listener -

removeListener

void removeListener(ContourModel.Listener listener)
Unregister a listener

Parameters:
listener -

JIVE Platform
Release 0.3.1