diff --git a/libs/model/src/main/java/de/cyface/model/CalibrationJob.java b/libs/model/src/main/java/de/cyface/model/CalibrationJob.java deleted file mode 100644 index 1c7f95c..0000000 --- a/libs/model/src/main/java/de/cyface/model/CalibrationJob.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2022-2023 Cyface GmbH - * - * This file is part of the Serialization. - * - * The Serialization is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Serialization is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the Serialization. If not, see . - */ -package de.cyface.model; - -import java.util.UUID; - -/** - * A {@link Job} which contains details about filtered data during calibration. - * - * @author Armin Schnabel - * @version 2.0.0 - * @since 2.3.1 - */ -@SuppressWarnings("unused") // Part of the API -public class CalibrationJob extends Job { - - /** - * {@code true} when the measurement contains processable tracks. - */ - private boolean processable; - /** - * The number of locations to be processed for this job. - */ - private final int totalLocations; - /** - * The number of locations which were filtered due to a rotated device. - */ - private int rotatedLocations = 0; - /** - * The number of locations which were filtered during interpolation. - */ - private int nonInterpolatableLocations = 0; - - /** - * Constructs a fully initialized instance of this class. - * - * @param id The id of the job to update about the status and progress of the processing. - * @param startedBy The id of the user who triggered the pipeline and will own the result data. - * @param processable {@code true} when the measurement contains processable tracks. - * @param totalLocations The number of locations to be processed for this job. - */ - public CalibrationJob(final String id, final UUID startedBy, final boolean processable, - final int totalLocations) { - super(id, startedBy); - this.processable = processable; - this.totalLocations = totalLocations; - } - - /** - * Constructs a fully initialized instance of this class. - * - * @param job The job which is processed. - * @param processable {@code true} when the measurement contains processable tracks. - * @param totalLocations The number of locations to be processed for this job. - */ - public CalibrationJob(final Job job, final boolean processable, final int totalLocations) { - super(job.getId(), job.getStartedBy()); - this.processable = processable; - this.totalLocations = totalLocations; - } - - /** - * @return {@code true} when the measurement contains processable tracks. - */ - @SuppressWarnings("unused") // Part of the API - public boolean isProcessable() { - return processable; - } - - /** - * @return The number of tracks which were filtered due to a rotated device. - */ - @SuppressWarnings("unused") // Part of the API - public int getRotatedLocations() { - return rotatedLocations; - } - - /** - * @return The number of locations which were filtered during interpolation. - */ - public int getNonInterpolatableLocations() { - return nonInterpolatableLocations; - } - - /** - * @return The number of locations to be processed for this job. - */ - public int getTotalLocations() { - return totalLocations; - } - - /** - * @param rotatedLocations The number of tracks which were filtered due to a rotated device. - * @return This for chaining. - */ - @SuppressWarnings("unused") // Part of the API - public CalibrationJob setRotatedLocations(final int rotatedLocations) { - this.rotatedLocations = rotatedLocations; - return this; - } - - /** - * @param nonInterpolatableLocations The number of locations which were filtered during interpolation. - * @return This for chaining. - */ - public CalibrationJob setNonInterpolatableLocations(int nonInterpolatableLocations) { - this.nonInterpolatableLocations = nonInterpolatableLocations; - return this; - } - - /** - * @param processable {@code true} when the measurement contains processable tracks. - * @return This for chaining. - */ - @SuppressWarnings("unused") // Part of the API - public CalibrationJob setProcessable(boolean processable) { - this.processable = processable; - return this; - } -} diff --git a/libs/model/src/main/kotlin/de/cyface/model/CalibrationJob.kt b/libs/model/src/main/kotlin/de/cyface/model/CalibrationJob.kt new file mode 100644 index 0000000..46efbe1 --- /dev/null +++ b/libs/model/src/main/kotlin/de/cyface/model/CalibrationJob.kt @@ -0,0 +1,110 @@ +/* + * Copyright 2022-2023 Cyface GmbH + * + * This file is part of the Serialization. + * + * The Serialization is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Serialization is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with the Serialization. If not, see . + */ +package de.cyface.model + +import java.util.UUID + +/** + * A [Job] which contains details about filtered data during calibration. + * + * @author Armin Schnabel + * @version 2.0.1 + * @since 2.3.1 + */ +@Suppress("unused") // Part of the API +class CalibrationJob : Job { + /** + * `true` when the measurement contains processable tracks. + */ + var isProcessable: Boolean + private set + + /** + * The number of locations to be processed for this job. + */ + @Suppress("MemberVisibilityCanBePrivate") // Part of the API + val totalLocations: Int + + /** + * The number of locations which were filtered due to a rotated device. + */ + var rotatedLocations = 0 + private set + + /** + * The number of locations which were filtered during interpolation. + */ + var nonInterpolatableLocations = 0 + private set + + /** + * Constructs a fully initialized instance of this class. + * + * @param id The id of the job to update about the status and progress of the processing. + * @param startedBy The id of the user who triggered the pipeline and will own the result data. + * @param processable `true` when the measurement contains processable tracks. + * @param totalLocations The number of locations to be processed for this job. + */ + constructor( + id: String?, startedBy: UUID?, processable: Boolean, + totalLocations: Int + ) : super(id, startedBy) { + isProcessable = processable + this.totalLocations = totalLocations + } + + /** + * Constructs a fully initialized instance of this class. + * + * @param job The job which is processed. + * @param processable `true` when the measurement contains processable tracks. + * @param totalLocations The number of locations to be processed for this job. + */ + constructor(job: Job, processable: Boolean, totalLocations: Int) : super(job.id, job.startedBy) { + isProcessable = processable + this.totalLocations = totalLocations + } + + /** + * @param rotatedLocations The number of tracks which were filtered due to a rotated device. + * @return This for chaining. + */ + fun setRotatedLocations(rotatedLocations: Int): CalibrationJob { + this.rotatedLocations = rotatedLocations + return this + } + + /** + * @param nonInterpolatableLocations The number of locations which were filtered during interpolation. + * @return This for chaining. + */ + fun setNonInterpolatableLocations(nonInterpolatableLocations: Int): CalibrationJob { + this.nonInterpolatableLocations = nonInterpolatableLocations + return this + } + + /** + * @param processable `true` when the measurement contains processable tracks. + * @return This for chaining. + */ + fun setProcessable(processable: Boolean): CalibrationJob { + isProcessable = processable + return this + } +} \ No newline at end of file diff --git a/libs/model/src/main/kotlin/de/cyface/model/Track.kt b/libs/model/src/main/kotlin/de/cyface/model/Track.kt index df38bff..be61ef8 100644 --- a/libs/model/src/main/kotlin/de/cyface/model/Track.kt +++ b/libs/model/src/main/kotlin/de/cyface/model/Track.kt @@ -173,6 +173,7 @@ class Track : Serializable { * @param location The location to remove. * @return This track for method chaining. */ + @Suppress("unused") // Part of the API fun clearFor(location: RawRecord): Track { // Find the index of the location to remove val locationIndex = locationRecords.indexOf(location)