The Physiologist's Friend Simulation API

ch.unizh.ini.friend.stimulus
Class ColorStimulusImpl

java.lang.Object
  extended by ch.unizh.ini.friend.stimulus.AbstractStimulus
      extended by ch.unizh.ini.friend.stimulus.ConcreteStimulus
          extended by ch.unizh.ini.friend.stimulus.ColorStimulusImpl
All Implemented Interfaces:
Updateable, ColorStimulus, Stimulus, Cloneable

public class ColorStimulusImpl
extends ConcreteStimulus
implements ColorStimulus, Cloneable

Default implementation of the ColorStimulus interface.

Version:
$Revision: 1.3 $
Author:
Johann Gyger

Field Summary
protected  LMSColor background
          The background color.
protected  LMSColor foreground
          The foreground color.
protected  LMSColor lastForeground
           
 
Fields inherited from class ch.unizh.ini.friend.stimulus.AbstractStimulus
backgroundExcitationDensity, BRIGHTNESS_CHANGE_RATIO, foregroundExcitationDensity, newBackgroundExcitationDensity, newForegroundExcitationDensity, newShape, shapes, transforms
 
Fields inherited from interface ch.unizh.ini.friend.stimulus.Stimulus
BACKGROUND_BRIGHTNESS, BRIGHTEN_BACKGROUND, BRIGHTEN_FOREGROUND, DARKEN_BACKGROUND, DARKEN_FOREGROUND, FOREGROUND_BRIGHTNESS, RESIZE_RATIO, ROTATE_BY
 
Constructor Summary
ColorStimulusImpl()
          Creates a new color stimulus.
 
Method Summary
 void brightenBackground()
          make background brighter
 void brightenForeground()
          make foreground brighter
 Object clone()
          clones the foreground color, background color, and the tranformed ShapeList
 void darkenBackground()
          make background darker
 void darkenForeground()
          make foreground darker
 void flipContrast()
          swap brightness of foreground and background
 Color getBackground()
          Returns the background excitation color of the stimulus.
 float getBackgroundExcitationDensity()
          Returns the background excitation density of the stimulus.
 Color getForeground()
          Returns the foreground excitation color of the stimulus.
 float getForegroundExcitationDensity()
          Returns the foreground excitation density of the stimulus.
 LMSColor getLMSBackground()
          Returns the background excitation color of the stimulus.
 LMSColor getLMSForeground()
          Returns the foreground excitation color of the stimulus.
 boolean isVisible()
          is stimulus hidden by its foreground brightness being set to the background?
 void setBackground(Color color)
          Sets the background excitation color of the stimulus.
 void setForeground(Color color)
          Sets the foreground excitation color of the stimulus.
 void setVisible(boolean visible)
          set state of stimulus to be hidden or shown.
 
Methods inherited from class ch.unizh.ini.friend.stimulus.ConcreteStimulus
update
 
Methods inherited from class ch.unizh.ini.friend.stimulus.AbstractStimulus
addShape, clearShapes, compute, expand, fatten, getShapes, getTransformedShapes, getTransforms, lengthen, removeShape, rotate, rotateCCW, rotateCW, setBackgroundExcitationDensity, setForegroundExcitationDensity, setShapes, setTransforms, shorten, shrink, thin, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ch.unizh.ini.friend.stimulus.Stimulus
addShape, clearShapes, expand, fatten, getShapes, getTransformedShapes, getTransforms, lengthen, removeShape, rotate, rotateCCW, rotateCW, setBackgroundExcitationDensity, setForegroundExcitationDensity, setShapes, setTransforms, shorten, shrink, thin
 
Methods inherited from interface ch.unizh.ini.friend.simulation.Updateable
compute, update
 

Field Detail

foreground

protected LMSColor foreground
The foreground color.


background

protected LMSColor background
The background color.


lastForeground

protected LMSColor lastForeground
Constructor Detail

ColorStimulusImpl

public ColorStimulusImpl()
Creates a new color stimulus.

Method Detail

getForeground

public Color getForeground()
Description copied from interface: ColorStimulus
Returns the foreground excitation color of the stimulus.

Specified by:
getForeground in interface ColorStimulus
Returns:
the color
See Also:
ColorStimulus.getForeground()

getBackground

