SleelaDoc API
HTML documentation for the SLeeLa standard library (/lib)
Home › Packages › philosophers

Package philosophers

This package contains 9 source unit(s) defining 9 class(es) / struct(s). Each unit below lists its fields (the values it stores) and methods (the actions it performs), with a plain explanation of each.

philosophers-demo #sleela 2.5 (lib/philosophers/philosophers-demo.sleela)

PhilosophersDemo class

builds the canonical chain Constructor() :: Patch :: Constructor :: Aim :: Guide, weighs favor on the Notice of Approach, runs a time-bounded contract, and lets the object live free.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
mainvoid main()No description in source.

SLConstructorContract #sleela 2.5 (lib/philosophers/SLConstructorContract.sleela)

SLConstructorContract class

The time-bounded contract of the instantiative moment -- the Constructor is of nature and time, and that moment does not outstay ~2 minutes.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
MAX_SECONDSstatic final int MAX_SECONDS = 120--- the two-minute boundary and the phases of the moment --------------- The instantiative moment runs no more than about two minutes.
PHASE_SEALEDstatic final int PHASE_SEALED = 0No description in source.
PHASE_OPENstatic final int PHASE_OPEN = 1No description in source.
PHASE_CLOSEDstatic final int PHASE_CLOSED = 2No description in source.
PHASE_FREEstatic final int PHASE_FREE = 3No description in source.
clockint clockthe clock of the moment, in seconds; only ever advanced ahead
phaseint phasethe current phase of the moment
freeint free1 once the object has been declared to live free of the moment

Methods — the actions this unit can perform.

MethodSignatureWhat it does
createvoid create()Prepare a sealed contract. The moment has not opened.
openvoid open()Open the instantiative moment. The clock starts at zero.
tickAheadint tickAhead(int seconds)The perpetual whistle of time, kept as "ahead": advance the clock forward by a number of seconds. Backward or zero ticks are ignored (time only ever goes ahead). When the clock reaches the two-minute boundary the moment closes on its own. Returns the clock after the tick.
withinContractboolean withinContract()Is the moment still inside its two-minute contract?
clampSecondsint clampSeconds(int seconds)Clamp a requested duration (seconds) into [1, MAX_SECONDS]. Offered so a caller never has to name this class's MAX_SECONDS constant directly.
maxSecondsint maxSeconds()The two-minute boundary, as a method, for callers that need the number.
sealMomentvoid sealMoment()Close the moment deliberately (e.g. construction finished before 2 min). Named sealMoment() rather than close(): a bare close() collides with the reserved Munction reach-handle built-in, so the contract uses its own name.
liberateboolean liberate()Declare the object free: it now lives on, released from the moment that made it. Only a closed moment can be freed; the whistle never runs back.
livesFreeboolean livesFree()No description in source.
getClockint getClock()No description in source.
getPhaseint getPhase()No description in source.
phaseTextString phaseText()No description in source.

SLFavorMechanism #sleela 2.5 (lib/philosophers/SLFavorMechanism.sleela)

SLFavorMechanism class

The Favor Mechanism -- it catches the facts and sayings of Approach at the time of the Constructor call and decides runnability.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
FAVOR_WITHHELDstatic final int FAVOR_WITHHELD = 0--- favor verdicts -----------------------------------------------------
FAVOR_GRANTEDstatic final int FAVOR_GRANTED = 1No description in source.
noticeCaughtint noticeCaughtthe running tally of Notice caught at the Time of the call
quorumint quorumthe least Notice that must be caught for favor to be granted
verdictint verdictthe last verdict rendered (FAVOR_WITHHELD / FAVOR_GRANTED)

Methods — the actions this unit can perform.

MethodSignatureWhat it does
createvoid create()Prepare the mechanism with a default quorum of one caught Notice.
setQuorumvoid setQuorum(int q)Set how much Notice the Approach must earn before favor can be granted. A quorum below one is lifted to one: favor is never free.
getQuorumint getQuorum()No description in source.
catchNoticevoid catchNotice(String saying)Catch one fact/saying of Approach. Each caught Notice raises the tally.
getNoticeCaughtint getNoticeCaught()No description in source.
weighint weigh()Weigh the Notice and render a verdict. Favor is granted only when the caught Notice meets or exceeds the quorum. Returns the verdict code.
grantedboolean granted()No description in source.
verdictTextString verdictText()The verdict as readable text, for banners and contracts.
resetvoid reset()Reset the mechanism for a fresh Constructor call, keeping the quorum.

