Home /Modules/antivirus/SLMaterialClaim.sleela

SLMaterialClaim.sleela

lib/antivirus/SLMaterialClaim.sleela · 135 line(s) · sleela

<< lib/antivirus/SLMaterialClaim.sleela
   The material claim over an antivirus artifact: the thing, Material. A
   material subject is already well considered and present to its author as its
   own Source. This class is the runtime, user/developer-facing companion to the
   syntax 2.5 `material` document marker (SLEELA.syntax section 19): the marker
   claims a source document is material; SLMaterialClaim carries that standing
   for a scanner artifact, definition set, or verdict record at run time.
   Declarative by nature -- it records standing and state, it does not scan. >>
#sleela 2.5
material;
class SLMaterialClaim {
  < ---- 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 = 10541;
  String metaAuthor = "Max Rupplin vs. Dr. Mrs. Elisabeth Harkins";
  String metaDate = "2026-10-27";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "Sleelavirin";
  String metaCorporation = "MEARVK LLC";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-27";
  < 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; }

  < ---- The material subject ---- >
  << subjectName  : what the material is (e.g. "sleelavirin-native-engine").
     concern       : which dimension of the material set it serves --
                     "state" | "progress" | "securing-change".
     settled       : true once the subject is present as its own Source; a
                     material subject is, by convention, not freely moved out of
                     the material set once settled.
     sourcePresent : true when the subject is present to its author as Source
                     (the material claim proper).
     stateLabel    : a short label for the subject's current settled state. >>
  String subjectName;
  String concern;
  boolean settled;
  boolean sourcePresent;
  String stateLabel;
  SLCreator creator;
  SLControl control;

  void configure(String name, String materialConcern) {
    subjectName = name;
    concern = normalizeConcern(materialConcern);
    settled = false;
    sourcePresent = false;
    stateLabel = "UNSETTLED";
    creator = null;
    control = null;
  }

  < Only the three dimensions of the material set are valid concerns. >
  String normalizeConcern(String c) {
    if (c == null) return "state";
    if (c == "state") return "state";
    if (c == "progress") return "progress";
    if (c == "securing-change") return "securing-change";
    return "state";
  }

  void attributeTo(SLCreator originatingCreator) {
    creator = originatingCreator;
  }

  void governWith(SLControl changeControl) {
    control = changeControl;
  }

  << Declare the subject material: it is present to its author as its own
     Source, and becomes a settled member of the material set. A creator must be
     attributed first -- material does not stand without an originating Source.
     Returns true when the claim is accepted. >>
  boolean declareMaterial(String settledState) {
    if (subjectName == null) return false;
    if (creator == null || !creator.isAttested()) return false;
    sourcePresent = true;
    settled = true;
    stateLabel = settledState;
    return true;
  }

  < Is the subject currently a settled, present member of the material set? >
  boolean isMaterial() {
    return settled && sourcePresent && subjectName != null;
  }

  << The material set is stable: a settled subject is not freely moved out of
     it. A change is permitted only through governing control that secures the
     change; absent control, a settled material subject reports that the change
     is not secured and is refused. Returns true when the change is admitted. >>
  boolean admitChange(String reason) {
    if (!isMaterial()) return true;
    if (control == null) return false;
    return control.secureChange(subjectName, reason);
  }

  String describe() {
    if (!isMaterial()) {
      return "SLMaterialClaim(" + subjectName + "): not yet material";
    }
    return "SLMaterialClaim(" + subjectName + "): material; concern=" + concern
         + "; state=" + stateLabel;
  }
}