NX01: Cleanup kode gen a little bit of byte rot
This commit is contained in:
parent
babb2cf188
commit
4af51ad9ae
6 changed files with 191 additions and 136 deletions
|
|
@ -38,10 +38,12 @@ import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAu
|
||||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||||
public class BabelTest {
|
public class BabelTest {
|
||||||
// ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.xxx
|
// ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.xxx
|
||||||
// ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ(8 times 2^6+2^6+2^6+2^9+2^6+2^6+2^6+2^6+2^6+2^6+2^9 = 12800 interface + mutex + etc)
|
// ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ(8 times 2^6+2^6+2^6+2^9+2^6+2^6+2^6+2^6+2^6+2^6+2^9 = 12800 interface + mutex + etc)
|
||||||
// ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᒼᑋᐤᣗᑊᐣ (SKIP-JAVA4?: REDO 8 times 3 chords of 2^18 tree slug size + file groupings)
|
// ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒼᑋᐤᣗᑊᐣ (SKIP-JAVA4?: REDO 8 times 3 chords of 2^18 tree slug size + file groupings)
|
||||||
// = 8*3*(2^18) = 6_291_456 is above default jvm max class limit
|
// = 8*3*(2^18) = 6_291_456 is above default jvm max class limit
|
||||||
// implement as group marker interface to readout relative distance to marker root
|
// implement as group marker interface to readout relative distance to marker root
|
||||||
|
// ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒄᑊᣔᒻ.ᒻᑊᣕᕐᓑᣔ (#interfaces; ~31K + file groupings)
|
||||||
|
// ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒄᑊᣔᒻ.ᒃᣔᔆᓫᒄ (#interfaces; 2304 + 2_655_360 + file groupings)
|
||||||
// ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᒃᐤᣕᓫ.ᣖᑊᣗᣔᐪᓫ.ᒃᐤᣔᐪs
|
// ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᒃᐤᣕᓫ.ᣖᑊᣗᣔᐪᓫ.ᒃᐤᣔᐪs
|
||||||
// ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᒃᐤᣕᓫ.ᣘᒻᓫᔆᑋ.ᣔᔿᔿᐤ
|
// ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᒃᐤᣕᓫ.ᣘᒻᓫᔆᑋ.ᣔᔿᔿᐤ
|
||||||
// ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᒼᣔᑊᑉᓫ.ᐪᣔᔆᐪᓫ
|
// ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᒼᣔᑊᑉᓫ.ᐪᣔᔆᐪᓫ
|
||||||
|
|
@ -53,8 +55,6 @@ public class BabelTest {
|
||||||
// ᒢᐩᐩ.ᒡᒢᣔᣗᣖ.ᔿᣔᣕᑊᣘᓫᔆᐪᐤᣗ.ᔆᒼᐤᣖᑊᒼ
|
// ᒢᐩᐩ.ᒡᒢᣔᣗᣖ.ᔿᣔᣕᑊᣘᓫᔆᐪᐤᣗ.ᔆᒼᐤᣖᑊᒼ
|
||||||
// ᒢᐩᐩ.ᐪᓫᕽᐪ.ᔆᐪᣗᑊᣕᕐ.ᣔᑊᐣᓑᒻᐪ (jpp 18 bit version of PrimordialOctalOrangeString)
|
// ᒢᐩᐩ.ᐪᓫᕽᐪ.ᔆᐪᣗᑊᣕᕐ.ᣔᑊᐣᓑᒻᐪ (jpp 18 bit version of PrimordialOctalOrangeString)
|
||||||
// ᒢᐩᐩ.ᐪᓫᕽᐪ.ᔆᐪᣗᑊᣕᕐ.ᓑᣕᣳᒼᐤᒄᓫ
|
// ᒢᐩᐩ.ᐪᓫᕽᐪ.ᔆᐪᣗᑊᣕᕐ.ᓑᣕᣳᒼᐤᒄᓫ
|
||||||
// ᒢᐩᐩ.ᐪᓫᕽᐪ.ᒄᓫᣕᐪᣔᒻ.ᒻᑊᣕᕐᓑᣔ (#interfaces; ~31K + file groupings)
|
|
||||||
// ᒢᐩᐩ.ᣕᓑᔿᒃᓫᣗ.ᙆᓫᣗᒄᑊᣕᣔᒻ.ᒃᣔᔆᓫᑊᐣ (#interfaces; 2304 + 2_655_360 + file groupings)
|
|
||||||
// - real enum terminator set is from FC18 (FCFlameNumberGram.java)
|
// - real enum terminator set is from FC18 (FCFlameNumberGram.java)
|
||||||
// - bone based terminators up to PIG size 2304 (after 99% of JPP code comes from nether generate on use)
|
// - bone based terminators up to PIG size 2304 (after 99% of JPP code comes from nether generate on use)
|
||||||
// - virtual terminator from nether chord group selector slug path is 2^18 bit pie part values
|
// - virtual terminator from nether chord group selector slug path is 2^18 bit pie part values
|
||||||
|
|
|
||||||
|
|
@ -39,47 +39,30 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>nx01-generate-nether</id>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<configuration>
|
||||||
|
<target>
|
||||||
|
<java classname="love.distributedrebirth.nx01.kode.generator.KodeGen" fork="true"
|
||||||
|
failonerror="true">
|
||||||
|
<!-- using test CP so local module gets resolved correctly -->
|
||||||
|
<classpath refid="maven.test.classpath" />
|
||||||
|
<arg line="tones" />
|
||||||
|
<arg line="generate" />
|
||||||
|
</java>
|
||||||
|
</target>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>nx01-jpp-klass-nether-generate</id>
|
|
||||||
<activation>
|
|
||||||
<file>
|
|
||||||
<!-- NOTE: this only works when clean is run seperate of compile -->
|
|
||||||
<missing>target/generated-sources.hash</missing>
|
|
||||||
</file>
|
|
||||||
</activation>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-antrun-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>nx01-generate-nether</id>
|
|
||||||
<goals>
|
|
||||||
<goal>run</goal>
|
|
||||||
</goals>
|
|
||||||
<phase>process-resources</phase>
|
|
||||||
<configuration>
|
|
||||||
<target>
|
|
||||||
<echo>NX01: Generating nether tones</echo>
|
|
||||||
<java classname="love.distributedrebirth.nx01.kode.generator.GenerateNetherTone" fork="true"
|
|
||||||
failonerror="true">
|
|
||||||
<!-- using test CP so local module gets resolved correctly -->
|
|
||||||
<classpath refid="maven.test.classpath" />
|
|
||||||
<arg line="generate" />
|
|
||||||
<arg line="based" />
|
|
||||||
</java>
|
|
||||||
<echo>NX01: Done nether</echo>
|
|
||||||
</target>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package love.distributedrebirth.nx01.kode.generator;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import love.distributedrebirth.nx01.kode.generator.klass.ModelKlassWriter;
|
||||||
|
|
||||||
|
/// Runs the different kode generators provided for the NX01.
|
||||||
|
///
|
||||||
|
/// @author للَّٰهِilLצسُو
|
||||||
|
/// @version ©Δ∞ 仙上主天
|
||||||
|
public class KodeGen {
|
||||||
|
|
||||||
|
private final static String SERIAL_VERSON_ID = "13";
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
if (skipCommand()) {
|
||||||
|
System.out.println("SKIPPED: Generated source are up to date");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<String> argu = Arrays.asList(args);
|
||||||
|
boolean writeToFile = argu.contains("generate");
|
||||||
|
String commandDesc = null;
|
||||||
|
KodeGenModel commandKode = null;
|
||||||
|
if (argu.contains("tones")) {
|
||||||
|
commandDesc = "nether tones";
|
||||||
|
commandKode = new ModelNetherTones();
|
||||||
|
} else {
|
||||||
|
System.err.println("No command given.");
|
||||||
|
System.exit(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// write all sources to files or stdout
|
||||||
|
System.out.println("Generating " + commandDesc);
|
||||||
|
ModelKlassWriter writer = new ModelKlassWriter("target/generated-sources");
|
||||||
|
writer.setProlog(new File("../licence.txt"));
|
||||||
|
commandKode.buildModels(writer);
|
||||||
|
writer.printModels(writeToFile);
|
||||||
|
System.out.println("Done " + commandDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean skipCommand() throws IOException {
|
||||||
|
Path hashFile = new File("target/generated-sources.hash").toPath();
|
||||||
|
if (hashFile.toFile().exists()) {
|
||||||
|
String hash = Files.readString(hashFile);
|
||||||
|
if (SERIAL_VERSON_ID.equals(hash)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Files.writeString(hashFile, SERIAL_VERSON_ID);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package love.distributedrebirth.nx01.kode.generator;
|
||||||
|
|
||||||
|
import love.distributedrebirth.nx01.kode.generator.klass.ModelKlassWriter;
|
||||||
|
|
||||||
|
/// Configure the model for the writer.
|
||||||
|
///
|
||||||
|
/// @author للَّٰهِilLצسُو
|
||||||
|
/// @version ©Δ∞ 仙上主天
|
||||||
|
public interface KodeGenModel {
|
||||||
|
|
||||||
|
void buildModels(ModelKlassWriter writer);
|
||||||
|
}
|
||||||
|
|
@ -27,13 +27,7 @@
|
||||||
|
|
||||||
package love.distributedrebirth.nx01.kode.generator;
|
package love.distributedrebirth.nx01.kode.generator;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import love.distributedrebirth.nx01.kode.generator.klass.ModelKlass;
|
import love.distributedrebirth.nx01.kode.generator.klass.ModelKlass;
|
||||||
|
|
@ -43,35 +37,10 @@ import love.distributedrebirth.nx01.kode.generator.klass.ModelKlassWriter;
|
||||||
///
|
///
|
||||||
/// @author للَّٰهِilLצسُو
|
/// @author للَّٰهِilLצسُو
|
||||||
/// @version ©Δ∞ 仙上主天
|
/// @version ©Δ∞ 仙上主天
|
||||||
public class GenerateNetherTone {
|
public class ModelNetherTones implements KodeGenModel {
|
||||||
|
|
||||||
private final static String SERIAL_VERSON_ID = "11";
|
@Override
|
||||||
|
public void buildModels(ModelKlassWriter writer) {
|
||||||
public static void main(String[] args) throws IOException {
|
|
||||||
List<String> argu = Arrays.asList(args);
|
|
||||||
GenerateNetherTone gen = new GenerateNetherTone();
|
|
||||||
boolean writeToFile = argu.contains("generate");
|
|
||||||
if (argu.contains("based")) {
|
|
||||||
gen.updateBased(writeToFile);
|
|
||||||
} else {
|
|
||||||
System.err.println("No command given.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateBased(boolean writeToFile) throws IOException {
|
|
||||||
Path hashFile = new File("target/generated-sources.hash").toPath();
|
|
||||||
if (hashFile.toFile().exists()) {
|
|
||||||
String hash = Files.readString(hashFile);
|
|
||||||
if (SERIAL_VERSON_ID.equals(hash)) {
|
|
||||||
System.out.println("SKIPPED: Generated source are up to date");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Files.writeString(hashFile, SERIAL_VERSON_ID);
|
|
||||||
|
|
||||||
ModelKlassWriter writer = new ModelKlassWriter("target/generated-sources");
|
|
||||||
writer.setProlog(new File("../licence.txt"));
|
|
||||||
|
|
||||||
buildQuadrants(writer, 1, "ᐧᐧᐧ");
|
buildQuadrants(writer, 1, "ᐧᐧᐧ");
|
||||||
buildQuadrants(writer, 2, "ᐧᐧᣟ");
|
buildQuadrants(writer, 2, "ᐧᐧᣟ");
|
||||||
buildQuadrants(writer, 3, "ᐧᣟᐧ");
|
buildQuadrants(writer, 3, "ᐧᣟᐧ");
|
||||||
|
|
@ -81,59 +50,32 @@ public class GenerateNetherTone {
|
||||||
buildQuadrants(writer, 7, "ᣟᣟᐧ");
|
buildQuadrants(writer, 7, "ᣟᣟᐧ");
|
||||||
buildQuadrants(writer, 8, "ᣟᣟᣟ");
|
buildQuadrants(writer, 8, "ᣟᣟᣟ");
|
||||||
|
|
||||||
createNetherQuadrant(writer, "NetherTone", "NetherToneQ", false);
|
buildNetherQuadrant(writer, "NetherTone", "NetherToneQ", false);
|
||||||
|
|
||||||
// write all sources to files or stdout
|
|
||||||
writer.write(writeToFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildQuadrants(ModelKlassWriter writer, int quadrant, String s) {
|
private void buildQuadrants(ModelKlassWriter writer, int quadrant, String s) {
|
||||||
String q = "ᐊQ" + quadrant;
|
String q = "ᐊQ" + quadrant;
|
||||||
String e = "NetherToneQ" + quadrant;
|
String e = "NetherToneQ" + quadrant;
|
||||||
|
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "AG1", "ᐅ", 64, e));
|
buildNetherTreeSlug(writer, s, q + "AG1", 64, e);
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "AG1"));
|
buildNetherTreeSlug(writer, s, q + "AG2", 64, e);
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "AG2", "ᐅ", 64, e));
|
buildNetherTreeSlug(writer, s, q + "AG3", 64, e);
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "AG2"));
|
buildNetherTreeSlug(writer, s, q + "BL0W", 512, e);
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "AG3", "ᐅ", 64, e));
|
buildNetherTreeSlug(writer, s, q + "CR1", 64, e);
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "AG3"));
|
buildNetherTreeSlug(writer, s, q + "CR2", 64, e);
|
||||||
|
buildNetherTreeSlug(writer, s, q + "CR3", 64, e);
|
||||||
|
buildNetherTreeSlug(writer, s, q + "DB1", 64, e);
|
||||||
|
buildNetherTreeSlug(writer, s, q + "DB2", 64, e);
|
||||||
|
buildNetherTreeSlug(writer, s, q + "DB3", 64, e);
|
||||||
|
buildNetherTreeSlug(writer, s, q + "ER0W", 512, e);
|
||||||
|
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "BL0W", "ᐅ", 512, e));
|
buildNetherQuadrant(writer, e, q, true); // permits all above
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "BL0W"));
|
|
||||||
|
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "CR1", "ᐅ", 64, e));
|
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "CR1"));
|
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "CR2", "ᐅ", 64, e));
|
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "CR2"));
|
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "CR3", "ᐅ", 64, e));
|
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "CR3"));
|
|
||||||
|
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "DB1", "ᐅ", 64, e));
|
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "DB1"));
|
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "DB2", "ᐅ", 64, e));
|
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "DB2"));
|
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "DB3", "ᐅ", 64, e));
|
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "DB3"));
|
|
||||||
|
|
||||||
writer.addModelKlass(buildNetherTreeSlug(s, q + "ER0W", "ᐅ", 512, e));
|
|
||||||
writer.addModelKlass(buildNetherTreeMutex(s, q + "ER0W"));
|
|
||||||
|
|
||||||
createNetherQuadrant(writer, e, q, true); // permits all above
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModelKlass buildNetherTreeMutex(String subPackage, String javaName) {
|
private void buildNetherTreeSlug(ModelKlassWriter writer, String subPackage, String javaName, int slugSize, String quadrant) {
|
||||||
ModelKlass klass = new ModelKlass("ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ." + subPackage, javaName + "Mutex");
|
|
||||||
StringBuilder buf = klass.getBody();
|
|
||||||
buf.append("interface ");
|
|
||||||
buf.append(klass.getJavaName());
|
|
||||||
buf.append("<T> {\n");
|
|
||||||
buf.append("}\n");
|
|
||||||
return klass;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ModelKlass buildNetherTreeSlug(String subPackage, String javaName, String slugName, int slugSize, String quadrant) {
|
|
||||||
ModelKlass klass = new ModelKlass("ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ." + subPackage, javaName);
|
ModelKlass klass = new ModelKlass("ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ." + subPackage, javaName);
|
||||||
klass.addJavaImport("ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ."+quadrant);
|
klass.addJavaImport("ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ." + quadrant);
|
||||||
|
writer.addModelKlass(klass);
|
||||||
StringBuilder buf = klass.getBody();
|
StringBuilder buf = klass.getBody();
|
||||||
buf.append("public sealed interface ");
|
buf.append("public sealed interface ");
|
||||||
buf.append(klass.getJavaName());
|
buf.append(klass.getJavaName());
|
||||||
|
|
@ -141,16 +83,23 @@ public class GenerateNetherTone {
|
||||||
buf.append(quadrant);
|
buf.append(quadrant);
|
||||||
buf.append(" {\n");
|
buf.append(" {\n");
|
||||||
for (int i = 1 ; i <= slugSize; i++) {
|
for (int i = 1 ; i <= slugSize; i++) {
|
||||||
String partCode = String.format("%03d", i);
|
String partCode = "ᐅ" + String.format("%03d", i);
|
||||||
String clsBase = slugName + partCode + " extends " + klass.getJavaName();
|
String clsBase = partCode + " extends " + klass.getJavaName();
|
||||||
String clsMutexExt = ", " + javaName + "Mutex<" + slugName + partCode + ">";
|
String clsMutexExt = ", " + javaName + "Mutex<" + partCode + ">";
|
||||||
buf.append("\tnon-sealed interface "+clsBase+clsMutexExt+" {}\n");
|
buf.append("\tnon-sealed interface " + clsBase + clsMutexExt + " {}\n");
|
||||||
}
|
}
|
||||||
buf.append("}\n");
|
buf.append("}\n");
|
||||||
return klass;
|
|
||||||
|
ModelKlass klassMutex = new ModelKlass("ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ." + subPackage, javaName + "Mutex");
|
||||||
|
writer.addModelKlass(klassMutex);
|
||||||
|
StringBuilder bufMutex = klassMutex.getBody();
|
||||||
|
bufMutex.append("interface ");
|
||||||
|
bufMutex.append(klassMutex.getJavaName());
|
||||||
|
bufMutex.append("<T> {\n");
|
||||||
|
bufMutex.append("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNetherQuadrant(ModelKlassWriter writer, String javaName, String javaSearch, boolean child) {
|
private void buildNetherQuadrant(ModelKlassWriter writer, String javaName, String javaSearch, boolean child) {
|
||||||
ModelKlass klass = new ModelKlass("ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ", javaName);
|
ModelKlass klass = new ModelKlass("ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ", javaName);
|
||||||
StringBuilder buf = klass.getBody();
|
StringBuilder buf = klass.getBody();
|
||||||
buf.append("public sealed interface ");
|
buf.append("public sealed interface ");
|
||||||
|
|
@ -63,14 +63,14 @@ public class ModelKlassWriter {
|
||||||
klasses.add(Objects.requireNonNull(klass));
|
klasses.add(Objects.requireNonNull(klass));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(boolean writeFile) throws IOException {
|
public void printModels(boolean writeFile) throws IOException {
|
||||||
if (writeFile) {
|
if (writeFile) {
|
||||||
if (!outputPath.toFile().exists()) {
|
if (!outputPath.toFile().exists()) {
|
||||||
outputPath.toFile().mkdirs();
|
outputPath.toFile().mkdirs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ModelKlass klass : klasses) {
|
for (ModelKlass klass : klasses) {
|
||||||
String content = writeKlass(klass);
|
String content = printKlass(klass);
|
||||||
if (writeFile) {
|
if (writeFile) {
|
||||||
Path outFile = outputPath.resolve(klass.getJavaFile().toPath());
|
Path outFile = outputPath.resolve(klass.getJavaFile().toPath());
|
||||||
outFile.toFile().getParentFile().mkdirs();
|
outFile.toFile().getParentFile().mkdirs();
|
||||||
|
|
@ -84,15 +84,15 @@ public class ModelKlassWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String writeKlass(ModelKlass klass) throws IOException {
|
private String printKlass(ModelKlass klass) throws IOException {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
writeKlassProlog(buf);
|
printKlassProlog(buf);
|
||||||
writeKlassHeader(buf, klass);
|
printKlassHeader(buf, klass);
|
||||||
buf.append(klass.getBody());
|
buf.append(klass.getBody());
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeKlassProlog(StringBuilder buf) throws IOException {
|
private void printKlassProlog(StringBuilder buf) throws IOException {
|
||||||
if (prolog == null) {
|
if (prolog == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +110,7 @@ public class ModelKlassWriter {
|
||||||
buf.append("\n");
|
buf.append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeKlassHeader(StringBuilder buf, ModelKlass klass) throws IOException {
|
private void printKlassHeader(StringBuilder buf, ModelKlass klass) throws IOException {
|
||||||
buf.append("package ");
|
buf.append("package ");
|
||||||
buf.append(klass.getJavaPackage());
|
buf.append(klass.getJavaPackage());
|
||||||
buf.append(";\n");
|
buf.append(";\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue