org.simBio.sim.analyzer.graph
Class AbstractGraph

java.lang.Object
  extended by org.simBio.core.Component
      extended by org.simBio.core.Parameter
          extended by org.simBio.core.Composite
              extended by org.simBio.core.Analyzer
                  extended by org.simBio.sim.analyzer.VisualizeAnalyzer
                      extended by org.simBio.sim.analyzer.graph.AbstractGraph
All Implemented Interfaces:
Node
Direct Known Subclasses:
BasicGraph

public abstract class AbstractGraph
extends VisualizeAnalyzer

Provides a Graph framework. Constructs a framework in this class so that the Graph class which inherits from it can be implemented simply, without providing redrawing functions etc.

Notice

Version:
$Id: AbstractGraph.java,v 1.4 2007/04/07 08:44:07 nsarai Exp $
Author:
Misaki

Field Summary
protected  AxisX axisX
          coordinate axis object (horizontal direction)
protected  AxisY axisY
          coordinate axis object (vertical direction)
 double interval
          calculation result processing interval
protected static Log log
           
protected  double maxTime
          maximum time until now
protected  double nextTime
          time of the next process
protected  int nTarget
          number of Nodes which become the target of management (target X, base)
protected  int nTargetOrigin
          The basic point of nTarget. Before carrying out super.setLinks(), it is set to 0 with setLinks() in the case of Graph, and 1 in the case of RelationGraph.
protected  Viewer page
          Viewer that this Graph is placed on
protected  IPlot plotDisplay
          instance of a screen drawing operation
protected  IPlot plotPrinter
          instance of a printing operation
protected  Node[] target
          Nodes which become the drawing target (target X)
protected  java.lang.String[] targetName
          name of the Node which becomes the drawing target (page.Graph.target X)
protected  double[] targetScale
          scale of the Node which becomes the drawing target (target X scale)
protected  java.lang.String[] targetShortName
          short name of the Node which becomes the drawing target (target X)
protected  AbstractGraph thisGraph
          information for accessing this Graph from a subclass
protected  double[] valuesBuffer
          buffer for temporary storage of calculation results
 
Fields inherited from class org.simBio.core.Parameter
value
 
Constructor Summary
AbstractGraph()
           
 
Method Summary
protected  void analyze(double t)
          Default analyze operation. Called by Conductor on the Simulation thread.
protected abstract  void analyzeSub(double t, double[] valuesBuffer, IPlot plot)
          Analyse operation for giving a description to a subclass.
 void changeScale()
          Carries out the necessary preparation for redrawing, when the display position/display range has changed. Currently it calls the Viewer method of the same name.
 void doRepaint()
          再描画を行う.
 void drawLine(IPlot plot, java.awt.Graphics2D graphics2d, double x1, double y1, double x2, double y2, int nGraph)
          Strikes a point on a graph. When a line is drawn instead of a point in Graph4State, it separates so that it is easy to inherit.
 void drawPoint(IPlot plot, java.awt.Graphics2D graphics2d, double x, double y, int nGraph)
          Draws a line on a graph. When a line is drawn instead of a point in Graph4State, it separates so that it is easy to inherit.
protected  void paintAxises(java.awt.Graphics2D graphics2d, IPlot plot)
          Initialize graph area, and draw axes and grids.
protected  void paintBackground(java.awt.Graphics2D graphics2d, IPlot plot)
          Draw background.
 void paintComponent(java.awt.Graphics graphic)
          Performs Graph screen drawing.
protected abstract  void paintGraph(java.awt.Graphics2D graphics2d, IPlot plot)
          Draw graph.
protected  void paintLegend(java.awt.Graphics2D graphics2d, IPlot plot)
          Draw legend.
protected  void prepare()
          Set link to the targets.
 void prepareRepaint()
          再描画を準備する.
protected  void printAxises(java.awt.Graphics2D graphics2d, IPlot plot)
          Initialize graph area, and draw axes and grids.
protected  void printBackground(java.awt.Graphics2D graphics2d, IPlot plot)
          Draw background.
 void printComponent(java.awt.Graphics graphic)
          Performs drawing for printing the Graph.
