<< lib/opcodes/running/SLOpcodeConditionalReactive.sleela SLeeLa Standard Library Definition. Definition: Defines SLOpcodeConditionalReactive, a construct that watches a condition over the running program and reacts by grouping, warming, gating, or skipping a group of opcodes. Role: this is the conditional-reactive the user asked for. It binds a SLOpcodeCondition (the trigger) to a SLOpcodeGroup (the subject) and a reaction. When the condition holds as the stream advances, the reaction fires: WARM — pre-warm the group so a hot path is ready before it is reached. RUN — run the group now, inline, as a reactive sub-sequence. GATE — admit the group into the live stream only now that the condition holds (gated inclusion). SKIP — hold the group back (do not run it) while the condition holds. A reactive is edge-sensitive: it reacts when the condition first becomes true, not repeatedly, unless rearmed. Family: opcodes.running. Native VM/OS work crosses an explicit bridge. >> #sleela 2.5 material; < Unified SLeeLa standard-library front-end object. > class SLOpcodeConditionalReactive { < ---- 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 = 10185; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-05"; < 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; } static final int WARM = 1; static final int RUN = 2; static final int GATE = 3; static final int SKIP = 4; String label; < the condition watched > SLOpcodeCondition trigger; < the group reacted upon > SLOpcodeGroup subject; < used when the reaction is WARM/GATE > SLOpcodeWarmer warmer; < one of WARM..SKIP > int reaction; < VM frame > int frame; < edge state: already reacted this rising edge > boolean latched; < how many times it has reacted > int reactions; int state; void configure(String name, SLOpcodeCondition cond, SLOpcodeGroup group, SLOpcodeWarmer warm, int howToReact, int vmFrame) { label = name; trigger = cond; subject = group; warmer = warm; reaction = howToReact; frame = vmFrame; latched = false; reactions = 0; state = 1; } void enable() { state = 1; } void disable() { state = 0; } boolean active() { return state == 1; } void rearm() { latched = false; } int reactionCount() { return reactions; } String name() { return label; } < Evaluate the trigger at the current stream index and react on the rising > < edge. Returns the reaction performed (0 = none this tick). > int tick(int index) { if (!active() || trigger == null) { return 0; } boolean now = trigger.holds(frame, index); < falling/low: reset the edge > if (!now) { latched = false; return 0; } < already reacted on this edge > if (latched) { return 0; } latched = true; reactions = reactions + 1; if (reaction == WARM) { if (warmer != null && subject != null) { warmer.warmGroup(subject); } return WARM; } if (reaction == RUN) { if (subject != null) { subject.run(frame); } return RUN; } if (reaction == GATE) { < Gated inclusion: warm now so the group is ready to be appended/run. > if (warmer != null && subject != null) { warmer.warmGroup(subject); } return GATE; } if (reaction == SKIP) { < Hold the group back: disable it so a driver will not run it. > if (subject != null) { subject.disable(); } return SKIP; } return 0; } < Whether the subject group should be allowed to run given the reaction and > < the current edge state. GATE allows only after reacting; SKIP forbids while > < latched; WARM/RUN leave running to the driver. > boolean admits() { if (reaction == GATE) { return latched; } if (reaction == SKIP) { return !latched; } return true; } }