Math2mat
|
00001 00002 00003 package m2m.backend.buildingblocks; 00004 00005 00012 public abstract class BuildingBlockFixed extends BuildingBlock { 00013 00018 BuildingBlockFixed() { 00019 m_size=16; 00020 m_decimals=8; 00021 } 00022 00026 public final NumType numType() { 00027 return NumType.FIXED; 00028 } 00029 00036 @Override 00037 public boolean useGenericSize() { 00038 return true; 00039 } 00040 00049 public boolean setSize(int size, int decimals) { 00050 if (size<0) 00051 return false; 00052 if (decimals<0) 00053 return false; 00054 if (decimals > size) 00055 return false; 00056 m_decimals = decimals; 00057 m_size = size; 00058 return true; 00059 } 00060 00065 public int getSize() { 00066 return m_size; 00067 } 00068 00073 public int getDecimals() { 00074 return m_decimals; 00075 } 00076 00080 protected int m_size; 00081 00085 protected int m_decimals; 00086 } 00087