public Color getBackground()
Description copied from interface: ColorStimulus
Returns the background excitation color of the stimulus.

Specified by:
getBackground in interface ColorStimulus
Returns:
the color
See Also:
ColorStimulus.getBackground()

setForeground

public void setForeground(Color color)
Description copied from interface: ColorStimulus
Sets the foreground excitation color of the stimulus.

Specified by:
setForeground in interface ColorStimulus
Parameters:
color - the new color
See Also:
ColorStimulus.setForeground(java.awt.Color)

setBackground

public void setBackground(Color color)
Description copied from interface: ColorStimulus
Sets the background excitation color of the stimulus.

Specified by:
setBackground in interface ColorStimulus
Parameters:
color - the new color
See Also:
ColorStimulus.setBackground(java.awt.Color)

brightenBackground

public void brightenBackground()
Description copied from class: AbstractStimulus
make background brighter

Specified by:
brightenBackground in interface Stimulus
Overrides:
brightenBackground in class AbstractStimulus
See Also:
Stimulus.brightenBackground()

brightenForeground

public void brightenForeground()
Description copied from class: AbstractStimulus
make foreground brighter

Specified by:
brightenForeground in interface Stimulus
Overrides:
brightenForeground in class AbstractStimulus
See Also:
Stimulus.brightenForeground()

darkenBackground

public void darkenBackground()
Description copied from class: AbstractStimulus
make background darker

Specified by:
darkenBackground in interface Stimulus
Overrides:
darkenBackground in class AbstractStimulus
See Also:
Stimulus.darkenBackground()

darkenForeground

public void darkenForeground()
Description copied from class: AbstractStimulus
make foreground darker

Specified by:
darkenForeground in interface Stimulus
Overrides:
darkenForeground in class AbstractStimulus
See Also:
Stimulus.darkenForeground()

getBackgroundExcitationDensity

public float getBackgroundExcitationDensity()
Description copied from class: AbstractStimulus
Returns the background excitation density of the stimulus.

Specified by:
getBackgroundExcitationDensity in interface Stimulus
Overrides:
getBackgroundExcitationDensity in class AbstractStimulus
Returns:
The excitation density.
See Also:
Stimulus.getBackgroundExcitationDensity()

getForegroundExcitationDensity

public float getForegroundExcitationDensity()
Description copied from class: AbstractStimulus
Returns the foreground excitation density of the stimulus.

Specified by:
getForegroundExcitationDensity in interface Stimulus
Overrides:
getForegroundExcitationDensity in class AbstractStimulus
Returns:
The excitation density.
See Also:
Stimulus.getForegroundExcitationDensity()

flipContrast

public void flipContrast()
Description copied from class: AbstractStimulus
swap brightness of foreground and background

Specified by:
flipContrast in interface Stimulus
Overrides:
flipContrast in class AbstractStimulus
See Also:
Stimulus.flipContrast()

isVisible

public boolean isVisible()
Description copied from class: AbstractStimulus
is stimulus hidden by its foreground brightness being set to the background?

Specified by:
isVisible in interface Stimulus
Overrides:
isVisible in class AbstractStimulus
See Also:
Stimulus.isVisible()

setVisible

public void setVisible(boolean visible)
Description copied from class: AbstractStimulus
set state of stimulus to be hidden or shown. Stimulus is hidden by setting its brightness the same as the background.

Specified by:
setVisible in interface Stimulus
Overrides:
setVisible in class AbstractStimulus
See Also:
Stimulus.setVisible(boolean)

getLMSBackground

public LMSColor getLMSBackground()
Description copied from interface: ColorStimulus
Returns the background excitation color of the stimulus.

Specified by:
getLMSBackground in interface ColorStimulus
Returns:
the color in LMS color space
See Also:
ColorStimulus.getLMSBackground()

getLMSForeground

public LMSColor getLMSForeground()
Description copied from interface: ColorStimulus
Returns the foreground excitation color of the stimulus.

Specified by:
getLMSForeground in interface ColorStimulus
Returns:
the color in LMS color space
See Also:
ColorStimulus.getLMSForeground()

clone

public Object clone()
clones the foreground color, background color, and the tranformed ShapeList

Overrides:
clone in class ConcreteStimulus

http://www.ini.unizh.ch/~tobi/friend