Algorithm
Development Kit 1.0

algs.model.problems.convexhull.andrew
Class PartialLinkedListHull

java.lang.Object
  extended by algs.model.problems.convexhull.andrew.PartialLinkedListHull

public class PartialLinkedListHull
extends java.lang.Object

Represents either the top or the bottom of a Convex Hull.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Constructor Summary
PartialLinkedListHull(IPoint first, IPoint second)
          Construct the initial partial hull.
 
Method Summary
 void add(IPoint p)
          Add point to the Partial Hull.
 boolean areLastThreeNonRight()
          Determines if last three points reflect a right turn.
 boolean hasThree()
          Determine if there are more than 2 points currently in the partial hull.
 DoubleLinkedList<IPoint> points()
          Return the points in this Partial Hull.
 boolean removeMiddleOfLastThree()
          Returns middle of last three.
 int size()
          Helper function to report number of points in the hull.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PartialLinkedListHull

public PartialLinkedListHull(IPoint first,
                             IPoint second)
Construct the initial partial hull.

Parameters:
first - Left-most point (for upper) and right-most (for lower)
second - Next one in sorted order, as the next assumed point in the hull.
Method Detail

add

public void add(IPoint p)
Add point to the Partial Hull.


removeMiddleOfLastThree

public boolean removeMiddleOfLastThree()
Returns middle of last three. Returns true on success; false otherwise.


hasThree

public boolean hasThree()
Determine if there are more than 2 points currently in the partial hull.


size

public int size()
Helper function to report number of points in the hull.


points

public DoubleLinkedList<IPoint> points()
Return the points in this Partial Hull.


areLastThreeNonRight

public boolean areLastThreeNonRight()
Determines if last three points reflect a right turn. If hasThree() is false, then this returns false.


Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.