edu.rit.numeric.plot
Class LinearAxis

java.lang.Object
  extended by edu.rit.numeric.plot.Axis
      extended by edu.rit.numeric.plot.NumericalAxis
          extended by edu.rit.numeric.plot.LinearAxis

public class LinearAxis
extends NumericalAxis

Class LinearAxis provides a linear axis on a plot. The axis goes from a starting value to an ending value in a linear fashion.


Field Summary
 
Fields inherited from class edu.rit.numeric.plot.NumericalAxis
myTicksAboveOrRight, myTicksBelowOrLeft
 
Fields inherited from class edu.rit.numeric.plot.Axis
DEFAULT_PAINT, DEFAULT_STROKE, myLength, myPaint, myStroke
 
Constructor Summary
LinearAxis(double theStart, double theEnd, int theMajorDivisionCount, int theMinorDivisionCount, double theCrossing, double theLength)
          Construct a new linear axis.
LinearAxis(double theStart, double theEnd, int theMajorDivisionCount, int theMinorDivisionCount, double theCrossing, double theLength, Stroke theStroke, Paint thePaint)
          Construct a new linear axis.
LinearAxis(double theStart, double theEnd, int theMajorDivisionCount, int theMinorDivisionCount, double theCrossing, double theLength, Stroke theStroke, Paint thePaint, Ticks theTicksBelowOrLeft, Ticks theTicksAboveOrRight)
          Construct a new linear axis.
LinearAxis(double theStart, double theEnd, int theMajorDivisionCount, int theMinorDivisionCount, double theCrossing, double theLength, Ticks theTicksBelowOrLeft, Ticks theTicksAboveOrRight)
          Construct a new linear axis.
 
Method Summary
 double getCrossing()
          Returns the value of the point where the perpendicular axis crosses this axis.
 double getDisplayDistance(double value)
          Returns the distance on the display from the start of this axis to the given value.
 double getEnd()
          Returns the ending value of this axis.
 double getMajorDivision(int i)
          Returns the value of the given major division.
 int getMajorDivisionCount()
          Returns the number of major divisions on this axis.
 double getMinorDivision(int i)
          Returns the value of the given minor division.
 int getMinorDivisionCount()
          Returns the number of minor divisions on this axis.
 double getStart()
          Returns the starting value of this axis.
 boolean includesValue(double value)
          Returns true if the given value falls within the bounds of this axis, false otherwise.
 
Methods inherited from class edu.rit.numeric.plot.NumericalAxis
drawHorizontal, drawVertical, getTicksAboveOrRight, getTicksBelowOrLeft
 
Methods inherited from class edu.rit.numeric.plot.Axis
autoscale, getLength, getPaint, getStroke
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearAxis

public LinearAxis(double theStart,
                  double theEnd,
                  int theMajorDivisionCount,
                  int theMinorDivisionCount,
                  double theCrossing,
                  double theLength)
Construct a new linear axis. The axis is drawn with the default stroke (solid, width=1) and paint (black). There are no tick marks.

Parameters:
theStart - Starting value for this axis.
theEnd - Ending value for this axis. It can be greater than or less than theStart.
theMajorDivisionCount - Number of major divisions for this axis.
theMinorDivisionCount - Number of minor divisions per major division for this axis.
theCrossing - Point at which the perpendicular axis crosses this axis.
theLength - Length of this axis on the display.
Throws:
IllegalArgumentException - (unchecked exception) Thrown if theStart equals theEnd. Thrown if theMajorDivisionCount is less than 1. Thrown if theMinorDivisionCount is less than 1. Thrown if theCrossing does not fall between theStart and theEnd inclusive. Thrown if theLength is less than or equal to 0.

LinearAxis

public LinearAxis(double theStart,
                  double theEnd,
                  int theMajorDivisionCount,
                  int theMinorDivisionCount,
                  double theCrossing,
                  double theLength,
                  Stroke theStroke,
                  Paint thePaint)
Construct a new linear axis. The axis is drawn with the given stroke and paint. There are no tick marks.

Parameters:
theStart - Starting value for this axis.
theEnd - Ending value for this axis. It can be greater than or less than theStart.
theMajorDivisionCount - Number of major divisions for this axis.
theMinorDivisionCount - Number of minor divisions per major division for this axis.
theCrossing - Point at which the perpendicular axis crosses this axis.
theLength - Length of this axis on the display.
theStroke - Stroke for drawing this axis on the display.
thePaint - Paint for drawing this axis on the display.
Throws:
NullPointerException - (unchecked exception) Thrown if theStroke is null or thePaint is null.
IllegalArgumentException - (unchecked exception) Thrown if theStart equals theEnd. Thrown if theMajorDivisionCount is less than 1. Thrown if theMinorDivisionCount is less than 1. Thrown if theCrossing does not fall between theStart and theEnd inclusive. Thrown if theLength is less than or equal to 0.

