test_class.declarator: topicName = "com.weevent.test"
test_class.modifier: private
test_class.original_string: private String topicName = "com.weevent.test";
test_class.type: String
test_class.var_name: topicName
test_class.declarator: patternTopic = "com/weevent/test"
test_class.modifier: private final static
test_class.original_string: private final static String patternTopic = "com/weevent/test";
test_class.type: String
test_class.var_name: patternTopic
test_class.declarator: tag = "tag_name"
test_class.modifier: private final static
test_class.original_string: private final static String tag = "tag_name";
test_class.type: String
test_class.var_name: tag
test_class.declarator: content = "hello world".getBytes(StandardCharsets.UTF_8)
test_class.modifier: private final static
test_class.original_string: private final static byte[] content = "hello world".getBytes(StandardCharsets.UTF_8);
test_class.type: byte[]
test_class.var_name: content
test_class.file: weevent-core/src/test/java/com/webank/weevent/core/task/SubscriptionTest.java
test_class.identifier: SubscriptionTest
test_class.superclass: extends JUnitTestBase
test_case.body: @Test
      public void testFilterPatternSharp7() {
          Map<String, String> ext = new HashMap<>();
          ext.put(WeEvent.WeEvent_TAG, tag);
  
          List<WeEvent> from = new ArrayList<>();
          from.add(new WeEvent(patternTopic, content, ext));
  
          String[] topics = {"com/#/test", topicName};
          List<WeEvent> to = Subscription.filter(from, topics, tag);
  
          Assert.assertTrue(to.isEmpty());
      }
test_case.class_method_signature: SubscriptionTest.testFilterPatternSharp7()
test_case.full_signature: @Test public void testFilterPatternSharp7()
test_case.identifier: testFilterPatternSharp7
test_case.invocations: put add filter assertTrue isEmpty
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFilterPatternSharp7()
focal_class.declarator: uuid
focal_class.modifier: private
focal_class.original_string: private String uuid;
focal_class.type: String
focal_class.var_name: uuid
focal_class.declarator: topics
focal_class.modifier: private
focal_class.original_string: private String[] topics;
focal_class.type: String[]
focal_class.var_name: topics
focal_class.declarator: groupId
focal_class.modifier: private
focal_class.original_string: private String groupId;
focal_class.type: String
focal_class.var_name: groupId
focal_class.declarator: offset
focal_class.modifier: private
focal_class.original_string: private String offset;
focal_class.type: String
focal_class.var_name: offset
focal_class.declarator: tag
focal_class.modifier: private
focal_class.original_string: private String tag;
focal_class.type: String
focal_class.var_name: tag
focal_class.declarator: interfaceType
focal_class.modifier: private
focal_class.original_string: private String interfaceType;
focal_class.type: String
focal_class.var_name: interfaceType
focal_class.declarator: remoteIp
focal_class.modifier: private
focal_class.original_string: private String remoteIp;
focal_class.type: String
focal_class.var_name: remoteIp
focal_class.declarator: createTimeStamp = new Date()
focal_class.modifier: private
focal_class.original_string: private Date createTimeStamp = new Date();
focal_class.type: Date
focal_class.var_name: createTimeStamp
focal_class.declarator: idleTime
focal_class.modifier: private
focal_class.original_string: private int idleTime;
focal_class.type: int
focal_class.var_name: idleTime
focal_class.declarator: notifyTask
focal_class.modifier: @ToString.Exclude
      private
focal_class.original_string: @ToString.Exclude
      private NotifyTask notifyTask;
focal_class.type: NotifyTask
focal_class.var_name: notifyTask
focal_class.declarator: historyEventLoop
focal_class.modifier: @ToString.Exclude
      private
focal_class.original_string: @ToString.Exclude
      private HistoryEventLoop historyEventLoop;