SLOrdain #sleela 2.5 (lib/philosophers/SLOrdain.sleela)

SLOrdain class

Ordain -- the ordinality itself. Not a Guide and not a seating, but the orthogonal principle of rank and order that stands across all twenty-one seatings at once.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
CROWNstatic final int CROWN = 20--- the axis of order ---------------------------------------------------- The ordaining crown: the seating the whole chain answers to (Approval).
FLOORstatic final int FLOOR = 0The floor of the register: the first seating (Approach).
CATEGORIESstatic final int CATEGORIES = 7The number of categories that Ordain ranks over the sequence.
registerSLPhilosopherSeating registerthe register whose order Ordain reads (orthogonal, not seated within it)

Methods — the actions this unit can perform.

MethodSignatureWhat it does
createvoid create()Prepare the ordinality over a fresh register.
readOvervoid readOver(SLPhilosopherSeating r)Read over an existing register instead of the fresh one.
ordainsboolean ordains(int ordinal)Is this ordinal ordained (a real, ranked seating)? Orthogonality means Ordain itself is never one of them, so it answers about others only.
rankint rank(int ordinal)The rank of an ordinal: its distance up from the floor (0 at Approach, 20 at Approval). This is the ordinality -- the order-number of the seat.
toCrownint toCrown(int ordinal)How near a seating stands to the ordaining crown: 0 at the crown itself, growing with distance below it. The chain answers upward, so nearness to the crown is nearness to Approval.
ordainingCategoryint ordainingCategory(int ordinal)The category that ordains a seating (which of the seven phases ranks it).
ordainingCategoryNameString ordainingCategoryName(int ordinal)No description in source.
isCrownboolean isCrown(int ordinal)Is this the ordaining crown itself (Approval, the seat answered to)?
readingString reading(int ordinal)A one-line reading of an ordinal's place in the order, e.g. "Aim: rank 6, category Intent, 14 below the crown (Approval)".

SLPackage #sleela 2.5 (lib/philosophers/SLPackage.sleela)

SLPackage class

Defines the SLeeLa standard-library package for philosophers.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
MODULEstatic final String MODULE = "philosophers"No description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
moduleNameString moduleName()No description in source.

SLPhilosopherChain #sleela 2.5 (lib/philosophers/SLPhilosopherChain.sleela)

SLPhilosopherChain class

A Constructor's chain of growths, written with "::" between one growth and the next -- Constructor() :: Patch :: Constructor :: Aim :: Guide.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
GROWTHstatic final String GROWTH = " :: "the growth separator: one growth :: the next
ROOTstatic final String ROOT = "Constructor()"the base of the chain is always a Constructor() call
seatingSLPhilosopherSeating seatingthe seating register governing how many Guides this chain may hold
guidesSLPhilosopherGuide[] guidesthe Guides of this chain, in order (index 0 is the first after the root)
countint counthow many Guides have been seated
refusedFlagint refusedFlag1 if a seat request was refused because the chain was at capacity

Methods — the actions this unit can perform.

MethodSignatureWhat it does
createvoid create()Prepare an empty chain at the default (band 0 -> 21) capacity.
admitint admit(int band)Admit a signed band of additional seatings before building the chain. Returns the band actually admitted (clamped into [-2,+6]).
capacityint capacity()No description in source.
sizeint size()No description in source.
refusedboolean refused()No description in source.
seatint seat(String guideName, int seatOrdinal, boolean carriesFavor)Seat one named Guide onto the given seating ordinal. An approving Guide carries favor (Gold); a growing Guide carries Green. Returns the Guide's index, or -1 when the chain is already at its admitted capacity.
atSLPhilosopherGuide at(int i)No description in source.
broadcastint broadcast(String impart)Broadcast one context/impart to every seated Guide; each matching Guide counts the match. Returns how many Guides matched this impart.
disposeAllvoid disposeAll()Dispose every Guide after the object lives free. Idempotent per Guide.
renderString render()Render the canonical chain text, e.g. "Constructor() :: Patch :: Constructor :: Aim :: Guide". Built with "+" so no bridged char op is needed; this is the text an editor colors.
colorManifestString colorManifest()A compact color manifest for the editor: the color impart of each Guide in order, joined with "::", e.g. "Gold/Yellow :: Green :: Gold/Yellow".