LinearAxis

public LinearAxis(double theStart,
                  double theEnd,
                  int theMajorDivisionCount,
                  int theMinorDivisionCount,
                  double theCrossing,
                  double theLength,
                  Ticks theTicksBelowOrLeft,
                  Ticks theTicksAboveOrRight)
Construct a new linear axis. The axis is drawn with the default stroke (solid, width=1) and paint (black). There are tick marks on either or both sides of the axis.

Parameters:
theStart - Starting value for this axis.
theEnd - Ending value for this axis. It can be greater than or less than theStart.
theMajorDivisionCount - Number of major divisions for this axis.
theMinorDivisionCount - Number of minor divisions per major division for this axis.
theCrossing - Point at which the perpendicular axis crosses this axis.
theLength - Length of this axis on the display.
theTicksBelowOrLeft - Ticks to draw below or to the left of the axis (for a horizontal or vertical axis, respectively). If null, no ticks are drawn below or to the left.
theTicksAboveOrRight - Ticks to draw above or to the right of the axis (for a horizontal or vertical axis, respectively). If null, no ticks are drawn above or to the right.
Throws:
IllegalArgumentException - (unchecked exception) Thrown if theStart equals theEnd. Thrown if theMajorDivisionCount is less than 1. Thrown if theMinorDivisionCount is less than 1. Thrown if theCrossing does not fall between theStart and theEnd inclusive. Thrown if theLength is less than or equal to 0.

LinearAxis

public LinearAxis(double theStart,
                  double theEnd,
                  int theMajorDivisionCount,
                  int theMinorDivisionCount,
                  double theCrossing,
                  double theLength,
                  Stroke theStroke,
                  Paint thePaint,
                  Ticks theTicksBelowOrLeft,
                  Ticks theTicksAboveOrRight)
Construct a new linear axis. The axis is drawn with the given stroke and paint. There are tick marks on either or both sides of the axis.

Parameters:
theStart - Starting value for this axis.
theEnd - Ending value for this axis. It can be greater than or less than theStart.
theMajorDivisionCount - Number of major divisions for this axis.
theMinorDivisionCount - Number of minor divisions per major division for this axis.
theCrossing - Point at which the perpendicular axis crosses this axis.
theLength - Length of this axis on the display.
theStroke - Stroke for drawing this axis on the display.
thePaint - Paint for drawing this axis on the display.
theTicksBelowOrLeft - Ticks to draw below or to the left of the axis (for a horizontal or vertical axis, respectively). If null, no ticks are drawn below or to the left.
theTicksAboveOrRight - Ticks to draw above or to the right of the axis (for a horizontal or vertical axis, respectively). If null, no ticks are drawn above or to the right.
Throws:
NullPointerException - (unchecked exception) Thrown if theStroke is null or thePaint is null.
IllegalArgumentException - (unchecked exception) Thrown if theStart equals theEnd. Thrown if theMajorDivisionCount is less than 1. Thrown if theMinorDivisionCount is less than 1. Thrown if theCrossing does not fall between theStart and theEnd inclusive. Thrown if theLength is less than or equal to 0.
Method Detail

getStart

public double getStart()
Returns the starting value of this axis. The starting value is the value at the left or bottom end of the axis for a horizontal or vertical orientation, respectively.

Specified by:
getStart in class NumericalAxis

getEnd

public double getEnd()
Returns the ending value of this axis. The ending value is the value at the right or top end of the axis for a horizontal or vertical orientation, respectively. Note that the ending value may be greater than or less than the starting value.

Specified by:
getEnd in class NumericalAxis

includesValue

public boolean includesValue(double value)
Returns true if the given value falls within the bounds of this axis, false otherwise.

Specified by:
includesValue in class NumericalAxis

getDisplayDistance

public double getDisplayDistance(double value)
Returns the distance on the display from the start of this axis to the given value.

Specified by:
getDisplayDistance in class NumericalAxis

getMajorDivisionCount

public int getMajorDivisionCount()
Returns the number of major divisions on this axis.

Specified by:
getMajorDivisionCount in class NumericalAxis

getMajorDivision

public double getMajorDivision(int i)
Returns the value of the given major division.

Specified by:
getMajorDivision in class NumericalAxis
Parameters:
i - Major division index in the range 0 .. getMajorDivisionCount().

getMinorDivisionCount

public int getMinorDivisionCount()
Returns the number of minor divisions on this axis.

Specified by:
getMinorDivisionCount in class NumericalAxis

getMinorDivision

public double getMinorDivision(int i)
Returns the value of the given minor division.

Specified by:
getMinorDivision in class NumericalAxis
Parameters:
i - Minor division index in the range 0 .. getMinorDivisionCount().

getCrossing

public double getCrossing()
Returns the value of the point where the perpendicular axis crosses this axis.

Specified by:
getCrossing in class NumericalAxis


Copyright © 2005 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.