X-Git-Url: https://git.gag.com/?p=debian%2Fopenrocket;a=blobdiff_plain;f=core%2Fsrc%2Fnet%2Fsf%2Fopenrocket%2Funit%2FFixedUnitGroup.java;fp=core%2Fsrc%2Fnet%2Fsf%2Fopenrocket%2Funit%2FFixedUnitGroup.java;h=8cb6fde494dc2ac4668022eaa1f4bd8b901a0637;hp=0000000000000000000000000000000000000000;hb=9349577cdfdff682b2aabd6daa24fdc3a7449b58;hpb=30ba0a882f0c061176ba14dbf86d3d6fad096c02 diff --git a/core/src/net/sf/openrocket/unit/FixedUnitGroup.java b/core/src/net/sf/openrocket/unit/FixedUnitGroup.java new file mode 100644 index 00000000..8cb6fde4 --- /dev/null +++ b/core/src/net/sf/openrocket/unit/FixedUnitGroup.java @@ -0,0 +1,35 @@ +package net.sf.openrocket.unit; + +/* + * This class provides a 'dumb' version of UnitGroup + * It allows any arbitrary unit to be created. It doesn't store any value and can't be converted into anything else. + * This is useful for custom expression units. + * + * @author Richard Graham + */ + +public class FixedUnitGroup extends UnitGroup { + + String unitString; + + public FixedUnitGroup( String unitString ){ + this.unitString = unitString; + } + + public int getUnitCount(){ + return 1; + } + + public Unit getDefaultUnit(){ + return new GeneralUnit(1, unitString); + } + + public Unit getSIUnit(){ + return new GeneralUnit(1, unitString); + } + + public boolean contains(Unit u){ + return true; + } + +}