SLPhilosopherConstructor #sleela 2.5 (lib/philosophers/SLPhilosopherConstructor.sleela)

SLPhilosopherConstructor class

The perfect Constructor -- it seats its Guides, opens a time-bounded contract, weighs favor, runs, and then lets the object live free.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
chainSLPhilosopherChain chainthe chain of growths this Constructor declares
favorSLFavorMechanism favorthe Favor Mechanism that weighs Notice at call time
contractSLConstructorContract contractthe time-bounded contract of the instantiative moment
ranint ran1 once the Constructor has actually run to completion

Methods — the actions this unit can perform.

MethodSignatureWhat it does
createvoid create()Prepare the Constructor with an empty chain, a fresh Favor Mechanism, and a sealed contract.
admitint admit(int band)Admit a signed seating band in [-2,+6]; returns the band admitted.
guideint guide(String name, int seatOrdinal, boolean carriesFavor)Seat one named Guide; returns its index or -1 when at capacity.
requireNoticevoid requireNotice(int quorum)Set how much Notice the Approach must earn for favor.
runboolean run(String[] imparts, int seconds)Run the instantiative moment. The caller first provides the facts/sayings of Approach as imparts; this method opens the contract, broadcasts each impart to the Guides, catches the matched Notice into the Favor Mechanism, weighs favor, and -- only on granted favor -- runs for the given duration, closes the moment, disposes the Guides, and liberates the object. Returns true when the object was constructed and now lives free.
constructedboolean constructed()No description in source.
chainTextString chainText()--- output surface -----------------------------------------------------
colorManifestString colorManifest()No description in source.
verdictString verdict()No description in source.
clockint clock()No description in source.
phaseString phase()No description in source.
capacityint capacity()No description in source.
guidesint guides()No description in source.
reportString report()A single-line report of quality, effect and output after construction.

SLPhilosopherGuide #sleela 2.5 (lib/philosophers/SLPhilosopherGuide.sleela)

SLPhilosopherGuide class

One Guide -- a single growth in a Constructor's chain, with its color impart and its listener for contexts and imparts.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
COLOR_NONEstatic final int COLOR_NONE = 0No description in source.
COLOR_GOLDstatic final int COLOR_GOLD = 1No description in source.
COLOR_GREENstatic final int COLOR_GREEN = 2No description in source.
nameString name--- a Guide's own name, seating and impart ----------------------------- the name as written in the chain, e.g. "Patch", "Aim", "Guide"
seatint seatthe seating ordinal this Guide claims (see SLPhilosopherSeating)
approvingint approving1 when this Guide carries approving favor forward, else 0
matchedint matcheda small count of contexts/imparts this Guide has matched so far
disposedint disposed1 once this Guide has been disposed after the object lives free

Methods — the actions this unit can perform.

MethodSignatureWhat it does
createvoid create()Prepare an empty, uncolored Guide.
sitvoid sit(String guideName, int seatOrdinal, boolean carriesFavor)Name a Guide onto a seating. An approving Guide carries favor (Gold); a still-growing Guide carries Green.
getNameString getName()No description in source.
getSeatint getSeat()No description in source.
isApprovingboolean isApproving()No description in source.
getMatchedint getMatched()No description in source.
colorint color()The editor color impart for this Guide. Idempotent: the same Guide always reports the same color for the same impart, and asking never mutates it.
colorNameString colorName()The color impart as text, for banners and editor manifests.
listenboolean listen(String impart)Listen for a context/impart at Constructor-call time. A Guide matches when the impart is non-null and names this Guide's seating or its own name; the match is counted so the Favor Mechanism can weigh Notice over Time.
disposevoid dispose()Dispose this Guide after the object lives free of its instantiative moment. Disposal is idempotent and produces the Guide's final effect: it stops listening and keeps its matched tally as its output of record.
isDisposedboolean isDisposed()No description in source.

SLPhilosopherSeating #sleela 2.5 (lib/philosophers/SLPhilosopherSeating.sleela)

SLPhilosopherSeating class

