<< lib/sldocument/SLSourceNameComparison.sleela SLeeLa Standard Library Definition. Definition: Defines SLSourceNameComparison, which compares the naming of a .sleela program against a .sldocument so an engineer can see how the two forms line up before or after a conversion. The two forms name things differently: - .sleela names every method explicitly (it is class/method shaped); - .sldocument may leave steps anonymous (ordered position or role only). This comparison pairs each document step with the .sleela method name it would have (via SLDocumentNaming) and reports, per step, whether the names match, whether a name had to be synthesized, and whether any collision arose. Family: sldocument. Native VM/OS work crosses an explicit bridge. >> #sleela 2.5 material; < Unified SLeeLa standard-library front-end object. > class SLSourceNameComparison { < ---- 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 = 10195; 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 MAX_ROWS = 65536; SLDocumentNaming naming; < the step's name in the document (may be "") > String[] documentName; < the method name it would have in .sleela > String[] sleelaName; < true when the .sleela name had to be synthesized > boolean[] synthesized; < true when this name duplicates an earlier one > boolean[] collided; int rows; int state; void init(SLDocumentNaming conv) { naming = conv; documentName = new String[MAX_ROWS]; sleelaName = new String[MAX_ROWS]; synthesized = new boolean[MAX_ROWS]; collided = new boolean[MAX_ROWS]; rows = 0; state = 1; } boolean active() { return state == 1; } int size() { return rows; } < Compare one document step. `textualPosition` is its 1-based top-down index. > void compareStep(SLDocumentAnnotation ann, int textualPosition) { if (!active() || rows >= MAX_ROWS) { return; } String docName = (ann == null || ann.method() == null) ? "" : ann.method(); String slName = naming.nameFor(ann, textualPosition); boolean synth = naming.isSynthesized(ann); < collision: does slName already appear in an earlier row? > boolean collide = false; for (int i = 0; i < rows; i = i + 1) { if (sleelaName[i] == slName) { collide = true; } } documentName[rows] = docName; sleelaName[rows] = slName; synthesized[rows] = synth; collided[rows] = collide; rows = rows + 1; } < How many steps had to be given a synthesized .sleela name? > int synthesizedCount() { int c = 0; for (int i = 0; i < rows; i = i + 1) { if (synthesized[i]) { c = c + 1; } } return c; } < Did any two steps resolve to the same .sleela method name? > boolean hasCollision() { for (int i = 0; i < rows; i = i + 1) { if (collided[i]) { return true; } } return false; } < True when the comparison is clean enough to convert safely: no collisions. > boolean convertible() { return active() && rows > 0 && !hasCollision(); } String documentNameAt(int i) { if (i < 0 || i >= rows) { return ""; } return documentName[i]; } String sleelaNameAt(int i) { if (i < 0 || i >= rows) { return ""; } return sleelaName[i]; } }