focal_class.type: HistoryEventLoop
focal_class.var_name: historyEventLoop
focal_class.declarator: mergeCache
focal_class.modifier: private
focal_class.original_string: private Map<String, Long> mergeCache;
focal_class.type: Map<String, Long>
focal_class.var_name: mergeCache
focal_class.declarator: mergeBlock = 8
focal_class.modifier: private
focal_class.original_string: private int mergeBlock = 8;
focal_class.type: int
focal_class.var_name: mergeBlock
focal_class.declarator: historyBlock = 0L
focal_class.modifier: private
focal_class.original_string: private Long historyBlock = 0L;
focal_class.type: Long
focal_class.var_name: historyBlock
focal_class.file: weevent-core/src/main/java/com/webank/weevent/core/task/Subscription.java
focal_class.identifier: Subscription
focal_class.class_method_signature: Subscription.Subscription(IBlockChain blockChain, String uuid, String[] topics, String groupId, String offset, String tag, IConsumer.ConsumerListener listener)
focal_class.full_signature: public  Subscription(IBlockChain blockChain, String uuid, String[] topics, String groupId, String offset, String tag, IConsumer.ConsumerListener listener)
focal_class.identifier: Subscription
focal_class.modifiers: public
focal_class.parameters: (IBlockChain blockChain, String uuid, String[] topics, String groupId, String offset, String tag, IConsumer.ConsumerListener listener)
focal_class.signature:  Subscription(IBlockChain blockChain, String uuid, String[] topics, String groupId, String offset, String tag, IConsumer.ConsumerListener listener)
focal_class.class_method_signature: Subscription.getNotifyingEventCount()
focal_class.full_signature: public Long getNotifyingEventCount()
focal_class.identifier: getNotifyingEventCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Long
focal_class.signature: Long getNotifyingEventCount()
focal_class.class_method_signature: Subscription.getNotifiedEventCount()
focal_class.full_signature: public Long getNotifiedEventCount()
focal_class.identifier: getNotifiedEventCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Long
focal_class.signature: Long getNotifiedEventCount()
focal_class.class_method_signature: Subscription.getNotifyTimeStamp()
focal_class.full_signature: public Date getNotifyTimeStamp()
focal_class.identifier: getNotifyTimeStamp
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Date
focal_class.signature: Date getNotifyTimeStamp()
focal_class.class_method_signature: Subscription.dispatch(List<WeEvent> events, boolean mainLoop, Long blockHeight)
focal_class.full_signature: public void dispatch(List<WeEvent> events, boolean mainLoop, Long blockHeight)
focal_class.identifier: dispatch
focal_class.modifiers: public
focal_class.parameters: (List<WeEvent> events, boolean mainLoop, Long blockHeight)
focal_class.return: void
focal_class.signature: void dispatch(List<WeEvent> events, boolean mainLoop, Long blockHeight)
focal_class.class_method_signature: Subscription.doStart(Executor executor)
focal_class.full_signature: public synchronized void doStart(Executor executor)
focal_class.identifier: doStart
focal_class.modifiers: public synchronized
focal_class.parameters: (Executor executor)
focal_class.return: void
focal_class.signature: void doStart(Executor executor)
focal_class.class_method_signature: Subscription.doStop()
focal_class.full_signature: public synchronized void doStop()
focal_class.identifier: doStop
focal_class.modifiers: public synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void doStop()
focal_class.class_method_signature: Subscription.stopHistory()
focal_class.full_signature: public synchronized void stopHistory()
focal_class.identifier: stopHistory
focal_class.modifiers: public synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void stopHistory()
focal_class.class_method_signature: Subscription.tryStopHistory(Long mainLastBlock)
focal_class.full_signature: public synchronized boolean tryStopHistory(Long mainLastBlock)
focal_class.identifier: tryStopHistory
focal_class.modifiers: public synchronized
focal_class.parameters: (Long mainLastBlock)
focal_class.return: boolean
focal_class.signature: boolean tryStopHistory(Long mainLastBlock)
focal_class.class_method_signature: Subscription.filter(List<WeEvent> from, String[] topics, String tag)
focal_class.full_signature: public static List<WeEvent> filter(List<WeEvent> from, String[] topics, String tag)
focal_class.identifier: filter
focal_class.modifiers: public static
focal_class.parameters: (List<WeEvent> from, String[] topics, String tag)
focal_class.return: List<WeEvent>
focal_class.signature: List<WeEvent> filter(List<WeEvent> from, String[] topics, String tag)
focal_class.class_method_signature: Subscription.isTopicPattern(String pattern)
focal_class.full_signature: public static boolean isTopicPattern(String pattern)
focal_class.identifier: isTopicPattern
focal_class.modifiers: public static
focal_class.parameters: (String pattern)
focal_class.return: boolean
focal_class.signature: boolean isTopicPattern(String pattern)
focal_class.class_method_signature: Subscription.validateTopicPattern(String pattern)
focal_class.full_signature: public static void validateTopicPattern(String pattern)
focal_class.identifier: validateTopicPattern
focal_class.modifiers: public static
focal_class.parameters: (String pattern)
focal_class.return: void
focal_class.signature: void validateTopicPattern(String pattern)
focal_class.class_method_signature: Subscription.patternMatch(String topic, String pattern)
focal_class.full_signature: public static boolean patternMatch(String topic, String pattern)
focal_class.identifier: patternMatch
focal_class.modifiers: public static
focal_class.parameters: (String topic, String pattern)
focal_class.return: boolean
focal_class.signature: boolean patternMatch(String topic, String pattern)
focal_method.body: public static List<WeEvent> filter(List<WeEvent> from, String[] topics, String tag) {
          List<WeEvent> to = new ArrayList<>();
          for (WeEvent event : from) {
              for (String topic : topics) {
                  boolean topic_target = false;
                  // subscription in pattern
                  if (isTopicPattern(topic)) {
                      if (patternMatch(event.getTopic(), topic)) {
                          topic_target = true;
                      }
                  } else { // subscription in normal topic
                      if (topic.equals(event.getTopic())) {
                          topic_target = true;
                      }
                  }
  
                  if (topic_target) {
                      // subscription without tag
                      if (StringUtils.isBlank(tag)) {
                          to.add(event);
                      } else {    // subscription in tag plus
                          if (tag.equals(event.getExtensions().get(WeEvent.WeEvent_TAG))) {
                              to.add(event);
                          }
                      }
                  }
              }
          }
  
          return to;
      }
focal_method.class_method_signature: Subscription.filter(List<WeEvent> from, String[] topics, String tag)
focal_method.full_signature: public static List<WeEvent> filter(List<WeEvent> from, String[] topics, String tag)
focal_method.identifier: filter
focal_method.invocations: isTopicPattern patternMatch getTopic equals getTopic isBlank add equals get getExtensions add
focal_method.modifiers: public static
focal_method.parameters: (List<WeEvent> from, String[] topics, String tag)
focal_method.return: List<WeEvent>
focal_method.signature: List<WeEvent> filter(List<WeEvent> from, String[] topics, String tag)