List of usage examples for java.util TreeSet size
public int size()
From source file:org.codice.ddf.pax.web.jetty.JettyAuthenticator.java
@Override public Authentication validateRequest(ServletRequest servletRequest, ServletResponse servletResponse, boolean mandatory) throws ServerAuthException { TreeSet<ServiceReference<SecurityFilter>> sortedSecurityFilterServiceReferences = null; final BundleContext bundleContext = getContext(); if (bundleContext == null) { throw new ServerAuthException( "Unable to get BundleContext. No servlet SecurityFilters can be applied. Blocking the request processing."); }/*from w w w. ja v a 2 s .c o m*/ try { sortedSecurityFilterServiceReferences = new TreeSet<>( bundleContext.getServiceReferences(SecurityFilter.class, null)); } catch (InvalidSyntaxException ise) { LOGGER.debug("Should never get this exception as there is no filter being passed."); } if (!CollectionUtils.isEmpty(sortedSecurityFilterServiceReferences)) { LOGGER.debug("Found {} filter(s), now filtering...", sortedSecurityFilterServiceReferences.size()); final ProxyFilterChain chain = new ProxyFilterChain(); // Insert the SecurityFilters into the chain one at a time (from lowest service ranking // to highest service ranking). The SecurityFilter with the highest service-ranking will // end up at index 0 in the FilterChain, which means that the SecurityFilters will be // run in order of highest to lowest service ranking. for (ServiceReference<SecurityFilter> securityFilterServiceReference : sortedSecurityFilterServiceReferences) { final SecurityFilter securityFilter = bundleContext.getService(securityFilterServiceReference); if (!hasBeenInitialized(securityFilterServiceReference, bundleContext)) { initializeSecurityFilter(bundleContext, securityFilterServiceReference, securityFilter); } chain.addSecurityFilter(securityFilter); } try { chain.doFilter(servletRequest, servletResponse); } catch (IOException e) { throw new ServerAuthException( "Unable to process security filter. Blocking the request processing."); } catch (AuthenticationChallengeException e) { return new Authentication.Challenge() { }; } catch (AuthenticationException e) { return new Authentication.Failure() { }; } } else { LOGGER.debug("Did not find any SecurityFilters. Send auth failure..."); return new Authentication.Failure() { }; } Subject subject = (Subject) servletRequest.getAttribute(SecurityConstants.SECURITY_SUBJECT); UserIdentity userIdentity = new JettyUserIdentity(getSecuritySubject(subject)); return new JettyAuthenticatedUser(userIdentity); }
From source file:org.codice.ddf.platform.filter.delegate.DelegateServletFilter.java
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { TreeSet<ServiceReference<SecurityFilter>> sortedSecurityFilterServiceReferences = null; final BundleContext bundleContext = getContext(); if (bundleContext == null) { throw new ServletException( "Unable to get BundleContext. No servlet SecurityFilters can be applied. Blocking the request processing."); }//from w w w. j a va 2 s . c o m try { sortedSecurityFilterServiceReferences = new TreeSet<>( bundleContext.getServiceReferences(SecurityFilter.class, null)); } catch (InvalidSyntaxException ise) { LOGGER.debug("Should never get this exception as there is no filter being passed."); } if (!CollectionUtils.isEmpty(sortedSecurityFilterServiceReferences)) { LOGGER.debug("Found {} filter(s), now filtering...", sortedSecurityFilterServiceReferences.size()); final ProxyFilterChain chain = new ProxyFilterChain(filterChain); // Insert the SecurityFilters into the chain one at a time (from lowest service ranking // to highest service ranking). The SecurityFilter with the highest service-ranking will // end up at index 0 in the FilterChain, which means that the SecurityFilters will be // run in order of highest to lowest service ranking. for (ServiceReference<SecurityFilter> securityFilterServiceReference : sortedSecurityFilterServiceReferences) { final SecurityFilter securityFilter = bundleContext.getService(securityFilterServiceReference); if (!hasBeenInitialized(securityFilterServiceReference, bundleContext)) { initializeSecurityFilter(bundleContext, securityFilterServiceReference, securityFilter); } chain.addSecurityFilter(securityFilter); } chain.doFilter(servletRequest, servletResponse); } else { LOGGER.debug("Did not find any SecurityFilters. Acting as a pass-through filter..."); filterChain.doFilter(servletRequest, servletResponse); } }
From source file:org.jtrfp.trcl.obj.ExplosionSystem.java
private boolean isNewExplosionFeasible(final Vector3D loc, ExplosionType type) { final TreeSet<Explosion> proximalExplosions = new TreeSet<Explosion>(new Comparator<Explosion>() { @Override//ww w . jav a 2 s .com public int compare(Explosion o1, Explosion o2) { return Misc.satCastInt(o1.getTimeOfLastReset() - o2.getTimeOfLastReset()); } }); for (int explosionTypeIndex = 0; explosionTypeIndex < allExplosions.length; explosionTypeIndex++) { Explosion[] explosionsOfThisType = allExplosions[explosionTypeIndex]; for (Explosion thisExplosion : explosionsOfThisType) { if (thisExplosion.isActive()) { final double distance = new Vector3D(thisExplosion.getPosition()).distance(loc); if (distance < 1000) return false; if (distance < OneShotBillboardEvent.PROXIMITY_TEST_DIST) proximalExplosions.add(thisExplosion); } // end if(isActive) } // end for(explosionsOfThisType) } // end for(explosions) if (proximalExplosions.size() + 1 > OneShotBillboardEvent.MAX_PROXIMAL_EVENTS) proximalExplosions.first().destroy();//Destroy oldest return true; }
From source file:org.lockss.servlet.DisplayContentTab.java
/** * Creates table rows for each AU/*from w w w . j a va 2 s . co m*/ * * * @param divTable The table object to add to * @param auMap Archival unit object for this row * @param cleanNameString Sanitised name used to create classes and divs * @throws UnsupportedEncodingException */ private void createAuRow(Table divTable, Map.Entry<String, TreeSet<ArchivalUnit>> auMap, String cleanNameString) throws UnsupportedEncodingException { String title = auMap.getKey(); String cleanTitleString = cleanName(title); TreeSet<ArchivalUnit> auSet = auMap.getValue(); if (auSet.size() > 0) { ArchivalUnit firstAu = auSet.first(); TdbAu firstTdbAu = TdbUtil.getTdbAu(firstAu); divTable.newRow(); Block columnRow = divTable.row(); columnRow.attribute("class", cleanNameString + "_class column-row hide-row"); divTable.addCell("", "class=\"checkboxDiv\""); for (String columnArray : columnArrayList) { Block columnHeader = new Block(Block.Bold); columnHeader.add(columnArray); divTable.addCell(columnHeader, "class=\"column-header\""); } divTable.newRow(); Block titleDiv = divTable.row(); titleDiv.attribute("id", cleanName(title) + "_title"); titleDiv.attribute("class", "journal-title " + cleanNameString + "_class hide-row"); Table titleTable = new Table(); titleTable.attribute("class", "title-table"); Input titleCheckbox = new Input(Input.Checkbox, cleanNameString + "_checkbox"); titleCheckbox.attribute("onClick", "titleCheckbox(this, \"" + cleanTitleString + "\")"); Block titleCheckboxDiv = new Block(Block.Div); titleCheckboxDiv.attribute("class", "checkboxDiv"); titleCheckboxDiv.add(titleCheckbox); divTable.addCell(titleCheckboxDiv, "class=\"checkboxDiv\""); addTitleRow(titleTable, "Title:", HtmlUtil.encode(firstTdbAu.getJournalTitle(), HtmlUtil.ENCODE_TEXT)); addTitleRow(titleTable, "Print ISSN:", firstTdbAu.getIssn()); addTitleRow(titleTable, "E-ISSN:", firstTdbAu.getEissn()); divTable.addCell(titleTable, "colspan=\"6\""); int rowCount = 0; for (ArchivalUnit au : auSet) { if (filterAu(au)) { String rowClass = rowCss(rowCount); TdbAu tdbAu = TdbUtil.getTdbAu(au); AuState auState = AuUtil.getAuState(au); String auName = HtmlUtil.encode(au.getName(), HtmlUtil.ENCODE_TEXT); String cleanedAuName = cleanAuName(auName); String encodedHref = URLEncoder.encode(au.getAuId(), "UTF-8"); divTable.newRow(); Block newRow = divTable.row(); newRow.attribute("class", cleanNameString + "_class hide-row " + rowClass); Block auDiv = new Block(Block.Div); auDiv.attribute("id", cleanedAuName + "_au_title"); auDiv.attribute("class", "au-title"); Link auLink = new Link("DaemonStatus"); if (tdbAu != null) { auLink.attribute("onClick", "updateDiv('" + cleanedAuName + "', '" + au.getAuId() + "', '" + cleanNameString + "-au', '" + cleanNameString + tdbAu.getYear() + "_image');return false"); Image auLinkImage = new Image(EXPAND_ICON); auLinkImage.attribute("id", cleanNameString + tdbAu.getYear() + "_image"); auLinkImage.attribute("class", "title-icon"); auLinkImage.attribute("alt", "Expand Volume"); auLinkImage.attribute("title", "Expand Volume"); auLink.add(auLinkImage); auLink.add(auName); auDiv.add(auLink); Block checkboxDiv = new Block(Block.Div); checkboxDiv.attribute("class", "checkboxDiv"); Input checkbox = new Input("checkbox", "deleteAu"); checkbox.attribute("value", au.getAuId()); checkbox.attribute("class", "chkbox " + cleanTitleString + "_chkbox"); checkboxDiv.add(checkbox); divTable.addCell(checkboxDiv, "class='checkboxDiv'"); divTable.addCell(auDiv, "class='au-title-cell'"); divTable.addCell(tdbAu.getYear()); divTable.addCell(checkHasContent(auState.getSubstanceState())); divTable.addCell( getCrawlImage(auState.getLastCrawlResult(), auState.getLastCrawlResultMsg()) + " " + showTimeElapsed(auState.getLastCrawlTime(), timeKey)); divTable.addCell(showTimeElapsed(auState.getLastPollStart(), timeKey)); } else { log.debug("TdbAu not found for Au " + au.getName()); auLink.attribute("onClick", "updateDiv('" + cleanedAuName + "', '" + au.getAuId() + "', '" + cleanNameString + "-au', '" + cleanNameString + rowCount + "_image');return false"); Image auLinkImage = new Image(EXPAND_ICON); auLinkImage.attribute("id", cleanNameString + rowCount + "_image"); auLinkImage.attribute("class", "title-icon"); auLinkImage.attribute("alt", "Expand Volume"); auLinkImage.attribute("title", "Expand Volume"); auLink.add(auLinkImage); auLink.add(auName); auDiv.add(auLink); divTable.addCell(auDiv); divTable.addCell(au.getName()); divTable.addCell("unknown"); divTable.addCell("unknown"); divTable.addCell(checkCollected(au, auState.getLastCrawlTime())); } Block serveContentDiv = new Block(Block.Div); serveContentDiv.attribute("class", "au-serve-content-div"); Link serveContentLink = new Link("ServeContent?auid=" + encodedHref); serveContentLink.target("_blank"); Image externalLinkImage = new Image(EXTERNAL_LINK_ICON); serveContentLink.add("Serve content<sup>" + externalLinkImage + "</sup>"); serveContentLink.attribute("class", "au-link"); serveContentDiv.add("[ " + serveContentLink + " ]"); divTable.addCell(serveContentDiv); divTable.newRow("class='hide-row " + rowClass + " " + cleanNameString + "-au' id='" + cleanedAuName + "_row'"); Block detailsDiv = new Block(Block.Div); detailsDiv.attribute("id", cleanedAuName + "_cell"); detailsDiv.attribute("class", rowClass); divTable.addCell(detailsDiv, "colspan='7' id='" + cleanedAuName + "'"); } rowCount++; } } addClearRow(divTable, cleanNameString, true); }
From source file:com.turn.ttorrent.client.Client.java
/** * Unchoke connected peers.//from w ww.jav a2 s . c o m * * <p> * This is one of the "clever" places of the BitTorrent client. Every * OPTIMISTIC_UNCHOKING_FREQUENCY seconds, we decide which peers should be * unchocked and authorized to grab pieces from us. * </p> * * <p> * Reciprocation (tit-for-tat) and upload capping is implemented here by * carefully choosing which peers we unchoke, and which peers we choke. * </p> * * <p> * The four peers with the best download rate and are interested in us get * unchoked. This maximizes our download rate as we'll be able to get data * from there four "best" peers quickly, while allowing these peers to * download from us and thus reciprocate their generosity. * </p> * * <p> * Peers that have a better download rate than these four downloaders but * are not interested get unchoked too, we want to be able to download from * them to get more data more quickly. If one becomes interested, it takes * a downloader's place as one of the four top downloaders (i.e. we choke * the downloader with the worst upload rate). * </p> * * @param optimistic Whether to perform an optimistic unchoke as well. */ private synchronized void unchokePeers(boolean optimistic) { // Build a set of all connected peers, we don't care about peers we're // not connected to. TreeSet<SharingPeer> bound = new TreeSet<SharingPeer>(this.getPeerRateComparator()); bound.addAll(this.connected.values()); if (bound.size() == 0) { logger.trace("No connected peers, skipping unchoking."); return; } else { logger.trace("Running unchokePeers() on {} connected peers.", bound.size()); } int downloaders = 0; Set<SharingPeer> choked = new HashSet<SharingPeer>(); // We're interested in the top downloaders first, so use a descending // set. for (SharingPeer peer : bound.descendingSet()) { if (downloaders < Client.MAX_DOWNLOADERS_UNCHOKE) { // Unchoke up to MAX_DOWNLOADERS_UNCHOKE interested peers if (peer.isChoking()) { if (peer.isInterested()) { downloaders++; } peer.unchoke(); } } else { // Choke everybody else choked.add(peer); } } // Actually choke all chosen peers (if any), except the eventual // optimistic unchoke. if (choked.size() > 0) { SharingPeer randomPeer = choked.toArray(new SharingPeer[0])[this.random.nextInt(choked.size())]; for (SharingPeer peer : choked) { if (optimistic && peer == randomPeer) { logger.debug("Optimistic unchoke of {}.", peer); continue; } peer.choke(); } } }
From source file:org.broadinstitute.gatk.tools.walkers.haplotypecaller.LDMerger.java
/** * Merge as many events among the haplotypes as possible based on pairwise LD among variants * * @param haplotypes a list of haplotypes whose events we want to merge * @param readLikelihoods map from sample name -> read likelihoods for each haplotype * @param startPosKeySet a set of starting positions of all events among the haplotypes * @param ref the reference bases/*ww w .j ava 2 s .c o m*/ * @param refLoc the span of the reference bases */ @Override public boolean merge(final List<Haplotype> haplotypes, final ReadLikelihoods<Haplotype> readLikelihoods, final TreeSet<Integer> startPosKeySet, final byte[] ref, final GenomeLoc refLoc) { if (haplotypes == null) throw new IllegalArgumentException("haplotypes cannot be null"); if (readLikelihoods == null) throw new IllegalArgumentException("readLikelihoods cannot be null"); if (startPosKeySet == null) throw new IllegalArgumentException("startPosKeySet cannot be null"); if (ref == null) throw new IllegalArgumentException("ref cannot be null"); if (refLoc == null) throw new IllegalArgumentException("refLoc cannot be null"); if (refLoc.size() != ref.length) throw new IllegalArgumentException( "refLoc size " + refLoc.size() + " != ref.length " + ref.length + " at " + refLoc); if (startPosKeySet.size() <= 1) { return false; } final int nSamples = readLikelihoods.sampleCount(); final HaplotypeLDCalculator r2Calculator = new HaplotypeLDCalculator(haplotypes, readLikelihoods); boolean somethingWasMerged = false; boolean mapWasUpdated = true; while (mapWasUpdated) { mapWasUpdated = mergeConsecutiveEventsBasedOnLDOnce(haplotypes, r2Calculator, nSamples, startPosKeySet, ref, refLoc); somethingWasMerged |= mapWasUpdated; } return somethingWasMerged; }
From source file:net.firejack.platform.generate.tools.Render.java
/** * @param params/*from w w w . j a va2 s .c om*/ * @return */ public String renderParams(TreeSet<Param> params) { if (params == null || params.isEmpty()) return ""; StringBuilder builder = new StringBuilder(); int i = 0; for (Param param : params) { builder.append(renderType(param)); builder.append(" ").append(param.getName()); if (i < params.size() - 1) { builder.append(", "); } i++; } return builder.toString(); }
From source file:com.autentia.intra.jsf.schedule.renderer.BitacoreScheduleDetailedDayRenderer.java
protected void writeEntries(FacesContext context, HtmlSchedule schedule, ScheduleDay day, ResponseWriter writer) throws IOException { final String clientId = schedule.getClientId(context); FormInfo parentFormInfo = RendererUtils.findNestingForm(schedule, context); String formId = parentFormInfo == null ? null : parentFormInfo.getFormName(); TreeSet entrySet = new TreeSet(); for (Iterator entryIterator = day.iterator(); entryIterator.hasNext();) { entrySet.add(new EntryWrapper((ScheduleEntry) entryIterator.next(), day)); }// w w w . j av a 2 s.c o m EntryWrapper[] entries = (EntryWrapper[]) entrySet.toArray(new EntryWrapper[entrySet.size()]); //determine overlaps scanEntries(entries, 0); //determine the number of columns within this day int maxColumn = 0; for (Iterator entryIterator = entrySet.iterator(); entryIterator.hasNext();) { EntryWrapper wrapper = (EntryWrapper) entryIterator.next(); maxColumn = Math.max(wrapper.column, maxColumn); } int numberOfColumns = maxColumn + 1; //make sure the entries take up all available space horizontally maximizeEntries(entries, numberOfColumns); //now determine the width in percent of 1 column float columnWidth = 100 / numberOfColumns; //and now draw the entries in the columns for (Iterator entryIterator = entrySet.iterator(); entryIterator.hasNext();) { EntryWrapper wrapper = (EntryWrapper) entryIterator.next(); boolean selected = isSelected(schedule, wrapper); //compose the CSS style for the entry box StringBuffer entryStyle = new StringBuffer(); entryStyle.append(wrapper.getBounds(schedule, columnWidth)); String entryBorderColor = getEntryRenderer(schedule).getColor(context, schedule, wrapper.entry, selected); if (entryBorderColor != null) { entryStyle.append(" border-color: "); entryStyle.append(entryBorderColor); entryStyle.append(";"); } if (selected) { writer.startElement(HTML.DIV_ELEM, schedule); writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "entry-selected"), null); writer.writeAttribute(HTML.STYLE_ATTR, entryStyle.toString(), null); //draw the tooltip if (showTooltip(schedule)) { getEntryRenderer(schedule).renderToolTip(context, writer, schedule, wrapper.entry, selected); } //draw the content getEntryRenderer(schedule).renderContent(context, writer, schedule, day, wrapper.entry, false, selected); writer.endElement(HTML.DIV_ELEM); } else { //if the schedule is read-only, the entries should not be //hyperlinks writer.startElement(schedule.isReadonly() ? HTML.DIV_ELEM : HTML.ANCHOR_ELEM, schedule); //draw the tooltip if (showTooltip(schedule)) { getEntryRenderer(schedule).renderToolTip(context, writer, schedule, wrapper.entry, selected); } if (!schedule.isReadonly()) { writer.writeAttribute("href", "#", null); writer.writeAttribute(HTML.ONMOUSEUP_ATTR, "fireEntrySelected('" + formId + "', '" + clientId + "', '" + wrapper.entry.getId() + "');", null); } writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "entry"), null); writer.writeAttribute(HTML.STYLE_ATTR, entryStyle.toString(), null); //draw the content getEntryRenderer(schedule).renderContent(context, writer, schedule, day, wrapper.entry, false, selected); writer.endElement(schedule.isReadonly() ? HTML.DIV_ELEM : "a"); } } }
From source file:com.autentia.tnt.jsf.schedule.renderer.BitacoreScheduleDetailedDayRenderer.java
protected void writeEntries(FacesContext context, HtmlSchedule schedule, ScheduleDay day, ResponseWriter writer) throws IOException { final String clientId = schedule.getClientId(context); FormInfo parentFormInfo = RendererUtils.findNestingForm(schedule, context); String formId = parentFormInfo == null ? null : parentFormInfo.getFormName(); TreeSet entrySet = new TreeSet(); for (Iterator entryIterator = day.iterator(); entryIterator.hasNext();) { entrySet.add(new EntryWrapper((ScheduleEntry) entryIterator.next(), day)); }/* ww w . jav a 2 s. c om*/ EntryWrapper[] entries = (EntryWrapper[]) entrySet.toArray(new EntryWrapper[entrySet.size()]); //determine overlaps scanEntries(entries, 0); //determine the number of columns within this day int maxColumn = 0; for (Iterator entryIterator = entrySet.iterator(); entryIterator.hasNext();) { EntryWrapper wrapper = (EntryWrapper) entryIterator.next(); maxColumn = Math.max(wrapper.column, maxColumn); } int numberOfColumns = maxColumn + 1; //make sure the entries take up all available space horizontally maximizeEntries(entries, numberOfColumns); //now determine the width in percent of 1 column float columnWidth = (float) 100 / numberOfColumns; //and now draw the entries in the columns for (Iterator entryIterator = entrySet.iterator(); entryIterator.hasNext();) { EntryWrapper wrapper = (EntryWrapper) entryIterator.next(); boolean selected = isSelected(schedule, wrapper); //compose the CSS style for the entry box StringBuffer entryStyle = new StringBuffer(); entryStyle.append(wrapper.getBounds(schedule, columnWidth)); String entryBorderColor = getEntryRenderer(schedule).getColor(context, schedule, wrapper.entry, selected); if (entryBorderColor != null) { entryStyle.append(" border-color: "); entryStyle.append(entryBorderColor); entryStyle.append(";"); } if (selected) { writer.startElement(HTML.DIV_ELEM, schedule); writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "entry-selected"), null); writer.writeAttribute(HTML.STYLE_ATTR, entryStyle.toString(), null); //draw the tooltip if (showTooltip(schedule)) { getEntryRenderer(schedule).renderToolTip(context, writer, schedule, wrapper.entry, selected); } //draw the content getEntryRenderer(schedule).renderContent(context, writer, schedule, day, wrapper.entry, false, selected); writer.endElement(HTML.DIV_ELEM); } else { //if the schedule is read-only, the entries should not be //hyperlinks writer.startElement(schedule.isReadonly() ? HTML.DIV_ELEM : HTML.ANCHOR_ELEM, schedule); //draw the tooltip if (showTooltip(schedule)) { getEntryRenderer(schedule).renderToolTip(context, writer, schedule, wrapper.entry, selected); } if (!schedule.isReadonly()) { writer.writeAttribute("href", "#", null); writer.writeAttribute(HTML.ONMOUSEUP_ATTR, "fireEntrySelected('" + formId + "', '" + clientId + "', '" + wrapper.entry.getId() + "');", null); } writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "entry"), null); writer.writeAttribute(HTML.STYLE_ATTR, entryStyle.toString(), null); //draw the content getEntryRenderer(schedule).renderContent(context, writer, schedule, day, wrapper.entry, false, selected); writer.endElement(schedule.isReadonly() ? HTML.DIV_ELEM : "a"); } } }
From source file:org.broadinstitute.gatk.utils.haplotype.LDMerger.java
/** * Merge as many events among the haplotypes as possible based on pairwise LD among variants * * @param haplotypes a list of haplotypes whose events we want to merge * @param haplotypeReadMap map from sample name -> read likelihoods for each haplotype * @param startPosKeySet a set of starting positions of all events among the haplotypes * @param ref the reference bases//ww w .j a v a 2 s. c om * @param refLoc the span of the reference bases */ @Override public boolean merge(final List<Haplotype> haplotypes, final Map<String, PerReadAlleleLikelihoodMap> haplotypeReadMap, final TreeSet<Integer> startPosKeySet, final byte[] ref, final GenomeLoc refLoc) { if (haplotypes == null) throw new IllegalArgumentException("haplotypes cannot be null"); if (haplotypeReadMap == null) throw new IllegalArgumentException("haplotypeReadMap cannot be null"); if (startPosKeySet == null) throw new IllegalArgumentException("startPosKeySet cannot be null"); if (ref == null) throw new IllegalArgumentException("ref cannot be null"); if (refLoc == null) throw new IllegalArgumentException("refLoc cannot be null"); if (refLoc.size() != ref.length) throw new IllegalArgumentException( "refLoc size " + refLoc.size() + " != ref.length " + ref.length + " at " + refLoc); if (startPosKeySet.size() <= 1) { return false; } final int nSamples = haplotypeReadMap.keySet().size(); final HaplotypeLDCalculator r2Calculator = new HaplotypeLDCalculator(haplotypes, haplotypeReadMap); boolean somethingWasMerged = false; boolean mapWasUpdated = true; while (mapWasUpdated) { mapWasUpdated = mergeConsecutiveEventsBasedOnLDOnce(haplotypes, r2Calculator, nSamples, startPosKeySet, ref, refLoc); somethingWasMerged |= mapWasUpdated; } return somethingWasMerged; }