From 2ec0c76ba2aebc35b5c8a27ebb29886464320697 Mon Sep 17 00:00:00 2001 From: "selva.andre" Date: Wed, 8 Aug 2012 21:26:35 +0200 Subject: [PATCH] First attempt for matching multi topic selector --- .../spi/impl/SubscriptionsStore.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/parser/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/SubscriptionsStore.java b/parser/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/SubscriptionsStore.java index f1335450..2a041da7 100644 --- a/parser/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/SubscriptionsStore.java +++ b/parser/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/SubscriptionsStore.java @@ -78,6 +78,10 @@ public class SubscriptionsStore { //check the matching of the current token //TODO take care of MULTI and SINGLE +// if (m_token == Token.MULTI) { +// matchingSubs.addAll(m_subscriptions); +// return; +// } List matchingChildren = new ArrayList(); for (TreeNode child : m_children) { @@ -86,12 +90,16 @@ public class SubscriptionsStore { } } - if (matchingChildren.isEmpty()) { - return; - } +// if (matchingChildren.isEmpty()) { +// return; +// } 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; } + + @Override + public String toString() { + return name; + } } // private List subscriptions = new ArrayList();