/** * An int between 0 (inclusive) and 100 (inclusive) representing how many * percent coverage the result sets this Coverage instance contains information * about had. */ public int getResultPercentage() { if (getResultSets() == 0) { return 0; } if (docs < active) { return (int) Math.round(docs * 100.0d / active); } return getFullResultSets() * 100 / getResultSets(); }
public void merge(Coverage other) { if (other == null) { return; } docs += other.getDocs(); nodes += other.getNodes(); nodesTried += other.nodesTried; active += other.getActive(); soonActive += other.getSoonActive(); degradedReason |= other.degradedReason; resultSets += other.getResultSets(); fullResultSets += other.getFullResultSets(); // explicitly incomplete beats doc count beats explicitly full switch (other.fullReason) { case EXPLICITLY_FULL: // do nothing break; case EXPLICITLY_INCOMPLETE: fullReason = FullCoverageDefinition.EXPLICITLY_INCOMPLETE; break; case DOCUMENT_COUNT: if (fullReason == FullCoverageDefinition.EXPLICITLY_FULL) { fullReason = FullCoverageDefinition.DOCUMENT_COUNT; } break; } }