The twenty-one catalogued "seatings" a perfect Constructor can admit -- each a Guide/Wisdom slot that governs the maturation of principle over a static constructor.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
BASE_SEATINGSstatic final int BASE_SEATINGS = 21--- the finitude of a perfect Constructor ------------------------------ BASE seatings that every perfect Constructor approves by default.
ADDITIONAL_MINstatic final int ADDITIONAL_MIN = -2The signed band of additional seatings a Constructor may admit.
ADDITIONAL_MAXstatic final int ADDITIONAL_MAX = 6No description in source.
MIN_CAPACITYstatic final int MIN_CAPACITY = 19Admitted capacity therefore lives in [MIN_CAPACITY, MAX_CAPACITY].
MAX_CAPACITYstatic final int MAX_CAPACITY = 27No description in source.
SEAT_APPROACHstatic final int SEAT_APPROACH = 0No description in source.
SEAT_NOTICEstatic final int SEAT_NOTICE = 1No description in source.
SEAT_WARRANTstatic final int SEAT_WARRANT = 2No description in source.
SEAT_PATCHstatic final int SEAT_PATCH = 3No description in source.
SEAT_SEEDstatic final int SEAT_SEED = 4No description in source.
SEAT_FRAMEstatic final int SEAT_FRAME = 5No description in source.
SEAT_AIMstatic final int SEAT_AIM = 6No description in source.
SEAT_COURSEstatic final int SEAT_COURSE = 7No description in source.
SEAT_MEASUREstatic final int SEAT_MEASURE = 8No description in source.
SEAT_HEALTHstatic final int SEAT_HEALTH = 9No description in source.
SEAT_VIGORstatic final int SEAT_VIGOR = 10No description in source.
SEAT_PATTERNstatic final int SEAT_PATTERN = 11No description in source.
SEAT_GUIDEstatic final int SEAT_GUIDE = 12No description in source.
SEAT_MINISTRYstatic final int SEAT_MINISTRY = 13No description in source.
SEAT_COUNSELstatic final int SEAT_COUNSEL = 14No description in source.
SEAT_OFFICEstatic final int SEAT_OFFICE = 15No description in source.
SEAT_SAINTstatic final int SEAT_SAINT = 16No description in source.
SEAT_FAVORstatic final int SEAT_FAVOR = 17No description in source.
SEAT_IMPARTstatic final int SEAT_IMPART = 18No description in source.
SEAT_CONFORMstatic final int SEAT_CONFORM = 19No description in source.
SEAT_APPROVALstatic final int SEAT_APPROVAL = 20No description in source.
CAT_ADMISSIONstatic final int CAT_ADMISSION = 0--- the seven categories (the ordinal ternary phases) -------------------
CAT_INCEPTIONstatic final int CAT_INCEPTION = 1No description in source.
CAT_INTENTstatic final int CAT_INTENT = 2No description in source.
CAT_VITALITYstatic final int CAT_VITALITY = 3No description in source.
CAT_GOVERNANCEstatic final int CAT_GOVERNANCE = 4No description in source.
CAT_STANDINGstatic final int CAT_STANDING = 5No description in source.
CAT_CLOSUREstatic final int CAT_CLOSURE = 6No description in source.
additionalint additionalthe number of additional seatings this register has admitted, in band
capacityint capacityadmitted capacity = BASE + additional, clamped to [MIN, MAX]

Methods — the actions this unit can perform.

MethodSignatureWhat it does
createvoid create()Prepare the register at the default (band = 0) capacity.
admitint admit(int band)Admit a signed number of additional seatings. Out-of-band requests are clamped into [ADDITIONAL_MIN, ADDITIONAL_MAX]; the method returns the band actually admitted so the caller learns the truth rather than a silent lie.
getCapacityint getCapacity()No description in source.
getAdditionalint getAdditional()No description in source.
seatsboolean seats(int ordinal)Is an ordinal a real seating in the current admitted capacity?
inBandboolean inBand(int band)Is a band value inside the signed admission band?
seatNameString seatName(int ordinal)The human name of a baseline seating ordinal, or "unseated" past 20.
categoryint category(int ordinal)The category ordinal (0..6) of a baseline seating, or -1 if unseated. Each category holds three consecutive seatings, so the category is the seating ordinal divided by three.
categoryNameString categoryName(int cat)The human name of a category ordinal (0..6), or "none".
seatCategoryNameString seatCategoryName(int ordinal)The category name of a seating ordinal directly, or "none" if unseated.