NX01: Added nether tone kode gen and java module thus changed version
This commit is contained in:
parent
6659889ca8
commit
babb2cf188
47 changed files with 860 additions and 60 deletions
85
nx01-jpp-klass-nether/pom.xml
Normal file
85
nx01-jpp-klass-nether/pom.xml
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<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-jpp-klass-nether</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}/generated-sources/</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</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>
|
||||
33
nx01-jpp-klass-nether/src/main/java/module-info.java
Normal file
33
nx01-jpp-klass-nether/src/main/java/module-info.java
Normal 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.klass.nether {
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1AG1;
|
||||
import ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1AG2;
|
||||
import ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1AG3;
|
||||
import ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1BL0W;
|
||||
import ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1CR1;
|
||||
import ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1CR2;
|
||||
import ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1CR3;
|
||||
import ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1DB1;
|
||||
import ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1DB2;
|
||||
import ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1DB3;
|
||||
import ᒢᐩᐩ.ᑊᑉᒻᣔᔆᔆ.ᣕᓫᐪᑋᓫᣗ.ᐪᐤᣕᓫ.ᐧᐧᐧ.ᐊQ1ER0W;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue