Copy of PropagatorBuilder

Hi all!

PropagatorBuilder has a method named copy(). In my opinion, it could be a better implementation if the PropagatorBuilder interface extends the Cloneable interface with its methode clone(). In other words, the purpose is the same, but closer to Java.

What do you think?


1 Like

Yeah, but clone() returns an Object, so it implies a cast afterwards.

Yes, but there is a workaround if the method is override inside the class implementing the interface.

public class Bunny implements Cloneable {


public Bunny clone() {
   try {
      Bunny cloned = (Bunny) super.clone();
      // clone all the attributs that are not automatically cloned
      return cloned;
    catch (CloneNotSupportedException cnse) {
        // bla bla bla

Resulting in:

Bunny newCuteBunny = bunny.clone();

I think that clone method can have a default implementation in AbstractPropagatorBuilder with specific implementations inside the classes with attributs not cloneable automatically.


I didn’t know about this trick. Nice!

Issue Openned: PropagatorBuilder shall implement Cloneable (#1378) · Issues · Orekit / Orekit · GitLab