Class FilterBase

java.lang.Object
de.grogra.pf.io.FilterBase
All Implemented Interfaces:
Filter, FilterSource, RegistryContext, Map
Direct Known Subclasses:
CompilationFilter, CompiledRGGFilter, CSVWriter, DTDFilter, DTDSourceFile.Loader, DTGFilter, ExcelWriter, FunctionReader, GLTFLoader, GraphObjectFilter, GraphReader, GSDWriterFilter, GSReader, GSWriter, GSZCWriter, GSZReader, GSZWriter, GUnzipFilter, GZipFilter, HTMLWriter, IESFilter, ImageReader, ImageWriter, ImportFilter, ImportFilter, LazyFilter, LuminanceFilter, MSMLProjectLoader, MSMLReader, MSMLWriter, MTGFilter, MTGLoader, MTGReader, MTGSourceFile.Loader, NullResourceFilter, OptionsSource.Loader, PDBImport, PDFWriter, PlainTextWriter, PointCloudFilterBase, QSMImporter, RegistryReader, SAXFilterBase, SceneGraphExport, SMBFilter, SourceFile.Loader, SPDFilter, SQLGraphLoader, SubGraphFilter, X3DImport, XEGImportFilter, XEGImportScene, XFrogFilter, XFrogProjectLoader, XLFilter, XMLReaderBase, XMLWriter

public abstract class FilterBase extends Object implements Filter, FilterSource, Map
This is a base class for the implementation of Filters. Its implementation of getMetaData forwards to #getImpl(Object, Object) firstly, then to the item which defines this filter, then to the meta data of the source, and returns the first value which could be found this way.
Author:
Ole Kniemeyer
  • Field Details

    • item

      protected final FilterItem item
      The defining FilterItem for this filter.
    • source

      protected final FilterSource source
      The data source of this filter.
  • Constructor Details

    • FilterBase

      public FilterBase(FilterItem item, FilterSource source)
      Creates a new FilterBase, initializes its item and source fields and sets the system id to the system id of the source.
      Parameters:
      item - the defining FilterItem
      source - the data source
  • Method Details

    • getSource

      public final FilterSource getSource()
      Description copied from interface: Filter
      Returns the data source of this filter.
      Specified by:
      getSource in interface Filter
      Returns:
      the data source of this filter
    • getFilter

      public final Filter getFilter()
      Description copied from interface: FilterSource
      Returns the Filter from which this instance obtains its data. If there is no such filter, i.e., if this is the first object in the filter pipeline, this method returns null.
      Specified by:
      getFilter in interface FilterSource
      Returns:
      the filter from which data is obtained, or null
    • getRegistry

      public final Registry getRegistry()
      Description copied from interface: RegistryContext
      Returns the Registry which is linked with this instance.
      Specified by:
      getRegistry in interface RegistryContext
      Returns:
      the registry linked with this instance
    • getFlavor

      public final IOFlavor getFlavor()
      Description copied from interface: FilterSource
      Returns the IOFlavor of this data source. Depending on the flavor, this instance has to implement corresponding subinterfaces of FilterSource.
      Specified by:
      getFlavor in interface FilterSource
      Returns:
      the flavor of the data
    • setFlavor

      protected final void setFlavor(IOFlavor flavor)
    • getSystemId

      public final String getSystemId()
      Description copied from interface: FilterSource
      Returns a system id which identifies this source.
      Specified by:
      getSystemId in interface FilterSource
      Returns:
      system id
    • setSystemId

      protected final void setSystemId(String systemId)
    • toURL

      public URL toURL() throws MalformedURLException
      Throws:
      MalformedURLException
    • initProgressMonitor

      public void initProgressMonitor(ProgressMonitor monitor)
      Specified by:
      initProgressMonitor in interface FilterSource
    • setProgress

      public void setProgress(String text, float progress)
      Specified by:
      setProgress in interface FilterSource
    • setMetaData

      protected void setMetaData(Map metaData)
      Sets the internal meta data map to the specified map.
      Parameters:
      metaData - a value for the internal meta data map
    • get

      public Object get(Object key, Object defaultValue)
      Description copied from interface: Map
      Returns the value associated with key. If there is no value associated with key, defaultValue is returned.
      Specified by:
      get in interface Map
      Parameters:
      key - a key for the map
      defaultValue - the default value
      Returns:
      the associated value, or defaultValue
    • getMetaData

      public <V> V getMetaData(FilterSource.MetaDataKey<V> key, V defaultValue)
      Specified by:
      getMetaData in interface FilterSource
    • setMetaData

      public <V> void setMetaData(FilterSource.MetaDataKey<V> key, V value)
      Specified by:
      setMetaData in interface FilterSource
    • getImpl

      protected Object getImpl(FilterSource.MetaDataKey key, Object defaultValue)
      This method is invoked by get(Object, Object). This default implementation forwards to the internal meta data map (see setMetaData(Map)), or returns defaultValue if no such internal map has been set.
      Parameters:
      key - a key
      defaultValue - a default value
      Returns:
      the associated value, or defaultValue
    • toString

      public String toString()
      Overrides:
      toString in class Object