Class: SciYAG::Backends::Filter

Inherits:
Object
  • Object
show all
Extended by:
Descriptions::DescriptionExtend
Includes:
Descriptions::DescriptionInclude
Defined in:
lib/SciYAG/Backends/filters/filter.rb

Overview

The base class for filters. Just an interface, in the java meaning of

the term. A filter just provides a function to apply itself.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Descriptions::DescriptionExtend

base_ancestor?, description, description_hash, description_hash_base, description_list, description_list_base, extend_object, inherit, init_param, init_params, lookup_description_extend_ancestor, param, param_noaccess, register_description, set_description, set_description_hash_base, set_description_list_base

Methods included from Descriptions::DescriptionInclude

#description, #fill_parser, #long_name, #parser_banner, #parser_options

Constructor Details

#initializeFilter

Returns a new instance of Filter.



32
33
# File 'lib/SciYAG/Backends/filters/filter.rb', line 32

def initialize
end

Class Method Details

.describe(name, longname, desc) ⇒ Object

Creates a description object with the given texts and associates it with the class. To be used in Filter subclasses, simply this way:

describe "biniou", "Biniou filter", "A filter to take out Binious"

Please remember also that if you don’t set a description for your Filter, it will most likely be of no use to anyone…



43
44
45
46
47
# File 'lib/SciYAG/Backends/filters/filter.rb', line 43

def Filter.describe(name, longname, desc)
  d = FilterDescription.new(self,name, longname, desc)
  set_description(d)
  register_description(d)
end

Instance Method Details

#apply(a) ⇒ Object

Gets a Function (or assimilate ?) and applies the filter on them. The functions *should not modify any data in ary*. By default, the mechanism is to make a copy of the data and apply apply! on it.



53
54
55
56
57
# File 'lib/SciYAG/Backends/filters/filter.rb', line 53

def apply(a)
  f = Dobjects::Function.new(a.x.dup, a.y.dup)
  apply!(f)
  return f
end

#apply!(func) ⇒ Object

This version modifies directly the Function inside the f.



60
61
62
# File 'lib/SciYAG/Backends/filters/filter.rb', line 60

def apply!(func)
  return func
end