Big update to custom expression feature.
[debian/openrocket] / core / src / net / sf / openrocket / unit / FixedUnitGroup.java
1 package net.sf.openrocket.unit;
2
3 /*
4  * This class provides a 'dumb' version of UnitGroup
5  * It allows any arbitrary unit to be created. It doesn't store any value and can't be converted into anything else.
6  * This is useful for custom expression units.
7  * 
8  * @author Richard Graham
9  */
10
11 public class FixedUnitGroup extends UnitGroup {
12         
13         String unitString;
14         
15         public FixedUnitGroup( String unitString ){
16                 this.unitString = unitString; 
17         }
18         
19         public int getUnitCount(){
20                 return 1;
21         }
22         
23         public Unit getDefaultUnit(){
24                 return new GeneralUnit(1, unitString);
25         }
26         
27         public Unit getSIUnit(){
28                 return new GeneralUnit(1, unitString);
29         }
30         
31         public boolean contains(Unit u){
32                 return true;
33         }
34         
35 }