Added javadoc headers.
This commit is contained in:
parent
956712d583
commit
e77999525b
|
@ -40,6 +40,12 @@ import net.forwardfire.unitxc.module.UnitXCModuleTemperature;
|
|||
import net.forwardfire.unitxc.module.UnitXCModuleTime;
|
||||
import net.forwardfire.unitxc.module.UnitXCModuleVolume;
|
||||
|
||||
/**
|
||||
* The unit cross converter factory to create the manager.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 9, 2015
|
||||
*/
|
||||
public final class UnitXCFactory {
|
||||
|
||||
private static final List<UnitXCConfigModule> DEFAULT_CONFIG_MODULES = Collections.unmodifiableList(Arrays.asList(
|
||||
|
|
|
@ -29,14 +29,26 @@ import net.forwardfire.unitxc.converter.UnitXConverter;
|
|||
import net.forwardfire.unitxc.model.UnitXCType;
|
||||
import net.forwardfire.unitxc.model.UnitXCGroup;
|
||||
|
||||
/**
|
||||
* The unit manager which holds all units/groups and provides access to the converter.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 9, 2015
|
||||
*/
|
||||
public interface UnitXCManager {
|
||||
|
||||
/**
|
||||
* @return Returns all unit types.
|
||||
*/
|
||||
Collection<UnitXCType> getUnitTypes();
|
||||
|
||||
UnitXCType getUnitType(String id);
|
||||
|
||||
boolean isUnitType(String id);
|
||||
|
||||
/**
|
||||
* @return Returns all unit groups.
|
||||
*/
|
||||
Collection<UnitXCGroup> getUnitGroups();
|
||||
|
||||
UnitXCGroup getUnitGroup(String id);
|
||||
|
|
|
@ -32,6 +32,12 @@ import org.apache.commons.lang3.Validate;
|
|||
import net.forwardfire.unitxc.model.UnitXCTypeModel;
|
||||
import net.forwardfire.unitxc.model.UnitXCGroupModel;
|
||||
|
||||
/**
|
||||
* Config to build unit types and groups.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public final class UnitXCConfig {
|
||||
|
||||
private final Map<String,UnitXCTypeModel> unitTypes;
|
||||
|
|
|
@ -39,6 +39,12 @@ import net.forwardfire.unitxc.model.UnitXCType;
|
|||
import net.forwardfire.unitxc.model.UnitXCGroup;
|
||||
import net.forwardfire.unitxc.model.UnitXConverterResult;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public class UnitXCConfigManager implements UnitXCManager {
|
||||
|
||||
private final UnitXCConfig config;
|
||||
|
|
|
@ -28,6 +28,12 @@ import java.util.List;
|
|||
|
||||
import net.forwardfire.unitxc.config.builder.UnitXCConfigBuilder;
|
||||
|
||||
/**
|
||||
* Config module to build groups and types.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public interface UnitXCConfigModule {
|
||||
|
||||
void configModule(UnitXCConfigBuilder config);
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.commons.lang3.builder.Builder;
|
|||
* @param <T> The object to build.
|
||||
* @param <B> This builder.
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 29, 2015
|
||||
* @version 1.0 Oct 22, 2015
|
||||
*/
|
||||
public abstract class AbstractUnitXCBuilder<P,T,B> implements Builder<P> {
|
||||
|
||||
|
|
|
@ -31,6 +31,12 @@ import java.util.function.BiConsumer;
|
|||
import net.forwardfire.unitxc.converter.step.UnitXConverterStep;
|
||||
import net.forwardfire.unitxc.model.UnitXCTypeModel;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 22, 2015
|
||||
*/
|
||||
public abstract class AbstractUnitXCTypeBuilder<P,B> extends AbstractUnitXCBuilder<P,UnitXCTypeModel,B> {
|
||||
|
||||
public AbstractUnitXCTypeBuilder(P parent,BiConsumer<P, UnitXCTypeModel> parentBuilder) {
|
||||
|
|
|
@ -27,6 +27,12 @@ import org.apache.commons.lang3.Validate;
|
|||
|
||||
import net.forwardfire.unitxc.config.UnitXCConfig;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public class UnitXCConfigBuilder {
|
||||
|
||||
public static final String TYPE_FLAG_IMPERIAL = "IMPERIAL"; // todo move to ...
|
||||
|
|
|
@ -28,6 +28,12 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 31, 2015
|
||||
*/
|
||||
public class UnitXCConfigModuleBuilder {
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,12 @@ package net.forwardfire.unitxc.config.builder;
|
|||
import net.forwardfire.unitxc.model.UnitXCGroupModel;
|
||||
import net.forwardfire.unitxc.model.UnitXCGroupType;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 22, 2015
|
||||
*/
|
||||
public class UnitXCGroupBuilder extends AbstractUnitXCBuilder<UnitXCConfigBuilder,UnitXCGroupModel,UnitXCGroupBuilder> {
|
||||
|
||||
public UnitXCGroupBuilder(UnitXCConfigBuilder parent) {
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package net.forwardfire.unitxc.config.builder;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 28, 2015
|
||||
*/
|
||||
public class UnitXCNumberTypeSetting {
|
||||
|
||||
private static final char ZERO_CHAR_NORMAL = '0';
|
||||
|
|
|
@ -27,6 +27,12 @@ import java.util.function.BiConsumer;
|
|||
|
||||
import net.forwardfire.unitxc.model.UnitXCTypeModel;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 23, 2015
|
||||
*/
|
||||
public class UnitXCTypeBuilder<P> extends AbstractUnitXCTypeBuilder<P,UnitXCTypeBuilder<P>> {
|
||||
|
||||
public UnitXCTypeBuilder(P parent, BiConsumer<P, UnitXCTypeModel> parentBuilder) {
|
||||
|
|
|
@ -32,6 +32,12 @@ import net.forwardfire.unitxc.converter.step.UnitXConverterStep;
|
|||
import net.forwardfire.unitxc.model.UnitXCGroupModel;
|
||||
import net.forwardfire.unitxc.model.UnitXCTypeModel;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 26, 2015
|
||||
*/
|
||||
public class UnitXCTypeCompoundExponentBuilder extends AbstractUnitXCBuilder<UnitXCGroupBuilder,Object,UnitXCTypeCompoundExponentBuilder> {
|
||||
|
||||
private final UnitXCConfigBuilder builder;
|
||||
|
|
|
@ -28,6 +28,12 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 22, 2015
|
||||
*/
|
||||
public enum UnitXCTypeSIPrefix {
|
||||
|
||||
YOTTA ("Y", 24),
|
||||
|
|
|
@ -31,6 +31,12 @@ import java.util.List;
|
|||
import net.forwardfire.unitxc.converter.step.UnitXCTypePowerOfTenConverterStep;
|
||||
import net.forwardfire.unitxc.model.UnitXCTypeModel;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 22, 2015
|
||||
*/
|
||||
public class UnitXCTypeSIPrefixBuilder<P> extends AbstractUnitXCTypeBuilder<P,UnitXCTypeSIPrefixBuilder<P>> {
|
||||
|
||||
private final UnitXCConfigBuilder builder;
|
||||
|
|
|
@ -37,6 +37,12 @@ import net.forwardfire.unitxc.converter.step.UnitXCTypeOffsetConverterStep;
|
|||
import net.forwardfire.unitxc.converter.step.UnitXCTypePowerConverterStep;
|
||||
import net.forwardfire.unitxc.converter.step.UnitXConverterStep;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 23, 2015
|
||||
*/
|
||||
public class UnitXConverterStepBuilder<P extends AbstractUnitXCTypeBuilder<?,?>> extends AbstractUnitXCBuilder<P,List<UnitXConverterStep>,UnitXConverterStepBuilder<P>> {
|
||||
|
||||
public UnitXConverterStepBuilder(P parent, BiConsumer<P, List<UnitXConverterStep>> parentBuilder) {
|
||||
|
|
|
@ -26,6 +26,12 @@ package net.forwardfire.unitxc.converter;
|
|||
import net.forwardfire.unitxc.model.UnitXCType;
|
||||
import net.forwardfire.unitxc.model.UnitXConverterResult;
|
||||
|
||||
/**
|
||||
* Converts value to value.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 8, 2015
|
||||
*/
|
||||
public interface UnitXConverter {
|
||||
|
||||
double convert(double value,String fromTypeId,String toTypeId);
|
||||
|
|
|
@ -39,6 +39,12 @@ import net.forwardfire.unitxc.model.UnitXConverterResultModel;
|
|||
import net.forwardfire.unitxc.model.UnitXConverterResultStep;
|
||||
import net.forwardfire.unitxc.model.UnitXConverterResultStepModel;
|
||||
|
||||
/**
|
||||
* Runs requested convert steps and builds result models.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public final class UnitXConverterEngine {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(UnitXConverterEngine.class);
|
||||
|
|
|
@ -28,6 +28,12 @@ import java.util.List;
|
|||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public abstract class AbstractUnitXConverterStep implements UnitXConverterStep {
|
||||
|
||||
private final String name;
|
||||
|
|
|
@ -25,6 +25,12 @@ package net.forwardfire.unitxc.converter.step;
|
|||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 20, 2015
|
||||
*/
|
||||
public class UnitXCTypeDevideConverterStep extends AbstractUnitXConverterStep {
|
||||
|
||||
private final static String STEP_NAME = "Devide";
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
package net.forwardfire.unitxc.converter.step;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public class UnitXCTypeMultiplyConverterStep extends AbstractUnitXConverterStep {
|
||||
|
||||
private final static String STEP_NAME = "Multiply";
|
||||
|
|
|
@ -26,6 +26,12 @@ package net.forwardfire.unitxc.converter.step;
|
|||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.math.Fraction;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 20, 2015
|
||||
*/
|
||||
public class UnitXCTypeMultiplyFractionConverterStep extends AbstractUnitXConverterStep {
|
||||
|
||||
private final static String STEP_NAME = "MultiplyFaction";
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
package net.forwardfire.unitxc.converter.step;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public class UnitXCTypeOffsetConverterStep extends AbstractUnitXConverterStep {
|
||||
|
||||
private final static String STEP_NAME = "Offset";
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
package net.forwardfire.unitxc.converter.step;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 26, 2015
|
||||
*/
|
||||
public class UnitXCTypePowerConverterStep extends AbstractUnitXConverterStep {
|
||||
|
||||
private final static String STEP_NAME = "power";
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
package net.forwardfire.unitxc.converter.step;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public class UnitXCTypePowerOfTenConverterStep extends AbstractUnitXConverterStep {
|
||||
|
||||
private final static String STEP_NAME = "power(10)";
|
||||
|
|
|
@ -25,6 +25,12 @@ package net.forwardfire.unitxc.converter.step;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 10, 2015
|
||||
*/
|
||||
public interface UnitXConverterStep {
|
||||
|
||||
String getStepName();
|
||||
|
|
|
@ -25,12 +25,27 @@ package net.forwardfire.unitxc.model;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* The unit group.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 10, 2015
|
||||
*/
|
||||
public interface UnitXCGroup {
|
||||
|
||||
/**
|
||||
* @return The unit group id.
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* @return The unit group name.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return The unit group description.
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
UnitXCGroupType getType();
|
||||
|
|
|
@ -29,6 +29,12 @@ import java.util.List;
|
|||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public class UnitXCGroupModel implements UnitXCGroup {
|
||||
|
||||
private String id;
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package net.forwardfire.unitxc.model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 26, 2015
|
||||
*/
|
||||
public enum UnitXCGroupType {
|
||||
|
||||
SI_BASE,
|
||||
|
|
|
@ -25,15 +25,30 @@ package net.forwardfire.unitxc.model;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* The unit type.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 10, 2015
|
||||
*/
|
||||
public interface UnitXCType {
|
||||
|
||||
/**
|
||||
* @return The unit type id.
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* @return The unit type name.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
Collection<String> getNameAliases();
|
||||
|
||||
String getUnitGroupId();
|
||||
|
||||
/**
|
||||
* @return The unit type flags.
|
||||
*/
|
||||
Collection<String> getTypeFlags();
|
||||
}
|
||||
|
|
|
@ -31,6 +31,12 @@ import org.apache.commons.lang3.Validate;
|
|||
|
||||
import net.forwardfire.unitxc.converter.step.UnitXConverterStep;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public class UnitXCTypeModel implements UnitXCType {
|
||||
|
||||
private String id;
|
||||
|
|
|
@ -25,17 +25,41 @@ package net.forwardfire.unitxc.model;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Holds the convert result and meta steps how we got there.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public interface UnitXConverterResult {
|
||||
|
||||
/**
|
||||
* @return The start value.
|
||||
*/
|
||||
Double getStartValue();
|
||||
|
||||
UnitXCType getStartType();
|
||||
/**
|
||||
* @return The start value type.
|
||||
*/
|
||||
UnitXCType getStartValueType();
|
||||
|
||||
/**
|
||||
* @return The result value.
|
||||
*/
|
||||
Double getResultValue();
|
||||
|
||||
UnitXCType getResultType();
|
||||
/**
|
||||
* @return The result value type.
|
||||
*/
|
||||
UnitXCType getResultValueType();
|
||||
|
||||
/**
|
||||
* @return The convert steps performed to get to result value.
|
||||
*/
|
||||
List<UnitXConverterResultStep> getSteps();
|
||||
|
||||
/**
|
||||
* @return The convert time in ms.
|
||||
*/
|
||||
Long getConvertTime();
|
||||
}
|
||||
|
|
|
@ -27,22 +27,28 @@ import java.util.List;
|
|||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 22, 2015
|
||||
*/
|
||||
public class UnitXConverterResultModel implements UnitXConverterResult {
|
||||
|
||||
private final Double startValue;
|
||||
private final List<UnitXConverterResultStep> resultSteps;
|
||||
private final Double resultValue;
|
||||
private final Long convertTime;
|
||||
private final UnitXCType startType;
|
||||
private final UnitXCType resultType;
|
||||
private final UnitXCType startValueType;
|
||||
private final UnitXCType resultValueType;
|
||||
|
||||
public UnitXConverterResultModel(Double startValue,Double resultValue,List<UnitXConverterResultStep> resultSteps,Long convertTime,UnitXCType startType,UnitXCType resultType) {
|
||||
public UnitXConverterResultModel(Double startValue,Double resultValue,List<UnitXConverterResultStep> resultSteps,Long convertTime,UnitXCType startValueType,UnitXCType resultValueType) {
|
||||
this.startValue = Validate.notNull(startValue);
|
||||
this.resultSteps = Validate.noNullElements(resultSteps);
|
||||
this.resultValue = Validate.notNull(resultValue);
|
||||
this.convertTime = convertTime;
|
||||
this.startType = Validate.notNull(startType);
|
||||
this.resultType = Validate.notNull(resultType);
|
||||
this.startValueType = Validate.notNull(startValueType);
|
||||
this.resultValueType = Validate.notNull(resultValueType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,12 +72,12 @@ public class UnitXConverterResultModel implements UnitXConverterResult {
|
|||
}
|
||||
|
||||
@Override
|
||||
public UnitXCType getStartType() {
|
||||
return startType;
|
||||
public UnitXCType getStartValueType() {
|
||||
return startValueType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnitXCType getResultType() {
|
||||
return resultType;
|
||||
public UnitXCType getResultValueType() {
|
||||
return resultValueType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
|
||||
package net.forwardfire.unitxc.model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public interface UnitXConverterResultStep {
|
||||
|
||||
String getName();
|
||||
|
|
|
@ -25,6 +25,12 @@ package net.forwardfire.unitxc.model;
|
|||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 22, 2015
|
||||
*/
|
||||
public class UnitXConverterResultStepModel implements UnitXConverterResultStep {
|
||||
|
||||
private final String name;
|
||||
|
|
|
@ -30,6 +30,12 @@ import net.forwardfire.unitxc.config.UnitXCConfigModule;
|
|||
import net.forwardfire.unitxc.config.builder.UnitXCConfigBuilder;
|
||||
import net.forwardfire.unitxc.config.builder.UnitXCTypeSIPrefix;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 23, 2015
|
||||
*/
|
||||
public class UnitXCModuleAmountOfSubstance implements UnitXCConfigModule {
|
||||
|
||||
public static final String GROUP_ID = "substance";
|
||||
|
|
|
@ -29,6 +29,12 @@ import static net.forwardfire.unitxc.model.UnitXCGroupType.SI_DERIVED;
|
|||
import net.forwardfire.unitxc.config.UnitXCConfigModule;
|
||||
import net.forwardfire.unitxc.config.builder.UnitXCConfigBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 26, 2015
|
||||
*/
|
||||
public class UnitXCModuleArea implements UnitXCConfigModule {
|
||||
|
||||
private static final int UNIT_COMPOUND_EXPONENT = 2;
|
||||
|
|
|
@ -30,6 +30,12 @@ import net.forwardfire.unitxc.config.UnitXCConfigModule;
|
|||
import net.forwardfire.unitxc.config.builder.UnitXCConfigBuilder;
|
||||
import net.forwardfire.unitxc.config.builder.UnitXCTypeSIPrefix;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 18, 2015
|
||||
*/
|
||||
public class UnitXCModuleElectricCurrent implements UnitXCConfigModule {
|
||||
|
||||
public static final String GROUP_ID = "current";
|
||||
|
|
|
@ -30,6 +30,12 @@ import net.forwardfire.unitxc.config.UnitXCConfigModule;
|
|||
import net.forwardfire.unitxc.config.builder.UnitXCConfigBuilder;
|
||||
import net.forwardfire.unitxc.config.builder.UnitXCTypeSIPrefix;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 24, 2015
|
||||
*/
|
||||
public class UnitXCModuleLength implements UnitXCConfigModule {
|
||||
|
||||
public static final String GROUP_ID = "length";
|
||||
|
|
|
@ -29,6 +29,12 @@ import static net.forwardfire.unitxc.model.UnitXCGroupType.SI_BASE;
|
|||
import net.forwardfire.unitxc.config.UnitXCConfigModule;
|
||||
import net.forwardfire.unitxc.config.builder.UnitXCConfigBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 23, 2015
|
||||
*/
|
||||
public class UnitXCModuleLuminousIntensity implements UnitXCConfigModule {
|
||||
|
||||
public static final String GROUP_ID = "light";
|
||||
|
|
|
@ -30,6 +30,12 @@ import net.forwardfire.unitxc.config.UnitXCConfigModule;
|
|||
import net.forwardfire.unitxc.config.builder.UnitXCConfigBuilder;
|
||||
import net.forwardfire.unitxc.config.builder.UnitXCTypeSIPrefix;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 25, 2015
|
||||
*/
|
||||
public class UnitXCModuleMass implements UnitXCConfigModule {
|
||||
|
||||
public static final String GROUP_ID = "mass";
|
||||
|
|
|
@ -31,6 +31,12 @@ import static net.forwardfire.unitxc.model.UnitXCGroupType.SI_BASE;
|
|||
|
||||
import org.apache.commons.lang3.math.Fraction;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 17, 2015
|
||||
*/
|
||||
public class UnitXCModuleTemperature implements UnitXCConfigModule {
|
||||
|
||||
public static final String GROUP_ID = "temperature";
|
||||
|
|
|
@ -30,6 +30,12 @@ import net.forwardfire.unitxc.config.UnitXCConfigModule;
|
|||
import net.forwardfire.unitxc.config.builder.UnitXCConfigBuilder;
|
||||
import net.forwardfire.unitxc.config.builder.UnitXCTypeSIPrefix;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 25, 2015
|
||||
*/
|
||||
public class UnitXCModuleTime implements UnitXCConfigModule {
|
||||
|
||||
public static final String GROUP_ID = "time";
|
||||
|
|
|
@ -29,6 +29,12 @@ import static net.forwardfire.unitxc.model.UnitXCGroupType.SI_DERIVED;
|
|||
import net.forwardfire.unitxc.config.UnitXCConfigModule;
|
||||
import net.forwardfire.unitxc.config.builder.UnitXCConfigBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Oct 28, 2015
|
||||
*/
|
||||
public class UnitXCModuleVolume implements UnitXCConfigModule {
|
||||
|
||||
private static final int UNIT_COMPOUND_EXPONENT = 3;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class UnitXCConverterStepTest {
|
|||
System.out.println("totalConv: "+(ts*ts-ts));
|
||||
|
||||
UnitXConverterResult result = unitManager.getConverter().convertStepped(211.0, "k°F", "m°C");
|
||||
System.out.println("Convert from: "+result.getStartType().getName()+" to: "+result.getResultType().getName());
|
||||
System.out.println("Convert from: "+result.getStartValueType().getName()+" to: "+result.getResultValueType().getName());
|
||||
System.out.println("startValue: "+result.getStartValue());
|
||||
System.out.println("resultValue: "+result.getResultValue());
|
||||
System.out.println("convertTime: "+result.getConvertTime());
|
||||
|
@ -82,7 +82,7 @@ public class UnitXCConverterStepTest {
|
|||
System.out.println("");
|
||||
|
||||
result = unitManager.getConverter().convertStepped(10.763, "ft²", "in²");
|
||||
System.out.println("Convert from: "+result.getStartType().getName()+" to: "+result.getResultType().getName());
|
||||
System.out.println("Convert from: "+result.getStartValueType().getName()+" to: "+result.getResultValueType().getName());
|
||||
System.out.println("startValue: "+result.getStartValue());
|
||||
System.out.println("resultValue: "+result.getResultValue());
|
||||
System.out.println("convertTime: "+result.getConvertTime());
|
||||
|
@ -93,7 +93,7 @@ public class UnitXCConverterStepTest {
|
|||
System.out.println("");
|
||||
|
||||
result = unitManager.getConverter().convertStepped(10.763, "ft³", "in³");
|
||||
System.out.println("Convert from: "+result.getStartType().getName()+" to: "+result.getResultType().getName());
|
||||
System.out.println("Convert from: "+result.getStartValueType().getName()+" to: "+result.getResultValueType().getName());
|
||||
System.out.println("startValue: "+result.getStartValue());
|
||||
System.out.println("resultValue: "+result.getResultValue());
|
||||
System.out.println("convertTime: "+result.getConvertTime());
|
||||
|
|
Loading…
Reference in a new issue