1    /*
2     * Copyright 2009 :torweg free software group
3     *
4     * This program is free software: you can redistribute it and/or modify
5     * it under the terms of the GNU General Public License as published by
6     * the Free Software Foundation, either version 3 of the License, or
7     * (at your option) any later version.
8     * 
9     * This program is distributed in the hope that it will be useful,
10    * but WITHOUT ANY WARRANTY; without even the implied warranty of
11    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    * GNU General Public License for more details.
13    * 
14    * You should have received a copy of the GNU General Public License
15    * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16    *
17    */
18   package org.torweg.pulse.component.statistics.util;
19   
20   import java.io.Serializable;
21   import java.util.Set;
22   
23   import org.torweg.pulse.util.time.IHasDuration;
24   
25   /**
26    * An abstract base class representing the data of the
27    * {@code ResultIHasDurationMatrixRow}s of the
28    * {@code ResultIHasDurationMatrix}.
29    * <p>
30    * <strong>NOTE:</strong> Implementing classes are to be JAXB-enabled.
31    * </p>
32    * 
33    * @param <T>
34    *            the implementation of the underlying {@code IHasDuration}
35    * 
36    * @author Daniel Dietz
37    * @version $Revision: 1933 $
38    */
39   public abstract class AbstractRowData<T extends IHasDuration> implements
40           Serializable {
41   
42       /**
43        * The serialVersionUID.
44        */
45       private static final long serialVersionUID = -6613846935134322426L;
46   
47       /**
48        * Factory method.
49        * <p>
50        * Creates a new {@code AbstractRowData} from the given data.
51        * </p>
52        * 
53        * @param dataObject
54        *            the {@code IHasDuration}
55        * 
56        * @return a new {@code AbstractRowData}.
57        */
58       protected abstract AbstractRowData<T> create(final T dataObject);
59   
60       /**
61        * Aggregates the values of the given data.
62        * 
63        * @param dataObject
64        *            the {@code IHasDuration}
65        */
66       protected abstract void aggregate(final T dataObject);
67   
68       /**
69        * Returns the underlying {@code IHasDuration}s dataObjects.
70        * 
71        * @return the {@code IHasDuration}s dataObjects
72        */
73       public abstract Set<T> getDataObjects();
74   
75   }
76