java - Define filters order -
i'm trying code filters text processor. receive socket files have process line line. each line need apply filters , in specific order. example, 1 file i'll use filter 1, filter 2, filter 3 , after filter 2 again.
my question best way run filters in specific order , how define them can add more filters without have change lot of code? best way ensure high speed executing filters line line?
i use chain of responsibility.
assume filter says either true
(include/accept line),
or false
(do not include i.e. reject line).
so chain several filters in chain, if filter 1 returns true
,
pass line next filter 2 (and on). otherwise
(if filter chain says false
), reject line and
don't go checking next filter chain.
chain of responsibility pattern
what best way ensure high speed
executing filters line line?
this depends on many factors so
hard give response on it.
Comments
Post a Comment