1 /*
2 * Copyright (C) 2013 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.numerical.robust;
17
18 /**
19 * Listener to be notified of events on a robust estimator such as when
20 * estimation starts, ends or when progress changes.
21 *
22 * @param <T> type of instance being estimated.
23 */
24 public interface RobustEstimatorListener<T> {
25
26 /**
27 * Called to determine when a robust estimator is ready to start estimation.
28 * This is true when all required data to start estimation is available
29 *
30 * @return true if robust estimator is ready to start estimation, false
31 * otherwise.
32 */
33 boolean isReady();
34
35 /**
36 * Called when estimation starts.
37 *
38 * @param estimator reference to robust estimator.
39 */
40 void onEstimateStart(final RobustEstimator<T> estimator);
41
42 /**
43 * Called when estimation ends.
44 *
45 * @param estimator reference to robust estimator.
46 */
47 void onEstimateEnd(final RobustEstimator<T> estimator);
48
49 /**
50 * Called when estimator iterates to refine a possible solution.
51 *
52 * @param estimator reference to robust estimator.
53 * @param iteration current iteration.
54 */
55 void onEstimateNextIteration(final RobustEstimator<T> estimator, final int iteration);
56
57 /**
58 * Called when estimation progress changes significantly.
59 *
60 * @param estimator reference to robust estimator.
61 * @param progress progress of estimation expressed as a value between 0.0
62 * and 1.0.
63 */
64 void onEstimateProgressChange(final RobustEstimator<T> estimator, final float progress);
65 }