Skip to content

Commit

Permalink
fix(serialization): Made LidarUpdates serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
FunKuchen committed Dec 3, 2024
1 parent d9ca5e5 commit ca9f4e3
Showing 1 changed file with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

public class LidarUpdates extends Interaction {
public class LidarUpdates extends Interaction implements Serializable {

public record LidarUpdate(String unitId, PointCloud pointCloud) {}
public record LidarUpdate(String unitId, PointCloud pointCloud) implements Serializable {}

private static final long serialVersionUID = 1L;

Expand All @@ -38,15 +39,10 @@ public record LidarUpdate(String unitId, PointCloud pointCloud) {}
*/
public final static String TYPE_ID = createTypeIdentifier(LidarUpdates.class);

/**
* Time at which the next sensor update will be sent.
*/
private long nextUpdate;

/**
* List of {@link PointCloud} containing LiDAR data from the simulator.
*/
List<LidarUpdate> updated;
private List<LidarUpdate> updated;

public LidarUpdates(long time, List<LidarUpdate> updated) {
super(time);
Expand All @@ -57,14 +53,9 @@ public List<LidarUpdate> getUpdated() {
return this.updated;
}

public void setNextUpdate(long nextUpdate) {
this.nextUpdate = nextUpdate;
}

@Override
public int hashCode() {
return new HashCodeBuilder(5, 17)
.append(nextUpdate)
.append(updated)
.toHashCode();
}
Expand All @@ -83,7 +74,6 @@ public boolean equals(Object obj) {

LidarUpdates other = (LidarUpdates) obj;
return new EqualsBuilder()
.append(this.nextUpdate, other.nextUpdate)
.append(this.updated, other.updated)
.isEquals();
}
Expand Down

0 comments on commit ca9f4e3

Please sign in to comment.