View Javadoc

1   /*
2    * Copyright 2006 - 2012 Christina Bohk and Roland Ewald
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 p3j.experiment.results;
17  
18  import java.io.File;
19  import java.io.IOException;
20  import java.util.List;
21  
22  /**
23   * A simple interface to define functions that select data for aggregation.
24   * 
25   * See {@link AbstractAggregationSelector} for auxiliary methods.
26   * 
27   * @author Christina Bohk
28   * @author Roland Ewald
29   * 
30   */
31  public interface IAggregationSelector {
32  
33    /**
34     * Initialize the number of age classes etc.
35     * 
36     * @param numOfTrials
37     *          the number of trials
38     * @param numOfYears
39     *          the number of years
40     * @param numOfAgeClasses
41     *          the number of age classes
42     */
43    void init(int numOfTrials, int numOfYears, int numOfAgeClasses);
44  
45    /**
46     * Called to consider a single result.
47     * 
48     * @param trialCount
49     *          the trial count (i.e. index)
50     * @param result
51     *          the result
52     */
53    void consider(int trialCount, ResultsOfTrial result);
54  
55    /**
56     * Finishing the aggregation. Called after all relevant results have been
57     * considered, use this to write results.
58     * 
59     * @param destinationDir
60     *          the destination dir
61     * @param indexOrdering
62     *          the index ordering
63     * @param resultExport
64     *          the result export
65     * 
66     * @throws IOException
67     *           Signals that an I/O exception has occurred.
68     */
69    void finish(File destinationDir, List<Integer> indexOrdering,
70        ResultExport resultExport) throws IOException;
71  
72  }