Commit a688eae9 authored by Jakob Schöttl's avatar Jakob Schöttl

Add comment on cloning attributes

parent 15bcf188
...@@ -15,6 +15,11 @@ package org.vadere.state.attributes; ...@@ -15,6 +15,11 @@ package org.vadere.state.attributes;
* these objects. All other fields must be immutable (e.g. String, Double, * these objects. All other fields must be immutable (e.g. String, Double,
* VPoint,...). * VPoint,...).
* *
* The standard clone method makes a flat copy. This is enough if the subclass
* only contains immutable fields. If the subclass contains other Attributes
* objects, it must implement a copy constructor and override {@link #clone()}
* to make a deep copy.
*
*/ */
public abstract class Attributes extends DefaultSealable implements Cloneable { public abstract class Attributes extends DefaultSealable implements Cloneable {
/** Used for default ID values of some scenario elements. */ /** Used for default ID values of some scenario elements. */
...@@ -23,8 +28,8 @@ public abstract class Attributes extends DefaultSealable implements Cloneable { ...@@ -23,8 +28,8 @@ public abstract class Attributes extends DefaultSealable implements Cloneable {
public Attributes() {} public Attributes() {}
/** /**
* Standard shallow clone of attributes. The shallow clone is sufficient * Standard flat copy of attributes. The flat copy is only sufficient (as
* because (as noted above) all fields must be immutable anyway. * noted above) if all fields are immutable.
*/ */
@Override @Override
public Attributes clone() { public Attributes clone() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment