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.
-
canvas
-
-
clearButton
-
-
hull
-
-
hullCheckbox
-
-
maxx
-
-
maxy
-
-
MIND
-
-
minx
-
-
miny
-
-
points
-
-
quitButton
-
-
running_as_applet
-
-
stairs
-
-
stairsCheckbox
-
-
ConvexHull()
-
initializes empty data-structures
-
actionPerformed(ActionEvent)
- Handles button events.
-
addPoint(CPoint)
- adds a new point to points[]
-
getAppletInfo()
- Gets the applet information.
-
getNum(StreamTokenizer)
- Gets a floating point number from the stream.
-
init()
- Initializes the user interface for the applet
-
itemStateChanged(ItemEvent)
- Handles checkbox events.
-
main(String[])
- main entrypoint - starts the part when it is run as an application
-
readData(String)
- Read points from a data file.
-
runMain(String[])
-
points
protected Vector points
hull
protected Vector hull
stairs
protected Vector stairs
canvas
protected Canvas canvas
quitButton
protected Button quitButton
clearButton
protected Button clearButton
hullCheckbox
protected Checkbox hullCheckbox
stairsCheckbox
protected Checkbox stairsCheckbox
minx
protected float minx
miny
protected float miny
maxx
protected float maxx
maxy
protected float maxy
MIND
private static final float MIND
running_as_applet
private static boolean running_as_applet
ConvexHull
public ConvexHull()
- initializes empty data-structures
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
itemStateChanged
public void itemStateChanged(ItemEvent e)
- Handles checkbox events.
addPoint
protected void addPoint(CPoint p)
- adds a new point to points[]
getAppletInfo
public String getAppletInfo()
- Gets the applet information.
- Returns:
- java.lang.String
- Overrides:
- getAppletInfo in class Applet
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)
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
init
public void init()
- Initializes the user interface for the applet
- Overrides:
- init in class Applet
main
public static void main(String args[])
- main entrypoint - starts the part when it is run as an application
- Parameters:
- args - java.lang.String[]
runMain
public void runMain(String args[])
All Packages Class Hierarchy This Package Previous Next Index