class Ed25519GroupElement implements Serializable {

  public Ed25519GroupElement dbl() {
    switch (this.coordinateSystem) {
      case P2:
      case P3:
        final Ed25519FieldElement xSquare;
        final Ed25519FieldElement ySquare;
        final Ed25519FieldElement b;
        final Ed25519FieldElement a;
        final Ed25519FieldElement aSquare;
        final Ed25519FieldElement ySquarePlusXSquare;
        final Ed25519FieldElement ySquareMinusXSquare;
        xSquare = this.x.square();
        ySquare = this.y.square();
        b = this.z.squareAndDouble();
        a = this.x.add(this.y);
        aSquare = a.square();
        ySquarePlusXSquare = ySquare.add(xSquare);
        ySquareMinusXSquare = ySquare.subtract(xSquare);
        return p1xp1(
            aSquare.subtract(ySquarePlusXSquare),
            ySquarePlusXSquare,
            ySquareMinusXSquare,
            b.subtract(ySquareMinusXSquare));
      default:
        throw new UnsupportedOperationException();
    }
  }

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

}