First attempt for matching multi topic selector

This commit is contained in:
selva.andre
2012-08-08 21:26:35 +02:00
parent 372af61076
commit 2ec0c76ba2
@@ -78,6 +78,10 @@ public class SubscriptionsStore {
//check the matching of the current token //check the matching of the current token
//TODO take care of MULTI and SINGLE //TODO take care of MULTI and SINGLE
// if (m_token == Token.MULTI) {
// matchingSubs.addAll(m_subscriptions);
// return;
// }
List<TreeNode> matchingChildren = new ArrayList<TreeNode>(); List<TreeNode> matchingChildren = new ArrayList<TreeNode>();
for (TreeNode child : m_children) { for (TreeNode child : m_children) {
@@ -86,12 +90,16 @@ public class SubscriptionsStore {
} }
} }
if (matchingChildren.isEmpty()) { // if (matchingChildren.isEmpty()) {
return; // return;
} // }
for (TreeNode child : matchingChildren) { for (TreeNode child : matchingChildren) {
child.matches(tokens, matchingSubs); if (child.getToken() == Token.MULTI) {
matchingSubs.addAll(m_subscriptions);
} else {
child.matches(tokens, matchingSubs);
}
} }
} }
@@ -165,6 +173,11 @@ public class SubscriptionsStore {
} }
return true; return true;
} }
@Override
public String toString() {
return name;
}
} }
// private List<Subscription> subscriptions = new ArrayList<Subscription>(); // private List<Subscription> subscriptions = new ArrayList<Subscription>();