Mp3dings 
20100427

net.sourceforge.mp3dings.filter
Class SubstringFilter

java.lang.Object
  extended by net.sourceforge.mp3dings.utils.Bean
      extended by net.sourceforge.mp3dings.filter.FilterBean
          extended by net.sourceforge.mp3dings.filter.AbstractStringFilter
              extended by net.sourceforge.mp3dings.filter.SubstringFilter
All Implemented Interfaces:
Serializable, Filter

public class SubstringFilter
extends AbstractStringFilter

A filter that extracts a substring from a string.

Version:
$Revision: 13 $ ($Date: 2007-07-27 11:52:39 +0200 (Fr, 27 Jul 2007) $)
Author:
Moritz Ringler
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.mp3dings.utils.Bean
L_NO_ID, NO_ID, PROPERTY_ID, PROPERTY_NAME
 
Constructor Summary
SubstringFilter()
          Constructs a filter with its indices initialized so that it returns all objects unchanged.
SubstringFilter(int loi, int upi)
          Constructs a new filter with the given indices.
 
Method Summary
 boolean equals(Object o)
           
 String filterString(String s)
           
 int getLowerIndex()
          Gets the lower index of this filter.
 int getUpperIndex()
          Gets the upper index of this filter.
 int hashCode()
           
static Bean load(Preferences pref, String key)
          returns a SubstringFilter or null
 void setIndices(int loi, int upi)
          Sets both lower and upper indices of this filter.
 void setLowerIndex(int loi)
          Sets the lower index used for substring filtering.
 void setUpperIndex(int upi)
          Sets the upper index used for substring filtering.
 
Methods inherited from class net.sourceforge.mp3dings.filter.AbstractStringFilter
filter
 
Methods inherited from class net.sourceforge.mp3dings.utils.Bean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getConstraints, getId, getName, getPropertyChangeListeners, getPropertyChangeListeners, isSavable, load, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubstringFilter

public SubstringFilter()
Constructs a filter with its indices initialized so that it returns all objects unchanged.


SubstringFilter

public SubstringFilter(int loi,
                       int upi)
Constructs a new filter with the given indices.

Parameters:
loi - the lower index
upi - the upper index
See Also:
setUpperIndex(int), setLowerIndex(int)
Method Detail

load

public static Bean load(Preferences pref,
                        String key)
returns a SubstringFilter or null


setLowerIndex

public void setLowerIndex(int loi)
Sets the lower index used for substring filtering. The actual start index of each substring is determined as follows: If the lower index loi is positive the start index will be loi. If loi < 0 characters will be counted from the end of the String with its last character having index -1. A start index < 0 is equivalent to 0.


getLowerIndex

public int getLowerIndex()
Gets the lower index of this filter.

See Also:
setLowerIndex(int)

setUpperIndex

public void setUpperIndex(int upi)
Sets the upper index used for substring filtering. The actual stop index of each substring is determined as follows: If the upper index upi is positive the start index will be upi. If upi < 0 characters will be counted from the end of the String with its last character having index -1. A stop index greater than the length of the String s is equivalent to s.length().


getUpperIndex

public int getUpperIndex()
Gets the upper index of this filter.

See Also:
setUpperIndex(int)

setIndices

public void setIndices(int loi,
                       int upi)
Sets both lower and upper indices of this filter.

Parameters:
loi - the lower index
upi - the upper index
See Also:
setUpperIndex(int), setLowerIndex(int)

filterString

public String filterString(String s)
Specified by:
filterString in class AbstractStringFilter

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

Mp3dings 
20100427