| 1 | package de.uka.ipd.sdq.pipesandfilters.framework.filters; |
| 2 | |
| 3 | import de.uka.ipd.sdq.pipesandfilters.framework.MetaDataInit; |
| 4 | import de.uka.ipd.sdq.pipesandfilters.framework.PipeData; |
| 5 | import de.uka.ipd.sdq.pipesandfilters.framework.PipeElement; |
| 6 | |
| 7 | /** |
| 8 | * The Filter class is the super class of any implemented filter in the pipe. A |
| 9 | * filter has exactly one successive pipe element to which every received data |
| 10 | * should be forwarded. |
| 11 | * |
| 12 | * @author Baum |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | public abstract class Filter extends PipeElement { |
| 17 | |
| 18 | /** |
| 19 | * The default constructor of a Filter. This constructor sets MAX_IN_DEGREE |
| 20 | * to 1 and MAX_OUT_DEGREE to Integer.MAX_VALUE. |
| 21 | */ |
| 22 | protected Filter() { |
| 23 | super(1, Integer.MAX_VALUE); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * The constructor of a Filter. |
| 28 | * |
| 29 | * @param MAX_IN_DEGREE |
| 30 | * The maximum in degree of the filter. |
| 31 | * @param MAX_OUT_DEGREE |
| 32 | * The maximum out degree of the filter. |
| 33 | */ |
| 34 | protected Filter(int MAX_IN_DEGREE, int MAX_OUT_DEGREE) { |
| 35 | super(MAX_IN_DEGREE, MAX_OUT_DEGREE); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * If this method is not overridden by the filter implementation, this |
| 40 | * method does nothing |
| 41 | */ |
| 42 | protected void initialize(MetaDataInit metaDataInit) { |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * If this method is not overridden by the filter implementation, this |
| 47 | * method does nothing except forwarding the flush instruction. |
| 48 | */ |
| 49 | protected void flush() { |
| 50 | forwardFlush(); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * If this method is not overridden by the filter implementation, the data |
| 55 | * is simply forwarded to the successive element in the pipe |
| 56 | */ |
| 57 | protected void processData(PipeData data) { |
| 58 | forwardData(data); |
| 59 | } |
| 60 | } |