com.sun.electric.database.geometry
Class EPoint

java.lang.Object
  extended by java.awt.geom.Point2D
      extended by com.sun.electric.database.geometry.EPoint
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public final class EPoint
extends java.awt.geom.Point2D
implements java.io.Serializable

The EPoint immutable class defines a point representing a location in (x, y) coordinate space. This class extends abstract class Point2D. This class is used in Electric database. Coordiates are snapped to grid according to DBMath.round method.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Point2D
java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Float
 
Field Summary
static EPoint ORIGIN
          EPoint with both zero coordinates.
 
Constructor Summary
EPoint(double lambdaX, double lambdaY)
          Constructs and initializes a EPoint with the specified coordinates in lambda units snapped to the grid.
 
Method Summary
static EPoint fromGrid(long gridX, long gridY)
          Returns EPoint with specified grid coordinates.
static EPoint fromLambda(double lambdaX, double lambdaY)
          Returns EPoint with specified grid coordinates.
 long getGridX()
          Returns the X coordinate of this EPoint in grid units in long precision.
 long getGridY()
          Returns the Y coordinate of this EPoint in grid units in long precision.
 double getLambdaX()
          Returns the X coordinate of this EPoint in lambda units in double precision.
 double getLambdaY()
          Returns the Y coordinate of this EPoint in lambda units in double precision.
 double getX()
          Returns the X coordinate of this EPoint in lambda units in double precision.
 double getY()
          Returns the Y coordinate of this EPoint in lambda unuts in double precision.
 double gridDistance(EPoint pt)
          Returns the distance from this EPoint to a specified EPoint in grid units.
 java.awt.geom.Point2D.Double gridMutable()
          Creates mutable Point2D.Double from the EPoint in grid units.
 boolean isSmall()
          Returns true if both coordinates of this EPoint are "small ints".
 double lambdaDistance(EPoint pt)
          Returns the distance from this EPoint to a specified EPoint in lambda units.
 java.awt.geom.Point2D.Double lambdaMutable()
          Creates mutable Point2D.Double from the EPoint in lambda units.
static void printStatistics()
          Prints statistics about EPoint objects.
 void setLocation(double x, double y)
          This method overrides Point2D.setLocation method.
static EPoint snap(java.awt.geom.Point2D p)
          Returns EPoint from specified Point2D snapped to the grid.
 java.lang.String toString()
          Returns a String that represents the value of this EPoint.
 
Methods inherited from class java.awt.geom.Point2D
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, equals, hashCode, setLocation
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ORIGIN

public static final EPoint ORIGIN
EPoint with both zero coordinates.

Constructor Detail

EPoint

public EPoint(double lambdaX,
              double lambdaY)
Constructs and initializes a EPoint with the specified coordinates in lambda units snapped to the grid.

Parameters:
lambdaX - the x-coordinate to which to set the newly constructed EPoint in lambda units.
lambdaY - the y-coordinate to which to set the newly constructed EPoint in lambda units.
Method Detail

fromLambda

public static EPoint fromLambda(double lambdaX,
                                double lambdaY)
Returns EPoint with specified grid coordinates.

Parameters:
lambdaX - the x-coordinate in lambda units.
lambdaY - the y-coordinate in lambda units.
Returns:
EPoint with specified grid coordinates.

fromGrid

public static EPoint fromGrid(long gridX,
                              long gridY)
Returns EPoint with specified grid coordinates.

Parameters:
gridX - the x-coordinate in grid units.
gridY - the y-coordinate in grid units.
Returns:
EPoint with specified grid coordinates.

snap

public static EPoint snap(java.awt.geom.Point2D p)
Returns EPoint from specified Point2D snapped to the grid.

Parameters:
p - specified Point2D
Returns:
Snapped EPoint

getX

public double getX()
Returns the X coordinate of this EPoint in lambda units in double precision.

Specified by:
getX in class java.awt.geom.Point2D
Returns:
the X coordinate of this EPoint.

getY

public double getY()
Returns the Y coordinate of this EPoint in lambda unuts in double precision.

Specified by:
getY in class java.awt.geom.Point2D
Returns:
the Y coordinate of this EPoint.

getLambdaX

public double getLambdaX()
Returns the X coordinate of this EPoint in lambda units in double precision.

Returns:
the X coordinate of this EPoint.

getLambdaY

public double getLambdaY()
Returns the Y coordinate of this EPoint in lambda units in double precision.

Returns:
the Y coordinate of this EPoint.

getGridX

public long getGridX()
Returns the X coordinate of this EPoint in grid units in long precision.

Returns:
the X coordinate of this EPoint.

getGridY

public long getGridY()
Returns the Y coordinate of this EPoint in grid units in long precision.

Returns:
the Y coordinate of this EPoint.

setLocation

public void setLocation(double x,
                        double y)
This method overrides Point2D.setLocation method. It throws UnsupportedOperationException.

Specified by:
setLocation in class java.awt.geom.Point2D
Parameters:
x - the x-coordinate to which to set this EPoint
y - the y-coordinate to which to set this EPoint
Throws:
java.lang.UnsupportedOperationException

lambdaMutable

public java.awt.geom.Point2D.Double lambdaMutable()
Creates mutable Point2D.Double from the EPoint in lambda units.

Returns:
mutable Point2D in lambda units

gridMutable

public java.awt.geom.Point2D.Double gridMutable()
Creates mutable Point2D.Double from the EPoint in grid units.

Returns:
mutable Point2D in grid units

lambdaDistance

public double lambdaDistance(EPoint pt)
Returns the distance from this EPoint to a specified EPoint in lambda units.

Parameters:
pt - the specified EPoint
Returns:
the distance between this EPoint and the specified Point in lambdaUnits.

gridDistance

public double gridDistance(EPoint pt)
Returns the distance from this EPoint to a specified EPoint in grid units.

Parameters:
pt - the specified EPoint
Returns:
the distance between this EPoint and the specified Point in gridUnits.

isSmall

public boolean isSmall()
Returns true if both coordinates of this EPoint are "small ints".

Returns:
true if both coordinates of this EPoint are "small ints".
See Also:
GenMath.MIN_SMALL_COORD, GenMath.MAX_SMALL_COORD

toString

public java.lang.String toString()
Returns a String that represents the value of this EPoint.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this EPoint.

printStatistics

public static void printStatistics()
Prints statistics about EPoint objects.