Cached length

This commit is contained in:
Willem Cazander 2022-10-13 14:38:07 +02:00
parent 9c1161e84c
commit 3acc28dbbf
9 changed files with 97 additions and 29 deletions

View file

@ -49,7 +49,7 @@ public class GlyphDemoComponent {
unicodeLauncher = new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Unicode Plane", () -> new DemoUnicodePlaneDeskApp(createBundle(), unicode4DService));
baseGlyphLauncher = new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Glyph Set", () -> new DemoGlyphSetDeskApp(createBundle()));
basePartLauncher = new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Number Parts", () -> new DemoNumberPartDeskApp(createBundle()));
unitConverterLauncher = new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Unitˣᶜ Converter", () -> new DemoUnitConverterDeskApp(unitManager));
unitConverterLauncher = new DeskAppLauncher(DeskAppMenuSection.SCIENCE, "Unitˣᶜ Converter", () -> new DemoUnitConverterDeskApp(unitManager));
}
private ResourceBundle createBundle() {

View file

@ -1,5 +1,6 @@
package love.distributedrebirth.gdxapp4d.app.glyphdemo.apps;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@ -16,6 +17,8 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.AbstractDeskApp;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer;
import love.distributedrebirth.numberxd.base2t.part.T10PartDecimal;
import love.distributedrebirth.numberxd.base2t.part.T16PartHex;
import net.forwardfire.unitxc.UnitXCManager;
import net.forwardfire.unitxc.model.UnitXCGroup;
import net.forwardfire.unitxc.model.UnitXCType;
@ -34,7 +37,7 @@ public class DemoUnitConverterDeskApp extends AbstractDeskApp implements DeskApp
private final ImInt convertFromType = new ImInt();
private final ImInt unitTypeLimit = new ImInt(5432);
private final List<UnitXCType> convertFromTypes;
private final long totalUnits;
private final BigInteger totalUnits;
private String[] convertFromTypeNames;
public DemoUnitConverterDeskApp(UnitXCManager unitManager) {
@ -60,7 +63,7 @@ public class DemoUnitConverterDeskApp extends AbstractDeskApp implements DeskApp
long tc = typeGroup.getUnitTypeSize();
ts += tc;
}
this.totalUnits = ts;
this.totalUnits = BigInteger.valueOf(ts); // TODO: goto DEC144 for counting unit types
updateConvertFromType();
updateUnitType();
@ -73,7 +76,9 @@ public class DemoUnitConverterDeskApp extends AbstractDeskApp implements DeskApp
@Override
public void render() {
ImGui.text("Total units loaded: "+totalUnits);
String amount10 = totalUnits.toString(T10PartDecimal.DEFAULT.BãßĦǿɇṽḝę̃ɬḪễïđ());
String amount16 = totalUnits.toString(T16PartHex.DEFAULT.BãßĦǿɇṽḝę̃ɬḪễïđ());
ImGui.text("Total units loaded: "+amount10+" ("+amount16+")");
// TODO: don't do update on render thread
if (ImGui.inputDouble("ConvertValue", convertValue)) {