Class Filter

java.lang.Object
org.eclipse.scanning.api.AbstractNameable
org.eclipse.scanning.api.filter.Filter
All Implemented Interfaces:
IFilter<String>, INameable

public class Filter extends AbstractNameable implements IFilter<String>
A springable class which encapsulates information for a given feature.

Filters

Filters work as follows:

 L = list of things to be filtered
 e = excluded function
 i = included function
 l = filtered list.
 

l = L-e(L)+i(L)

This means that all combinations are possible. An exclude of .* may be applied if only particular devices are required in the filter and everything done with includes. A particular set of devices may be removed but if one is required, it may be added back in with the final include.

Example Spring

        <bean id="filter" class="org.eclipse.scanning.api.filter.Filter" init-method="register">
        	<property name="name" value="org.eclipse.scanning.scannableFilter"/>
        	<property name="excludes">
        		<list>
        			<value>monitor.*</value>
        			<value>a</value>
        			<value>b</value>
        			<value>c</value>
        			<value>beam.*</value>
        			<value>neXusScannable.*</value>
        			<value>monitor1</value>
        		</list>
        	</property>
        	<property name="includes">
        		<list>
        			<value>monitor.*</value>
        			<value>beamcurrent</value>
        			<value>neXusScannable2</value>
        			<value>neXusScannable</value> <!--  Should not match anything -->
        		</list>
        	</property>
       <property name="bundle"   value="org.eclipse.scanning.example" /> <!-- Delete for real spring? -->
        </bean>
          
  • Constructor Details

    • Filter

      public Filter()
  • Method Details

    • register

      public void register()
    • getExcludes

      public List<String> getExcludes()
      Description copied from interface: IFilter
      The list of exclude regular expressions These regular expressions are matched with the String.matches(String) method.
      Specified by:
      getExcludes in interface IFilter<String>
      Returns:
    • setExcludes

      public void setExcludes(List<String> excludes)
      Description copied from interface: IFilter
      The list of exclude regular expressions These regular expressions are matched with the String.matches(String) method.
      Specified by:
      setExcludes in interface IFilter<String>
    • getIncludes

      public List<String> getIncludes()
      Description copied from interface: IFilter
      The list of include regular expressions These regular expressions are matched with the String.matches(String) method.
      Specified by:
      getIncludes in interface IFilter<String>
      Returns:
    • setIncludes

      public void setIncludes(List<String> includes)
      Description copied from interface: IFilter
      The list of include regular expressions These regular expressions are matched with the String.matches(String) method.
      Specified by:
      setIncludes in interface IFilter<String>
    • filter

      public List<String> filter(Collection<String> items)
      Specified by:
      filter in interface IFilter<String>
      Parameters:
      items -
      Returns:
      filtered set
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractNameable
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class AbstractNameable
    • toString

      public String toString()
      Overrides:
      toString in class AbstractNameable