All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class convexHull.ConvexHull

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----convexHull.ConvexHull

public class ConvexHull
extends Applet
implements ActionListener, ItemListener
This class implements a user interface (both for main() and Applet) to test the code for convex hull algorithm.


Variable Index

 o canvas
 o clearButton
 o hull
 o hullCheckbox
 o maxx
 o maxy
 o MIND
 o minx
 o miny
 o points
 o quitButton
 o running_as_applet
 o stairs
 o stairsCheckbox

Constructor Index

 o ConvexHull()
initializes empty data-structures

Method Index

 o actionPerformed(ActionEvent)
Handles button events.
 o addPoint(CPoint)
adds a new point to points[]
 o getAppletInfo()
Gets the applet information.
 o getNum(StreamTokenizer)
Gets a floating point number from the stream.
 o init()
Initializes the user interface for the applet
 o itemStateChanged(ItemEvent)
Handles checkbox events.
 o main(String[])
main entrypoint - starts the part when it is run as an application
 o readData(String)
Read points from a data file.
 o runMain(String[])

Variables

 o points
 protected Vector points
 o hull
 protected Vector hull
 o stairs
 protected Vector stairs
 o canvas
 protected Canvas canvas
 o quitButton
 protected Button quitButton
 o clearButton
 protected Button clearButton
 o hullCheckbox
 protected Checkbox hullCheckbox
 o stairsCheckbox
 protected Checkbox stairsCheckbox
 o minx
 protected float minx
 o miny
 protected float miny
 o maxx
 protected float maxx
 o maxy
 protected float maxy
 o MIND
 private static final float MIND
 o running_as_applet
 private static boolean running_as_applet

Constructors

 o ConvexHull
 public ConvexHull()
initializes empty data-structures

Methods

 o actionPerformed
 public void actionPerformed(ActionEvent e)
Handles button events. quit button --> exit the program clear button --> erase the points and the convex hull, then redraw the screen

 o itemStateChanged
 public void itemStateChanged(ItemEvent e)
Handles checkbox events.

 o addPoint
 protected void addPoint(CPoint p)
adds a new point to points[]

 o getAppletInfo
 public String getAppletInfo()
Gets the applet information.

Returns:
java.lang.String
Overrides:
getAppletInfo in class Applet
 o getNum
 private float getNum(StreamTokenizer st) throws EOFException, IOException
Gets a floating point number from the stream.

Parameters:
st - StreamTokenizer
Returns:
floating point number (next on the input)
 o readData
 public boolean readData(String fname)
Read points from a data file.

Parameters:
fname - name of the file to read the data from
Returns:
boolean true = error occurd, false = no errors
 o init
 public void init()
Initializes the user interface for the applet

Overrides:
init in class Applet
 o main
 public static void main(String args[])
main entrypoint - starts the part when it is run as an application

Parameters:
args - java.lang.String[]
 o runMain
 public void runMain(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index