/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "intcnt.h" IntCount::IntCount() : numInts(0), iPair(nullptr) { } IntCount::~IntCount() { delete [] iPair;} int IntCount::getSize() {return numInts;} int IntCount::getCount(int pos) {return iPair[pos].cnt;} int IntCount::getIndex(int pos) {return iPair[pos].idx;} void IntCount::clear() { delete[] iPair; iPair = new IntPair[0]; numInts = 0; } int IntCount::countAdd(int index, int increment) { if(numInts) { // Do a binary search to find the element int divPoint = 0; if(index>iPair[numInts-1].idx) { divPoint = numInts; } else if(indexiPair[mid].idx) { if(mid