Research Article
SCondi: A Smart Context Distribution Framework Based on a Messaging Service for the Internet of Things
Algorithm 2
Example of filter chain.
| ⋯ | | FilterChain = | | Channel.getFilterChain(CurrentWeight) | | FilterChain.addFirst(new AverageFilter(10)); | | FilterChain.addLast(new ChangedValueFilter()); | | ⋯ | | class AverageFilter | | implemented Filter | | | ⋯ ⋯ | | Object execute(Object c) | | sum += c; | | if (checkCount()) | | result = sum/avgCount; | | init(); | | return nextFilter.execute(result); | | | | ⋯ ⋯ | | | class ChangedValueFilter | | implemented Filter | | ⋯ ⋯ | | Object execute(Object c) | | old = cur; | | cur = c; | | if (isChanged() == true) | | return nextFilter.execute(cur); | | ⋯ | |
|