protected  void printGraph(java.awt.Graphics2D graphics2d, IPlot plot)
          Draw graph.
protected  void printLegend(java.awt.Graphics2D graphics2d, IPlot plot)
          Draw legend.
protected  void resize(IPlot plot)
          Recalculates the Graph size, based on the size of the current parent window.
 void setAreaChanged()
          Provides notification when the displayed area has changed. For Graph etc, if calculation data is processed and cached, if the display area scrolls, if the resolution changes etc, there are cases where it is necessary to get rid of the cache. In such a case, when this method is called it gets rid of the cache.
protected  void setLinks()
          Link to the Viewer, AxisX, AxisY and count number of the target, get array.
 
Methods inherited from class org.simBio.sim.analyzer.VisualizeAnalyzer
getColorParameter, getDouble, getFontParameter, getNodeHierarchically, getNodeRecursive, repaint, resetBuffer
 
Methods inherited from class org.simBio.core.Composite
accept, getLink, getNode, getNodesIterator, getNodesSize
 
Methods inherited from class org.simBio.core.Parameter
addValue, getValue, getValueString, setInitializer, setValue, setValueString, setValueToField
 
Methods inherited from class org.simBio.core.Component
addDydt, end, getIndent, getIndentedShortName, getName, getName, getParent, getRoot, getShortName, getUnits, isNamed, isPrefixed, logIndented, quit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.simBio.core.Node
addDydt, addValue, getValue, setValue
 

Field Detail

log

protected static Log log

interval

public double interval
calculation result processing interval


axisX

protected AxisX axisX
coordinate axis object (horizontal direction)


axisY

protected AxisY axisY
coordinate axis object (vertical direction)


nextTime

protected double nextTime
time of the next process


maxTime

protected double maxTime
maximum time until now


valuesBuffer

protected double[] valuesBuffer
buffer for temporary storage of calculation results


thisGraph

protected AbstractGraph thisGraph
information for accessing this Graph from a subclass


page

protected Viewer page
Viewer that this Graph is placed on


plotDisplay

protected IPlot plotDisplay
instance of a screen drawing operation


plotPrinter

protected IPlot plotPrinter
instance of a printing operation


target

protected Node[] target
Nodes which become the drawing target (target X)


targetName

protected java.lang.String[] targetName
name of the Node which becomes the drawing target (page.Graph.target X)


targetShortName

protected java.lang.String[] targetShortName
short name of the Node which becomes the drawing target (target X)


targetScale

protected double[] targetScale
scale of the Node which becomes the drawing target (target X scale)


nTarget

protected int nTarget
number of Nodes which become the target of management (target X, base)


nTargetOrigin

protected int nTargetOrigin
The basic point of nTarget. Before carrying out super.setLinks(), it is set to 0 with setLinks() in the case of Graph, and 1 in the case of RelationGraph.

Constructor Detail

AbstractGraph

public AbstractGraph()
Method Detail

setLinks

protected void setLinks()
Link to the Viewer, AxisX, AxisY and count number of the target, get array.

Overrides:
setLinks in class Component
See Also:
Component.setLinks()

prepare

protected void prepare()
Set link to the targets.

Overrides:
prepare in class Parameter
See Also:
Component.prepare()

paintComponent

public void paintComponent(java.awt.Graphics graphic)
Performs Graph screen drawing.

Parameters:
graphic - Graphics drawing object

printComponent

public void printComponent(java.awt.Graphics graphic)
Performs drawing for printing the Graph.

Parameters:
graphic - Graphics drawing object

prepareRepaint

public void prepareRepaint()
Description copied from class: VisualizeAnalyzer
再描画を準備する. 指定したNodeおよび配下のNodeについて、再描画の準備を行います。 GUIからグラフ領域を更新する際、必ず、doRepaint() メソッドの前に呼び出すこと。
クラス実装上の扱い

Overrides:
prepareRepaint in class VisualizeAnalyzer

doRepaint

