class Ed25519GroupElement implements Serializable {

  public boolean satisfiesCurveEquation() {
    switch (this.coordinateSystem) {
      case P2:
      case P3:
        final Ed25519FieldElement inverse = this.z.invert();
        final Ed25519FieldElement xElement = this.x.multiply(inverse);
        final Ed25519FieldElement yElement = this.y.multiply(inverse);
        final Ed25519FieldElement xSquare = xElement.square();
        final Ed25519FieldElement ySquare = yElement.square();
        final Ed25519FieldElement dXSquareYSquare =
            Ed25519Field.D.multiply(xSquare).multiply(ySquare);
        return Ed25519Field.ONE.add(dXSquareYSquare).add(xSquare).equals(ySquare);

      default:
        return this.toP2().satisfiesCurveEquation();
    }
  }

  public  Ed25519GroupElement(
      final CoordinateSystem coordinateSystem,
      final Ed25519FieldElement x,
      final Ed25519FieldElement y,
      final Ed25519FieldElement z,
      final Ed25519FieldElement t);

}