Skip to content

Commit

Permalink
style(implementationbase): annotate AbstractEnvironment's serializa…
Browse files Browse the repository at this point in the history
…tion methods and fields with `@Serialize`
  • Loading branch information
DanySK committed Aug 30, 2024
1 parent 379a2b5 commit fd8e1a9
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serial;
import java.io.Serializable;
import java.util.Iterator;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -65,6 +66,7 @@
*/
public abstract class AbstractEnvironment<T, P extends Position<P>> implements Environment<T, P> {

@Serial
private static final long serialVersionUID = 0L;
private final Map<Molecule, Layer<T, P>> layers = new LinkedHashMap<>();
private final TIntObjectHashMap<Neighborhood<T>> neighCache = new TIntObjectHashMap<>();
Expand Down Expand Up @@ -413,6 +415,7 @@ protected boolean nodeShouldBeAdded(final Node<T> node, final P p) {
return true;
}

@Serial
private void readObject(final ObjectInputStream in) throws ClassNotFoundException, IOException {
in.defaultReadObject();
final String name = in.readObject().toString();
Expand Down Expand Up @@ -583,6 +586,7 @@ protected final void updateNeighborhood(final Node<T> node, final boolean isNewN
}
}

@Serial
private void writeObject(final ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(incarnation.getClass().getSimpleName());
Expand Down

0 comments on commit fd8e1a9

Please sign in to comment.