|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.tostring0.AToString com.rubecula.darwin.visualization.VisualizationModel_
public abstract class VisualizationModel_
Base implementation of fields/methods for a VisualizationModel
. In
particular, this class maintains the following properties:
_title
(a String representing the title of this modelcomponent
(a component which should be repainted if this model
changes)_avatars
(a list of Avatar
objects_attributes
(a list of Map
objectsvisible
(a boolean representing the current visibility of this
model
Field Summary | |
---|---|
protected java.util.Map<Individual,Avatar> |
_avatars
|
protected static org.apache.commons.logging.Log |
LOG
|
Fields inherited from interface net.sf.tostring0.IToString |
---|
ANGBR_OPEN, ANGBRA_CLSE, BRA_CLSE, BRA_OPEN, BRCE_OPEN, BRCS_CLSE, COLON, LIST_SEPARATOR, MAX_ELEMENTS_DEFAULT, S_MT, S_PERCENT, SEPARATOR, SPACE |
Constructor Summary | |
---|---|
protected |
VisualizationModel_(java.lang.String title)
Protected constructor which creates new instances for the _avatars and _attributes properties. |
Method Summary | |
---|---|
void |
addAvatar(Avatar avatar)
Get the current count, then add the individual. |
int |
clean()
Loop through all the individuals and remove any which are dead and buried. |
void |
clear()
Method to remove all individuals from the model. |
Avatar |
findAvatar(Individual individual)
|
void |
fireModelChange()
Notify the listeners that the model has changed. |
java.util.Map<java.lang.String,java.lang.Object> |
getAttributes()
|
protected java.awt.Component |
getComponent()
|
int |
getCount()
|
java.util.Collection<Avatar> |
getIndividuals()
|
java.lang.String |
getTitle()
|
boolean |
isVisible()
|
void |
putAttribute(java.lang.String attrName,
java.lang.Object attrValue)
Method to set (or reset) an attribute. |
boolean |
removeIndividual(Avatar avatar)
Remove from the _avatars map that avatar which is indexed by the
individual referenced by the parameter avatar . |
void |
setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Getter/setter normally invoked by reflection. |
void |
setComponent(java.awt.Component component)
|
void |
setVisible(boolean visible)
Getter/setter normally invoked by reflection. |
static int |
updateModel(VisualizationModel model,
Individual individual,
VisualizationFactory factory)
XXX consider moving this to VisualizationModel (but beware architecture constraints). |
void |
visualize(Visualizable visualizable,
VisualizationFactory visualizationFactory)
|
Methods inherited from class net.sf.tostring0.AToString |
---|
toString, toString, toStringBrief, toStringId |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final java.util.Map<Individual,Avatar> _avatars
protected static final org.apache.commons.logging.Log LOG
Constructor Detail |
---|
protected VisualizationModel_(java.lang.String title)
_avatars
and _attributes
properties. It also sets the
_title
as given by title
and initializes
visible
to true.
title
- the title for this model.Method Detail |
---|
public static int updateModel(VisualizationModel model, Individual individual, VisualizationFactory factory)
model
- individual
- factory
- VisualizationFactory to create avatars
public void addAvatar(Avatar avatar)
addAvatar
in interface VisualizationModel
avatar
- an individual which is to be added to the population.VisualizationModel.addAvatar(Avatar)
public int clean()
clean
in interface VisualizationModel
VisualizationModel.clean()
public void clear()
VisualizationModel
clear
in interface VisualizationModel
ArrayList.clear()
public Avatar findAvatar(Individual individual)
findAvatar
in interface VisualizationModel
VisualizationModel.findAvatar(com.rubecula.darwin.foundation.Individual)
public void fireModelChange()
addAvatar(Avatar)
or removeIndividual(Avatar)
.
fireModelChange
in interface VisualizationModel
()
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
getAttributes
in interface VisualizationModel
VisualizationModel.getAttributes()
public int getCount()
getCount
in interface Countable
Countable.getCount()
public java.util.Collection<Avatar> getIndividuals()
getIndividuals
in interface VisualizationModel
VisualizationModel.getIndividuals()
public java.lang.String getTitle()
getTitle
in interface VisualizationModel
VisualizationModel.getTitle()
public boolean isVisible()
isVisible
in interface VisualizationModel
VisualizationModel.isVisible()
public void putAttribute(java.lang.String attrName, java.lang.Object attrValue)
VisualizationModel
putAttribute
in interface VisualizationModel
VisualizationModel.putAttribute(java.lang.String,
java.lang.Object)
public boolean removeIndividual(Avatar avatar)
_avatars
map that avatar which is indexed by the
individual referenced by the parameter avatar
.
TODO consider passing in Individual instead of Avatar.
XXX consider eliminating synchronized since it should be handled by the
_avatars object
removeIndividual
in interface VisualizationModel
avatar
- an individual which is to be removed from the population.
VisualizationModel.removeIndividual(Avatar)
public void setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
setAttributes
in interface VisualizationModel
VisualizationModel.setAttributes(java.util.Map)
public void setComponent(java.awt.Component component)
setComponent
in interface VisualizationModel
component
- the component to setpublic void setVisible(boolean visible)
setVisible
in interface VisualizationModel
visible
- the visible to setVisualizationModel.setVisible(boolean)
public void visualize(Visualizable visualizable, VisualizationFactory visualizationFactory)
visualize
in interface VisualizationModel
visualizable
- visualizationFactory
- protected java.awt.Component getComponent()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |