test_class.file: restx-common/src/test/java/restx/common/watch/FileWatchEventCoalescorTest.java
test_class.identifier: FileWatchEventCoalescorTest
test_case.body: @Test
  	public void should_remove_consecutive_create_and_delete_events() {
  		TestFileWatchEventCoalescor watchEventCoalescor = new TestFileWatchEventCoalescor();
  		watchEventCoalescor.post("tmp/foo", StandardWatchEventKinds.ENTRY_CREATE);
  		FileWatchEvent noise = watchEventCoalescor.post("tmp/bar", StandardWatchEventKinds.ENTRY_CREATE);// just to add some noise
  		watchEventCoalescor.post("tmp/foo", StandardWatchEventKinds.ENTRY_DELETE);
  
  		assertThat(watchEventCoalescor.removeNoise(noise)).isTrue(); // remove noisy event
  
  		assertThat(watchEventCoalescor.scheduledEvents).hasSize(1);
  		assertThat(watchEventCoalescor.scheduledEvents.get(0).isPresent()).isFalse();
  	}
test_case.class_method_signature: FileWatchEventCoalescorTest.should_remove_consecutive_create_and_delete_events()
test_case.full_signature: @Test public void should_remove_consecutive_create_and_delete_events()
test_case.identifier: should_remove_consecutive_create_and_delete_events
test_case.invocations: post post post isTrue assertThat removeNoise hasSize assertThat isFalse assertThat isPresent get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_remove_consecutive_create_and_delete_events()
focal_class.declarator: queue = new HashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final HashMap<FileWatchEventKey, Deque<EventReference>> queue = new HashMap<>();
focal_class.type: HashMap<FileWatchEventKey, Deque<EventReference>>
focal_class.var_name: queue
focal_class.file: restx-common/src/main/java/restx/common/watch/FileWatchEventCoalescor.java
focal_class.identifier: FileWatchEventCoalescor
focal_class.class_method_signature: FileWatchEventCoalescor.create(EventBus eventBus, long coalescePeriod)
focal_class.full_signature: public static FileWatchEventCoalescor create(EventBus eventBus, long coalescePeriod)
focal_class.identifier: create
focal_class.modifiers: public static
focal_class.parameters: (EventBus eventBus, long coalescePeriod)
focal_class.return: FileWatchEventCoalescor
focal_class.signature: FileWatchEventCoalescor create(EventBus eventBus, long coalescePeriod)
focal_class.class_method_signature: FileWatchEventCoalescor.FileWatchEventCoalescor(EventBus eventBus, long coalescePeriod)
focal_class.full_signature:   FileWatchEventCoalescor(EventBus eventBus, long coalescePeriod)
focal_class.identifier: FileWatchEventCoalescor
focal_class.parameters: (EventBus eventBus, long coalescePeriod)
focal_class.signature:  FileWatchEventCoalescor(EventBus eventBus, long coalescePeriod)
focal_class.class_method_signature: FileWatchEventCoalescor.post(final FileWatchEvent event)
focal_class.full_signature: public void post(final FileWatchEvent event)
focal_class.identifier: post
focal_class.modifiers: public
focal_class.parameters: (final FileWatchEvent event)
focal_class.return: void
focal_class.signature: void post(final FileWatchEvent event)
focal_class.class_method_signature: FileWatchEventCoalescor.merge(EventReference previous, FileWatchEvent current)
focal_class.full_signature: private boolean merge(EventReference previous, FileWatchEvent current)
focal_class.identifier: merge
focal_class.modifiers: private
focal_class.parameters: (EventReference previous, FileWatchEvent current)
focal_class.return: boolean
focal_class.signature: boolean merge(EventReference previous, FileWatchEvent current)
focal_class.class_method_signature: FileWatchEventCoalescor.schedulePost(final EventReference event)
focal_class.full_signature:  void schedulePost(final EventReference event)
focal_class.identifier: schedulePost
focal_class.parameters: (final EventReference event)
focal_class.return: void
focal_class.signature: void schedulePost(final EventReference event)
focal_class.class_method_signature: FileWatchEventCoalescor.dequeue(FileWatchEventKey key, EventReference event)
focal_class.full_signature:  void dequeue(FileWatchEventKey key, EventReference event)
focal_class.identifier: dequeue
focal_class.parameters: (FileWatchEventKey key, EventReference event)
focal_class.return: void
focal_class.signature: void dequeue(FileWatchEventKey key, EventReference event)
focal_class.class_method_signature: FileWatchEventCoalescor.clear()
focal_class.full_signature:  void clear()
focal_class.identifier: clear
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clear()
focal_class.superclass: extends EventCoalescor<FileWatchEvent>
focal_method.body: public void post(final FileWatchEvent event) {
  		synchronized (queue) {
  			final FileWatchEventKey key = FileWatchEventKey.fromEvent(event);
  
  			Deque<EventReference> fileEvents;
  			if ((fileEvents = queue.get(key)) == null) {
  				// easy case, first event for a file, just queue it and schedule a post
  				fileEvents = new ArrayDeque<>();
  				queue.put(key, fileEvents);
  				EventReference reference = EventReference.of(key, event);
  				fileEvents.add(reference);
  				schedulePost(reference);
  				return;
  			}
  
  			// more complex case, we need to analyze the last saved event for this file
  			EventReference last = fileEvents.getLast();
  			if (!merge(last, event)) {
  				// event has not been merged, so try to add it
  				EventReference reference = EventReference.of(key, event);
  				fileEvents.add(reference);
  				schedulePost(reference);
  			}
  		}
  	}
focal_method.class_method_signature: FileWatchEventCoalescor.post(final FileWatchEvent event)
focal_method.full_signature: public void post(final FileWatchEvent event)
focal_method.identifier: post
focal_method.invocations: fromEvent get put of add schedulePost getLast merge of add schedulePost
focal_method.modifiers: public
focal_method.parameters: (final FileWatchEvent event)
focal_method.return: void
focal_method.signature: void post(final FileWatchEvent event)