我想做;
从映射结构中包含的任何数组列表元素的 CEP 开始,并继续使用我已启动的其余数组列表元素。
映射和图案结构:
final Map< Integer,ArrayList<String>> deger = new HashMap<Integer,ArrayList<String>>();
deger.put(1,new ArrayList<String>(Arrays.asList("h:1","l:1","g:0")));
deger.put(2,new ArrayList<String>(Arrays.asList("h:1","l:1","g:1")));
deger.put(3,new ArrayList<String>(Arrays.asList("h:2","l:3","g:1")));
deger.put(4,new ArrayList<String>(Arrays.asList("h:0","l:2","g:2")));
for(int i=1;i<deger.size()+1;i++) {
temp1.add(deger.get(i));
}
Pattern<String,?> pattern = Pattern.<String>begin("start").where(
new SimpleCondition<String>() {
// @Override
public boolean filter(String value) throws Exception {
for (ArrayList<String> aa: temp1){
for (String dd : aa)
if(value.equals(dd)){
return true;
}
}
return false;
}
}
).followedBy("middle").where(
new SimpleCondition<String>() {
@Override
public boolean filter(String value) throws Exception {
return value.equals(temp1.get(1));
}
}
).followedBy("end").where(
new SimpleCondition<String>() {
@Override
public boolean filter(String value) throws Exception {
return value.equals(temp1.get(2));
}
}
);
我的目的是在映射中使用数组列表元素发出警告,但是数组列表元素的顺序并不重要,因为其中的流流。我想继续处理此数组的其余元素,当我从此处的任何数组开始时,我可以返回此数组的信息。例如:
Incoming data = "l:1","h:1","g:0"
my pattern = "h:1","l:1","g:0"
Start -> l:1 find
Middle -> g:0 or h:1 | h:1 find
End -> g:0 find -> alarm
慕妹3242003
慕少森
相关分类