Home /Modules/gui/SLGuiDocument.sleela

SLGuiDocument.sleela

lib/gui/version-dual/SLGuiDocument.sleela · 78 line(s) · sleela

<< lib/gui/version-dual/SLGuiDocument.sleela
   SLeeLa Standard Library Definition.
   Definition: Defines SLGuiDocument — one document watched by the GUI document
     listener. Mirrors SleelaDocument in gui/: a stable id, a resolved host
     path, and an OS-derived revision fingerprint (lastModifiedMillis:size, or
     "absent" when the file is gone). A change is a same-id/same-path document
     whose revision moved; an OS event that does not move the revision is
     coalesced away. >>
#sleela 2.5
material;
< SLeeLa gui front-end contract — an immutable watched-document snapshot. >
< Family: gui. The revision is OS metadata (cheap on every OS call), not file >
< contents; it is sufficient to detect the "document changed" condition. >
class SLGuiDocument {
  < ---- 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 = 11180;
  String metaAuthor = "Kiro Agent";
  String metaDate = "2026-10-16";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-16";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < 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; }
  < SLeeLa-facing identity, stable across revisions >
  String id;
  < resolved, normalized host path >
  String path;
  < "lastModifiedMillis:size", or "absent" >
  String revision;
  void configure(String docId, String docPath, String rev) {
    id = docId; path = docPath; revision = rev;
  }
  String getId() { return id; }
  String getPath() { return path; }
  String getRevision() { return revision; }
  < Absent means the file was gone/unreadable at snapshot time; appearance or >
  < disappearance is itself a detectable change. >
  boolean absent() { return revision == "absent"; }
  boolean present() { return revision != null && revision != "absent"; }
  < True when `other` names the same document at a different revision. >
  boolean changedFrom(SLGuiDocument other) {
    if (other == null) { return false; }
    return id == other.id && path == other.path && revision != other.revision;
  }
}