### Question:
ProfileToNetworkDriver { void levelControl(KHeap[] topInteractions) { int numGenes = getNumGenes(); int sizeLimit = Math.max(k, Math.min((int)(MAX_PERCENTAGE*numGenes), MAX_ALLOWED_INTERACTIONS_INCLUDING_LEVEL_MATCH)); logger.debug("level control at size limit of " + sizeLimit); for (KHeap heap: topInteractions) { if (heap.size() > sizeLimit) { double lastLevel = heap.getWeight(0); int sizeBefore = heap.size(); heap.popLE(lastLevel); logger.debug("trimmed heap from " + sizeBefore + " to " + heap.size()); } } }  static void main(String [] args); void process(Reader in, Writer out); void load(Reader source, char delim); void loadSparse(Reader source, char delim); void loadNetwork(Reader source, char delim); int dump(PrintWriter writer); void setK(int k); void setSepChar(char sepChar); void setCorrelationType(CorrelationType corType); void setEqualElementBin(boolean equalElementBin); void setSizeType(SizeType sizeType); void setProfileType(String profileType); void setMaxMissingPercentage(double missingPercentage); void setSynSepChar( char synSepChar ); void setSynIdColumn( int col ); void setSynNameColumn( int col ); void setSynReader(Reader synReader); boolean isNoHeader(); void setNoHeader(boolean val); void setProgressReporter(ProgressReporter progress); ProgressReporter getProgressReporter(); String getThreshold(); void setThreshold(String threshold); boolean isKeepAllTies(); void setKeepAllTies(boolean keepAllTies); boolean isLimitTies(); void setLimitTies(boolean limitTies); static final String CONTINUOUS; static final String BINARY; static final String NETWORK; static final String THRESHOLD_AUTO; static final String THRESHOLD_OFF; static final String THRESHOLD_DEFAULT; }### Answer:
@Test public void testLevelControl() throws Exception { StringBuilder synonyms = new StringBuilder(); int totalUniqueNodes = 100; for (int i = 0; i < totalUniqueNodes; i++) { synonyms.append(String.format("gene%1$d,gene%1$d", i)); } ProfileToNetworkDriver loader = new ProfileToNetworkDriver(); int k = 50; loader.setK(k); loader.setKeepAllTies(true); loader.setLimitTies(true); loader.setSynIdColumn(0); loader.setSynNameColumn(1); loader.setSynSepChar(','); loader.setSynReader(new StringReader(synonyms.toString())); KHeap heap = new KHeap(k); KHeap[] heaps = new KHeap[1]; heaps[0] = heap; for (int i = 0; i < totalUniqueNodes; i++) { heap.offer(i, i); } loader.levelControl(heaps); assertEquals(k, heap.size()); }