SLGuiRotationSchedule.sleela
lib/gui/version-thual/SLGuiRotationSchedule.sleela · 132 line(s) · sleela
<< lib/gui/version-thual/SLGuiRotationSchedule.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLGuiRotationSchedule — a "schene": a scheduled rotation
cadence for a UI component. On its face it rotates a component by a fixed
step every interval (a clean, professional motion accent). Its second,
deliberate role is a CRYPTOGRAPHIC ROTATION CADENCE for an internal
memorandum: the same tick that advances the visible angle also advances a
key epoch, so "the component is rotating" and "the memo's internal key has
rotated to a new epoch" are one observable event. The visible rotation is
the honest, external signal of an internal key rotation — rotation you can
see maps to rotation you can trust.
This class carries ONLY the cadence/accounting (interval, step, epoch,
bounded total turns); it does not implement a cipher. It states how often
the memorandum's key epoch turns and lets a consumer read epoch()/turns()
to drive the actual key schedule elsewhere. Every value is clamped.
Family: gui. Carried by SLGuiEffects; advanced by the app/mount loop tick. >>
#sleela 2.5
material;
class SLGuiRotationSchedule {
< ---- 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 = 11248;
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; }
< time between rotation steps, 50..3600000 ms >
int intervalMillis;
< degrees added each interval, -359..359 >
int stepDeg;
< 1 while the cadence advances >
int running;
< elapsed time banked toward the next step >
int accumMillis;
< key epoch: increments once per completed step >
int epoch;
< total steps applied >
int turns;
< 0 = unbounded; else stop after maxTurns steps >
int maxTurns;
< the internal memorandum this cadence rotates the key for >
String memoLabel;
void configure(int intervalMs, int degPerStep) {
intervalMillis = clampInterval(intervalMs);
stepDeg = clampStep(degPerStep);
running = 0; accumMillis = 0; epoch = 0; turns = 0; maxTurns = 0;
memoLabel = "";
}
int clampInterval(int ms) { if (ms < 50) { return 50; } if (ms > 3600000) { return 3600000; } return ms; }
int clampStep(int d) { if (d < -359) { return -359; } if (d > 359) { return 359; } return d; }
< Name the internal memorandum whose key epoch this schene rotates, and >
< optionally cap how many epochs it will turn through (0 = unbounded). >
void bindMemorandum(String label, int epochCap) {
memoLabel = (label == null) ? "" : label;
maxTurns = (epochCap < 0) ? 0 : epochCap;
}
void start() { running = 1; }
void stop() { running = 0; }
boolean active() { return running == 1; }
< Advance by `elapsedMillis`. When a full interval banks (and the turn cap is >
< not reached), apply one step: bump the epoch + turns and return the degree >
< step to add. Returns 0 when no step fired this tick. >
int advance(int elapsedMillis) {
if (running == 0 || elapsedMillis <= 0) { return 0; }
if (maxTurns > 0 && turns >= maxTurns) { running = 0; return 0; }
accumMillis = accumMillis + elapsedMillis;
if (accumMillis < intervalMillis) { return 0; }
accumMillis = accumMillis - intervalMillis;
< the memorandum's internal key rotates one epoch >
epoch = epoch + 1;
turns = turns + 1;
if (maxTurns > 0 && turns >= maxTurns) { running = 0; }
< the visible component rotates by this much >
return stepDeg;
}
int getIntervalMillis() { return intervalMillis; }
int getStepDeg() { return stepDeg; }
int epochNow() { return epoch; }
int totalTurns() { return turns; }
int getMaxTurns() { return maxTurns; }
String memorandum() { return memoLabel; }
boolean boundToMemorandum() { return memoLabel != ""; }
boolean honored() {
boolean iv = intervalMillis >= 50 && intervalMillis <= 3600000;
boolean st = stepDeg >= -359 && stepDeg <= 359;
return iv && st;
}
}