public class OOStatePainter extends java.lang.Object implements StatePainter
StatePainter for painting OOState instances. Painting is defined by being given a list of
OO-MDP class-wise painters and specific instance-wise painters. A class-wise painter will handle painting all
OO-MDP objects belonging to a specific OO-MDP class, except for objects that have an associated instance-wise
painter, which override any class-wise painters for the painting of the object.
Painting order goes by class-wise painters, with the order that the painters were added, and then instance-wise painters.
| Modifier and Type | Class and Description |
|---|---|
static class |
OOStatePainter.ObjectPainterAndClassNamePair
A pair of the name of an object class to paint, and the
ObjectPainter to
use to paint it. |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<OOStatePainter.ObjectPainterAndClassNamePair> |
objectClassPainterList
Ordered list of painters for each object class
|
protected java.util.Map<java.lang.String,ObjectPainter> |
specificObjectPainters
Map of painters that define how to paint specific objects; if an object it appears in both specific and general lists, the specific painter is used
|
| Constructor and Description |
|---|
OOStatePainter() |
| Modifier and Type | Method and Description |
|---|---|
void |
addObjectClassPainter(java.lang.String className,
ObjectPainter op)
Adds a class that will paint objects that belong to a given OO-MDPclass.
|
void |
addSpecificObjectPainter(java.lang.String objectName,
ObjectPainter op)
Adds a painter that will be used to paint a specific object in states
|
void |
paint(java.awt.Graphics2D g2,
State s,
float cWidth,
float cHeight)
Paints general state information not to graphics context g2
|
protected java.util.List<OOStatePainter.ObjectPainterAndClassNamePair> objectClassPainterList
protected java.util.Map<java.lang.String,ObjectPainter> specificObjectPainters
public void addObjectClassPainter(java.lang.String className,
ObjectPainter op)
className - the name of the class that the provided painter can paintop - the painterpublic void addSpecificObjectPainter(java.lang.String objectName,
ObjectPainter op)
objectName - the name of the object this painter is used to paintop - the painterpublic void paint(java.awt.Graphics2D g2,
State s,
float cWidth,
float cHeight)
StatePainterpaint in interface StatePainterg2 - graphics context to which the static data should be painteds - the state to be paintedcWidth - the width of the canvascHeight - the height of the canvas