Home /Modules/advantage/SLModuleGrade.sleela

SLModuleGrade.sleela

lib/advantage/grading/SLModuleGrade.sleela · 111 line(s) · sleela

<< lib/advantage/grading/SLModuleGrade.sleela
   SLeeLa Standard Library Definition.
   Definition: One graded module -- a name, a raw sophistication score, a
   derived rating, and a role in the grading circuit. >>
#sleela 3.0
material;
artifact;
pure;
gasoline;
< The atom of the sophistication circuit grader. ANY module in the advantage >
< package (an onion component, a compartment, a vertical-integration model, or >
< even another grader) is represented here by its NAME and a raw SOPHISTICATION >
< SCORE. From the score the grader derives a RATING on two faithful scales: a >
< 1..10 tier and an S/A/B/C/D/F letter. The ROLE flags how the module >
< participates: 0 normal, 1 grader (it grades others), 2 absolute (judged >
< against a fixed bar, not the field). >
class SLModuleGrade {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
     or catalog can read and (where appropriate) override this record.
     Values are faithful to the subject's real origin where publicly known. >>
  String metaVersion = "1.0.0";
  int metaId = 10550;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-11-08";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-11-08";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 8;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }

  < ---- Module grade state ---- >
  String label;
  int score;
  int role;

  < role constants (methods cost no layout slot) >
  int ROLE_NORMAL()   { return 0; }
  int ROLE_GRADER()   { return 1; }
  int ROLE_ABSOLUTE() { return 2; }

  void configure(String lbl, int rawScore, int moduleRole) {
    label = lbl;
    score = rawScore;
    role = moduleRole;
  }

  String getLabel() { return label; }
  int getScore() { return score; }
  void setScore(int s) { score = s; }
  int getRole() { return role; }
  void setRole(int r) { role = r; }

  boolean isGrader()   { return role == 1; }
  boolean isAbsolute() { return role == 2; }

  < Rating tier 1..10 from the raw score. Scores are clamped: a score of 100+ >
  < is a perfect 10, and every 10 points is one tier (floor at 1). >
  int tier() {
    int t = score / 10;
    if (t > 10) { t = 10; }
    if (t < 1) { t = 1; }
    return t;
  }

  < Letter rating from the tier. S is reserved for a perfect/elite tier. >
  String letter() {
    int t = tier();
    if (t >= 10) { return "S"; }
    if (t >= 9)  { return "A"; }
    if (t >= 8)  { return "B"; }
    if (t >= 6)  { return "C"; }
    if (t >= 4)  { return "D"; }
    return "F";
  }

  String describe() {
    return "module '" + label + "' score=" + score
         + " tier=" + tier() + " letter=" + letter()
         + " role=" + role;
  }
}