FileDocCategorySizeDatePackage
ECPoint.javaAPI DocAndroid 1.5 API3842Wed May 06 22:41:06 BST 2009java.security.spec

ECPoint

public class ECPoint extends Object
A Point on an Elliptic Curve in barycentric (or affine) coordinates.
since
Android 1.0

Fields Summary
public static final ECPoint
POINT_INFINITY
The point on an Elliptic Curve at infinity.
private final BigInteger
affineX
private final BigInteger
affineY
Constructors Summary
private ECPoint()


    // Private ctor for POINT_INFINITY
      
        affineX = null;
        affineY = null;
    
public ECPoint(BigInteger affineX, BigInteger affineY)
Creates a new point at the specified coordinates.

param
affineX the x-coordinate.
param
affineY the y-coordinate.
since
Android 1.0

        this.affineX = affineX;
        if (this.affineX == null) {
            throw new NullPointerException(Messages.getString("security.83", "X")); //$NON-NLS-1$ //$NON-NLS-2$
        }
        this.affineY = affineY;
        if (this.affineY == null) {
            throw new NullPointerException(Messages.getString("security.83", "Y")); //$NON-NLS-1$ //$NON-NLS-2$
        }
    
Methods Summary
public booleanequals(java.lang.Object other)
Returns whether the specified object and this elliptic curve point are equal.

param
other the object to compare.
return
{@code true} if the specified object and this elliptic curve point are equal, otherwise {@code false}.
since
Android 1.0

        if (this == other) {
            return true;
        }
        if (other instanceof ECPoint) {
            if (this.affineX != null) {
                ECPoint otherPoint = (ECPoint)other;
                // no need to check for null in this case
                return this.affineX.equals(otherPoint.affineX) &&
                       this.affineY.equals(otherPoint.affineY);
            } else {
                return other == POINT_INFINITY;
            }
        }
        return false;
    
public java.math.BigIntegergetAffineX()
Returns the x-coordinate.

return
the x-coordinate, or {@code null} for the infinite point.
since
Android 1.0

        return affineX;
    
public java.math.BigIntegergetAffineY()
Returns the y-coordinate.

return
the y-coordinate, or {@code null} fot the infinite point.
since
Android 1.0

        return affineY;
    
public inthashCode()
Returns the hashcode of this elliptic curve point.

return
the hashcode of this elliptic curve point.
since
Android 1.0

        if (this.affineX != null) {
            return affineX.hashCode() * 31 + affineY.hashCode();
        }
        return 11;