gt:                     if (!isRecording) {
context: package com.telenav.osv.recorder.score;
  
  import android.location.Location;
  
  import androidx.annotation.NonNull;
  
  import com.telenav.osv.common.filter.FilterFactory;
  import com.telenav.osv.common.model.KVLatLng;
  import com.telenav.osv.data.score.datasource.ScoreDataSource;
  import com.telenav.osv.data.score.model.ScoreHistory;
  import com.telenav.osv.event.OSVEvent;
  import com.telenav.osv.item.Segment;
  import com.telenav.osv.item.SpeedData;
  import com.telenav.osv.location.LocationService;
  import com.telenav.osv.location.filter.LocationFilterType;
  import com.telenav.osv.obd.manager.ObdManager;
  import com.telenav.osv.recorder.score.event.ScoreChangedEvent;
  import com.telenav.osv.utils.Log;
  import com.telenav.osv.utils.Utils;
  
  import java.util.HashMap;
  import java.util.Map;
  import java.util.UUID;
  
  import io.reactivex.Completable;
  import io.reactivex.Observable;
  import io.reactivex.android.schedulers.AndroidSchedulers;
  import io.reactivex.disposables.CompositeDisposable;
  import io.reactivex.disposables.Disposable;
  import io.reactivex.schedulers.Schedulers;
  import io.reactivex.subjects.PublishSubject;
  
  /**
   * Component responsible for points calculation, while recording takes place
   * Created by Kalman on 17/11/2016.
   */
  public class ScoreManager implements Score, PositionMatcher.SegmentsListener, ObdManager.ObdConnectionListener {
  
      /**
       * Default value for score calculation when using the segment's coverage.
       */
      public static final int UNKNOWN_VALUE = -1;
  
      /**
       * Photo increment value for score.
       */
      private static final int SCORE_PHOTO_INCREMENT_VALUE = 1;
  
      private static final String TAG = ScoreManager.class.getSimpleName();
  
      /**
       * The maximum value for the coverage.
       */
      private static final int MAX_COVERAGE_VALUE = 10;
  
      /**
       * The value to double the points if the OBD is connected.
       */
      private static final int OBD_CONNECTED_MULTIPLIER = 2;
  
      /**
       * The default value if the OBD is disconnected.
       */
      private static final int OBD_DISCONNECTED_MULTIPLIER = 1;
  
      /**
       * Map which references each pair of coverage and {@code ScoreHistory}. This is used to update persistence with changes which occur to the current recording sequence
       * regarding only score.
       */
      private Map<Integer, ScoreHistory> scoreHistoryMap;
  
      /**
       * The instance to the {@code PositionMatcher} used for matching the current position with a segment.
       */
      private PositionMatcher positionMatcher;
  
      /**
       * Total points gained during the current recording.
       */
      private long points;
  
      /**
       * The sequence id for the current recording.
       */
      private String sequenceId = null;
  
      /**
       * The instance to the {@code LocalDataSource} in order to store the score in the database.
       */
      private ScoreDataSource scoreDataSource;
  
      /**
       * The instance of {@code LocationService} which is used for receiving location updates.
       */
      private LocationService locationService;
  
      /**
       * The {@code ObdManager} fused for updates regarding the OBD state.
       */
      private ObdManager obdManager;
  
      /**
       * The observable for the score changes. This is used to send the score updates to the observers.
       */
      private PublishSubject<OSVEvent> publishSubject = PublishSubject.create();
  
      /**
       * {@code true} if the recording is started, {@code false} otherwise.
       */
      private boolean isRecording;
  
      /**
       * The holder of all score's subscribers
       */
      private CompositeDisposable compositeDisposable = new CompositeDisposable();
  
      /**
       * This is used to hold the obd connection state: true when the obd is connected, false otherwise.
       */
      private boolean isObdConnected;
  
      public ScoreManager(@NonNull ScoreDataSource scoreDataSource, @NonNull PositionMatcher positionMatcher, @NonNull LocationService locationService, @NonNull ObdManager
              obdManager) {
          this.positionMatcher = positionMatcher;
          this.scoreDataSource = scoreDataSource;
          this.positionMatcher.setSegmentsListener(this);
          this.locationService = locationService;
          this.obdManager = obdManager;
          isObdConnected = obdManager.getObdState() == ObdManager.ObdState.OBD_CONNECTED;
          obdManager.addObdConnectionListener(this);
          observeOnLocationUpdates();
      }
  
      @Override
      public void onSegmentsReceived(KVLatLng location) {
          if (!isRecording) {
              return;
          }
          Log.d(TAG, "ScoreManager#onSegmentsReceived");
          Segment matchedSegment = positionMatcher.match(location);
          updateGamification(matchedSegment, false);
      }
  
      @Override
      public void onPictureTaken(Location location) {
          if (!isRecording) {
              return;
          }
          Log.d(TAG, "ScoreManager#onPictureTaken");
          if (sequenceId != null) {
              Segment matchedSegment = positionMatcher.onPictureTaken(new KVLatLng(location, 0));
              updateGamification(matchedSegment, true);
          }
      }
  
      @Override
      public void onRecordingStateChanged(boolean isRecording, String sequenceId) {
          this.isRecording = isRecording;
          if (isRecording) {
              points = 0;
              this.sequenceId = sequenceId;
              scoreHistoryMap = new HashMap<>();
          } else {
              this.sequenceId = null;
              scoreHistoryMap = null;
              points = 0;
          }
      }
  
      @Override
      public Observable<OSVEvent> getScoreUpdates() {
          return publishSubject.toSerialized().hide();
      }
  
      @Override
      public void setScoreValue(long score) {
          points = score;
      }
  
      @Override
      public void release() {
          Log.d(TAG, "release score component");
          if (!compositeDisposable.isDisposed()) {
              compositeDisposable.clear();
          }
          obdManager.removeObdConnectionListener(this);
      }
  
      @Override
      public void onSpeedObtained(SpeedData speed) {
  
      }
  
      @Override
      public void onObdConnected() {
          isObdConnected = true;
      }
  
      @Override
      public void onObdDisconnected() {
          isObdConnected = false;
      }
  
      @Override
      public void onObdConnecting() {
  
      }
  
      @Override
      public void onObdInitialised() {
  
      }
  
      /**
       * Registers the observer for location updates.
       */
      private void observeOnLocationUpdates() {
          Log.d(TAG, "observeOnLocationUpdates");
          compositeDisposable.add(locationService.getLocationUpdates()
                  .filter(FilterFactory.getLocationFilter(LocationFilterType.FILTER_ZERO_VALUES))
                  .subscribe(location -> {
  