JPP: nether lingua to 64 packs with auto mod and clean naming a bit
This commit is contained in:
parent
1c699c4c1b
commit
7dd4e80a2a
5 changed files with 81 additions and 71 deletions
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/// The nether tone tree slug index.
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
open module jpp.nether.dial.lingua {
|
||||
requires transitive jpp.nether.tone;
|
||||
//TODO no support for dynamic sub packages, thus generate this file too
|
||||
//exports ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒄᑊᣔᒻ.ᒻᑊᣕᕐᓑᣔᓫ.*;
|
||||
exports ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒄᑊᣔᒻ.ᒻᑊᣕᕐᓑᣔᓫ.ᐧᐧᐧ;
|
||||
exports ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒄᑊᣔᒻ.ᒻᑊᣕᕐᓑᣔᓫ.ᐧᐧᣟ;
|
||||
exports ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒄᑊᣔᒻ.ᒻᑊᣕᕐᓑᣔᓫ.ᣟᣟᣟ;
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ public class ModelDialLingua implements KodeGenModel {
|
|||
|
||||
@Override
|
||||
public String generatorModelHash() {
|
||||
return "4";
|
||||
return "5";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -91,11 +91,15 @@ public class ModelDialLingua implements KodeGenModel {
|
|||
// Group per package
|
||||
Map<String, Map<String, List<NetherSlugNamed>>> splitSlugs = new HashMap<>();
|
||||
for (NetherSlugNamed slug : netherSlugs) {
|
||||
int split3Package = slug.view().bl0w() >> 6; // 8 package
|
||||
int split6PackageFile = slug.view().bl0w() & 0b111111; // with 64 files
|
||||
// we can't split a hinary9 char , changes as it big indian char...so dots for now
|
||||
String subPackage = writer.buildPackageInuktitutDots(split3Package, 3);
|
||||
String filePackage = writer.buildPackageInuktitutDots(split6PackageFile, 6);
|
||||
int split6Package = slug.view().bl0w() >> 3; // 64 package with 8 files (is 1000+ classes per package folder)
|
||||
String subPackage = "ᐞ" + writer.buildPackageInuktitutDots(split6Package, 6);
|
||||
StringBuilder fileName = new StringBuilder();
|
||||
fileName.append("ᐃ"); // use full prefix dot id for unique class names over all nether sub packages
|
||||
fileName.append(writer.buildPackageInuktitutDots(slug.view().ag1(), 3));
|
||||
fileName.append(writer.buildPackageInuktitutDots(slug.view().ag2(), 3));
|
||||
fileName.append(writer.buildPackageInuktitutDots(slug.view().ag3(), 3));
|
||||
fileName.append(writer.buildPackageInuktitutDots(slug.view().bl0w(), 9));
|
||||
String filePackage = fileName.toString();
|
||||
Map<String, List<NetherSlugNamed>> map = splitSlugs.get(subPackage);
|
||||
if (map == null) {
|
||||
map = new HashMap<>();
|
||||
|
|
@ -112,20 +116,19 @@ public class ModelDialLingua implements KodeGenModel {
|
|||
// Build model classes
|
||||
for (String pack : splitSlugs.keySet()) {
|
||||
Map<String, List<NetherSlugNamed>> map = splitSlugs.get(pack);
|
||||
for (String file : map.keySet()) {
|
||||
List<NetherSlugNamed> list = map.get(file);
|
||||
for (String javaName : map.keySet()) {
|
||||
List<NetherSlugNamed> list = map.get(javaName);
|
||||
if (list.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
NetherSlugNamed slugTpl = list.get(0);
|
||||
List<Class<?>> tonesTpl = slugTpl.view().toNetherTones(0);
|
||||
String javaName = "ᐃ" + file;
|
||||
ModelKlass klass = new ModelKlass(BASE_PACK + "." + pack, javaName);
|
||||
for (Class<?> tone : tonesTpl) {
|
||||
klass.addJavaImport(tone.getDeclaringClass().getName()); // auto dedup
|
||||
klass.addJavaImport(tone.getDeclaringClass().getName());
|
||||
}
|
||||
klass.addJavaDescription("Lingua set of supported human text and vocal dialects for terminators.");
|
||||
klass.addJavaDescription("Keyed by the: Observatoire Human Linguistique");
|
||||
klass.setJavaDocAuthor("Observatoire Human Linguistique");
|
||||
writer.addModelKlass(klass);
|
||||
StringBuilder buf = klass.getBody();
|
||||
buf.append("public sealed interface ");
|
||||
|
|
@ -149,7 +152,8 @@ public class ModelDialLingua implements KodeGenModel {
|
|||
humanKlassPart = humanKlassPart.replaceAll("\\&", "ᖃ");
|
||||
humanKlassPart = humanKlassPart.replaceAll("\\.", "");
|
||||
humanKlassPart = humanKlassPart.replaceAll(" ", "");
|
||||
String slugName = "ᐊ" + slug.view().toNúmero2Lingua("ᣞ") + "ᐅ" + humanKlassPart;
|
||||
// N2L prints LR and read and renders RL
|
||||
String slugName = "ᐊ" + slug.view().toNúmero2Lingua() + "ᐅ" + humanKlassPart;
|
||||
buf.append("\t/// ");
|
||||
buf.append(slug.linguaKey);
|
||||
buf.append("\n");
|
||||
|
|
@ -174,6 +178,21 @@ public class ModelDialLingua implements KodeGenModel {
|
|||
buf.append("}\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Write module file with dynamic packages
|
||||
ModelKlass klass = new ModelKlass("", "module-info");
|
||||
klass.addJavaDescription("The nether tone tree slug index.");
|
||||
writer.addModelKlass(klass);
|
||||
StringBuilder buf = klass.getBody();
|
||||
buf.append("module jpp.nether.dial.lingua {\n");
|
||||
buf.append("\trequires transitive jpp.nether.tone;\n");
|
||||
buf.append("\t\n");
|
||||
for (String pack : splitSlugs.keySet()) {
|
||||
buf.append("\texports ");
|
||||
buf.append(BASE_PACK + "." + pack);
|
||||
buf.append(";\n");
|
||||
}
|
||||
buf.append("}\n");
|
||||
}
|
||||
|
||||
record NetherSlugNamed(String linguaKey, String linguaName, NetherToneSlugView view) {
|
||||
|
|
|
|||
|
|
@ -75,26 +75,22 @@ public record NetherToneSlugView(
|
|||
buf.appendCodePoint(VALUES_9.codePoints().skip((value >> 0) & 7).findFirst().getAsInt());
|
||||
}
|
||||
|
||||
public String toNúmero2Lingua(String seperator) {
|
||||
public String toNúmero2Lingua() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
printNúmero2Lingua6(buf, ag1);buf.append(seperator);
|
||||
printNúmero2Lingua6(buf, ag2);buf.append(seperator);
|
||||
printNúmero2Lingua6(buf, ag3);buf.append(seperator);
|
||||
printNúmero2Lingua9(buf, bl0w);buf.append(seperator);
|
||||
printNúmero2Lingua6(buf, cr1);buf.append(seperator);
|
||||
printNúmero2Lingua6(buf, cr2);buf.append(seperator);
|
||||
printNúmero2Lingua6(buf, cr3);buf.append(seperator);
|
||||
printNúmero2Lingua6(buf, db1);buf.append(seperator);
|
||||
printNúmero2Lingua6(buf, db2);buf.append(seperator);
|
||||
printNúmero2Lingua6(buf, db3);buf.append(seperator);
|
||||
printNúmero2Lingua6(buf, ag1);
|
||||
printNúmero2Lingua6(buf, ag2);
|
||||
printNúmero2Lingua6(buf, ag3);
|
||||
printNúmero2Lingua9(buf, bl0w);
|
||||
printNúmero2Lingua6(buf, cr1);
|
||||
printNúmero2Lingua6(buf, cr2);
|
||||
printNúmero2Lingua6(buf, cr3);
|
||||
printNúmero2Lingua6(buf, db1);
|
||||
printNúmero2Lingua6(buf, db2);
|
||||
printNúmero2Lingua6(buf, db3);
|
||||
printNúmero2Lingua9(buf, er0w);
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public String toNúmero2Lingua() {
|
||||
return toNúmero2Lingua("");
|
||||
}
|
||||
|
||||
public List<Class<?>> toNetherTones(int idx) {
|
||||
Class<?> qClass = qClass(idx);
|
||||
List<Class<?>> result = new ArrayList<>(11);
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ public class ModelKlass {
|
|||
private final List<String> javaDescriptions;
|
||||
private final List<String> javaImports;
|
||||
private final StringBuilder body;
|
||||
private String javaDocAuthor;
|
||||
private String javaDocVersion;
|
||||
|
||||
public ModelKlass(String javaPackage, String javaName) {
|
||||
this.javaPackage = Objects.requireNonNull(javaPackage);
|
||||
|
|
@ -51,9 +53,14 @@ public class ModelKlass {
|
|||
this.javaDescriptions = new ArrayList<>();
|
||||
String packageFolder = javaPackage.replaceAll("\\.", "/");
|
||||
String filePath = packageFolder + "/" + javaName + ".java";
|
||||
if (packageFolder.isEmpty()) {
|
||||
filePath = javaName + ".java";
|
||||
}
|
||||
this.javaFile = new File(filePath);
|
||||
this.javaImports = new ArrayList<>();
|
||||
this.body = new StringBuilder();
|
||||
this.javaDocAuthor = "للَّٰهِilLצسُو";
|
||||
this.javaDocVersion = "©Δ∞ 仙上主天";
|
||||
}
|
||||
|
||||
public File getJavaFile() {
|
||||
|
|
@ -90,4 +97,20 @@ public class ModelKlass {
|
|||
public StringBuilder getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public String getJavaDocAuthor() {
|
||||
return javaDocAuthor;
|
||||
}
|
||||
|
||||
public void setJavaDocAuthor(String javaDocAuthor) {
|
||||
this.javaDocAuthor = javaDocAuthor;
|
||||
}
|
||||
|
||||
public String getJavaDocVersion() {
|
||||
return javaDocVersion;
|
||||
}
|
||||
|
||||
public void setJavaDocVersion(String javaDocVersion) {
|
||||
this.javaDocVersion = javaDocVersion;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ public class ModelKlassWriter {
|
|||
if (writeFile) {
|
||||
Path outFile = outputPath.resolve(klass.getJavaFile().toPath());
|
||||
outFile.toFile().getParentFile().mkdirs();
|
||||
outFile.toFile().createNewFile();
|
||||
Files.writeString(outFile, content);
|
||||
System.out.println("Wrote file: " + klass.getJavaFile());
|
||||
} else {
|
||||
|
|
@ -110,9 +109,11 @@ public class ModelKlassWriter {
|
|||
}
|
||||
|
||||
private void printKlassHeader(StringBuilder buf, ModelKlass klass) throws IOException {
|
||||
buf.append("package ");
|
||||
buf.append(klass.getJavaPackage());
|
||||
buf.append(";\n");
|
||||
if (!klass.getJavaPackage().isEmpty()) {
|
||||
buf.append("package ");
|
||||
buf.append(klass.getJavaPackage());
|
||||
buf.append(";\n");
|
||||
}
|
||||
buf.append("\n");
|
||||
for (String javaImport : klass.getJavaImports()) {
|
||||
buf.append("import ");
|
||||
|
|
@ -125,8 +126,17 @@ public class ModelKlassWriter {
|
|||
buf.append(javaDescription);
|
||||
buf.append("\n");
|
||||
}
|
||||
buf.append("/// @author للَّٰهِilLצسُو\n");
|
||||
buf.append("/// @version ©Δ∞ 仙上主天\n");
|
||||
buf.append("///\n");
|
||||
if (klass.getJavaDocAuthor() != null && !klass.getJavaDocAuthor().isBlank()) {
|
||||
buf.append("/// @author ");
|
||||
buf.append(klass.getJavaDocAuthor());
|
||||
buf.append("\n");
|
||||
}
|
||||
if (klass.getJavaDocVersion() != null && !klass.getJavaDocVersion().isBlank()) {
|
||||
buf.append("/// @version ");
|
||||
buf.append(klass.getJavaDocVersion());
|
||||
buf.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
public String buildPackageInuktitutDots(int number, int digets) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue