| Algorithm 1 Data Aggregation with Pattern Matching. |
| INITIALIZATIONS |
| thresholdvalue |
| code |
| p_code = Generate_pattern_code(data,code) |
| END INITIALIZATIONS |
| int Generate_pattern_code(data,code) |
| { |
| data_matched = Compare_data_with_stored_pattern(data,code) |
| if (data_matched) then |
| return (code) |
| else |
| return () |
| end if |
| } END Generate_pattern_code |
| if (p_code ) then |
| send_data(data) |
| else |
| send_data(p_code) |
| end if |