1 /*
2 * This file is a part of CAST project.
3 * (c) Copyright 2007, AGH University of Science & Technology
4 * https://caribou.iisg.agh.edu.pl/trac/cast
5 *
6 * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7 * You may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 * http://www.eclipse.org/legal/epl-v10.html
10 */
11 /*
12 * File: IConverter.java
13 * Created: 2009-08-04
14 * Author: tmilos
15 * $Id$
16 */
17
18 package pl.edu.agh.cast.data.converter;
19
20 import java.util.List;
21
22 import pl.edu.agh.cast.common.collections.MultiMap;
23 import pl.edu.agh.cast.data.model.IDataSet;
24 import pl.edu.agh.cast.data.model.IElement;
25
26 /**
27 * An interface of a data set converter.
28 *
29 * <p>
30 * Converters allow for transforming one or more (input) data sets of specified type into a new (output) data set of
31 * specified type. Information about input entries and output type are encapsulated in converter specification.
32 *
33 * @see ConverterSpecification
34 *
35 * @author AGH CAST Team
36 */
37 public interface IConverter {
38
39 /**
40 * Returns the converter specification.
41 *
42 * @return the converter specification
43 */
44 public ConverterSpecification getSpecification();
45
46 /**
47 * Converts given input data sets into a new output data set.
48 *
49 * @param <T>
50 * the type of conversion output data set
51 * @param dataSets
52 * a map of data sets indexed by the input entries returned by the {@link #getInputEntries()} method
53 * @return an instance of a data set of the same type as returned by the {@link #getOutputType()} method
54 *
55 * @throws ConverterException
56 * if the input data sets do not conform to the input entry specification or a data set conversion
57 * failed
58 */
59 public <T extends IDataSet<? extends IElement>> T convert(
60 MultiMap<ConverterInputEntry, ? extends IDataSet<? extends IElement>> dataSets) throws ConverterException;
61
62 /**
63 * Converts given input data sets into a new output data set.
64 *
65 * @param <T>
66 * the type of conversion output data set
67 * @param dataSets
68 * a list of data sets
69 * @return an instance of a data set of the same type as returned by the {@link #getOutputType()} method
70 *
71 * @throws ConverterException
72 * if the input data sets do not conform to the input entry specification or a data set conversion
73 * failed
74 */
75 public <T extends IDataSet<? extends IElement>> T convert(List<? extends IDataSet<? extends IElement>> dataSets)
76 throws ConverterException;
77
78 }