Played with embedded number

This commit is contained in:
Willem Cazander 2022-02-21 02:46:41 +01:00
parent 5a6800d2d3
commit 8d275b982c
21 changed files with 200 additions and 34 deletions

View file

@ -14,11 +14,7 @@ public interface BaseNumber<V extends BaseNumber<V>> {
static float CIRCLE_DEGREE = 360f;
int getBitCount();
default float getSliceAngle() {
return CIRCLE_DEGREE/getBitCount();
}
int BãßBitCount();
V toClone();

View file

@ -38,7 +38,7 @@ public final class V006Tixte implements BaseNumber<V006Tixte> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -54,7 +54,7 @@ public final class V009Tyte implements BaseNumberTyte<V009Tyte> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -65,7 +65,7 @@ public final class V018Tord implements BaseNumberTyte<V018Tord> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -44,7 +44,7 @@ public final class V027Temvig implements BaseNumberTyte<V027Temvig> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -66,7 +66,7 @@ public final class V036Teger implements BaseNumberTyte<V036Teger> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -36,7 +36,7 @@ public final class V042Traw implements BaseNumber<V042Traw> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -57,7 +57,7 @@ public final class V072Tong implements BaseNumberTyte<V072Tong> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -73,7 +73,7 @@ public final class V144Tocta implements BaseNumberTyte<V144Tocta> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -37,7 +37,7 @@ public class V0x000348ˣᴸ implements BaseNumberˣᴸ<V0x000348ˣᴸ> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -38,7 +38,7 @@ public class V0x000654ˣᴸ implements BaseNumberTyteˣᴸ<V0x000654ˣᴸ> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -38,7 +38,7 @@ public class V0x000CA8ˣᴸ implements BaseNumberTyteˣᴸ<V0x000CA8ˣᴸ> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -36,7 +36,7 @@ public class V0x0013B0ˣᴸ implements BaseNumberˣᴸ<V0x0013B0ˣᴸ> {
}
@Override
public int getBitCount() {
public int BãßBitCount() {
return BIT_COUNT;
}

View file

@ -2,6 +2,7 @@ package love.distributedrebirth.numberxd.x4o;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.eld.lang.ModuleElement;
import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.element.ElementNamespace;
@ -28,17 +29,17 @@ import love.distributedrebirth.numberxd.base2t.type.V144Tocta;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class NumberXDModuleLoader implements X4OLanguageModuleLoader {
private static final String PP_NXD_PROVIDER_HOST = "numberxd.x4o.distributedrebirth.love";
private static final String PP_NXD_PROVIDER_HOST = "unicode4d.x4o.distributedrebirth.love";
private static final String PP_NXD_XMLNS = "http://"+PP_NXD_PROVIDER_HOST+"/xml/ns/";
private static final String PP_NXD_XSD_FILE = "-1.0.xsd";
private static final String NXD_CORE = "nxd-core";
private static final String NXD_ROOT = "nxd-root";
private static final String NXD_CORE_XSD_FILE = NXD_CORE+PP_NXD_XSD_FILE;
private static final String NXD_ROOT_XSD_FILE = NXD_ROOT+PP_NXD_XSD_FILE;
public static final String NXD_CORE_URI = PP_NXD_XMLNS+NXD_CORE;
public static final String NXD_ROOT_URI = PP_NXD_XMLNS+NXD_ROOT;
public static final String NXD_CORE_XSD_URI = NXD_CORE_URI+PP_NXD_XSD_FILE;
public static final String NXD_ROOT_XSD_URI = NXD_ROOT_URI+PP_NXD_XSD_FILE;
private static final String NXD_DATA = "d";
//private static final String NXD_ROOT = "nxd-root";
private static final String NXD_DATA_XSD_FILE = NXD_DATA+PP_NXD_XSD_FILE;
//private static final String NXD_ROOT_XSD_FILE = NXD_ROOT+PP_NXD_XSD_FILE;
public static final String NXD_DATA_URI = PP_NXD_XMLNS+NXD_DATA;
//public static final String NXD_ROOT_URI = PP_NXD_XMLNS+NXD_ROOT;
public static final String NXD_DATA_XSD_URI = NXD_DATA_URI+PP_NXD_XSD_FILE;
//public static final String NXD_ROOT_XSD_URI = NXD_ROOT_URI+PP_NXD_XSD_FILE;
@Override
public void loadLanguageModule(X4OLanguageLocal language, X4OLanguageModuleLocal languageModule) throws X4OLanguageModuleLoaderException {
@ -47,6 +48,11 @@ public class NumberXDModuleLoader implements X4OLanguageModuleLoader {
languageModule.setProviderHost(PP_NXD_PROVIDER_HOST);
languageModule.setDescription("Number eXtra Dimension Module Loader");
addBindingHandler(languageModule,new V072TongBindingHandler(),"v072-bind","Binds the V072Tong childeren.");
addBindingHandler(languageModule,new V072TongP1BindingHandler(),"v072P1-bind","Binds the V072TongP1 childeren.");
addBindingHandler(languageModule,new V072TongP2BindingHandler(),"v072P2-bind","Binds the V072TongP2 childeren.");
/*
ElementNamespace namespaceRoot = createNamespaceContext(language,NXD_ROOT,NXD_ROOT_URI,NXD_ROOT_XSD_URI,NXD_ROOT_XSD_FILE,NXD_ROOT);
namespaceRoot.setLanguageRoot(true); // Only define single language root so xsd is (mostly) not cicle import.
ElementClass rootElement = createElementClass(language,"module",language.getLanguageConfiguration().getDefaultElementLanguageModule(),ModuleElement.class,"The module tag is the root xml element for ELD language.");
@ -54,8 +60,9 @@ public class NumberXDModuleLoader implements X4OLanguageModuleLoader {
rootElement.addElementClassAttribute(createElementClassAttribute(language,"providerHost",true,null));
namespaceRoot.addElementClass(rootElement);
startAndAddNamespace(language,languageModule,namespaceRoot);
*/
ElementNamespace namespace = createNamespaceContext(language,NXD_CORE,NXD_CORE_URI,NXD_CORE_XSD_URI,NXD_CORE_XSD_FILE,NXD_CORE);
ElementNamespace namespace = createNamespaceContext(language,NXD_DATA,NXD_DATA_URI,NXD_DATA_XSD_URI,NXD_DATA_XSD_FILE,NXD_DATA);
configElementClasses(language,namespace);
startAndAddNamespace(language,languageModule,namespace);
}
@ -65,22 +72,35 @@ public class NumberXDModuleLoader implements X4OLanguageModuleLoader {
ec = createElementClass(language,"v006",V006Tixte.class,null,"Defines an V006Tixte number.");
//configBãßBȍőnPartAttributes(language, ec, T02PartBinary.PART_1);
namespace.addElementClass(ec);
ec = createElementClass(language,"v009",V009Tyte.class,null,"Defines an V009Tyte number.");
//configBãßBȍőnPartAttributes(language, ec, T03PartTrit.PART_1);
namespace.addElementClass(ec);
ec = createElementClass(language,"v018",V018Tord.class,null,"Defines an V018Tord number.");
//configBãßBȍőnPartAttributes(language, ec, T02PartBinary.PART_1);
namespace.addElementClass(ec);
ec = createElementClass(language,"v036",V036Teger.class,null,"Defines an V036Teger number.");
ec = createElementClass(language,"",V036Teger.class,null,"Defines an V036Teger number.");
//configBãßBȍőnPartAttributes(language, ec, T02PartBinary.PART_1);
namespace.addElementClass(ec);
ec = createElementClass(language,"v072",V072Tong.class,null,"Defines an V072Tong number.");
ec = createElementClass(language,"",V072Tong.class,null,"Defines an V072Tong number.");
//configBãßBȍőnPartAttributes(language, ec, T02PartBinary.PART_1);
namespace.addElementClass(ec);
ec = createElementClass(language,"v072",V144Tocta.class,null,"Defines an V144Tocta number.");
ec = createElementClass(language,"",V072TongP1.class,null,"Defines an V072TongP1 number.");
//configBãßBȍőnPartAttributes(language, ec, T02PartBinary.PART_1);
namespace.addElementClass(ec);
ec = createElementClass(language,"",V072TongP2.class,null,"Defines an V072TongP1 number.");
//configBãßBȍőnPartAttributes(language, ec, T02PartBinary.PART_1);
namespace.addElementClass(ec);
ec = createElementClass(language,"v144",V144Tocta.class,null,"Defines an V144Tocta number.");
//configBãßBȍőnPartAttributes(language, ec, T02PartBinary.PART_1);
namespace.addElementClass(ec);
}
@ -158,4 +178,10 @@ public class NumberXDModuleLoader implements X4OLanguageModuleLoader {
namespace.setSchemaPrefix(schemaPrefix);
return namespace;
}
private void addBindingHandler(X4OLanguageModuleLocal languageModule,ElementBindingHandler handler,String id,String description) {
handler.setId(id);
handler.setDescription(description);
languageModule.addElementBindingHandler(handler);
}
}

View file

@ -0,0 +1,44 @@
package love.distributedrebirth.numberxd.x4o;
import org.x4o.xml.element.AbstractElementBindingHandler;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementBindingHandlerException;
import love.distributedrebirth.numberxd.base2t.part.T02PartBinary;
import love.distributedrebirth.numberxd.base2t.type.V072Tong;
public class V072TongBindingHandler extends AbstractElementBindingHandler<V072Tong> {
@Override
public Class<?>[] getBindChildClasses() {
return new Class[] {V072TongP1.class, V072TongP2.class};
}
@Override
public Class<?> getBindParentClass() {
return V072Tong.class;
}
@Override
public void bindChild(Element childElement, V072Tong parent, Object childObject) throws ElementBindingHandlerException {
if (childObject instanceof V072TongP1) {
V072TongP1 p1 = (V072TongP1)childObject;
parent.setValue(T02PartBinary.PART_1, p1.theValue());
}
if (childObject instanceof V072TongP2) {
V072TongP2 p2 = (V072TongP2)childObject;
parent.setValue(T02PartBinary.PART_2, p2.theValue());
}
}
@Override
public void createChilderen(Element parentElement,V072Tong parent) throws ElementBindingHandlerException {
V072TongP1 p1 = new V072TongP1();
V072TongP2 p2 = new V072TongP2();
p1.setValue(parent.getValue(T02PartBinary.PART_1));
p2.setValue(parent.getValue(T02PartBinary.PART_2));
createChild(parentElement, p1);
createChild(parentElement, p2);
}
}

View file

@ -0,0 +1,16 @@
package love.distributedrebirth.numberxd.x4o;
import love.distributedrebirth.numberxd.base2t.type.V036Teger;
public class V072TongP1 {
private V036Teger value;
public V036Teger theValue() {
return value;
}
public void setValue(V036Teger value) {
this.value = value;
}
}

View file

@ -0,0 +1,31 @@
package love.distributedrebirth.numberxd.x4o;
import org.x4o.xml.element.AbstractElementBindingHandler;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementBindingHandlerException;
import love.distributedrebirth.numberxd.base2t.type.V036Teger;
public class V072TongP1BindingHandler extends AbstractElementBindingHandler<V072TongP1> {
@Override
public Class<?>[] getBindChildClasses() {
return new Class[] {V036Teger.class};
}
@Override
public Class<?> getBindParentClass() {
return V072TongP1.class;
}
@Override
public void bindChild(Element childElement, V072TongP1 parent, Object childObject) throws ElementBindingHandlerException {
V036Teger child = (V036Teger)childObject;
parent.setValue(child);
}
@Override
public void createChilderen(Element parentElement,V072TongP1 parent) throws ElementBindingHandlerException {
createChild(parentElement, parent.theValue());
}
}

View file

@ -0,0 +1,16 @@
package love.distributedrebirth.numberxd.x4o;
import love.distributedrebirth.numberxd.base2t.type.V036Teger;
public class V072TongP2 {
private V036Teger value;
public V036Teger theValue() {
return value;
}
public void setValue(V036Teger value) {
this.value = value;
}
}

View file

@ -0,0 +1,31 @@
package love.distributedrebirth.numberxd.x4o;
import org.x4o.xml.element.AbstractElementBindingHandler;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementBindingHandlerException;
import love.distributedrebirth.numberxd.base2t.type.V036Teger;
public class V072TongP2BindingHandler extends AbstractElementBindingHandler<V072TongP2> {
@Override
public Class<?>[] getBindChildClasses() {
return new Class[] {V036Teger.class};
}
@Override
public Class<?> getBindParentClass() {
return V072TongP2.class;
}
@Override
public void bindChild(Element childElement, V072TongP2 parent, Object childObject) throws ElementBindingHandlerException {
V036Teger child = (V036Teger)childObject;
parent.setValue(child);
}
@Override
public void createChilderen(Element parentElement,V072TongP2 parent) throws ElementBindingHandlerException {
createChild(parentElement, parent.theValue());
}
}

View file

@ -15,6 +15,12 @@
parentClass="love.distributedrebirth.unicode4d.atlas.FontAtlasStore"
childClass="love.distributedrebirth.unicode4d.atlas.FontAtlasStoreGlyph"
addMethod="addGlyph" getMethod="getGlyphs" />
<!--
<eld:classBindingHandler id="FontAtlasStoreGlyph-V072Tong"
parentClass="love.distributedrebirth.unicode4d.atlas.FontAtlasStoreGlyph"
childClass="love.distributedrebirth.numberxd.base2t.type.V072Tong"
addMethod="addTong" getMethod="getTongs" />
-->
<eld:namespace
uri="http://unicode4d-atlas.x4o.distributedrebirth.love/xml/ns/unicode4d-atlas-root"

View file

@ -34,10 +34,10 @@ public class TestConvFont {
public void run() {
try {
// NOTE: Are in order like the FontAtlas of ImGui
conf("Code2000", new File("../conv-font/bin/code-2000.xml"), new File("../main-gdxapp/assets/font/code-2000.xml"));
conf("Code2001", new File("../conv-font/bin/code-2001.xml"), new File("../main-gdxapp/assets/font/code-2001.xml"));
conf("Code2002", new File("../conv-font/bin/code-2002.xml"), new File("../main-gdxapp/assets/font/code-2002.xml"));
conf("Free Sans", new File("../conv-font/bin/free-sans.xml"), new File("../main-gdxapp/assets/font/free-sans.xml"));
//conf("Code2000", new File("../conv-font/bin/code-2000.xml"), new File("../main-gdxapp/assets/font/code-2000.xml"));
//conf("Code2001", new File("../conv-font/bin/code-2001.xml"), new File("../main-gdxapp/assets/font/code-2001.xml"));
//conf("Code2002", new File("../conv-font/bin/code-2002.xml"), new File("../main-gdxapp/assets/font/code-2002.xml"));
//conf("Free Sans", new File("../conv-font/bin/free-sans.xml"), new File("../main-gdxapp/assets/font/free-sans.xml"));
conf("New Gardiner BMP", new File("../conv-font/bin/new-gardiner-bmp.xml"), new File("../main-gdxapp/assets/font/new-gardiner-bmp.xml"));
conf("Font Awesome", new File("../conv-font/bin/fa-solid-900.xml"), new File("../main-gdxapp/assets/font/fa-solid-900.xml"));
conf("Noto Sans Brahmi", new File("../conv-font/bin/noto-sans-brahmi.xml"), new File("../main-gdxapp/assets/font/noto-sans-brahmi.xml"));