001 package net.sourceforge.mp3dings.filter;
002
003 /* Mp3dings - manage mp3 meta-information
004 * Copyright (C) 2003 Moritz Ringler
005 * $Id: Filter.java 13 2007-07-27 09:52:39Z ringler $
006 *
007 * This program is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU General Public License
009 * as published by the Free Software Foundation; either version 2
010 * of the License, or (at your option) any later version.
011 *
012 * This program is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015 * GNU General Public License for more details.
016 *
017 * You should have received a copy of the GNU General Public License
018 * along with this program; if not, write to the Free Software
019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020 */
021
022 import java.io.Serializable;
023
024 /** A filter processes an input value in some pre-defined way to produce
025 * a derived value of the same type.
026 * @author Moritz Ringler
027 * @version $Revision: 13 $ ($Date: 2007-07-27 11:52:39 +0200 (Fr, 27 Jul 2007) $)
028 */
029 public interface Filter extends Serializable{
030 static final long serialVersionUID = -2882260606963996591L;
031
032 /** Filters the Object val.
033 * @param val the object to filter
034 * @return the filtered object. It must be an instance of the class of val.
035 * Implementations should assure this with an assert statement
036 * such as<p>
037 * <code>assert returnval == null || val == null || val.getClass().isInstance(returnval);</code>
038 **/
039 public Object filter(Object val);
040
041 // /** Saves the filter to a Preference node under the given key. Implementations
042 // * should provide a static method that loads a saved FieldFilter:<p>
043 // * <code>static FieldFilter load(Preferences node, String key)</code>.
044 // * @param node a user or system preferences node
045 // * @param key a string that serves to identify the filter in the preferences
046 // **/
047 // public void save(Preferences node, String key);
048 //
049 // public void setName(String s);
050 //
051 // public String getName();
052 //
053 // /** The unique number identifying this particular filter object. **/
054 // public long getId();
055 }