NX01: Rename nether to top level for preparing dial tones

This commit is contained in:
Willem Cazander 2026-01-23 11:54:16 +01:00
parent 4af51ad9ae
commit e69a13ec92
12 changed files with 122 additions and 40 deletions

View file

@ -0,0 +1,33 @@
/*
* 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 ©Δ 仙上主天
module jpp.nether.tone {
}

View file

@ -0,0 +1,126 @@
/*
* 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 ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ;
import java.util.ArrayList;
import java.util.List;
/// Nether tone slug view record.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public record NetherToneSlugView(
int ag1,
int ag2,
int ag3,
int bl0w,
int cr1,
int cr2,
int cr3,
int db1,
int db2,
int db3,
int er0w
) {
public List<Class<?>> toNetherTones(int idx) {
Class<?> qClass = qClass(idx);
List<Class<?>> result = new ArrayList<>(11);
for (int i = 0; i < 11; i++) {
Class<?> subClass = qClass.getPermittedSubclasses()[i];
Class<?>[] valueClasses = subClass.getPermittedSubclasses();
result.add(switch (i) {
case 0: yield valueClasses[ag1];
case 1: yield valueClasses[ag2];
case 2: yield valueClasses[ag3];
case 3: yield valueClasses[bl0w];
case 4: yield valueClasses[cr1];
case 5: yield valueClasses[cr2];
case 6: yield valueClasses[cr3];
case 7: yield valueClasses[db1];
case 8: yield valueClasses[db2];
case 9: yield valueClasses[db3];
case 10: yield valueClasses[er0w];
default:
throw new IllegalArgumentException("Unexpected value: " + i);
});
}
return result;
}
// TODO: idx = 0 = Q1 = maybe enum
static private Class<?> qClass(int idx) {
if (idx < 0) {
throw new IllegalArgumentException("Negative Q index: " + idx);
}
if (idx >= 8) {
throw new IllegalArgumentException("Outside octal Q space boundry: " + idx);
}
return NetherTone.class.getPermittedSubclasses()[idx];
}
static NetherToneSlugView ofQSluq(int idx, Class<? extends NetherTone> q) {
Class<?> qClass = qClass(idx);
int[] d = new int[11];
int dataIdx = 0;
for (Class<?> subClass : qClass.getPermittedSubclasses()) {
boolean hasValue = false;
Class<?>[] valueClasses = subClass.getPermittedSubclasses();
for (int i = 0; i < valueClasses.length; i++) {
Class<?> valueClass = valueClasses[i];
if (valueClass.isAssignableFrom(q)) {
hasValue = true;
d[dataIdx] = i;
dataIdx++;
break;
}
}
if (!hasValue) {
throw new IllegalArgumentException("missing Q value in nether space of: " + subClass);
}
}
return new NetherToneSlugView(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9], d[10]);
}
static boolean slugPresent(int idx, Class<? extends NetherTone> q) {
Class<?> qClass = qClass(idx);
for (Class<?> subClass : qClass.getPermittedSubclasses()) {
boolean hasValue = false;
for (Class<?> valueClass : subClass.getPermittedSubclasses()) {
if (valueClass.isAssignableFrom(q)) {
hasValue = true;
break;
}
}
if (!hasValue) {
return false;
}
}
return true;
}
}

View file

@ -0,0 +1,137 @@
/*
* 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 ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ;
import java.util.Iterator;
import java.util.stream.Stream;
import love.distributedrebirth.nx01.kode.generator.KodeGenModel;
import love.distributedrebirth.nx01.kode.generator.klass.ModelKlass;
import love.distributedrebirth.nx01.kode.generator.klass.ModelKlassWriter;
/// Generated the nether tone interface tree forest.
///
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
public class ModelNetherTones implements KodeGenModel {
private final String BASE_PACK = "ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ";
@Override
public String generatorName() {
return "nether-tones";
}
@Override
public void buildModels(ModelKlassWriter writer) {
buildQuadrants(writer, 1, "ᐧᐧᐧ");
buildQuadrants(writer, 2, "ᐧᐧᣟ");
buildQuadrants(writer, 3, "ᐧᣟᐧ");
buildQuadrants(writer, 4, "ᐧᣟᣟ");
buildQuadrants(writer, 5, "ᣟᐧᐧ");
buildQuadrants(writer, 6, "ᣟᐧᣟ");
buildQuadrants(writer, 7, "ᣟᣟᐧ");
buildQuadrants(writer, 8, "ᣟᣟᣟ");
buildNetherQuadrant(writer, "NetherTone", "NetherToneQ", false);
}
private void buildQuadrants(ModelKlassWriter writer, int quadrant, String s) {
String q = "ᐊQ" + quadrant;
String e = "NetherToneQ" + quadrant;
buildNetherTreeSlug(writer, s, q + "AG1", 64, e);
buildNetherTreeSlug(writer, s, q + "AG2", 64, e);
buildNetherTreeSlug(writer, s, q + "AG3", 64, e);
buildNetherTreeSlug(writer, s, q + "BL0W", 512, e);
buildNetherTreeSlug(writer, s, q + "CR1", 64, e);
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);
buildNetherQuadrant(writer, e, q, true); // permits all above
}
private void buildNetherTreeSlug(ModelKlassWriter writer, String subPackage, String javaName, int slugSize, String quadrant) {
ModelKlass klass = new ModelKlass(BASE_PACK + "." + subPackage, javaName);
klass.addJavaImport(BASE_PACK + "." + quadrant);
writer.addModelKlass(klass);
StringBuilder buf = klass.getBody();
buf.append("public sealed interface ");
buf.append(klass.getJavaName());
buf.append(" extends ");
buf.append(quadrant);
buf.append(" {\n");
for (int i = 1 ; i <= slugSize; i++) {
String partCode = "" + String.format("%03d", i);
String clsBase = partCode + " extends " + klass.getJavaName();
String clsMutexExt = ", " + javaName + "Mutex<" + partCode + ">";
buf.append("\tnon-sealed interface " + clsBase + clsMutexExt + " {}\n");
}
buf.append("}\n");
ModelKlass klassMutex = new ModelKlass(BASE_PACK + "." + 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 buildNetherQuadrant(ModelKlassWriter writer, String javaName, String javaSearch, boolean child) {
ModelKlass klass = new ModelKlass(BASE_PACK, javaName);
StringBuilder buf = klass.getBody();
buf.append("public sealed interface ");
buf.append(klass.getJavaName());
if (child) {
buf.append(" extends NetherTone");
}
buf.append(" permits\n");
Stream<ModelKlass> f = writer.getModelKlasses().stream().filter(v -> !v.getJavaName().contains("Mutex")).filter(v -> v.getJavaName().contains(javaSearch));
for (Iterator<ModelKlass> i = f.iterator(); i.hasNext() ;) {
ModelKlass mk = i.next();
if (child) {
klass.addJavaImport(mk.getJavaPackage() + "." + mk.getJavaName());
}
buf.append("\t");
buf.append(mk.getJavaName());
if (i.hasNext()) {
buf.append(",\n");
} else {
buf.append("\n");
}
}
buf.append("\t{\n");
buf.append("}\n");
writer.addModelKlass(klass);
}
}

View file

@ -0,0 +1,98 @@
/*
* 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 ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1AG1;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1AG2;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1AG3;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1BL0W;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1CR1;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1CR2;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1CR3;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1DB1;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1DB2;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1DB3;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1ER0W;
import ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.NetherToneSlugView;
public class NetherToneSlugViewTest {
private interface Q1SlugExample extends
ᐊQ1AG1.ᐅ001,
ᐊQ1AG2.ᐅ002,
ᐊQ1AG3.ᐅ003,
ᐊQ1BL0W.ᐅ004,
ᐊQ1CR1.ᐅ005,
ᐊQ1CR2.ᐅ006,
ᐊQ1CR3.ᐅ007,
ᐊQ1DB1.ᐅ008,
ᐊQ1DB2.ᐅ009,
ᐊQ1DB3.ᐅ010,
ᐊQ1ER0W.ᐅ011
{
}
private interface Q1SlugExampleErr extends
ᐊQ1AG1.ᐅ001,
ᐊQ1AG2.ᐅ002
{
}
@Test
public void testSlugViewErr() {
Assertions.assertThrows(IllegalArgumentException.class, () -> {
NetherToneSlugView.ofQSluq(0, Q1SlugExampleErr.class);
});
Assertions.assertFalse(NetherToneSlugView.slugPresent(0, Q1SlugExampleErr.class));
}
@Test
public void testSlugViewParse() {
NetherToneSlugView slug = NetherToneSlugView.ofQSluq(0, Q1SlugExample.class);
Assertions.assertNotNull(slug);
Assertions.assertEquals(0, slug.ag1());
Assertions.assertEquals(1, slug.ag2());
Assertions.assertEquals(2, slug.ag3());
}
@Test
public void testSlugViewDecompose() {
NetherToneSlugView slug = NetherToneSlugView.ofQSluq(0, Q1SlugExample.class);
Assertions.assertNotNull(slug);
List<Class<?>> result = slug.toNetherTones(0);
Assertions.assertNotNull(result);
Assertions.assertEquals(ᐊQ1AG1.ᐅ001.class, result.get(0));
Assertions.assertEquals(ᐊQ1AG2.ᐅ002.class, result.get(1));
Assertions.assertEquals(ᐊQ1AG3.ᐅ003.class, result.get(2));
}
}

View file

@ -0,0 +1 @@
ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ModelNetherTones