class JobCounter {

        private final AtomicInteger jobs;
        private Set<HugeElement> elements;
        private Set<HugeIndex> indexes;
        private final int batchSize;

        public JobCounter(int batchSize) {
            this.jobs = new AtomicInteger(0);
            this.elements = ConcurrentHashMap.newKeySet();
            this.indexes = ConcurrentHashMap.newKeySet();
            this.batchSize = batchSize;
        }

        public int jobs() {
            return this.jobs.get();
        }

        public void decrement() {
            this.jobs.decrementAndGet();
        }

        public void increment() {
            this.jobs.incrementAndGet();
        }

        public Set<HugeElement> elements() {
            return this.elements;
        }

        public Set<HugeIndex> indexes() {
            return this.indexes;
        }

        public void clear(Object object) {
            if (object instanceof HugeElement) {
                this.elements = ConcurrentHashMap.newKeySet();
            } else {
                assert object instanceof HugeIndex;
                this.indexes = ConcurrentHashMap.newKeySet();
            }
        }

        public boolean addAndTriggerDelete(Object object) {
            return object instanceof HugeElement ?
                   addElementAndTriggerDelete((HugeElement) object) :
                   addIndexAndTriggerDelete((HugeIndex) object);
        }

        /**
         * Try to add element in collection waiting to be deleted
         *
         * @param element
         * @return true if we should create a new delete job, false otherwise
         */
        public boolean addElementAndTriggerDelete(HugeElement element) {<FILL_FUNCTION_BODY>}

        /**
         * Try to add edge in collection waiting to be deleted
         *
         * @param index
         * @return true if we should create a new delete job, false otherwise
         */
        public boolean addIndexAndTriggerDelete(HugeIndex index) {
            if (this.indexes.size() >= this.batchSize) {
                return true;
            }
            this.indexes.add(index);
            return this.indexes.size() >= this.batchSize;
        }
    }

            if (this.elements.size() >= this.batchSize) {
                return true;
            }
            this.elements.add(element);
            return this.elements.size() >= this.batchSize;
        
<no_super_class>