uk.ac.leeds.ccg.andyt.gws.utilities
Class Utilities

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.gws.utilities.Utilities

public class Utilities
extends java.lang.Object

TODO: docs


Constructor Summary
Utilities()
          Creates a new instance of Utilities
 
Method Summary
static java.util.HashSet getInDistancePointIDs(java.util.HashSet pointIDs, java.awt.geom.Point2D.Double[] points, java.awt.geom.Point2D.Double point, double distance)
          Returns as a HashSet the IDs of points that are in distance of point.
static java.util.HashSet getInDistancePointIDs(java.util.HashSet pointIDs, Point2DBigDecimal[] points, Point2DBigDecimal point, double distance, int decimalPlaces)
          Returns as a HashSet the IDs of points that are in distance of point.
static java.util.HashSet getInDistancePointIDs(java.awt.geom.Point2D.Double[] points, java.awt.geom.Point2D.Double point, double distance)
          Returns the IDs of points that are in distance of point as a HashSet.
static java.util.HashSet getInDistancePointIDs(Point2DBigDecimal[] points, Point2DBigDecimal point, java.math.BigDecimal distance, int decimalPlaces)
          Returns the IDs of points that are in distance of point as a HashSet.
static java.util.HashSet getPointsIntersected(java.util.HashSet pointIDs, java.awt.geom.Point2D.Double[] points, java.math.BigDecimal[] dimensions)
          Returns as a HashSet the IDs of points that intersect dimensions.
static java.util.HashSet getPointsIntersected(java.util.HashSet pointIDs, Point2DBigDecimal[] points, java.math.BigDecimal[] dimensions)
          Returns as a HashSet the IDs of points that intersect dimensions.
static java.util.HashSet getPointsIntersected(java.awt.geom.Point2D.Double[] points, java.math.BigDecimal[] dimensions)
          Returns as a HashSet the IDs of points that intersect dimensions.
static java.util.HashSet getPointsIntersected(Point2DBigDecimal[] points, java.math.BigDecimal[] dimensions)
          Returns as a HashSet the IDs of points that intersect dimensions.
static boolean isPointContained(Point2DBigDecimal point, java.math.BigDecimal[] dimensions)
          Returns true iff point is contained in dimensions as in: point.x > xmin, point.y > ymin, point.x < xmax, point.y < ymax
static boolean isPointIn(Point2DBigDecimal point, java.math.BigDecimal[] dimensions)
          Returns true iff point is contained in dimensions as in: point.x >= xmin, point.y >= ymin, point.x < xmax, point.y < ymax
static boolean isPointIntersected(java.awt.geom.Point2D.Double point, java.math.BigDecimal[] dimensions)
          Returns true iff point is contained in dimensions as in: point.x >= xmin, point.y >= ymin, point.x <= xmax, point.y <= ymax
static boolean isPointIntersected(Point2DBigDecimal point, java.math.BigDecimal[] dimensions)
          Returns true iff point is contained in dimensions as in: point.x >= xmin, point.y >= ymin, point.x <= xmax, point.y <= ymax
static java.awt.geom.Point2D.Double[] loadData(java.io.File inputFile)
          Returns a Point2D.Double[] of points loaded from inputFile.
static java.awt.geom.Point2D.Double[] loadData(java.io.File inputFile, java.math.BigDecimal[] dimensions)
          Returns a Point2D.Double[] of points loaded from inputFile that are in bounds given by dimensions.
static java.awt.geom.Point2D.Double[] loadData(java.io.File inputFile, double xmin, double ymin, double xmax, double ymax)
          Returns a Point2D.Double[] of points loaded from inputFile that are in bounds given by xmin, ymin, xmax, ymax
static java.awt.geom.Point2D.Double[] loadData(java.awt.geom.Point2D.Double[] pointsToAddTo, java.io.File inputFile)
          Returns a Point2D.Double[] of points loaded from inputFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utilities

public Utilities()
Creates a new instance of Utilities

Method Detail

loadData

public static java.awt.geom.Point2D.Double[] loadData(java.io.File inputFile)
Returns a Point2D.Double[] of points loaded from inputFile.

Parameters:
inputFile -

loadData

public static java.awt.geom.Point2D.Double[] loadData(java.awt.geom.Point2D.Double[] pointsToAddTo,
                                                      java.io.File inputFile)
Returns a Point2D.Double[] of points loaded from inputFile


loadData

