com.rubecula.darwin.visualization
Class Avatar_

java.lang.Object
  extended by net.sf.tostring0.AToString
      extended by com.rubecula.darwin.visualization.Avatar_
All Implemented Interfaces:
Avatar, net.sf.tostring0.IToString
Direct Known Subclasses:
Avatar_ColorLocation, Avatar_Variable

public abstract class Avatar_
extends net.sf.tostring0.AToString
implements Avatar

Abstract base class for implementers of Avatar.

Author:
Robin Hillyard

Field Summary
static java.text.NumberFormat numberFormatter
           
 
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 Avatar_(Individual individual)
          Protected constructor which creates a new instance of Avatar at the point [0,0] and with color black.
protected Avatar_(Individual individual, java.awt.Color color)
          Protected constructor which creates a new instance of Avatar at the point [0,0] and with given color.
protected Avatar_(Individual individual, java.awt.Point location)
          Protected constructor which creates a new instance of Avatar at the given point and with color black.
protected Avatar_(Individual individual, java.awt.Point location, java.awt.Color color)
          Protected constructor which creates a new instance of Avatar at the given point and with given color.
 
Method Summary
 boolean equals(java.lang.Object obj)
          This is purely for debugging/logging purposes.
 java.awt.Color getColor()
           
 Individual getIndividual()
           
 java.awt.Point getLocation()
           
 double getSize()
          By default, we simply return 1.
 int hashCode()
           
protected  void moveTo(java.awt.Point point)
          Not a public method unless Moveable is implemented.
protected  void setColor(java.awt.Color color)
          Not a public method unless Colorable is implemented.
static java.lang.String showColor(java.awt.Color color)
           
static java.lang.String showLocation(java.awt.Point location)
           
static java.lang.String showSize(java.lang.Double size)
           
 
Methods inherited from class net.sf.tostring0.AToString
toString, toString, toStringBrief, toStringId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

numberFormatter

public static final java.text.NumberFormat numberFormatter
Constructor Detail

Avatar_

protected Avatar_(Individual individual)
Protected constructor which creates a new instance of Avatar at the point [0,0] and with color black.

Parameters:
individual - the individual which is modeled by this avatar.

Avatar_

protected Avatar_(Individual individual,
                  java.awt.Color color)
Protected constructor which creates a new instance of Avatar at the point [0,0] and with given color.

Parameters:
individual - the individual which is modeled by this avatar.
color - the color for the new Avatar.

Avatar_

protected Avatar_(Individual individual,
                  java.awt.Point location)
Protected constructor which creates a new instance of Avatar at the given point and with color black.

Parameters:
individual - the individual which is modeled by this avatar.
location - the location for the new Avatar. TEST

Avatar_

protected Avatar_(Individual individual,
                  java.awt.Point location,
                  java.awt.Color color)
Protected constructor which creates a new instance of Avatar at the given point and with given color.

Parameters:
individual - the individual which is modeled by this avatar.
location - the location for the new Avatar.
color - the color for the new Avatar.
Method Detail

showColor

public static java.lang.String showColor(java.awt.Color color)
Parameters:
color -
Returns:
a String of the form {r:g:b} where r, g and b are the integers representing the red, green and blue values.

showLocation

public static java.lang.String showLocation(java.awt.Point location)
Parameters:
location -
Returns:

showSize

public static java.lang.String showSize(java.lang.Double size)
Parameters:
location -
Returns:

getSize

public double getSize()
By default, we simply return 1.

Specified by:
getSize in interface Avatar
Returns:
the (relative) size of this individual
See Also:
Avatar.getSize()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

moveTo

protected void moveTo(java.awt.Point point)
Not a public method unless Moveable is implemented.

Parameters:
point -

setColor

protected void setColor(java.awt.Color color)
Not a public method unless Colorable is implemented.

Parameters:
color -

equals

public boolean equals(java.lang.Object obj)
This is purely for debugging/logging purposes.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

getColor

public java.awt.Color getColor()
Specified by:
getColor in interface Avatar
Returns:
the color TEST

getIndividual

public Individual getIndividual()
Specified by:
getIndividual in interface Avatar
Returns:
the organism
See Also:
Avatar.getIndividual()

getLocation

public java.awt.Point getLocation()
Specified by:
getLocation in interface Avatar
Returns:
the location TEST


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.