com.monkeycoder.monkeyfractal.base
Class FractalPlugin

java.lang.Object
  extended by com.monkeycoder.monkeyfractal.base.FractalPlugin
Direct Known Subclasses:
JuliaPlugin, MandelbrotMtPlugin, MandelbrotPlugin, NewtonPlugin, PlasmaPlugin

public abstract class FractalPlugin
extends java.lang.Object

This is the interface that all FractalPlugin's must implement. The behavior of each function should follow that which is outlined below very carefully but the specific implementation is up to the developer of the FractalPlugin. Functions that do not work as described will likely fail when used by MonkeyFractal.

Originally part of the MonkeyFractal project.

Author:
David Stephens

Field Summary
protected  ParameterList params
          Holds the configuration of this plugin in the form of a ParameterList.
protected  FractalThreadManager threadManager
          Holds a reference to the containing FractalThreadManager.
 
Constructor Summary
FractalPlugin()
          FractalPlugin is abstract and cannot be directly constructed.
 
Method Summary
abstract  FractalBuffer generateFractal()
          This function generates the fractal represented by the FractalPlugin and configured by the current ParameterList.
abstract  ComplexRange getComplexRange()
          This function gets the current ComplexRange used internally by the FractalPlugin.
abstract  ComplexRange getComplexRange(java.awt.Rectangle inPixelRect)
          Calculates a new ComplexRange based on a Rectangle of pixels.
abstract  java.lang.String getHelpAboutInfo()
          This method returns a String containing Help About information about this plugin.
 ParameterList getParameterList()
          This function returns the current ParameterList being used by this FractalPlugin.
abstract  void resetParameterList()
          This function creates a default ParameterList for this FractalPlugin.
abstract  void setComplexRange(ComplexRange inComplexRange)
          This function sets the ComplexRange used internally by the FractalPlugin.
abstract  void setComplexRange(java.awt.Rectangle inPixelRect)
          This function sets the ComplexRange used internally by the FractalPlugin.
 void setParameterList(ParameterList inParamList)
          This function takes in a ParameterList that will replace the internal ParameterList being used by this FractalPlugin.
abstract  void setPixelDimensions(java.awt.Dimension inPixelDim)
          This method sets the Dimensions of the FractalBuffer that will be generated by generateFractal().
 void setThreadManager(FractalThreadManager inThreadManager)
          This method accepts a reference to the containing FractalThreadManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

params

protected ParameterList params
Holds the configuration of this plugin in the form of a ParameterList.


threadManager

protected FractalThreadManager threadManager
Holds a reference to the containing FractalThreadManager. This reference can be used to relay update messages to the GUI.

Constructor Detail

FractalPlugin

public FractalPlugin()
FractalPlugin is abstract and cannot be directly constructed. Extend this class implement the required abstract methods and instantiate the child class.

Method Detail

getParameterList

public ParameterList getParameterList()
This function returns the current ParameterList being used by this FractalPlugin. If there is not yet an internal ParameterList this method calls resetParameterList() to create one and fill it in with default values.

Returns:
The current ParameterList being used by this FractalPlugin.
See Also:
resetParameterList()

setParameterList

public void setParameterList(ParameterList inParamList)
This function takes in a ParameterList that will replace the internal ParameterList being used by this FractalPlugin. The basis for the ParameterList that is passed in via this method should be one that was originally acquired by getParameterList(). No new parameters should be added externally as each plugin will know only its own parameter list.

Parameters:
inParamList - The new ParameterList to be used by this FractalPlugin.
See Also:
getParameterList()

resetParameterList

public abstract void resetParameterList()
This function creates a default ParameterList for this FractalPlugin. This ParameterList should replace the one used internally by this FractalPlugin and should contain useful default values.


generateFractal

public abstract FractalBuffer generateFractal()
This function generates the fractal represented by the FractalPlugin and configured by the current ParameterList. The result is a generic FractalBuffer full of data representing the output of the calculation.

Returns:
A FractalBuffer containing the results of the calculation.
See Also:
FractalThreadManager.getFractalBuffer()

getComplexRange

public abstract ComplexRange getComplexRange()
This function gets the current ComplexRange used internally by the FractalPlugin.

Returns:
A ComplexRange containing the ranges from the internal ParameterList.

getComplexRange

public abstract ComplexRange getComplexRange(java.awt.Rectangle inPixelRect)
Calculates a new ComplexRange based on a Rectangle of pixels. This method performs its calculation based on the current ParameterList values.

Returns:
A ComplexRange containing the ranges from the internal ParameterList based on the supplied Rectangle of pixels.

setComplexRange

public abstract void setComplexRange(ComplexRange inComplexRange)
This function sets the ComplexRange used internally by the FractalPlugin. The complex range should be loaded into the internal ParameterList for subsequent requests to generateFractal().

Parameters:
inComplexRange - The new ComplexRange to be loaded into the internal ParameterList.
See Also:
generateFractal()

setComplexRange

public abstract void setComplexRange(java.awt.Rectangle inPixelRect)
This function sets the ComplexRange used internally by the FractalPlugin. This is a convenience method that processes the Rectangle of pixels through getComplexRange(Rectangle) before passing the result to setComplexRange(ComplexRange).

Parameters:
inPixelRect - A Rectangle of pixels to use to create a new ComplexRange to be loaded into the internal ParameterList.
See Also:
getComplexRange(Rectangle), setComplexRange(ComplexRange)

setPixelDimensions

public abstract void setPixelDimensions(java.awt.Dimension inPixelDim)
This method sets the Dimensions of the FractalBuffer that will be generated by generateFractal(). The Dimensions passed in should be loaded into the internal ParameterList for subsequent calls to generateFractal().

Parameters:
inPixelDim - A Dimension of pixels that represents how large a FractalBuffer will be generated.
See Also:
generateFractal()

setThreadManager

public void setThreadManager(FractalThreadManager inThreadManager)
This method accepts a reference to the containing FractalThreadManager.

Parameters:
inThreadManager - A reference to the containing FractalThreadManager that will be provided by the thread manager itself when it is started.
See Also:
FractalThreadManager.run()

getHelpAboutInfo

public abstract java.lang.String getHelpAboutInfo()
This method returns a String containing Help About information about this plugin. This information will be displayed in the Help About dialog box when this plugin is active.

Returns:
Help About information for this plugin.