public void doRepaint()
Description copied from class: VisualizeAnalyzer
再描画を行う. 指定したNodeおよび配下のNodeについて、再描画を行います。 GUIからグラフ領域を更新する際、prepareRepaint() メソッドの後に呼び出すこと。
クラス実装上の扱い

Overrides:
doRepaint in class VisualizeAnalyzer

changeScale

public void changeScale()
Carries out the necessary preparation for redrawing, when the display position/display range has changed. Currently it calls the Viewer method of the same name.


analyze

protected final void analyze(double t)
Default analyze operation. Called by Conductor on the Simulation thread.

Specified by:
analyze in class VisualizeAnalyzer
Parameters:
t - time
See Also:
Conductor.integrate()

analyzeSub

protected abstract void analyzeSub(double t,
                                   double[] valuesBuffer,
                                   IPlot plot)
Analyse operation for giving a description to a subclass.

Parameters:
t - time
valuesBuffer - array of calculation results
plot - drawing operation object

paintBackground

protected void paintBackground(java.awt.Graphics2D graphics2d,
                               IPlot plot)
Draw background.

Parameters:
graphics2d - drawn Graphics
plot - drawing operation object

paintGraph

protected abstract void paintGraph(java.awt.Graphics2D graphics2d,
                                   IPlot plot)
Draw graph.

Parameters:
graphics2d - drawn Graphics
plot - drawing operation object

paintAxises

protected void paintAxises(java.awt.Graphics2D graphics2d,
                           IPlot plot)
Initialize graph area, and draw axes and grids.

Parameters:
graphics2d - drawn Graphics
plot - drawing operation object

paintLegend

protected void paintLegend(java.awt.Graphics2D graphics2d,
                           IPlot plot)
Draw legend.

Parameters:
graphics2d - drawn Graphics
plot - drawing operation object

printBackground

protected void printBackground(java.awt.Graphics2D graphics2d,
                               IPlot plot)
Draw background.

Parameters:
graphics2d - Graphics which are drawn
plot - drawing operation object

printGraph

protected void printGraph(java.awt.Graphics2D graphics2d,
                          IPlot plot)
Draw graph. Called by JPanel#printComponent() on Event thread.

Parameters:
graphics2d - Graphics which are drawn
plot - drawing operation object

printAxises

protected void printAxises(java.awt.Graphics2D graphics2d,
                           IPlot plot)
Initialize graph area, and draw axes and grids.

Parameters:
graphics2d - Graphics which are drawn
plot - drawing operation object

printLegend

protected void printLegend(java.awt.Graphics2D graphics2d,
                           IPlot plot)
Draw legend.

Parameters:
graphics2d - Graphics which are drawn
plot - drawing operation object

resize

protected void resize(IPlot plot)
Recalculates the Graph size, based on the size of the current parent window.

Parameters:
plot - drawing operation object

drawLine

public void drawLine(IPlot plot,
                     java.awt.Graphics2D graphics2d,
                     double x1,
                     double y1,
                     double x2,
                     double y2,
                     int nGraph)
Strikes a point on a graph. When a line is drawn instead of a point in Graph4State, it separates so that it is easy to inherit.

Parameters:
plot - drawing operation object
graphics2d - Graphics which are drawn
x1 - starting X coordinate
y1 - starting Y coordinate
x2 - finishing X coordinate
y2 - finishing Y coordinate
nGraph - series number of the graph (0..n)

drawPoint

public void drawPoint(IPlot plot,
                      java.awt.Graphics2D graphics2d,
                      double x,
                      double y,
                      int nGraph)
Draws a line on a graph. When a line is drawn instead of a point in Graph4State, it separates so that it is easy to inherit.

Parameters:
plot - drawing operation object
graphics2d - Graphics which are drawn
x - X coordinate
y - Y coordinate
nGraph - series number of a graph (0..n)

setAreaChanged

public void setAreaChanged()
Provides notification when the displayed area has changed. For Graph etc, if calculation data is processed and cached, if the display area scrolls, if the resolution changes etc, there are cases where it is necessary to get rid of the cache. In such a case, when this method is called it gets rid of the cache.



Copyright © 2002-2008 Cell/Biodinamics simulation project. All Rights Reserved.