View Javadoc
1   /*
2    * Copyright (C) 2018 Alberto Irurueta Carro (alberto@irurueta.com)
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.irurueta.navigation.indoor.radiosource;
17  
18  import com.irurueta.geometry.Point2D;
19  import com.irurueta.navigation.NavigationException;
20  import com.irurueta.navigation.indoor.Beacon;
21  import com.irurueta.navigation.indoor.BeaconWithPowerAndLocated2D;
22  import com.irurueta.navigation.indoor.RadioSource;
23  import com.irurueta.navigation.indoor.RadioSourceWithPowerAndLocated;
24  import com.irurueta.navigation.indoor.RssiReadingLocated;
25  import com.irurueta.navigation.indoor.WifiAccessPoint;
26  import com.irurueta.navigation.indoor.WifiAccessPointWithPowerAndLocated2D;
27  import com.irurueta.numerical.robust.RobustEstimatorMethod;
28  
29  import java.util.ArrayList;
30  import java.util.List;
31  
32  /**
33   * This is an abstract class to robustly estimate 2D position, transmitted power and
34   * path-loss exponent of a radio source (e.g. Wi-Fi access point or bluetooth beacon),
35   * by discarding outliers and assuming that the radio source emits isotropically
36   * following the expression below:
37   * Pr = Pt*Gt*Gr*lambda^2 / (4*pi*d)^2,
38   * where Pr is the received power (expressed in mW),
39   * Gt is the Gain of the transmission antenna
40   * Gr is the Gain of the receiver antenna
41   * d is the distance between emitter and receiver
42   * and lambda is the wavelength and is equal to: lambda = c / f,
43   * where c is the speed of light
44   * and f is the carrier frequency of the radio signal.
45   * Because usually information about the antenna of the radio source cannot be
46   * retrieved (because many measurements are made on unknown devices where
47   * physical access is not possible), this implementation will estimate the
48   * equivalent transmitted power as: Pte = Pt * Gt * Gr.
49   * If RssiReadings contain RSSI standard deviations, those values will be used,
50   * otherwise it will be assumed an RSSI standard deviation of 1 dB.
51   * Implementations of this class should be able to detect and discard outliers in
52   * order to find the best solution.
53   * <p>
54   * IMPORTANT: Implementations of this class can choose to estimate a
55   * combination of radio source position, transmitted power and path loss
56   * exponent. However enabling all three estimations usually achieves
57   * inaccurate results. When using this class, estimation must be of at least
58   * one parameter (position, transmitted power or path loss exponent) when
59   * initial values are provided for the other two, and at most it should consist
60   * of two parameters (either position and transmitted power, position and
61   * path loss exponent or transmitted power and path loss exponent), providing an
62   * initial value for the remaining parameter.
63   *
64   * @param <S> a {@link RadioSource} type.
65   */
66  @SuppressWarnings("Duplicates")
67  public abstract class RobustRssiRadioSourceEstimator2D<S extends RadioSource> extends
68          RobustRssiRadioSourceEstimator<S, Point2D> {
69  
70      /**
71       * Radio source estimator used internally.
72       */
73      protected final RssiRadioSourceEstimator2D<S> innerEstimator = new RssiRadioSourceEstimator2D<>();
74  
75      /**
76       * Subset of readings used by inner estimator.
77       */
78      private final List<RssiReadingLocated<S, Point2D>> innerReadings = new ArrayList<>();
79  
80      /**
81       * Constructor.
82       */
83      protected RobustRssiRadioSourceEstimator2D() {
84          super();
85          preliminarySubsetSize = getMinReadings();
86      }
87  
88      /**
89       * Constructor.
90       * Sets signal readings belonging to the same radio source.
91       *
92       * @param readings signal readings belonging to the same radio source.
93       * @throws IllegalArgumentException if readings are not valid.
94       */
95      protected RobustRssiRadioSourceEstimator2D(final List<? extends RssiReadingLocated<S, Point2D>> readings) {
96          super(readings);
97          preliminarySubsetSize = getMinReadings();
98      }
99  
100     /**
101      * Constructor.
102      *
103      * @param listener listener in charge of attending events raised by this instance.
104      */
105     protected RobustRssiRadioSourceEstimator2D(final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
106         super(listener);
107         preliminarySubsetSize = getMinReadings();
108     }
109 
110     /**
111      * Constructor.
112      * Sets signal readings belonging to the same radio source.
113      *
114      * @param readings signal readings belonging to the same radio source.
115      * @param listener listener in charge of attending events raised by this instance.
116      * @throws IllegalArgumentException if readings are not valid.
117      */
118     protected RobustRssiRadioSourceEstimator2D(
119             final List<? extends RssiReadingLocated<S, Point2D>> readings,
120             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
121         super(readings, listener);
122         preliminarySubsetSize = getMinReadings();
123     }
124 
125     /**
126      * Constructor.
127      * Sets signal readings belonging to the same radio source.
128      *
129      * @param readings        signal readings belonging to the same radio source.
130      * @param initialPosition initial position to start the estimation of radio
131      *                        source position.
132      * @throws IllegalArgumentException if readings are not valid.
133      */
134     protected RobustRssiRadioSourceEstimator2D(
135             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition) {
136         super(readings, initialPosition);
137         preliminarySubsetSize = getMinReadings();
138     }
139 
140     /**
141      * Constructor.
142      *
143      * @param initialPosition initial position to start the estimation of radio
144      *                        source position.
145      */
146     protected RobustRssiRadioSourceEstimator2D(final Point2D initialPosition) {
147         super(initialPosition);
148         preliminarySubsetSize = getMinReadings();
149     }
150 
151     /**
152      * Constructor.
153      *
154      * @param initialPosition initial position to start the estimation of radio
155      *                        source position.
156      * @param listener        listener in charge of attending events raised by this instance.
157      */
158     protected RobustRssiRadioSourceEstimator2D(
159             final Point2D initialPosition, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
160         super(initialPosition, listener);
161         preliminarySubsetSize = getMinReadings();
162     }
163 
164     /**
165      * Constructor.
166      * Sets signal readings belonging to the same radio source.
167      *
168      * @param readings        signal readings belonging to the same radio source.
169      * @param initialPosition initial position to start the estimation of radio
170      *                        source position.
171      * @param listener        listener in charge of attending events raised by this instance.
172      * @throws IllegalArgumentException if readings are not valid.
173      */
174     protected RobustRssiRadioSourceEstimator2D(
175             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
176             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
177         super(readings, initialPosition, listener);
178         preliminarySubsetSize = getMinReadings();
179     }
180 
181     /**
182      * Constructor.
183      *
184      * @param initialTransmittedPowerdBm initial transmitted power to start the
185      *                                   estimation of radio source transmitted power
186      *                                   (expressed in dBm's)
187      */
188     protected RobustRssiRadioSourceEstimator2D(final Double initialTransmittedPowerdBm) {
189         super(initialTransmittedPowerdBm);
190         preliminarySubsetSize = getMinReadings();
191     }
192 
193     /**
194      * Constructor.
195      * Sets signal readings belonging to the same radio source.
196      *
197      * @param readings                   Wi-Fi signal readings belonging to the same radio source.
198      * @param initialTransmittedPowerdBm initial transmitted power to start the
199      *                                   estimation of radio source transmitted power
200      *                                   (expressed in dBm's)
201      * @throws IllegalArgumentException if readings are not valid.
202      */
203     protected RobustRssiRadioSourceEstimator2D(
204             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Double initialTransmittedPowerdBm) {
205         super(readings, initialTransmittedPowerdBm);
206         preliminarySubsetSize = getMinReadings();
207     }
208 
209     /**
210      * Constructor.
211      *
212      * @param initialTransmittedPowerdBm initial transmitted power to start the
213      *                                   estimation of radio source transmitted power
214      *                                   (expressed in dBm's)
215      * @param listener                   listener in charge of attending events raised by this instance.
216      */
217     protected RobustRssiRadioSourceEstimator2D(
218             final Double initialTransmittedPowerdBm,
219             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
220         super(initialTransmittedPowerdBm, listener);
221         preliminarySubsetSize = getMinReadings();
222     }
223 
224     /**
225      * Constructor.
226      * Sets signal readings belonging to the same radio source.
227      *
228      * @param readings                   Wi-Fi signal readings belonging to the radio source point.
229      * @param initialTransmittedPowerdBm initial transmitted power to start the
230      *                                   estimation of radio source transmitted power
231      *                                   (expressed in dBm's)
232      * @param listener                   listener in charge of attending events raised by this instance.
233      * @throws IllegalArgumentException if readings are not valid.
234      */
235     protected RobustRssiRadioSourceEstimator2D(
236             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Double initialTransmittedPowerdBm,
237             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
238         super(readings, initialTransmittedPowerdBm, listener);
239         preliminarySubsetSize = getMinReadings();
240     }
241 
242     /**
243      * Constructor.
244      * Sets signal readings belonging to the same radio source.
245      *
246      * @param readings                   signal readings belonging to the same radio source.
247      * @param initialPosition            initial position to start the estimation of radio
248      *                                   source position.
249      * @param initialTransmittedPowerdBm initial transmitted power to start the
250      *                                   estimation of radio source transmitted power
251      *                                   (expressed in dBm's).
252      * @throws IllegalArgumentException if readings are not valid.
253      */
254     protected RobustRssiRadioSourceEstimator2D(
255             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
256             final Double initialTransmittedPowerdBm) {
257         super(readings, initialPosition, initialTransmittedPowerdBm);
258         preliminarySubsetSize = getMinReadings();
259     }
260 
261     /**
262      * Constructor.
263      *
264      * @param initialPosition            initial position to start the estimation of radio
265      *                                   source position.
266      * @param initialTransmittedPowerdBm initial transmitted power to start the
267      *                                   estimation of radio source transmitted power
268      *                                   (expressed in dBm's).
269      */
270     protected RobustRssiRadioSourceEstimator2D(
271             final Point2D initialPosition, final Double initialTransmittedPowerdBm) {
272         super(initialPosition, initialTransmittedPowerdBm);
273         preliminarySubsetSize = getMinReadings();
274     }
275 
276     /**
277      * Constructor.
278      *
279      * @param initialPosition            initial position to start the estimation of radio
280      *                                   source position.
281      * @param initialTransmittedPowerdBm initial transmitted power to start the
282      *                                   estimation of radio source transmitted power
283      *                                   (expressed in dBm's).
284      * @param listener                   listener in charge of attending events raised by this instance.
285      */
286     protected RobustRssiRadioSourceEstimator2D(
287             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
288             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
289         super(initialPosition, initialTransmittedPowerdBm, listener);
290         preliminarySubsetSize = getMinReadings();
291     }
292 
293     /**
294      * Constructor.
295      * Sets signal readings belonging to the same radio source.
296      *
297      * @param readings                   signal readings belonging to the same radio source.
298      * @param initialPosition            initial position to start the estimation of radio
299      *                                   source position.
300      * @param initialTransmittedPowerdBm initial transmitted power to start the
301      *                                   estimation of radio source transmitted power
302      *                                   (expressed in dBm's).
303      * @param listener                   listener in charge of attending events raised by this instance.
304      * @throws IllegalArgumentException if readings are not valid.
305      */
306     protected RobustRssiRadioSourceEstimator2D(
307             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
308             final Double initialTransmittedPowerdBm,
309             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
310         super(readings, initialPosition, initialTransmittedPowerdBm, listener);
311         preliminarySubsetSize = getMinReadings();
312     }
313 
314     /**
315      * Constructor.
316      * Sets signal readings belonging to the same radio source.
317      *
318      * @param readings                   signal readings belonging to the same radio source.
319      * @param initialPosition            initial position to start the estimation of radio
320      *                                   source position.
321      * @param initialTransmittedPowerdBm initial transmitted power to start the
322      *                                   estimation of radio source transmitted power
323      *                                   (expressed in dBm's).
324      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
325      * @throws IllegalArgumentException if readings are not valid.
326      */
327     protected RobustRssiRadioSourceEstimator2D(
328             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
329             final Double initialTransmittedPowerdBm, final double initialPathLossExponent) {
330         super(readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent);
331         preliminarySubsetSize = getMinReadings();
332     }
333 
334     /**
335      * Constructor.
336      *
337      * @param initialPosition            initial position to start the estimation of radio
338      *                                   source position.
339      * @param initialTransmittedPowerdBm initial transmitted power to start the
340      *                                   estimation of radio source transmitted power
341      *                                   (expressed in dBm's).
342      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
343      */
344     protected RobustRssiRadioSourceEstimator2D(
345             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
346             final double initialPathLossExponent) {
347         super(initialPosition, initialTransmittedPowerdBm, initialPathLossExponent);
348         preliminarySubsetSize = getMinReadings();
349     }
350 
351     /**
352      * Constructor.
353      *
354      * @param initialPosition            initial position to start the estimation of radio
355      *                                   source position.
356      * @param initialTransmittedPowerdBm initial transmitted power to start the
357      *                                   estimation of radio source transmitted power
358      *                                   (expressed in dBm's).
359      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
360      * @param listener                   listener in charge of attending events raised by this instance.
361      */
362     protected RobustRssiRadioSourceEstimator2D(
363             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
364             final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
365         super(initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, listener);
366         preliminarySubsetSize = getMinReadings();
367     }
368 
369     /**
370      * Constructor.
371      * Sets signal readings belonging to the same radio source.
372      *
373      * @param readings                   signal readings belonging to the same radio source.
374      * @param initialPosition            initial position to start the estimation of radio
375      *                                   source position.
376      * @param initialTransmittedPowerdBm initial transmitted power to start the
377      *                                   estimation of radio source transmitted power
378      *                                   (expressed in dBm's).
379      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
380      * @param listener                   listener in charge of attending events raised by this instance.
381      * @throws IllegalArgumentException if readings are not valid.
382      */
383     protected RobustRssiRadioSourceEstimator2D(
384             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
385             final Double initialTransmittedPowerdBm, final double initialPathLossExponent,
386             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
387         super(readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, listener);
388         preliminarySubsetSize = getMinReadings();
389     }
390 
391     /**
392      * Creates a robust 2D position radio source estimator.
393      *
394      * @param method robust estimator method.
395      * @param <S>    a {@link RadioSource} type.
396      * @return a new robust 2D position radio source estimator.
397      */
398     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
399             final RobustEstimatorMethod method) {
400         return switch (method) {
401             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>();
402             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>();
403             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>();
404             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>();
405             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>();
406         };
407     }
408 
409     /**
410      * Creates a robust 2D position radio source estimator.
411      *
412      * @param readings signal readings belonging to the same radio source.
413      * @param method   robust estimator method.
414      * @param <S>      a {@link RadioSource} type.
415      * @return a new robust 2D position radio source estimator.
416      * @throws IllegalArgumentException if readings are not valid.
417      */
418     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
419             final List<? extends RssiReadingLocated<S, Point2D>> readings, final RobustEstimatorMethod method) {
420         return switch (method) {
421             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings);
422             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings);
423             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings);
424             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(readings);
425             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(readings);
426         };
427     }
428 
429     /**
430      * Creates a robust 2D position radio source estimator.
431      *
432      * @param listener listener in charge of attending events raised by this instance.
433      * @param method   robust estimator method.
434      * @param <S>      a {@link RadioSource} type.
435      * @return a new robust 2D position radio source estimator.
436      */
437     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
438             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
439         return switch (method) {
440             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(listener);
441             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(listener);
442             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(listener);
443             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(listener);
444             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(listener);
445         };
446     }
447 
448     /**
449      * Creates a robust 2D position radio source estimator.
450      *
451      * @param readings signal readings belonging to the same radio source.
452      * @param listener listener in charge of attending events raised by this instance.
453      * @param method   robust estimator method.
454      * @param <S>      a {@link RadioSource} type.
455      * @return a new robust 2D position radio source estimator.
456      * @throws IllegalArgumentException if readings are not valid.
457      */
458     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
459             final List<? extends RssiReadingLocated<S, Point2D>> readings,
460             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
461         return switch (method) {
462             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, listener);
463             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, listener);
464             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, listener);
465             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(readings, listener);
466             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(readings, listener);
467         };
468     }
469 
470     /**
471      * Creates a robust 2D position radio source estimator.
472      *
473      * @param readings        signal readings belonging to the same radio source.
474      * @param initialPosition initial position to start the estimation of radio
475      *                        source position.
476      * @param method          robust estimator method.
477      * @param <S>             a {@link RadioSource} type.
478      * @return a new robust 2D position radio source estimator.
479      * @throws IllegalArgumentException if readings are not valid.
480      */
481     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
482             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
483             final RobustEstimatorMethod method) {
484         return switch (method) {
485             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition);
486             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition);
487             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition);
488             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition);
489             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition);
490         };
491     }
492 
493     /**
494      * Creates a robust 2D position radio source estimator.
495      *
496      * @param initialPosition initial position to start the estimation of radio
497      *                        source position.
498      * @param method          robust estimator method.
499      * @param <S>             a {@link RadioSource} type.
500      * @return a new robust 2D position radio source estimator.
501      */
502     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
503             final Point2D initialPosition, final RobustEstimatorMethod method) {
504         return switch (method) {
505             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition);
506             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition);
507             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition);
508             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(initialPosition);
509             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(initialPosition);
510         };
511     }
512 
513     /**
514      * Creates a robust 2D position radio source estimator.
515      *
516      * @param initialPosition initial position to start the estimation of radio
517      *                        source position.
518      * @param listener        listener in charge of attending events raised by this instance.
519      * @param method          robust estimator method.
520      * @param <S>             a {@link RadioSource} type.
521      * @return a new robust 2D position radio source estimator.
522      */
523     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
524             final Point2D initialPosition, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener,
525             final RobustEstimatorMethod method) {
526         return switch (method) {
527             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition, listener);
528             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, listener);
529             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition, listener);
530             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(initialPosition, listener);
531             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, listener);
532         };
533     }
534 
535     /**
536      * Creates a robust 2D position radio source estimator.
537      *
538      * @param readings        signal readings belonging to the same radio source.
539      * @param initialPosition initial position to start the estimation of radio
540      *                        source position.
541      * @param listener        listener in charge of attending events raised by this instance
542      * @param method          robust estimator method.
543      * @param <S>             a {@link RadioSource} type.
544      * @return a new robust 2D position radio source estimator.
545      * @throws IllegalArgumentException if readings are not valid.
546      */
547     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
548             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
549             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
550         return switch (method) {
551             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition, listener);
552             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition, listener);
553             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition, listener);
554             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition, listener);
555             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition, listener);
556         };
557     }
558 
559     /**
560      * Creates a robust 2D position radio source estimator.
561      *
562      * @param initialTransmittedPowerdBm initial transmitted power to start the
563      *                                   estimation of radio source transmitted power
564      *                                   (expressed in dBm's).
565      * @param method                     robust estimator method.
566      * @param <S>                        a {@link RadioSource} type.
567      * @return a new robust 2D position radio source estimator.
568      */
569     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
570             final Double initialTransmittedPowerdBm, final RobustEstimatorMethod method) {
571         return switch (method) {
572             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm);
573             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm);
574             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm);
575             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm);
576             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm);
577         };
578     }
579 
580     /**
581      * Creates a robust 2D position radio source estimator.
582      *
583      * @param readings                   signal readings belonging to the same radio source.
584      * @param initialTransmittedPowerdBm initial transmitted power to start the
585      *                                   estimation of radio source transmitted power
586      *                                   (expressed in dBm's).
587      * @param method                     robust estimator method.
588      * @param <S>                        a {@link RadioSource} type.
589      * @return a new robust 2D position radio source estimator.
590      * @throws IllegalArgumentException if readings are not valid.
591      */
592     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
593             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Double initialTransmittedPowerdBm,
594             final RobustEstimatorMethod method) {
595         return switch (method) {
596             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm);
597             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm);
598             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm);
599             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm);
600             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm);
601         };
602     }
603 
604     /**
605      * Creates a robust 2D position radio source estimator.
606      *
607      * @param initialTransmittedPowerdBm initial transmitted power to start the
608      *                                   estimation of radio source transmitted power
609      *                                   (expressed in dBm's)
610      * @param listener                   listener in charge of attending events raised by this instance.
611      * @param method                     robust estimator method.
612      * @param <S>                        a {@link RadioSource} type.
613      * @return a new robust 2D position radio source estimator.
614      */
615     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
616             final Double initialTransmittedPowerdBm, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener,
617             final RobustEstimatorMethod method) {
618         return switch (method) {
619             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm, listener);
620             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm, listener);
621             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm, listener);
622             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm, listener);
623             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm, listener);
624         };
625     }
626 
627     /**
628      * Creates a robust 2D position radio source estimator.
629      *
630      * @param readings                   signal readings belonging to the same radio source.
631      * @param initialTransmittedPowerdBm initial transmitted power to start the
632      *                                   estimation of radio source transmitted power
633      *                                   (expressed in dBm's)
634      * @param listener                   listener in charge of attending events raised by this instance.
635      * @param method                     robust estimator method.
636      * @param <S>                        a {@link RadioSource} type.
637      * @return a new robust 2D radio source power and position estimator.
638      * @throws IllegalArgumentException if readings are not valid.
639      */
640     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
641             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Double initialTransmittedPowerdBm,
642             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
643         return switch (method) {
644             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm, listener);
645             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm, listener);
646             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm, listener);
647             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm, listener);
648             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm, listener);
649         };
650     }
651 
652     /**
653      * Creates a robust 2D position radio source estimator.
654      *
655      * @param readings                   signal readings belonging to the same radio source.
656      * @param initialPosition            initial position to start the estimation of radio
657      *                                   source position.
658      * @param initialTransmittedPowerdBm initial transmitted power to start the
659      *                                   estimation of radio source transmitted power
660      *                                   (expressed in dBm's).
661      * @param method                     robust estimator method.
662      * @param <S>                        a {@link RadioSource} type.
663      * @return a new robust 2D radio source power and position estimator.
664      * @throws IllegalArgumentException if readings are not valid.
665      */
666     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
667             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
668             final Double initialTransmittedPowerdBm, final RobustEstimatorMethod method) {
669         return switch (method) {
670             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
671                     initialTransmittedPowerdBm);
672             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
673                     initialTransmittedPowerdBm);
674             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
675                     initialTransmittedPowerdBm);
676             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
677                     initialTransmittedPowerdBm);
678             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
679                     initialTransmittedPowerdBm);
680         };
681     }
682 
683     /**
684      * Creates a robust 2D position radio source estimator.
685      *
686      * @param initialPosition            initial position to start the estimation of radio
687      *                                   source position.
688      * @param initialTransmittedPowerdBm initial transmitted power to start the
689      *                                   estimation of radio source transmitted power
690      *                                   (expressed in dBm's).
691      * @param method                     robust estimator method.
692      * @param <S>                        a {@link RadioSource} type.
693      * @return a new robust 2D position radio source estimator.
694      */
695     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
696             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
697             final RobustEstimatorMethod method) {
698         return switch (method) {
699             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm);
700             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm);
701             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm);
702             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm);
703             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm);
704         };
705     }
706 
707     /**
708      * Creates a robust 2D position radio source estimator.
709      *
710      * @param initialPosition            initial position to start the estimation of radio
711      *                                   source position.
712      * @param initialTransmittedPowerdBm initial transmitted power to start the
713      *                                   estimation of radio source transmitted power
714      *                                   (expressed in dBm's).
715      * @param listener                   listener in charge of attending events raised by this instance.
716      * @param method                     robust estimator method.
717      * @param <S>                        a {@link RadioSource} type.
718      * @return a new robust 2D position radio source estimator.
719      */
720     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
721             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
722             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
723         return switch (method) {
724             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
725                     listener);
726             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
727                     listener);
728             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
729                     listener);
730             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
731                     listener);
732             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
733                     listener);
734         };
735     }
736 
737     /**
738      * Creates a robust 2D position radio source estimator.
739      *
740      * @param readings                   signal readings belonging to the same radio source.
741      * @param initialPosition            initial position to start the estimation of radio
742      *                                   source position.
743      * @param initialTransmittedPowerdBm initial transmitted power to start the
744      *                                   estimation of radio source transmitted power
745      *                                   (expressed in dBm's).
746      * @param listener                   listener in charge of attending events raised by this instance.
747      * @param method                     robust estimator method.
748      * @param <S>                        a {@link RadioSource} type.
749      * @return a new robust 2D position radio source estimator.
750      * @throws IllegalArgumentException if readings are not valid.
751      */
752     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
753             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
754             final Double initialTransmittedPowerdBm, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener,
755             final RobustEstimatorMethod method) {
756         return switch (method) {
757             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
758                     initialTransmittedPowerdBm, listener);
759             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
760                     initialTransmittedPowerdBm, listener);
761             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
762                     initialTransmittedPowerdBm, listener);
763             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
764                     initialTransmittedPowerdBm, listener);
765             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
766                     initialTransmittedPowerdBm, listener);
767         };
768     }
769 
770     /**
771      * Creates a robust 2D position radio source estimator.
772      *
773      * @param readings                   signal readings belonging to the same radio source.
774      * @param initialPosition            initial position to start the estimation of radio
775      *                                   source position.
776      * @param initialTransmittedPowerdBm initial transmitted power to start the
777      *                                   estimation of radio source transmitted power
778      *                                   (expressed in dBm's).
779      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
780      * @param method                     robust estimator method.
781      * @param <S>                        a {@link RadioSource} type.
782      * @return a new robust 2D position radio source estimator.
783      * @throws IllegalArgumentException if readings are not valid.
784      */
785     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
786             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
787             final Double initialTransmittedPowerdBm, final double initialPathLossExponent,
788             final RobustEstimatorMethod method) {
789         return switch (method) {
790             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
791                     initialTransmittedPowerdBm, initialPathLossExponent);
792             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
793                     initialTransmittedPowerdBm, initialPathLossExponent);
794             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
795                     initialTransmittedPowerdBm, initialPathLossExponent);
796             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
797                     initialTransmittedPowerdBm, initialPathLossExponent);
798             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
799                     initialTransmittedPowerdBm, initialPathLossExponent);
800         };
801     }
802 
803     /**
804      * Creates a robust 2D position radio source estimator.
805      *
806      * @param initialPosition            initial position to start the estimation of radio
807      *                                   source position.
808      * @param initialTransmittedPowerdBm initial transmitted power to start the
809      *                                   estimation of radio source transmitted power
810      *                                   (expressed in dBm's).
811      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
812      * @param method                     robust estimator method.
813      * @param <S>                        a {@link RadioSource} type.
814      * @return a new robust 2D position radio source estimator.
815      */
816     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
817             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
818             final double initialPathLossExponent, final RobustEstimatorMethod method) {
819         return switch (method) {
820             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
821                     initialPathLossExponent);
822             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
823                     initialPathLossExponent);
824             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
825                     initialPathLossExponent);
826             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
827                     initialPathLossExponent);
828             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
829                     initialPathLossExponent);
830         };
831     }
832 
833     /**
834      * Creates a robust 2D position radio source estimator.
835      *
836      * @param initialPosition            initial position to start the estimation of radio
837      *                                   source position.
838      * @param initialTransmittedPowerdBm initial transmitted power to start the
839      *                                   estimation of radio source transmitted power
840      *                                   (expressed in dBm's).
841      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
842      * @param listener                   listener in charge of attending events raised by this instance.
843      * @param method                     robust estimator method.
844      * @param <S>                        a {@link RadioSource} type.
845      * @return a new robust 2D position radio source estimator.
846      */
847     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
848             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
849             final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener,
850             final RobustEstimatorMethod method) {
851         return switch (method) {
852             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
853                     initialPathLossExponent, listener);
854             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
855                     initialPathLossExponent, listener);
856             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
857                     initialPathLossExponent, listener);
858             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
859                     initialPathLossExponent, listener);
860             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
861                     initialPathLossExponent, listener);
862         };
863     }
864 
865     /**
866      * Creates a robust 2D position radio source estimator.
867      *
868      * @param readings                   signal readings belonging to the same radio source.
869      * @param initialPosition            initial position to start the estimation of radio
870      *                                   source position.
871      * @param initialTransmittedPowerdBm initial transmitted power to start the
872      *                                   estimation of radio source transmitted power
873      *                                   (expressed in dBm's).
874      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
875      * @param listener                   listener in charge of attending events raised by this instance.
876      * @param method                     robust estimator method.
877      * @param <S>                        a {@link RadioSource} type.
878      * @return a new robust 2D position radio source estimator.
879      * @throws IllegalArgumentException if readings are not valid.
880      */
881     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
882             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
883             final Double initialTransmittedPowerdBm, final double initialPathLossExponent,
884             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
885         return switch (method) {
886             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
887                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
888             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
889                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
890             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
891                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
892             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
893                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
894             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
895                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
896         };
897     }
898 
899     /**
900      * Creates a robust 2D position radio source estimator.
901      *
902      * @param qualityScores quality scores corresponding to each provided
903      *                      sample. The larger the score value the better
904      *                      the quality of the sample.
905      * @param method        robust estimator method.
906      * @param <S>           a {@link RadioSource} type.
907      * @return a new robust 2D position radio source estimator.
908      */
909     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
910             final double[] qualityScores, final RobustEstimatorMethod method) {
911         return switch (method) {
912             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>();
913             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>();
914             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>();
915             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores);
916             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores);
917         };
918     }
919 
920     /**
921      * Creates a robust 2D position radio source estimator.
922      *
923      * @param qualityScores quality scores corresponding to each provided
924      *                      sample. The larger the score value the better
925      *                      the quality of the sample.
926      * @param readings      signal readings belonging to the same radio source.
927      * @param method        robust estimator method.
928      * @param <S>           a {@link RadioSource} type.
929      * @return a new robust 2D position radio source estimator.
930      * @throws IllegalArgumentException if readings are not valid.
931      */
932     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
933             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
934             final RobustEstimatorMethod method) {
935         return switch (method) {
936             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings);
937             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings);
938             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings);
939             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, readings);
940             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, readings);
941         };
942     }
943 
944     /**
945      * Creates a robust 2D position radio source estimator.
946      *
947      * @param qualityScores quality scores corresponding to each provided
948      *                      sample. The larger the score value the better
949      *                      the quality of the sample.
950      * @param listener      listener in charge of attending events raised by this instance.
951      * @param method        robust estimator method.
952      * @param <S>           a {@link RadioSource} type.
953      * @return a new robust 2D position radio source estimator.
954      */
955     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
956             final double[] qualityScores, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener,
957             final RobustEstimatorMethod method) {
958         return switch (method) {
959             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(listener);
960             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(listener);
961             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(listener);
962             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, listener);
963             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, listener);
964         };
965     }
966 
967     /**
968      * Creates a robust 2D position radio source estimator.
969      *
970      * @param qualityScores quality scores corresponding to each provided
971      *                      sample. The larger the score value the better
972      *                      the quality of the sample.
973      * @param readings      signal readings belonging to the same radio source.
974      * @param listener      listener in charge of attending events raised by this instance.
975      * @param method        robust estimator method.
976      * @param <S>           a {@link RadioSource} type.
977      * @return a new robust 2D position radio source estimator.
978      * @throws IllegalArgumentException if readings are not valid.
979      */
980     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
981             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
982             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
983         return switch (method) {
984             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, listener);
985             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, listener);
986             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, listener);
987             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, listener);
988             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, listener);
989         };
990     }
991 
992     /**
993      * Creates a robust 2D position radio source estimator.
994      *
995      * @param qualityScores   quality scores corresponding to each provided
996      *                        sample. The larger the score value the better
997      *                        the quality of the sample.
998      * @param readings        signal readings belonging to the same radio source.
999      * @param initialPosition initial position to start the estimation of radio
1000      *                        source position.
1001      * @param method          robust estimator method.
1002      * @param <S>             a {@link RadioSource} type.
1003      * @return a new robust 2D position radio source estimator.
1004      * @throws IllegalArgumentException if readings are not valid.
1005      */
1006     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1007             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1008             final Point2D initialPosition, final RobustEstimatorMethod method) {
1009         return switch (method) {
1010             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition);
1011             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition);
1012             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition);
1013             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition);
1014             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition);
1015         };
1016     }
1017 
1018     /**
1019      * Creates a robust 2D position radio source estimator.
1020      *
1021      * @param qualityScores   quality scores corresponding to each provided
1022      *                        sample. The larger the score value the better
1023      *                        the quality of the sample.
1024      * @param initialPosition initial position to start the estimation of radio
1025      *                        source position.
1026      * @param method          robust estimator method.
1027      * @param <S>             a {@link RadioSource} type.
1028      * @return a new robust 2D position radio source estimator.
1029      */
1030     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1031             final double[] qualityScores, final Point2D initialPosition, final RobustEstimatorMethod method) {
1032         return switch (method) {
1033             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition);
1034             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition);
1035             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition);
1036             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition);
1037             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition);
1038         };
1039     }
1040 
1041     /**
1042      * Creates a robust 2D position radio source estimator.
1043      *
1044      * @param qualityScores   quality scores corresponding to each provided
1045      *                        sample. The larger the score value the better
1046      *                        the quality of the sample.
1047      * @param initialPosition initial position to start the estimation of radio
1048      *                        source position.
1049      * @param listener        listener in charge of attending events raised by this instance.
1050      * @param method          robust estimator method.
1051      * @param <S>             a {@link RadioSource} type.
1052      * @return a new robust 2D position radio source estimator.
1053      */
1054     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1055             final double[] qualityScores, final Point2D initialPosition,
1056             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
1057         return switch (method) {
1058             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition, listener);
1059             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, listener);
1060             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition, listener);
1061             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition, listener);
1062             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition, listener);
1063         };
1064     }
1065 
1066     /**
1067      * Creates a robust 2D position radio source estimator.
1068      *
1069      * @param qualityScores   quality scores corresponding to each provided
1070      *                        sample. The larger the score value the better
1071      *                        the quality of the sample.
1072      * @param readings        signal readings belonging to the same radio source.
1073      * @param initialPosition initial position to start the estimation of radio
1074      *                        source position.
1075      * @param listener        listener in charge of attending events raised by this instance
1076      * @param method          robust estimator method.
1077      * @param <S>             a {@link RadioSource} type.
1078      * @return a new robust 2D position radio source estimator.
1079      * @throws IllegalArgumentException if readings are not valid.
1080      */
1081     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1082             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1083             final Point2D initialPosition, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener,
1084             final RobustEstimatorMethod method) {
1085         return switch (method) {
1086             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition, listener);
1087             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition, listener);
1088             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition, listener);
1089             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition,
1090                     listener);
1091             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition,
1092                     listener);
1093         };
1094     }
1095 
1096     /**
1097      * Creates a robust 2D position radio source estimator.
1098      *
1099      * @param qualityScores              quality scores corresponding to each provided
1100      *                                   sample. The larger the score value the better
1101      *                                   the quality of the sample.
1102      * @param initialTransmittedPowerdBm initial transmitted power to start the
1103      *                                   estimation of access point transmitted power
1104      *                                   (expressed in dBm's).
1105      * @param method                     robust estimator method.
1106      * @param <S>                        a {@link RadioSource} type.
1107      * @return a new robust 2D position radio source estimator.
1108      */
1109     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1110             final double[] qualityScores, final Double initialTransmittedPowerdBm, final RobustEstimatorMethod method) {
1111         return switch (method) {
1112             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm);
1113             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm);
1114             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm);
1115             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, initialTransmittedPowerdBm);
1116             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, initialTransmittedPowerdBm);
1117         };
1118     }
1119 
1120     /**
1121      * Creates a robust 2D position radio source estimator.
1122      *
1123      * @param qualityScores              quality scores corresponding to each provided
1124      *                                   sample. The larger the score value the better
1125      *                                   the quality of the sample.
1126      * @param readings                   signal readings belonging to the same radio source.
1127      * @param initialTransmittedPowerdBm initial transmitted power to start the
1128      *                                   estimation of radio source transmitted power
1129      *                                   (expressed in dBm's).
1130      * @param method                     robust estimator method.
1131      * @param <S>                        a {@link RadioSource} type.
1132      * @return a new robust 2D position radio source estimator.
1133      * @throws IllegalArgumentException if readings are not valid.
1134      */
1135     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1136             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1137             final Double initialTransmittedPowerdBm, final RobustEstimatorMethod method) {
1138         return switch (method) {
1139             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm);
1140             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm);
1141             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm);
1142             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, readings,
1143                     initialTransmittedPowerdBm);
1144             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, readings,
1145                     initialTransmittedPowerdBm);
1146         };
1147     }
1148 
1149     /**
1150      * Creates a robust 2D position radio source estimator.
1151      *
1152      * @param qualityScores              quality scores corresponding to each provided
1153      *                                   sample. The larger the score value the better
1154      *                                   the quality of the sample.
1155      * @param initialTransmittedPowerdBm initial transmitted power to start the
1156      *                                   estimation of radio source transmitted power
1157      *                                   (expressed in dBm's)
1158      * @param listener                   listener in charge of attending events raised by this instance.
1159      * @param method                     robust estimator method.
1160      * @param <S>                        a {@link RadioSource} type.
1161      * @return a new robust 2D position radio source estimator.
1162      */
1163     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1164             final double[] qualityScores, final Double initialTransmittedPowerdBm,
1165             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
1166         return switch (method) {
1167             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm, listener);
1168             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm, listener);
1169             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialTransmittedPowerdBm, listener);
1170             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, initialTransmittedPowerdBm,
1171                     listener);
1172             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, initialTransmittedPowerdBm,
1173                     listener);
1174         };
1175     }
1176 
1177     /**
1178      * Creates a robust 2D position radio source estimator.
1179      *
1180      * @param qualityScores              quality scores corresponding to each provided
1181      *                                   sample. The larger the score value the better
1182      *                                   the quality of the sample.
1183      * @param readings                   signal readings belonging to the same radio source.
1184      * @param initialTransmittedPowerdBm initial transmitted power to start the
1185      *                                   estimation of radio source transmitted power
1186      *                                   (expressed in dBm's)
1187      * @param listener                   listener in charge of attending events raised by this instance.
1188      * @param method                     robust estimator method.
1189      * @param <S>                        a {@link RadioSource} type.
1190      * @return a new robust 2D position radio source estimator.
1191      * @throws IllegalArgumentException if readings are not valid.
1192      */
1193     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1194             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1195             final Double initialTransmittedPowerdBm, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener,
1196             final RobustEstimatorMethod method) {
1197         return switch (method) {
1198             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm, listener);
1199             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm, listener);
1200             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialTransmittedPowerdBm, listener);
1201             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, readings,
1202                     initialTransmittedPowerdBm, listener);
1203             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, readings,
1204                     initialTransmittedPowerdBm, listener);
1205         };
1206     }
1207 
1208     /**
1209      * Creates a robust 2D position radio source estimator.
1210      *
1211      * @param qualityScores              quality scores corresponding to each provided
1212      *                                   sample. The larger the score value the better
1213      *                                   the quality of the sample.
1214      * @param readings                   signal readings belonging to the same radio source.
1215      * @param initialPosition            initial position to start the estimation of radio
1216      *                                   source position.
1217      * @param initialTransmittedPowerdBm initial transmitted power to start the
1218      *                                   estimation of radio source transmitted power
1219      *                                   (expressed in dBm's).
1220      * @param method                     robust estimator method.
1221      * @param <S>                        a {@link RadioSource} type.
1222      * @return a new robust 2D position radio source estimator.
1223      * @throws IllegalArgumentException if readings are not valid.
1224      */
1225     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1226             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1227             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1228             final RobustEstimatorMethod method) {
1229         return switch (method) {
1230             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1231                     initialTransmittedPowerdBm);
1232             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1233                     initialTransmittedPowerdBm);
1234             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1235                     initialTransmittedPowerdBm);
1236             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition,
1237                     initialTransmittedPowerdBm);
1238             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition,
1239                     initialTransmittedPowerdBm);
1240         };
1241     }
1242 
1243     /**
1244      * Creates a robust 2D position radio source estimator.
1245      *
1246      * @param qualityScores              quality scores corresponding to each provided
1247      *                                   sample. The larger the score value the better
1248      *                                   the quality of the sample.
1249      * @param initialPosition            initial position to start the estimation of radio
1250      *                                   source position.
1251      * @param initialTransmittedPowerdBm initial transmitted power to start the
1252      *                                   estimation of radio source transmitted power
1253      *                                   (expressed in dBm's).
1254      * @param method                     robust estimator method.
1255      * @param <S>                        a {@link RadioSource} type.
1256      * @return a new robust 2D position radio source estimator.
1257      */
1258     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1259             final double[] qualityScores, final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1260             final RobustEstimatorMethod method) {
1261         return switch (method) {
1262             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm);
1263             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm);
1264             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm);
1265             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition,
1266                     initialTransmittedPowerdBm);
1267             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition,
1268                     initialTransmittedPowerdBm);
1269         };
1270     }
1271 
1272     /**
1273      * Creates a robust 2D position radio source estimator.
1274      *
1275      * @param qualityScores              quality scores corresponding to each provided
1276      *                                   sample. The larger the score value the better
1277      *                                   the quality of the sample.
1278      * @param initialPosition            initial position to start the estimation of radio
1279      *                                   source position.
1280      * @param initialTransmittedPowerdBm initial transmitted power to start the
1281      *                                   estimation of radio source transmitted power
1282      *                                   (expressed in dBm's).
1283      * @param listener                   listener in charge of attending events raised by this instance.
1284      * @param method                     robust estimator method.
1285      * @param <S>                        a {@link RadioSource} type.
1286      * @return a new robust 2D position radio source estimator.
1287      */
1288     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1289             final double[] qualityScores, final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1290             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
1291         return switch (method) {
1292             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
1293                     listener);
1294             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
1295                     listener);
1296             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
1297                     listener);
1298             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition,
1299                     initialTransmittedPowerdBm, listener);
1300             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition,
1301                     initialTransmittedPowerdBm, listener);
1302         };
1303     }
1304 
1305     /**
1306      * Creates a robust 2D position radio source estimator.
1307      *
1308      * @param qualityScores              quality scores corresponding to each provided
1309      *                                   sample. The larger the score value the better
1310      *                                   the quality of the sample.
1311      * @param readings                   signal readings belonging to the same radio source.
1312      * @param initialPosition            initial position to start the estimation of radio
1313      *                                   source position.
1314      * @param initialTransmittedPowerdBm initial transmitted power to start the
1315      *                                   estimation of radio source transmitted power
1316      *                                   (expressed in dBm's).
1317      * @param listener                   listener in charge of attending events raised by this instance.
1318      * @param method                     robust estimator method.
1319      * @param <S>                        a {@link RadioSource} type.
1320      * @return a new robust 2D position radio source estimator.
1321      * @throws IllegalArgumentException if readings are not valid.
1322      */
1323     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1324             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1325             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1326             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener, final RobustEstimatorMethod method) {
1327         return switch (method) {
1328             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1329                     initialTransmittedPowerdBm, listener);
1330             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1331                     initialTransmittedPowerdBm, listener);
1332             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1333                     initialTransmittedPowerdBm, listener);
1334             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition,
1335                     initialTransmittedPowerdBm, listener);
1336             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition,
1337                     initialTransmittedPowerdBm, listener);
1338         };
1339     }
1340 
1341     /**
1342      * Creates a robust 2D position radio source estimator.
1343      *
1344      * @param qualityScores              quality scores corresponding to each provided
1345      *                                   sample. The larger the score value the better
1346      *                                   the quality of the sample.
1347      * @param readings                   signal readings belonging to the same radio source.
1348      * @param initialPosition            initial position to start the estimation of radio
1349      *                                   source position.
1350      * @param initialTransmittedPowerdBm initial transmitted power to start the
1351      *                                   estimation of radio source transmitted power
1352      *                                   (expressed in dBm's).
1353      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
1354      * @param method                     robust estimator method.
1355      * @param <S>                        a {@link RadioSource} type.
1356      * @return a new robust 2D position radio source estimator.
1357      * @throws IllegalArgumentException if readings are not valid.
1358      */
1359     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1360             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1361             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1362             final double initialPathLossExponent, final RobustEstimatorMethod method) {
1363         return switch (method) {
1364             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1365                     initialTransmittedPowerdBm, initialPathLossExponent);
1366             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1367                     initialTransmittedPowerdBm, initialPathLossExponent);
1368             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1369                     initialTransmittedPowerdBm, initialPathLossExponent);
1370             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition,
1371                     initialTransmittedPowerdBm, initialPathLossExponent);
1372             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition,
1373                     initialTransmittedPowerdBm, initialPathLossExponent);
1374         };
1375     }
1376 
1377     /**
1378      * Creates a robust 2D position radio source estimator.
1379      *
1380      * @param qualityScores              quality scores corresponding to each provided
1381      *                                   sample. The larger the score value the better
1382      *                                   the quality of the sample.
1383      * @param initialPosition            initial position to start the estimation of radio
1384      *                                   source position.
1385      * @param initialTransmittedPowerdBm initial transmitted power to start the
1386      *                                   estimation of radio source transmitted power
1387      *                                   (expressed in dBm's).
1388      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
1389      * @param method                     robust estimator method.
1390      * @param <S>                        a {@link RadioSource} type.
1391      * @return a new robust 2D position radio source estimator.
1392      */
1393     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1394             final double[] qualityScores, final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1395             final double initialPathLossExponent, final RobustEstimatorMethod method) {
1396         return switch (method) {
1397             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
1398                     initialPathLossExponent);
1399             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
1400                     initialPathLossExponent);
1401             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
1402                     initialPathLossExponent);
1403             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition,
1404                     initialTransmittedPowerdBm, initialPathLossExponent);
1405             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition,
1406                     initialTransmittedPowerdBm, initialPathLossExponent);
1407         };
1408     }
1409 
1410     /**
1411      * Creates a robust 2D position radio source estimator.
1412      *
1413      * @param qualityScores              quality scores corresponding to each provided
1414      *                                   sample. The larger the score value the better
1415      *                                   the quality of the sample.
1416      * @param initialPosition            initial position to start the estimation of radio
1417      *                                   source position.
1418      * @param initialTransmittedPowerdBm initial transmitted power to start the
1419      *                                   estimation of radio source transmitted power
1420      *                                   (expressed in dBm's).
1421      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
1422      * @param listener                   listener in charge of attending events raised by this instance.
1423      * @param method                     robust estimator method.
1424      * @param <S>                        a {@link RadioSource} type.
1425      * @return a new robust 2D position radio source estimator.
1426      */
1427     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1428             final double[] qualityScores, final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1429             final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener,
1430             final RobustEstimatorMethod method) {
1431         return switch (method) {
1432             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
1433                     initialPathLossExponent, listener);
1434             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
1435                     initialPathLossExponent, listener);
1436             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(initialPosition, initialTransmittedPowerdBm,
1437                     initialPathLossExponent, listener);
1438             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition,
1439                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
1440             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, initialPosition,
1441                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
1442         };
1443     }
1444 
1445     /**
1446      * Creates a robust 2D position radio source estimator.
1447      *
1448      * @param qualityScores              quality scores corresponding to each provided
1449      *                                   sample. The larger the score value the better
1450      *                                   the quality of the sample.
1451      * @param readings                   signal readings belonging to the same radio source.
1452      * @param initialPosition            initial position to start the estimation of radio
1453      *                                   source position.
1454      * @param initialTransmittedPowerdBm initial transmitted power to start the
1455      *                                   estimation of radio source transmitted power
1456      *                                   (expressed in dBm's).
1457      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
1458      * @param listener                   listener in charge of attending events raised by this instance.
1459      * @param method                     robust estimator method.
1460      * @param <S>                        a {@link RadioSource} type.
1461      * @return a new robust 2D position radio source estimator.
1462      * @throws IllegalArgumentException if readings are not valid.
1463      */
1464     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1465             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1466             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1467             final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener,
1468             final RobustEstimatorMethod method) {
1469         return switch (method) {
1470             case RANSAC -> new RANSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1471                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
1472             case LMEDS -> new LMedSRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1473                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
1474             case MSAC -> new MSACRobustRssiRadioSourceEstimator2D<>(readings, initialPosition,
1475                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
1476             case PROSAC -> new PROSACRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition,
1477                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
1478             default -> new PROMedSRobustRssiRadioSourceEstimator2D<>(qualityScores, readings, initialPosition,
1479                     initialTransmittedPowerdBm, initialPathLossExponent, listener);
1480         };
1481     }
1482 
1483     /**
1484      * Creates a robust 2D position radio source estimator using
1485      * default method.
1486      *
1487      * @param <S> a {@link RadioSource} type.
1488      * @return a new robust 2D position radio source estimator.
1489      */
1490     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create() {
1491         return create(DEFAULT_ROBUST_METHOD);
1492     }
1493 
1494     /**
1495      * Creates a robust 2D position radio source estimator using
1496      * default method.
1497      *
1498      * @param readings signal readings belonging to the same radio source.
1499      * @param <S>      a {@link RadioSource} type.
1500      * @return a new robust 2D position radio source estimator.
1501      * @throws IllegalArgumentException if readings are not valid.
1502      */
1503     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1504             final List<? extends RssiReadingLocated<S, Point2D>> readings) {
1505         return create(readings, DEFAULT_ROBUST_METHOD);
1506     }
1507 
1508     /**
1509      * Creates a robust 2D position radio source estimator using
1510      * default method.
1511      *
1512      * @param listener listener in charge of attending events raised by this instance.
1513      * @param <S>      a {@link RadioSource} type.
1514      * @return a new robust 2D position radio source estimator.
1515      */
1516     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1517             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1518         return create(listener, DEFAULT_ROBUST_METHOD);
1519     }
1520 
1521     /**
1522      * Creates a robust 2D position radio source estimator using
1523      * default method.
1524      *
1525      * @param readings signal readings belonging to the same radio source.
1526      * @param listener listener in charge of attending events raised by this instance.
1527      * @param <S>      a {@link RadioSource} type.
1528      * @return a new robust 2D position radio source estimator.
1529      * @throws IllegalArgumentException if readings are not valid.
1530      */
1531     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1532             final List<? extends RssiReadingLocated<S, Point2D>> readings,
1533             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1534         return create(readings, listener, DEFAULT_ROBUST_METHOD);
1535     }
1536 
1537     /**
1538      * Creates a robust 2D position radio source estimator using
1539      * default method.
1540      *
1541      * @param readings        signal readings belonging to the same radio source.
1542      * @param initialPosition initial position to start the estimation of radio
1543      *                        source position.
1544      * @param <S>             a {@link RadioSource} type.
1545      * @return a new robust 2D position radio source estimator.
1546      * @throws IllegalArgumentException if readings are not valid.
1547      */
1548     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1549             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition) {
1550         return create(readings, initialPosition, DEFAULT_ROBUST_METHOD);
1551     }
1552 
1553     /**
1554      * Creates a robust 2D position radio source estimator using
1555      * default method.
1556      *
1557      * @param initialPosition initial position to start the estimation of radio
1558      *                        source position.
1559      * @param <S>             a {@link RadioSource} type.
1560      * @return a new robust 2D position radio source estimator.
1561      */
1562     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(final Point2D initialPosition) {
1563         return create(initialPosition, DEFAULT_ROBUST_METHOD);
1564     }
1565 
1566     /**
1567      * Creates a robust 2D position radio source estimator using
1568      * default method.
1569      *
1570      * @param initialPosition initial position to start the estimation of radio
1571      *                        source position.
1572      * @param listener        listener in charge of attending events raised by this instance.
1573      * @param <S>             a {@link RadioSource} type.
1574      * @return a new robust 2D position radio source estimator.
1575      */
1576     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1577             final Point2D initialPosition, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1578         return create(initialPosition, listener, DEFAULT_ROBUST_METHOD);
1579     }
1580 
1581     /**
1582      * Creates a robust 2D position radio source estimator using
1583      * default method.
1584      *
1585      * @param readings        signal readings belonging to the same radio source.
1586      * @param initialPosition initial position to start the estimation of radio
1587      *                        source position.
1588      * @param listener        listener in charge of attending events raised by this instance
1589      * @param <S>             a {@link RadioSource} type.
1590      * @return a new robust 2D position radio source estimator.
1591      * @throws IllegalArgumentException if readings are not valid.
1592      */
1593     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1594             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
1595             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1596         return create(readings, initialPosition, listener, DEFAULT_ROBUST_METHOD);
1597     }
1598 
1599     /**
1600      * Creates a robust 2D position radio source estimator using
1601      * default method.
1602      *
1603      * @param initialTransmittedPowerdBm initial transmitted power to start the
1604      *                                   estimation of radio source transmitted power
1605      *                                   (expressed in dBm's).
1606      * @param <S>                        a {@link RadioSource} type.
1607      * @return a new robust 2D position radio source estimator.
1608      */
1609     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1610             final Double initialTransmittedPowerdBm) {
1611         return create(initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
1612     }
1613 
1614     /**
1615      * Creates a robust 2D position radio source estimator using
1616      * default method.
1617      *
1618      * @param readings                   signal readings belonging to the same radio source.
1619      * @param initialTransmittedPowerdBm initial transmitted power to start the
1620      *                                   estimation of radio source transmitted power
1621      *                                   (expressed in dBm's).
1622      * @param <S>                        a {@link RadioSource} type.
1623      * @return a new robust 2D position radio source estimator.
1624      * @throws IllegalArgumentException if readings are not valid.
1625      */
1626     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1627             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Double initialTransmittedPowerdBm) {
1628         return create(readings, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
1629     }
1630 
1631     /**
1632      * Creates a robust 2D position radio source estimator using
1633      * default method.
1634      *
1635      * @param initialTransmittedPowerdBm initial transmitted power to start the
1636      *                                   estimation of radio source transmitted power
1637      *                                   (expressed in dBm's)
1638      * @param listener                   listener in charge of attending events raised by this instance.
1639      * @param <S>                        a {@link RadioSource} type.
1640      * @return a new robust 2D position radio source estimator.
1641      */
1642     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1643             final Double initialTransmittedPowerdBm,
1644             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1645         return create(initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
1646     }
1647 
1648     /**
1649      * Creates a robust 2D position radio source estimator using
1650      * default method.
1651      *
1652      * @param readings                   signal readings belonging to the same radio source.
1653      * @param initialTransmittedPowerdBm initial transmitted power to start the
1654      *                                   estimation of radio source transmitted power
1655      *                                   (expressed in dBm's)
1656      * @param listener                   listener in charge of attending events raised by this instance.
1657      * @param <S>                        a {@link RadioSource} type.
1658      * @return a new robust 2D position radio source estimator.
1659      * @throws IllegalArgumentException if readings are not valid.
1660      */
1661     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1662             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Double initialTransmittedPowerdBm,
1663             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1664         return create(readings, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
1665     }
1666 
1667     /**
1668      * Creates a robust 2D position radio source estimator using
1669      * default method.
1670      *
1671      * @param readings                   signal readings belonging to the same radio source.
1672      * @param initialPosition            initial position to start the estimation of radio
1673      *                                   source position.
1674      * @param initialTransmittedPowerdBm initial transmitted power to start the
1675      *                                   estimation of radio source transmitted power
1676      *                                   (expressed in dBm's).
1677      * @param <S>                        a {@link RadioSource} type.
1678      * @return a new robust 2D position radio source estimator.
1679      * @throws IllegalArgumentException if readings are not valid.
1680      */
1681     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1682             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
1683             final Double initialTransmittedPowerdBm) {
1684         return create(readings, initialPosition, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
1685     }
1686 
1687     /**
1688      * Creates a robust 2D position radio source estimator using
1689      * default method.
1690      *
1691      * @param initialPosition            initial position to start the estimation of radio
1692      *                                   source position.
1693      * @param initialTransmittedPowerdBm initial transmitted power to start the
1694      *                                   estimation of radio source transmitted power
1695      *                                   (expressed in dBm's).
1696      * @param <S>                        a {@link RadioSource} type.
1697      * @return a new robust 2D position radio source estimator.
1698      */
1699     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1700             final Point2D initialPosition, final Double initialTransmittedPowerdBm) {
1701         return create(initialPosition, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
1702     }
1703 
1704     /**
1705      * Creates a robust 2D position radio source estimator using
1706      * default method.
1707      *
1708      * @param initialPosition            initial position to start the estimation of radio
1709      *                                   source position.
1710      * @param initialTransmittedPowerdBm initial transmitted power to start the
1711      *                                   estimation of radio source transmitted power
1712      *                                   (expressed in dBm's).
1713      * @param listener                   listener in charge of attending events raised by this instance.
1714      * @param <S>                        a {@link RadioSource} type.
1715      * @return a new robust 2D position radio source estimator.
1716      */
1717     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1718             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1719             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1720         return create(initialPosition, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
1721     }
1722 
1723     /**
1724      * Creates a robust 2D position radio source estimator using
1725      * default method.
1726      *
1727      * @param readings                   signal readings belonging to the same radio source.
1728      * @param initialPosition            initial position to start the estimation of radio
1729      *                                   source position.
1730      * @param initialTransmittedPowerdBm initial transmitted power to start the
1731      *                                   estimation of radio source transmitted power
1732      *                                   (expressed in dBm's).
1733      * @param listener                   listener in charge of attending events raised by this instance.
1734      * @param <S>                        a {@link RadioSource} type.
1735      * @return a new robust 2D position radio source estimator.
1736      * @throws IllegalArgumentException if readings are not valid.
1737      */
1738     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1739             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
1740             final Double initialTransmittedPowerdBm,
1741             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1742         return create(readings, initialPosition, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
1743     }
1744 
1745     /**
1746      * Creates a robust 2D position radio source estimator using
1747      * default method.
1748      *
1749      * @param readings                   signal readings belonging to the same radio source.
1750      * @param initialPosition            initial position to start the estimation of radio
1751      *                                   source position.
1752      * @param initialTransmittedPowerdBm initial transmitted power to start the
1753      *                                   estimation of radio source transmitted power
1754      *                                   (expressed in dBm's).
1755      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
1756      * @param <S>                        a {@link RadioSource} type.
1757      * @return a new robust 2D position radio source estimator.
1758      * @throws IllegalArgumentException if readings are not valid.
1759      */
1760     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1761             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
1762             final Double initialTransmittedPowerdBm, final double initialPathLossExponent) {
1763         return create(readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent,
1764                 DEFAULT_ROBUST_METHOD);
1765     }
1766 
1767     /**
1768      * Creates a robust 2D position radio source estimator using
1769      * default method.
1770      *
1771      * @param initialPosition            initial position to start the estimation of radio
1772      *                                   source position.
1773      * @param initialTransmittedPowerdBm initial transmitted power to start the
1774      *                                   estimation of radio source transmitted power
1775      *                                   (expressed in dBm's).
1776      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
1777      * @param <S>                        a {@link RadioSource} type.
1778      * @return a new robust 2D position radio source estimator.
1779      */
1780     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1781             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1782             final double initialPathLossExponent) {
1783         return create(initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, DEFAULT_ROBUST_METHOD);
1784     }
1785 
1786     /**
1787      * Creates a robust 2D position radio source estimator using
1788      * default method.
1789      *
1790      * @param initialPosition            initial position to start the estimation of radio
1791      *                                   source position.
1792      * @param initialTransmittedPowerdBm initial transmitted power to start the
1793      *                                   estimation of radio source transmitted power
1794      *                                   (expressed in dBm's).
1795      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
1796      * @param listener                   listener in charge of attending events raised by this instance.
1797      * @param <S>                        a {@link RadioSource} type.
1798      * @return a new robust 2D position radio source estimator.
1799      */
1800     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1801             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
1802             final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1803         return create(initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, listener,
1804                 DEFAULT_ROBUST_METHOD);
1805     }
1806 
1807     /**
1808      * Creates a robust 2D position radio source estimator using
1809      * default method.
1810      *
1811      * @param readings                   signal readings belonging to the same radio source.
1812      * @param initialPosition            initial position to start the estimation of radio
1813      *                                   source position.
1814      * @param initialTransmittedPowerdBm initial transmitted power to start the
1815      *                                   estimation of radio source transmitted power
1816      *                                   (expressed in dBm's).
1817      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
1818      * @param listener                   listener in charge of attending events raised by this instance.
1819      * @param <S>                        a {@link RadioSource} type.
1820      * @return a new robust 2D position radio source estimator.
1821      * @throws IllegalArgumentException if readings are not valid.
1822      */
1823     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1824             final List<? extends RssiReadingLocated<S, Point2D>> readings, final Point2D initialPosition,
1825             final Double initialTransmittedPowerdBm, final double initialPathLossExponent,
1826             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1827         return create(readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, listener,
1828                 DEFAULT_ROBUST_METHOD);
1829     }
1830 
1831     /**
1832      * Creates a robust 2D position radio source estimator using
1833      * default method.
1834      *
1835      * @param qualityScores quality scores corresponding to each provided
1836      *                      sample. The larger the score value the better
1837      *                      the quality of the sample.
1838      * @param <S>           a {@link RadioSource} type.
1839      * @return a new robust 2D position radio source estimator.
1840      */
1841     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(final double[] qualityScores) {
1842         return create(qualityScores, DEFAULT_ROBUST_METHOD);
1843     }
1844 
1845     /**
1846      * Creates a robust 2D position radio source estimator using
1847      * default method.
1848      *
1849      * @param qualityScores quality scores corresponding to each provided
1850      *                      sample. The larger the score value the better
1851      *                      the quality of the sample.
1852      * @param readings      signal readings belonging to the same radio source.
1853      * @param <S>           a {@link RadioSource} type.
1854      * @return a new robust 2D position radio source estimator.
1855      * @throws IllegalArgumentException if readings are not valid.
1856      */
1857     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1858             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings) {
1859         return create(qualityScores, readings, DEFAULT_ROBUST_METHOD);
1860     }
1861 
1862     /**
1863      * Creates a robust 2D position radio source estimator using
1864      * default method.
1865      *
1866      * @param qualityScores quality scores corresponding to each provided
1867      *                      sample. The larger the score value the better
1868      *                      the quality of the sample.
1869      * @param listener      listener in charge of attending events raised by this instance.
1870      * @param <S>           a {@link RadioSource} type.
1871      * @return a new robust 2D position radio source estimator.
1872      */
1873     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1874             final double[] qualityScores, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1875         return create(qualityScores, listener, DEFAULT_ROBUST_METHOD);
1876     }
1877 
1878     /**
1879      * Creates a robust 2D position radio source estimator using
1880      * default method.
1881      *
1882      * @param qualityScores quality scores corresponding to each provided
1883      *                      sample. The larger the score value the better
1884      *                      the quality of the sample.
1885      * @param readings      signal readings belonging to the same radio source.
1886      * @param listener      listener in charge of attending events raised by this instance.
1887      * @param <S>           a {@link RadioSource} type.
1888      * @return a new robust 2D position radio source estimator.
1889      * @throws IllegalArgumentException if readings are not valid.
1890      */
1891     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1892             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1893             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1894         return create(qualityScores, readings, listener, DEFAULT_ROBUST_METHOD);
1895     }
1896 
1897     /**
1898      * Creates a robust 2D position radio source estimator using
1899      * default method.
1900      *
1901      * @param qualityScores   quality scores corresponding to each provided
1902      *                        sample. The larger the score value the better
1903      *                        the quality of the sample.
1904      * @param readings        signal readings belonging to the same radio source.
1905      * @param initialPosition initial position to start the estimation of radio
1906      *                        source position.
1907      * @param <S>             a {@link RadioSource} type.
1908      * @return a new robust 2D position radio source estimator.
1909      * @throws IllegalArgumentException if readings are not valid.
1910      */
1911     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1912             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1913             final Point2D initialPosition) {
1914         return create(qualityScores, readings, initialPosition, DEFAULT_ROBUST_METHOD);
1915     }
1916 
1917     /**
1918      * Creates a robust 2D position radio source estimator using
1919      * default method.
1920      *
1921      * @param qualityScores   quality scores corresponding to each provided
1922      *                        sample. The larger the score value the better
1923      *                        the quality of the sample.
1924      * @param initialPosition initial position to start the estimation of radio
1925      *                        source position.
1926      * @param <S>             a {@link RadioSource} type.
1927      * @return a new robust 2D position radio source estimator.
1928      */
1929     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1930             final double[] qualityScores, final Point2D initialPosition) {
1931         return create(qualityScores, initialPosition, DEFAULT_ROBUST_METHOD);
1932     }
1933 
1934     /**
1935      * Creates a robust 2D position radio source estimator using
1936      * default method.
1937      *
1938      * @param qualityScores   quality scores corresponding to each provided
1939      *                        sample. The larger the score value the better
1940      *                        the quality of the sample.
1941      * @param initialPosition initial position to start the estimation of radio
1942      *                        source position.
1943      * @param listener        listener in charge of attending events raised by this instance.
1944      * @param <S>             a {@link RadioSource} type.
1945      * @return a new robust 2D position radio source estimator.
1946      */
1947     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1948             final double[] qualityScores, final Point2D initialPosition,
1949             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1950         return create(qualityScores, initialPosition, listener, DEFAULT_ROBUST_METHOD);
1951     }
1952 
1953     /**
1954      * Creates a robust 2D position radio source estimator using
1955      * default method.
1956      *
1957      * @param qualityScores   quality scores corresponding to each provided
1958      *                        sample. The larger the score value the better
1959      *                        the quality of the sample.
1960      * @param readings        signal readings belonging to the same radio source.
1961      * @param initialPosition initial position to start the estimation of radio
1962      *                        source position.
1963      * @param listener        listener in charge of attending events raised by this instance
1964      * @param <S>             a {@link RadioSource} type.
1965      * @return a new robust 2D position radio source estimator.
1966      * @throws IllegalArgumentException if readings are not valid.
1967      */
1968     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1969             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
1970             final Point2D initialPosition, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
1971         return create(qualityScores, readings, initialPosition, listener, DEFAULT_ROBUST_METHOD);
1972     }
1973 
1974     /**
1975      * Creates a robust 2D position radio source estimator using
1976      * default method.
1977      *
1978      * @param qualityScores              quality scores corresponding to each provided
1979      *                                   sample. The larger the score value the better
1980      *                                   the quality of the sample.
1981      * @param initialTransmittedPowerdBm initial transmitted power to start the
1982      *                                   estimation of radio source transmitted power
1983      *                                   (expressed in dBm's).
1984      * @param <S>                        a {@link RadioSource} type.
1985      * @return a new robust 2D position radio source estimator.
1986      */
1987     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
1988             final double[] qualityScores, final Double initialTransmittedPowerdBm) {
1989         return create(qualityScores, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
1990     }
1991 
1992     /**
1993      * Creates a robust 2D position radio source estimator using
1994      * default method.
1995      *
1996      * @param qualityScores              quality scores corresponding to each provided
1997      *                                   sample. The larger the score value the better
1998      *                                   the quality of the sample.
1999      * @param readings                   signal readings belonging to the same radio source.
2000      * @param initialTransmittedPowerdBm initial transmitted power to start the
2001      *                                   estimation of radio source transmitted power
2002      *                                   (expressed in dBm's).
2003      * @param <S>                        a {@link RadioSource} type.
2004      * @return a new robust 2D position radio source estimator.
2005      * @throws IllegalArgumentException if readings are not valid.
2006      */
2007     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2008             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
2009             final Double initialTransmittedPowerdBm) {
2010         return create(qualityScores, readings, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
2011     }
2012 
2013     /**
2014      * Creates a robust 2D position radio source estimator using
2015      * default method.
2016      *
2017      * @param qualityScores              quality scores corresponding to each provided
2018      *                                   sample. The larger the score value the better
2019      *                                   the quality of the sample.
2020      * @param initialTransmittedPowerdBm initial transmitted power to start the
2021      *                                   estimation of radio source transmitted power
2022      *                                   (expressed in dBm's)
2023      * @param listener                   listener in charge of attending events raised by this instance.
2024      * @param <S>                        a {@link RadioSource} type.
2025      * @return a new robust 2D position radio source estimator.
2026      */
2027     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2028             final double[] qualityScores, final Double initialTransmittedPowerdBm,
2029             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
2030         return create(qualityScores, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
2031     }
2032 
2033     /**
2034      * Creates a robust 2D position radio source estimator using
2035      * default method.
2036      *
2037      * @param qualityScores              quality scores corresponding to each provided
2038      *                                   sample. The larger the score value the better
2039      *                                   the quality of the sample.
2040      * @param readings                   signal readings belonging to the same radio source.
2041      * @param initialTransmittedPowerdBm initial transmitted power to start the
2042      *                                   estimation of radio source transmitted power
2043      *                                   (expressed in dBm's)
2044      * @param listener                   listener in charge of attending events raised by this instance.
2045      * @param <S>                        a {@link RadioSource} type.
2046      * @return a new robust 2D position radio source estimator.
2047      * @throws IllegalArgumentException if readings are not valid.
2048      */
2049     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2050             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
2051             final Double initialTransmittedPowerdBm,
2052             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
2053         return create(qualityScores, readings, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
2054     }
2055 
2056     /**
2057      * Creates a robust 2D position radio source estimator using
2058      * default method.
2059      *
2060      * @param qualityScores              quality scores corresponding to each provided
2061      *                                   sample. The larger the score value the better
2062      *                                   the quality of the sample.
2063      * @param readings                   signal readings belonging to the same radio source.
2064      * @param initialPosition            initial position to start the estimation of radio
2065      *                                   source position.
2066      * @param initialTransmittedPowerdBm initial transmitted power to start the
2067      *                                   estimation of radio source transmitted power
2068      *                                   (expressed in dBm's).
2069      * @param <S>                        a {@link RadioSource} type.
2070      * @return a new robust 2D position radio source estimator.
2071      * @throws IllegalArgumentException if readings are not valid.
2072      */
2073     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2074             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
2075             final Point2D initialPosition, final Double initialTransmittedPowerdBm) {
2076         return create(qualityScores, readings, initialPosition, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
2077     }
2078 
2079     /**
2080      * Creates a robust 2D position radio source estimator using
2081      * default method.
2082      *
2083      * @param qualityScores              quality scores corresponding to each provided
2084      *                                   sample. The larger the score value the better
2085      *                                   the quality of the sample.
2086      * @param initialPosition            initial position to start the estimation of radio
2087      *                                   source position.
2088      * @param initialTransmittedPowerdBm initial transmitted power to start the
2089      *                                   estimation of radio source transmitted power
2090      *                                   (expressed in dBm's).
2091      * @param <S>                        a {@link RadioSource} type.
2092      * @return a new robust 2D position radio source estimator.
2093      */
2094     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2095             final double[] qualityScores, final Point2D initialPosition, final Double initialTransmittedPowerdBm) {
2096         return create(qualityScores, initialPosition, initialTransmittedPowerdBm, DEFAULT_ROBUST_METHOD);
2097     }
2098 
2099     /**
2100      * Creates a robust 2D position radio source estimator using
2101      * default method.
2102      *
2103      * @param qualityScores              quality scores corresponding to each provided
2104      *                                   sample. The larger the score value the better
2105      *                                   the quality of the sample.
2106      * @param initialPosition            initial position to start the estimation of radio
2107      *                                   source position.
2108      * @param initialTransmittedPowerdBm initial transmitted power to start the
2109      *                                   estimation of radio source transmitted power
2110      *                                   (expressed in dBm's).
2111      * @param listener                   listener in charge of attending events raised by this instance.
2112      * @param <S>                        a {@link RadioSource} type.
2113      * @return a new robust 2D position radio source estimator.
2114      */
2115     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2116             final double[] qualityScores, final Point2D initialPosition, final Double initialTransmittedPowerdBm,
2117             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
2118         return create(qualityScores, initialPosition, initialTransmittedPowerdBm, listener, DEFAULT_ROBUST_METHOD);
2119     }
2120 
2121     /**
2122      * Creates a robust 2D position radio source estimator using
2123      * default method.
2124      *
2125      * @param qualityScores              quality scores corresponding to each provided
2126      *                                   sample. The larger the score value the better
2127      *                                   the quality of the sample.
2128      * @param readings                   signal readings belonging to the same radio source.
2129      * @param initialPosition            initial position to start the estimation of radio
2130      *                                   source position.
2131      * @param initialTransmittedPowerdBm initial transmitted power to start the
2132      *                                   estimation of radio source transmitted power
2133      *                                   (expressed in dBm's).
2134      * @param listener                   listener in charge of attending events raised by this instance.
2135      * @param <S>                        a {@link RadioSource} type.
2136      * @return a new robust 2D position radio source estimator.
2137      * @throws IllegalArgumentException if readings are not valid.
2138      */
2139     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2140             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
2141             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
2142             final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
2143         return create(qualityScores, readings, initialPosition, initialTransmittedPowerdBm, listener,
2144                 DEFAULT_ROBUST_METHOD);
2145     }
2146 
2147     /**
2148      * Creates a robust 2D position radio source estimator using
2149      * default method.
2150      *
2151      * @param qualityScores              quality scores corresponding to each provided
2152      *                                   sample. The larger the score value the better
2153      *                                   the quality of the sample.
2154      * @param readings                   signal readings belonging to the same radio source.
2155      * @param initialPosition            initial position to start the estimation of radio
2156      *                                   source position.
2157      * @param initialTransmittedPowerdBm initial transmitted power to start the
2158      *                                   estimation of radio source transmitted power
2159      *                                   (expressed in dBm's).
2160      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
2161      * @param <S>                        a {@link RadioSource} type.
2162      * @return a new robust 2D position radio source estimator.
2163      * @throws IllegalArgumentException if readings are not valid.
2164      */
2165     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2166             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
2167             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
2168             final double initialPathLossExponent) {
2169         return create(qualityScores, readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent,
2170                 DEFAULT_ROBUST_METHOD);
2171     }
2172 
2173     /**
2174      * Creates a robust 2D position radio source estimator using
2175      * default method.
2176      *
2177      * @param qualityScores              quality scores corresponding to each provided
2178      *                                   sample. The larger the score value the better
2179      *                                   the quality of the sample.
2180      * @param initialPosition            initial position to start the estimation of radio
2181      *                                   source position.
2182      * @param initialTransmittedPowerdBm initial transmitted power to start the
2183      *                                   estimation of radio source transmitted power
2184      *                                   (expressed in dBm's).
2185      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
2186      * @param <S>                        a {@link RadioSource} type.
2187      * @return a new robust 2D position radio source estimator.
2188      */
2189     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2190             final double[] qualityScores, final Point2D initialPosition, final Double initialTransmittedPowerdBm,
2191             final double initialPathLossExponent) {
2192         return create(qualityScores, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent,
2193                 DEFAULT_ROBUST_METHOD);
2194     }
2195 
2196     /**
2197      * Creates a robust 2D position radio source estimator using
2198      * default method.
2199      *
2200      * @param qualityScores              quality scores corresponding to each provided
2201      *                                   sample. The larger the score value the better
2202      *                                   the quality of the sample.
2203      * @param initialPosition            initial position to start the estimation of radio
2204      *                                   source position.
2205      * @param initialTransmittedPowerdBm initial transmitted power to start the
2206      *                                   estimation of radio source transmitted power
2207      *                                   (expressed in dBm's).
2208      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
2209      * @param listener                   listener in charge of attending events raised by this instance.
2210      * @param <S>                        a {@link RadioSource} type.
2211      * @return a new robust 2D position radio source estimator.
2212      */
2213     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2214             final double[] qualityScores, final Point2D initialPosition, final Double initialTransmittedPowerdBm,
2215             final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
2216         return create(qualityScores, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent, listener,
2217                 DEFAULT_ROBUST_METHOD);
2218     }
2219 
2220     /**
2221      * Creates a robust 2D position radio source estimator using
2222      * default method.
2223      *
2224      * @param qualityScores              quality scores corresponding to each provided
2225      *                                   sample. The larger the score value the better
2226      *                                   the quality of the sample.
2227      * @param readings                   signal readings belonging to the same radio source.
2228      * @param initialPosition            initial position to start the estimation of radio
2229      *                                   source position.
2230      * @param initialTransmittedPowerdBm initial transmitted power to start the
2231      *                                   estimation of radio source transmitted power
2232      *                                   (expressed in dBm's).
2233      * @param initialPathLossExponent    initial path loss exponent. A typical value is 2.0.
2234      * @param listener                   listener in charge of attending events raised by this instance.
2235      * @param <S>                        a {@link RadioSource} type.
2236      * @return a new robust 2D position radio source estimator.
2237      * @throws IllegalArgumentException if readings are not valid.
2238      */
2239     public static <S extends RadioSource> RobustRssiRadioSourceEstimator2D<S> create(
2240             final double[] qualityScores, final List<? extends RssiReadingLocated<S, Point2D>> readings,
2241             final Point2D initialPosition, final Double initialTransmittedPowerdBm,
2242             final double initialPathLossExponent, final RobustRssiRadioSourceEstimatorListener<S, Point2D> listener) {
2243         return create(qualityScores, readings, initialPosition, initialTransmittedPowerdBm, initialPathLossExponent,
2244                 listener, DEFAULT_ROBUST_METHOD);
2245     }
2246 
2247     /**
2248      * Gets minimum required number of readings to estimate
2249      * power, position and path-loss exponent.
2250      * This value depends on the number of parameters to
2251      * be estimated, but for position only, this is 3
2252      * readings.
2253      *
2254      * @return minimum required number of readings.
2255      */
2256     @Override
2257     public int getMinReadings() {
2258         var minReadings = 0;
2259         if (isPositionEstimationEnabled()) {
2260             minReadings += Point2D.POINT2D_INHOMOGENEOUS_COORDINATES_LENGTH;
2261         }
2262         if (isTransmittedPowerEstimationEnabled()) {
2263             minReadings++;
2264         }
2265         if (isPathLossEstimationEnabled()) {
2266             minReadings++;
2267         }
2268         return ++minReadings;
2269     }
2270 
2271     /**
2272      * Gets number of dimensions of position points.
2273      *
2274      * @return always returns 2 dimensions.
2275      */
2276     @Override
2277     public int getNumberOfDimensions() {
2278         return Point2D.POINT2D_INHOMOGENEOUS_COORDINATES_LENGTH;
2279     }
2280 
2281     /**
2282      * Gets estimated located radio source with estimated transmitted power.
2283      *
2284      * @return estimated located radio source with estimated transmitted power or null.
2285      */
2286     @Override
2287     @SuppressWarnings("unchecked")
2288     public RadioSourceWithPowerAndLocated<Point2D> getEstimatedRadioSource() {
2289         final var readings = getReadings();
2290         if (readings == null || readings.isEmpty()) {
2291             return null;
2292         }
2293         final var source = readings.get(0).getSource();
2294 
2295         final var estimatedPosition = getEstimatedPosition();
2296         if (estimatedPosition == null) {
2297             return null;
2298         }
2299 
2300         final var estimatedPositionCovariance = getEstimatedPositionCovariance();
2301 
2302         final var transmittedPowerVariance = getEstimatedTransmittedPowerVariance();
2303         final var transmittedPowerStandardDeviation = transmittedPowerVariance != null
2304                 ? Math.sqrt(transmittedPowerVariance) : null;
2305 
2306         final var pathlossExponentVariance = getEstimatedPathLossExponentVariance();
2307         final var pathlossExponentStandardDeviation = pathlossExponentVariance != null
2308                 ? Math.sqrt(pathlossExponentVariance) : null;
2309 
2310         if (source instanceof WifiAccessPoint accessPoint) {
2311             return new WifiAccessPointWithPowerAndLocated2D(accessPoint.getBssid(), source.getFrequency(),
2312                     accessPoint.getSsid(), getEstimatedTransmittedPowerdBm(), transmittedPowerStandardDeviation,
2313                     getEstimatedPathLossExponent(), pathlossExponentStandardDeviation, estimatedPosition,
2314                     estimatedPositionCovariance);
2315         } else if (source instanceof Beacon beacon) {
2316             return new BeaconWithPowerAndLocated2D(beacon.getIdentifiers(), getEstimatedTransmittedPowerdBm(),
2317                     beacon.getFrequency(), beacon.getBluetoothAddress(), beacon.getBeaconTypeCode(),
2318                     beacon.getManufacturer(), beacon.getServiceUuid(), beacon.getBluetoothName(),
2319                     getEstimatedPathLossExponent(), transmittedPowerStandardDeviation,
2320                     pathlossExponentStandardDeviation, estimatedPosition, estimatedPositionCovariance);
2321         } else {
2322             return null;
2323         }
2324     }
2325 
2326     /**
2327      * Solves preliminary solution for a subset of samples.
2328      *
2329      * @param samplesIndices indices of subset samples.
2330      * @param solutions      instance where solution will be stored.
2331      */
2332     @Override
2333     protected void solvePreliminarySolutions(final int[] samplesIndices, final List<Solution<Point2D>> solutions) {
2334 
2335         try {
2336             innerReadings.clear();
2337             for (final var samplesIndex : samplesIndices) {
2338                 innerReadings.add(readings.get(samplesIndex));
2339             }
2340 
2341             // initial transmitted power and position might or might not be available
2342             innerEstimator.setInitialTransmittedPowerdBm(initialTransmittedPowerdBm);
2343             innerEstimator.setInitialPosition(initialPosition);
2344             innerEstimator.setInitialPathLossExponent(initialPathLossExponent);
2345 
2346             innerEstimator.setTransmittedPowerEstimationEnabled(transmittedPowerEstimationEnabled);
2347             innerEstimator.setPositionEstimationEnabled(positionEstimationEnabled);
2348             innerEstimator.setPathLossEstimationEnabled(pathLossEstimationEnabled);
2349 
2350             innerEstimator.setReadings(innerReadings);
2351 
2352             innerEstimator.estimate();
2353 
2354             final var estimatedPosition = innerEstimator.getEstimatedPosition();
2355             final var estimatedTransmittedPowerdBm = innerEstimator.getEstimatedTransmittedPowerdBm();
2356             final var estimatedPathLossExponent = innerEstimator.getEstimatedPathLossExponent();
2357             solutions.add(new Solution<>(estimatedPosition, estimatedTransmittedPowerdBm, estimatedPathLossExponent));
2358         } catch (final NavigationException ignore) {
2359             // if anything fails, no solution is added
2360         }
2361     }
2362 
2363     /**
2364      * Attempts to refine estimated position and transmitted power contained in
2365      * provided solution if refinement is requested.
2366      * This method sets a refined result and transmitted power or provided input
2367      * result if refinement is not requested or has failed.
2368      * If refinement is enabled, and it is requested to keep covariance, this method
2369      * will also keep covariance of refined result.
2370      * solution if not requested or refinement failed.
2371      *
2372      * @param result result to be refined.
2373      */
2374     protected void attemptRefine(final Solution<Point2D> result) {
2375         final var initialPosition = result.getEstimatedPosition();
2376         final var initialTransmittedPowerdBm = result.getEstimatedTransmittedPowerdBm();
2377         final var initialPathLossExponent = result.getEstimatedPathLossExponent();
2378 
2379         if (refineResult && inliersData != null) {
2380             final var inliers = inliersData.getInliers();
2381             final var nSamples = readings.size();
2382 
2383             innerReadings.clear();
2384 
2385             for (var i = 0; i < nSamples; i++) {
2386                 if (inliers.get(i)) {
2387                     // sample is inlier
2388                     innerReadings.add(readings.get(i));
2389                 }
2390             }
2391 
2392             try {
2393                 innerEstimator.setInitialPosition(initialPosition);
2394                 innerEstimator.setInitialTransmittedPowerdBm(initialTransmittedPowerdBm);
2395                 innerEstimator.setInitialPathLossExponent(initialPathLossExponent);
2396                 innerEstimator.setTransmittedPowerEstimationEnabled(transmittedPowerEstimationEnabled);
2397                 innerEstimator.setPositionEstimationEnabled(positionEstimationEnabled);
2398                 innerEstimator.setPathLossEstimationEnabled(pathLossEstimationEnabled);
2399                 innerEstimator.setReadings(innerReadings);
2400 
2401                 innerEstimator.estimate();
2402 
2403                 final var cov = innerEstimator.getEstimatedCovariance();
2404                 if (keepCovariance && cov != null) {
2405                     // keep covariance
2406                     covariance = cov;
2407 
2408                     final var dims = getNumberOfDimensions();
2409                     var pos = 0;
2410                     if (positionEstimationEnabled) {
2411                         // position estimation enabled
2412                         final var d = dims - 1;
2413                         if (estimatedPositionCovariance == null) {
2414                             estimatedPositionCovariance = covariance.getSubmatrix(0, 0, d, d);
2415                         } else {
2416                             covariance.getSubmatrix(0, 0, d, d, estimatedPositionCovariance);
2417                         }
2418                         pos += dims;
2419                     } else {
2420                         // position estimation disabled
2421                         estimatedPositionCovariance = null;
2422                     }
2423 
2424                     if (transmittedPowerEstimationEnabled) {
2425                         // transmitted power estimation enabled
2426                         estimatedTransmittedPowerVariance = covariance.getElementAt(pos, pos);
2427                         pos++;
2428                     } else {
2429                         // transmitted power estimation disabled
2430                         estimatedTransmittedPowerVariance = null;
2431                     }
2432 
2433                     if (pathLossEstimationEnabled) {
2434                         // path-loss exponent estimation enabled
2435                         estimatedPathLossExponentVariance = covariance.getElementAt(pos, pos);
2436                     } else {
2437                         // path-loss exponent estimation disabled
2438                         estimatedPathLossExponentVariance = null;
2439                     }
2440                 } else {
2441                     covariance = null;
2442                     estimatedPositionCovariance = null;
2443                     estimatedTransmittedPowerVariance = null;
2444                     estimatedPathLossExponentVariance = null;
2445                 }
2446 
2447                 estimatedPosition = innerEstimator.getEstimatedPosition();
2448                 estimatedTransmittedPowerdBm = innerEstimator.getEstimatedTransmittedPowerdBm();
2449                 estimatedPathLossExponent = innerEstimator.getEstimatedPathLossExponent();
2450             } catch (final Exception e) {
2451                 // refinement failed, so we return input value, and covariance
2452                 // becomes unavailable
2453                 covariance = null;
2454                 estimatedPositionCovariance = null;
2455                 estimatedTransmittedPowerVariance = null;
2456                 estimatedPathLossExponentVariance = null;
2457 
2458                 estimatedPosition = initialPosition;
2459                 estimatedTransmittedPowerdBm = initialTransmittedPowerdBm;
2460                 estimatedPathLossExponent = initialPathLossExponent;
2461             }
2462         } else {
2463             covariance = null;
2464             estimatedPositionCovariance = null;
2465             estimatedTransmittedPowerVariance = null;
2466             estimatedPathLossExponentVariance = null;
2467 
2468             estimatedPosition = initialPosition;
2469             estimatedTransmittedPowerdBm = initialTransmittedPowerdBm;
2470             estimatedPathLossExponent = initialPathLossExponent;
2471         }
2472     }
2473 }