NX01: Rename to numeric modules and split collections2
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 49s
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 49s
This commit is contained in:
parent
c67142faba
commit
b8855069df
77 changed files with 191 additions and 118 deletions
68
nx01-jpp0-nether-tone/pom.xml
Normal file
68
nx01-jpp0-nether-tone/pom.xml
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01</artifactId>
|
||||
<version>5786.SHEVAT〄.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>nx01-jpp0-nether-tone</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.nx01</groupId>
|
||||
<artifactId>nx01-kode-gen</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.build.directory}/kode-nether-tone</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</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="nether-tone" />
|
||||
<arg line="generate" />
|
||||
</java>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
35
nx01-jpp0-nether-tone/src/main/java/module-info.java
Normal file
35
nx01-jpp0-nether-tone/src/main/java/module-info.java
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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 NX01 jpp0 nether tone module.
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
module ᣕᕁᐤᣳ.ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ {
|
||||
exports ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ;
|
||||
exports ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ;
|
||||
}
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* 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 NetherToneSlugView {
|
||||
if (ag1 < 0 || ag1 > 63) { throw new IllegalArgumentException("ag1: " + ag1); }
|
||||
if (ag2 < 0 || ag2 > 63) { throw new IllegalArgumentException("ag2: " + ag2); }
|
||||
if (ag3 < 0 || ag3 > 63) { throw new IllegalArgumentException("ag3: " + ag3); }
|
||||
if (bl0w < 0 || bl0w > 511) { throw new IllegalArgumentException("bl0w: " + bl0w); }
|
||||
if (cr1 < 0 || cr1 > 63) { throw new IllegalArgumentException("cr1: " + cr1); }
|
||||
if (cr2 < 0 || cr2 > 63) { throw new IllegalArgumentException("cr2: " + cr2); }
|
||||
if (cr3 < 0 || cr3 > 63) { throw new IllegalArgumentException("cr3: " + cr3); }
|
||||
if (db1 < 0 || db1 > 63) { throw new IllegalArgumentException("db1: " + db1); }
|
||||
if (db2 < 0 || db2 > 63) { throw new IllegalArgumentException("db2: " + db2); }
|
||||
if (db3 < 0 || db3 > 63) { throw new IllegalArgumentException("db3: " + db3); }
|
||||
if (er0w < 0 || er0w > 511) { throw new IllegalArgumentException("er0w: " + er0w); }
|
||||
}
|
||||
|
||||
private final static String VALUES_3 = "\u05D3\u05D5\u05D6\u05D9\u05E8\u05F0\u05F1\u05F2";
|
||||
private final static String VALUES_6 = "\u05B0\u05B2\u05B3\u05B5\u05B6\u05B7\u05BB\u05BD";
|
||||
private final static String VALUES_9 = "\u0594\u0595\u0598\u059D\u059E\u059F\u05A0\u05A9";
|
||||
private void printNúmero2Lingua6(StringBuilder buf, int value) {
|
||||
buf.appendCodePoint(VALUES_3.codePoints().skip((value >> 3) & 7).findFirst().getAsInt());
|
||||
buf.appendCodePoint(VALUES_6.codePoints().skip((value >> 0) & 7).findFirst().getAsInt());
|
||||
}
|
||||
private void printNúmero2Lingua9(StringBuilder buf, int value) {
|
||||
buf.appendCodePoint(VALUES_3.codePoints().skip((value >> 6) & 7).findFirst().getAsInt());
|
||||
buf.appendCodePoint(VALUES_6.codePoints().skip((value >> 3) & 7).findFirst().getAsInt());
|
||||
buf.appendCodePoint(VALUES_9.codePoints().skip((value >> 0) & 7).findFirst().getAsInt());
|
||||
}
|
||||
|
||||
public String toNúmero2Lingua() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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 ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆAG1;
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆAG2;
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆAG3;
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆBL0W;
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆCR1;
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆCR2;
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆCR3;
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆDB1;
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆDB2;
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆDB3;
|
||||
import ᒢᣘᐧᐧ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᔆᒼᣗᑊᣖᐪ.ᐊᐪᔆER0W;
|
||||
|
||||
public class NetherToneSlugViewTest {
|
||||
|
||||
private interface Q1SlugExample extends
|
||||
ᐊᐪᔆAG1.ᐅ00,
|
||||
ᐊᐪᔆAG2.ᐅ01,
|
||||
ᐊᐪᔆAG3.ᐅ02,
|
||||
ᐊᐪᔆBL0W.ᐅ003,
|
||||
ᐊᐪᔆCR1.ᐅ04,
|
||||
ᐊᐪᔆCR2.ᐅ05,
|
||||
ᐊᐪᔆCR3.ᐅ06,
|
||||
ᐊᐪᔆDB1.ᐅ07,
|
||||
ᐊᐪᔆDB2.ᐅ08,
|
||||
ᐊᐪᔆDB3.ᐅ09,
|
||||
ᐊᐪᔆER0W.ᐅ010
|
||||
{
|
||||
}
|
||||
|
||||
private interface Q1SlugExampleErr extends
|
||||
ᐊᐪᔆAG1.ᐅ00,
|
||||
ᐊᐪᔆAG2.ᐅ01
|
||||
{
|
||||
}
|
||||
|
||||
@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(ᐊᐪᔆAG1.ᐅ00.class, result.get(0));
|
||||
Assertions.assertEquals(ᐊᐪᔆAG2.ᐅ01.class, result.get(1));
|
||||
Assertions.assertEquals(ᐊᐪᔆAG3.ᐅ02.class, result.get(2));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue