From 8c02789a62f005b7bbdde9b10f6e453e69006954 Mon Sep 17 00:00:00 2001 From: Willem Date: Sun, 25 Mar 2018 17:03:53 +0200 Subject: [PATCH] wip open left overs. --- .../unitxc/config/builder/AbstractUnitXCGroupBuilder.java | 2 +- .../unitxc/config/builder/UnitXCConfigBuilder.java | 3 +-- .../net/forwardfire/unitxc/UnitXCConverterStepTest.java | 8 +++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/unitxc-converter/src/main/java/net/forwardfire/unitxc/config/builder/AbstractUnitXCGroupBuilder.java b/unitxc-converter/src/main/java/net/forwardfire/unitxc/config/builder/AbstractUnitXCGroupBuilder.java index 4436bd6..1b73522 100644 --- a/unitxc-converter/src/main/java/net/forwardfire/unitxc/config/builder/AbstractUnitXCGroupBuilder.java +++ b/unitxc-converter/src/main/java/net/forwardfire/unitxc/config/builder/AbstractUnitXCGroupBuilder.java @@ -55,7 +55,7 @@ abstract public class AbstractUnitXCGroupBuilder v.addQuantity(new DefaultUnitXCGroupQuantity(null,"group."+v.getId()+".quantity",id))); + return make((v) -> v.addQuantity(new DefaultUnitXCGroupQuantity(null,"group."+v.getId()+".quantity",id))); // TODO: fix null bundle here } public B addQuantityIds(String...ids) { diff --git a/unitxc-converter/src/main/java/net/forwardfire/unitxc/config/builder/UnitXCConfigBuilder.java b/unitxc-converter/src/main/java/net/forwardfire/unitxc/config/builder/UnitXCConfigBuilder.java index 05ed1da..1f66a74 100644 --- a/unitxc-converter/src/main/java/net/forwardfire/unitxc/config/builder/UnitXCConfigBuilder.java +++ b/unitxc-converter/src/main/java/net/forwardfire/unitxc/config/builder/UnitXCConfigBuilder.java @@ -23,7 +23,6 @@ package net.forwardfire.unitxc.config.builder; -import java.util.Collections; import java.util.Locale; import java.util.ResourceBundle; @@ -45,7 +44,7 @@ import net.forwardfire.unitxc.model.UnitXCResourceBundle; */ public class UnitXCConfigBuilder { - public static final String TYPE_FLAG_IMPERIAL = "IMPERIAL"; // todo move to ... + public static final String TYPE_FLAG_IMPERIAL = "IMPERIAL"; // TODO: move to ... public static final String TYPE_FLAG_IMPERIAL_EXTRA = "IMPERIAL_EXTRA"; public static final String TYPE_FLAG_ALIAS = "ALIAS"; diff --git a/unitxc-converter/src/test/java/net/forwardfire/unitxc/UnitXCConverterStepTest.java b/unitxc-converter/src/test/java/net/forwardfire/unitxc/UnitXCConverterStepTest.java index 3f7942f..d2d8ab5 100644 --- a/unitxc-converter/src/test/java/net/forwardfire/unitxc/UnitXCConverterStepTest.java +++ b/unitxc-converter/src/test/java/net/forwardfire/unitxc/UnitXCConverterStepTest.java @@ -129,9 +129,10 @@ public class UnitXCConverterStepTest { result = unitManager.getConverter().convertStepped(50, "km/h", "mm",para); //System.out.println("CONVERT-RESULT: "+result); - int x=0; + long totalUnits=0; StringBuilder buf = new StringBuilder(); buf.append("digraph G {\n"); + //buf.append("\tsize = \"4,4\"\n"); for (UnitXCGroup typeGroup:unitManager.getConfig().getUnitGroups()) { UnitXCType baseType = unitManager.getUnitType(typeGroup.getBaseTypeId()); @@ -170,6 +171,8 @@ public class UnitXCConverterStepTest { buf.append("color=red,label=\""+typeGroup.getUnitTypeSize()+"\""); buf.append("];\n"); + totalUnits += typeGroup.getUnitTypeSize(); + // print relations for (String groupFrom:typeGroup.getDerivedFrom()) { buf.append("\t"+groupFrom+" -> "+typeGroup.getId()); @@ -202,6 +205,9 @@ public class UnitXCConverterStepTest { //} //} } + + buf.append("Stats[shape=box,color=\".9 0.2 0.8\",label=\"unit groups: "+unitManager.getConfig().getUnitGroups().size()+"\\ntotal units: "+totalUnits+"\",labelloc=b];\n"); + buf.append("}\n"); System.out.println("dot: \n"+buf.toString()); FileUtils.write(new File("target/groups.dot"), buf.toString(), Charset.forName("UTF-8"), false);