# Class PlotExample

java.lang.Object
uk.ac.starlink.ttools.build.PlotExample

public class PlotExample extends Object
Programmatically generates example text and images for STILTS plotting tasks. Used in generating the documentation.

Since:
  9 Oct 2008
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`PlotExample(String name, String taskName, String[] params, String[] comments)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static PlotExample[]`
`createPlot2dExamples()`
Returns a list of examples for the plot2d task.
`static PlotExample[]`
`createPlot3dExamples()`
Returns a list of examples for the plot3d task.
`static PlotExample[]`
`createPlotHistExamples()`
Returns a list of examples for the plothist task.
`static void`
`main(String[] args)`
Writes example files ready for incorporation into documentation.
`String`
`writeImage()`
Generates and outputs the image file showing the result of this example.
`void`
`writeXml(PrintStream out)`
Outputs the XML for this example as a <dt><dd> element pair.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PlotExample

public PlotExample(String name, String taskName, String[] params, String[] comments) throws uk.ac.starlink.task.TaskException, uk.ac.starlink.util.LoadException
Constructor.

Parameters:
  `name` - example name
  `taskName` - name of the STILTS task being used
  `params` - array of name=value pairs giving parameters; a null in the list signifies line break for formatting
  `comments` - array of lines consituting the example description; concatenated must form one or more XML <p> elements
Throws:
  `uk.ac.starlink.task.TaskException`
  `uk.ac.starlink.util.LoadException`

## Method Details

### writeXml

public void writeXml(PrintStream out) throws IOException
Outputs the XML for this example as a <dt><dd> element pair.

Parameters:
  `out` - destination stream
Throws:
  `IOException`

### writeImage

public String writeImage() throws IOException, uk.ac.starlink.task.TaskException
Generates and outputs the image file showing the result of this example.

Returns:
  name of the written file in the current directory
Throws:
  `IOException`
  `uk.ac.starlink.task.TaskException`

### createPlot2dExamples

public static PlotExample[] createPlot2dExamples() throws uk.ac.starlink.task.TaskException, uk.ac.starlink.util.LoadException
Returns a list of examples for the plot2d task.

Returns:
  example array
Throws:
  `uk.ac.starlink.task.TaskException`
  `uk.ac.starlink.util.LoadException`

### createPlot3dExamples

public static PlotExample[] createPlot3dExamples() throws uk.ac.starlink.task.TaskException, uk.ac.starlink.util.LoadException
Returns a list of examples for the plot3d task.

Returns:
  example array
Throws:
  `uk.ac.starlink.task.TaskException`
  `uk.ac.starlink.util.LoadException`

### createPlotHistExamples

public static PlotExample[] createPlotHistExamples() throws uk.ac.starlink.task.TaskException, uk.ac.starlink.util.LoadException
Returns a list of examples for the plothist task.

Returns:
  example array
Throws:
  `uk.ac.starlink.task.TaskException`
  `uk.ac.starlink.util.LoadException`

### main

public static void main(String[] args) throws Exception
Writes example files ready for incorporation into documentation.

Throws:
  `Exception`