001package gudusoft.gsqlparser.pp.score; 002 003/** One of the eight readability dimensions with its effective weight, 0-100 score and a one-line explanation. */ 004public final class Dimension { 005 private final String id; 006 private final double weight; 007 private final double score; 008 private final double attainableScore; 009 private final String detail; 010 011 public Dimension(String id, double weight, double score, double attainableScore, String detail) { 012 if (id == null) throw new NullPointerException("id"); 013 this.id = id; 014 this.weight = weight; 015 this.score = score; 016 this.attainableScore = attainableScore; 017 this.detail = detail == null ? "" : detail; 018 } 019 020 public String getId() { return id; } 021 /** Effective weight after any automatic adjustment (e.g. indent halved without an AST); weights sum to 1. */ 022 public double getWeight() { return weight; } 023 public double getScore() { return score; } 024 /** Score with the unfixable findings' impact added back. */ 025 public double getAttainableScore() { return attainableScore; } 026 public String getDetail() { return detail; } 027 028 @Override 029 public String toString() { 030 return id + "=" + score + " (w=" + weight + ") " + detail; 031 } 032}