public static java.awt.geom.Point2D.Double[] loadData(java.io.File inputFile,
                                                      double xmin,
                                                      double ymin,
                                                      double xmax,
                                                      double ymax)
Returns a Point2D.Double[] of points loaded from inputFile that are in bounds given by xmin, ymin, xmax, ymax


loadData

public static java.awt.geom.Point2D.Double[] loadData(java.io.File inputFile,
                                                      java.math.BigDecimal[] dimensions)
Returns a Point2D.Double[] of points loaded from inputFile that are in bounds given by dimensions.

Parameters:
inputFile -
dimensions - TODO: This can be improved by reading data into BigDecimal Point2DBigDecimal[] and using BigDecimal.compareTo();

getInDistancePointIDs

public static java.util.HashSet getInDistancePointIDs(java.awt.geom.Point2D.Double[] points,
                                                      java.awt.geom.Point2D.Double point,
                                                      double distance)
Returns the IDs of points that are in distance of point as a HashSet. The IDs are the positions in the array points given as Integers.


getInDistancePointIDs

public static java.util.HashSet getInDistancePointIDs(Point2DBigDecimal[] points,
                                                      Point2DBigDecimal point,
                                                      java.math.BigDecimal distance,
                                                      int decimalPlaces)
Returns the IDs of points that are in distance of point as a HashSet. The IDs are the positions in the array points given as Integers.


getInDistancePointIDs

public static java.util.HashSet getInDistancePointIDs(java.util.HashSet pointIDs,
                                                      java.awt.geom.Point2D.Double[] points,
                                                      java.awt.geom.Point2D.Double point,
                                                      double distance)
Returns as a HashSet the IDs of points that are in distance of point. Only those IDs in IDsHashSet need be tested. It is assumed that all IDs in IDsHashSet are greater than 0 and less than points.length. The IDs are the positions in the array points given as Integers.


getInDistancePointIDs

public static java.util.HashSet getInDistancePointIDs(java.util.HashSet pointIDs,
                                                      Point2DBigDecimal[] points,
                                                      Point2DBigDecimal point,
                                                      double distance,
                                                      int decimalPlaces)
Returns as a HashSet the IDs of points that are in distance of point. Only those IDs in IDsHashSet need be tested. It is assumed that all IDs in IDsHashSet are greater than 0 and less than points.length. The IDs are the positions in the array points given as Integers.


getPointsIntersected

public static java.util.HashSet getPointsIntersected(Point2DBigDecimal[] points,
                                                     java.math.BigDecimal[] dimensions)
Returns as a HashSet the IDs of points that intersect dimensions.

Parameters:
points -
dimensions - The dimensions used: dimensions[ 0 ] is reserved. This is because it stores cellsize in Grid2DSquareCellAbstract.dimensions. (N.B. developer: It might be worth using it here as a parameter to extend the box tested for point intersection.) dimensions[ 1 ] = xmin ( left-most coordinate of box ). dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). dimensions[ 3 ] = xmax ( right-most coordinate of box ). dimensions[ 4 ] = ymax ( top-most coordinate of box ).

getPointsIntersected

public static java.util.HashSet getPointsIntersected(java.awt.geom.Point2D.Double[] points,
                                                     java.math.BigDecimal[] dimensions)
Returns as a HashSet the IDs of points that intersect dimensions.

Parameters:
points -
dimensions - The dimensions used: dimensions[ 0 ] is reserved. This is because it stores cellsize in Grid2DSquareCellAbstract.dimensions. (N.B. developer: It might be worth using it here as a parameter to extend the box tested for point intersection.) dimensions[ 1 ] = xmin ( left-most coordinate of box ). dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). dimensions[ 3 ] = xmax ( right-most coordinate of box ). dimensions[ 4 ] = ymax ( top-most coordinate of box ).

getPointsIntersected

public static java.util.HashSet getPointsIntersected(java.util.HashSet pointIDs,
                                                     java.awt.geom.Point2D.Double[] points,
                                                     java.math.BigDecimal[] dimensions)
Returns as a HashSet the IDs of points that intersect dimensions. Only those points with IDs in pointIDs need be tested. It is assumed that all IDs in IDsHashSet are greater than 0 and less than points.length. The IDs are the positions in the array points given as Integers.

Parameters:
pointIDs -
points -
dimensions - The dimensions used: dimensions[ 0 ] is reserved. This is because it stores cellsize in Grid2DSquareCellAbstract.dimensions. (N.B. developer: It might be worth using it here as a parameter to extend the box tested for point intersection.) dimensions[ 1 ] = xmin ( left-most coordinate of box ). dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). dimensions[ 3 ] = xmax ( right-most coordinate of box ). dimensions[ 4 ] = ymax ( top-most coordinate of box ).

