@Test public void testCostBenefitInfo() { for (int i = 0; i < 5; i++) { List<String> randomSegments = CompactionPolicyTest.generateRandomLogSegmentName(3); long cost = getRandomCost(); int benefit = 1 + TestUtils.RANDOM.nextInt(Integer.MAX_VALUE); CostBenefitInfo actual = new CostBenefitInfo(randomSegments, cost, benefit); verifyCostBenfitInfo(actual, randomSegments, cost, benefit, cost * (1.0 / benefit)); } }
CostBenefitInfo(List<String> segmentsToCompact, long cost, int benefit) { this.segmentsToCompact = segmentsToCompact; this.cost = cost; this.benefit = benefit; costBenefitRatio = benefit == 0 ? Double.MAX_VALUE : cost * (1.0 / benefit); }
CostBenefitInfo implements Comparable<CostBenefitInfo> { CostBenefitInfo(List<String> segmentsToCompact, long cost, int benefit) { this.segmentsToCompact = segmentsToCompact; this.cost = cost; this.benefit = benefit; costBenefitRatio = benefit == 0 ? Double.MAX_VALUE : cost * (1.0 / benefit); } }
CostBenefitInfo implements Comparable<CostBenefitInfo> { CostBenefitInfo(List<String> segmentsToCompact, long cost, int benefit) { this.segmentsToCompact = segmentsToCompact; this.cost = cost; this.benefit = benefit; costBenefitRatio = benefit == 0 ? Double.MAX_VALUE : cost * (1.0 / benefit); } CostBenefitInfo(List<String> segmentsToCompact, long cost, int benefit); }
CostBenefitInfo implements Comparable<CostBenefitInfo> { CostBenefitInfo(List<String> segmentsToCompact, long cost, int benefit) { this.segmentsToCompact = segmentsToCompact; this.cost = cost; this.benefit = benefit; costBenefitRatio = benefit == 0 ? Double.MAX_VALUE : cost * (1.0 / benefit); } CostBenefitInfo(List<String> segmentsToCompact, long cost, int benefit); @Override int compareTo(CostBenefitInfo that); @Override String toString(); }
CostBenefitInfo implements Comparable<CostBenefitInfo> { CostBenefitInfo(List<String> segmentsToCompact, long cost, int benefit) { this.segmentsToCompact = segmentsToCompact; this.cost = cost; this.benefit = benefit; costBenefitRatio = benefit == 0 ? Double.MAX_VALUE : cost * (1.0 / benefit); } CostBenefitInfo(List<String> segmentsToCompact, long cost, int benefit); @Override int compareTo(CostBenefitInfo that); @Override String toString();  }