Home /Modules/advantage/SLAdvantageLayer.sleela

SLAdvantageLayer.sleela

lib/advantage/SLAdvantageLayer.sleela · 107 line(s) · sleela

<< lib/advantage/SLAdvantageLayer.sleela
   SLeeLa Standard Library Definition.
   Definition: One concentric layer of the advantage Sequitur onion model. >>
#sleela 3.0
material;
artifact;
pure;
gasoline;
< A single layer in the onion. The onion is navigated by DEPTH: depth 0 is the >
< outermost skin, higher depth is further inward toward the core. Each layer >
< has a name, a kind, and a numeric contribution it makes to the running >
< dividend when the layer is applied. The named layers of the standard >
< Sequitur, outer to inner, are: >
<   0 dividend     -- the value under consideration >
<   1 review       -- look again; validate the premise >
<   2 concerns     -- surface risks and caveats >
<   3 maths        -- the quantitative core >
<   4 additions    -- what the layer adds to the dividend >
<   5 subtraction  -- what the layer takes away >
<   6 regrouping   -- reorganize concepts, carry/borrow across the model >
<   7 iteration    -- decide to go further down or back up the onion >
class SLAdvantageLayer {
  < ---- 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 = 10511;
  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; }

  < ---- Layer identity and behavior ---- >
  < position in the onion; 0 = outermost >
  int depth;
  < human name of this stage >
  String layerName;
  < category: value|validate|risk|quant|grow|shrink|reorg|loop >
  String kind;
  < signed amount this layer applies to the dividend >
  int contribution;
  < has this layer been applied on the current pass >
  boolean visited;

  void configure(int d, String nm, String k, int c) {
    depth = d;
    layerName = nm;
    kind = k;
    contribution = c;
    visited = false;
  }

  int getDepth() { return depth; }
  String getName() { return layerName; }
  String getKind() { return kind; }
  int getContribution() { return contribution; }
  void setContribution(int c) { contribution = c; }

  boolean wasVisited() { return visited; }
  void markVisited() { visited = true; }
  void resetVisit() { visited = false; }

  < Apply this layer to a running dividend value and return the new value. >
  < The sign/role is governed by `kind`; the amount is `contribution`. >
  int applyTo(int running) {
    visited = true;
    return running + contribution;
  }

  String describe() {
    return "[" + depth + "] " + layerName + " (" + kind + ") "
         + "contribution=" + contribution;
  }
}