Repository navigation
ExplicitGaps
Up | Previous | Next | Русский
Below is the full source of the class in documentation form. The comments inside the block explain the purpose of the parts of the class, but they are not stored in the working file ExplicitGaps.java: the production code stays clean and the explanations live in the wiki.
package com.velitask.plugin.official.processing.gaps;
import com.velitask.sdk.data.SensorAtom;
import com.velitask.sdk.scenario.GapInput;
import com.velitask.sdk.scenario.GapsStep;
import com.velitask.sdk.scenario.IStepControl;
/* Formula "Pauses from the file": looks for no pauses of its own, keeps only those recorded by the device. */
public final class ExplicitGaps extends GapsStep<SensorAtom> {
/* Stable step name; localization keys Plugin.ImportStep.explicitGaps.* */
public static final String NAME = "explicitGaps";
public ExplicitGaps() {
super(NAME, 1, SensorAtom.class);
}
@Override
/* No pause is set after any atom; the pauses from the file are added by the GapsStep base class. */
protected boolean[] detect(GapInput<SensorAtom> input, IStepControl control) {
return new boolean[input.atoms().length];
}
}ExplicitGaps is the "Pauses from the file" formula (explicitGaps): it keeps only the pauses recorded by the device itself (pause button, auto-pause, the start of a new recording segment) and looks for no new ones. It is the most common formula in the built-in scenarios: it covers most FIT, GoPro, DJI and GPX sensors, whose recording boundaries are already known from the file.
Data. The formula reads nothing: detect(...) returns an array of false whose length is the number of atoms.
Parameters. The formula has no parameters of its own (defineFormulaParameters() is not overridden and returns an empty set). Only the common parameter of the base class remains, "Stood if moved less than, m" (stoodMeters, default 30): it marks a pause recorded by the device as a stop if the track moved less than this distance during it.
Where the pauses come from. All the work is done by GapsStep. Before calling detect(...) it divides the pause rows of the input into rows of the file format (reasons TIMER, SEGMENT, SIGNAL), manual rows and rows written by previous steps. After detect(...) it merges them with the pauses found by the formula, distributes the atoms over segments and writes the pause rows. So the result of ExplicitGaps is exactly the pauses from the file plus the manual and inherited ones.
- The step finds nothing by itself: if the device recorded no pauses, the result has no pauses. Other formulas (
StepGaps,UnchangedGaps, etc.) serve for searching in the data. - Pauses from the file and manual pauses are kept by any pause formula: after the step the base class checks that none of them is lost.
- A sensor with coordinates does not need a track; for sensors without coordinates the built-in scenarios attach the GPS sensor (role
track), so that the pauses can be described by displacement.