getPointsIntersected

public static java.util.HashSet getPointsIntersected(java.util.HashSet pointIDs,
                                                     Point2DBigDecimal[] points,
                                                     java.math.BigDecimal[] dimensions)
Returns as a HashSet the IDs of points that intersect dimensions. Only those points with IDs in pointIDs need be tested. It is assumed that all IDs in IDsHashSet are greater than 0 and less than points.length. The IDs are the positions in the array points given as Integers.

Parameters:
pointIDs -
points -
dimensions - The dimensions used: dimensions[ 0 ] is reserved. This is because it stores cellsize in Grid2DSquareCellAbstract.dimensions. (N.B. developer: It might be worth using it here as a parameter to extend the box tested for point intersection.) dimensions[ 1 ] = xmin ( left-most coordinate of box ). dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). dimensions[ 3 ] = xmax ( right-most coordinate of box ). dimensions[ 4 ] = ymax ( top-most coordinate of box ).

isPointContained

public static boolean isPointContained(Point2DBigDecimal point,
                                       java.math.BigDecimal[] dimensions)
Returns true iff point is contained in dimensions as in: point.x > xmin, point.y > ymin, point.x < xmax, point.y < ymax

Parameters:
point - the Point2DBigDecimal to be tested for intersection
dimensions - The dimensions tested: dimensions[ 0 ] is reserved. This is because it stores cellsize in Grid2DSquareCellAbstract.dimensions. (N.B. developer: It might be worth using it here as a parameter to extend the box tested for point intersection.) dimensions[ 1 ] = xmin ( left-most coordinate of box ). dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). dimensions[ 3 ] = xmax ( right-most coordinate of box ). dimensions[ 4 ] = ymax ( top-most coordinate of box ).

isPointIntersected

public static boolean isPointIntersected(Point2DBigDecimal point,
                                         java.math.BigDecimal[] dimensions)
Returns true iff point is contained in dimensions as in: point.x >= xmin, point.y >= ymin, point.x <= xmax, point.y <= ymax

Parameters:
point - the Point2DBigDecimal to be tested for intersection
dimensions - The dimensions tested: dimensions[ 0 ] is reserved. This is because it stores cellsize in Grid2DSquareCellAbstract.dimensions. (N.B. developer: It might be worth using it here as a parameter to extend the box tested for point intersection.) dimensions[ 1 ] = xmin ( left-most coordinate of box ). dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). dimensions[ 3 ] = xmax ( right-most coordinate of box ). dimensions[ 4 ] = ymax ( top-most coordinate of box ).

isPointIntersected

public static boolean isPointIntersected(java.awt.geom.Point2D.Double point,
                                         java.math.BigDecimal[] dimensions)
Returns true iff point is contained in dimensions as in: point.x >= xmin, point.y >= ymin, point.x <= xmax, point.y <= ymax

Parameters:
point - the Point2DBigDecimal to be tested for intersection
dimensions - The dimensions tested: dimensions[ 0 ] is reserved. This is because it stores cellsize in Grid2DSquareCellAbstract.dimensions. (N.B. developer: It might be worth using it here as a parameter to extend the box tested for point intersection.) dimensions[ 1 ] = xmin ( left-most coordinate of box ). dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). dimensions[ 3 ] = xmax ( right-most coordinate of box ). dimensions[ 4 ] = ymax ( top-most coordinate of box ).

isPointIn

public static boolean isPointIn(Point2DBigDecimal point,
                                java.math.BigDecimal[] dimensions)
Returns true iff point is contained in dimensions as in: point.x >= xmin, point.y >= ymin, point.x < xmax, point.y < ymax

Parameters:
point - the Point2DBigDecimal to be tested for intersection
dimensions - The dimensions tested: dimensions[ 0 ] is reserved. This is because it stores cellsize in Grid2DSquareCellAbstract.dimensions. (N.B. developer: It might be worth using it here as a parameter to extend the box tested for point intersection.) dimensions[ 1 ] = xmin ( left-most coordinate of box ). dimensions[ 2 ] = ymin ( bottom-most coordinate of box ). dimensions[ 3 ] = xmax ( right-most coordinate of box ). dimensions[ 4 ] = ymax ( top-most coordinate of box ).