MOA 12.03
Real Time Analytics for Data Streams
AbstractStreamFilter.java
Go to the documentation of this file.
00001 /*
00002  *    AbstractStreamFilter.java
00003  *    Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
00004  *    @author Richard Kirkby ([email protected])
00005  *
00006  *    This program is free software; you can redistribute it and/or modify
00007  *    it under the terms of the GNU General Public License as published by
00008  *    the Free Software Foundation; either version 3 of the License, or
00009  *    (at your option) any later version.
00010  *
00011  *    This program is distributed in the hope that it will be useful,
00012  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *    GNU General Public License for more details.
00015  *
00016  *    You should have received a copy of the GNU General Public License
00017  *    along with this program. If not, see <http://www.gnu.org/licenses/>.
00018  *    
00019  */
00020 package moa.streams.filters;
00021 
00022 import moa.core.ObjectRepository;
00023 import moa.options.AbstractOptionHandler;
00024 import moa.streams.InstanceStream;
00025 import moa.tasks.TaskMonitor;
00026 
00033 public abstract class AbstractStreamFilter extends AbstractOptionHandler
00034         implements StreamFilter {
00035 
00037     protected InstanceStream inputStream;
00038 
00039     @Override
00040     public void setInputStream(InstanceStream stream) {
00041         this.inputStream = stream;
00042         prepareForUse();
00043     }
00044 
00045     @Override
00046     public void prepareForUseImpl(TaskMonitor monitor,
00047             ObjectRepository repository) {
00048         restartImpl();
00049     }
00050 
00051     @Override
00052     public long estimatedRemainingInstances() {
00053         return this.inputStream.estimatedRemainingInstances();
00054     }
00055 
00056     @Override
00057     public boolean hasMoreInstances() {
00058         return this.inputStream.hasMoreInstances();
00059     }
00060 
00061     @Override
00062     public boolean isRestartable() {
00063         return this.inputStream.isRestartable();
00064     }
00065 
00066     @Override
00067     public void restart() {
00068         this.inputStream.restart();
00069         restartImpl();
00070     }
00071 
00077     protected abstract void restartImpl();
00078 }
 All Classes Namespaces Files Functions Variables Enumerations