class MEASUREMENT_UNIT indexing about: "This class represents typesafe implementation of measurement units."; author: "Dragan Stosic"; copyright: "none"; organisation: "School of Computer Science and Informatics, UCD"; date: "2009/07/05"; version: "Revision: 1.00"; feature AMPER: INTEGER ensure Result = 0; Result /= Void; end array: SEQUENCE[INTEGER] ensure Result = old array; Result /= Void; end CELSIUS: INTEGER ensure Result = 5; Result /= Void; end DECIBEL: INTEGER ensure Result = 4; Result /= Void; end KHERTZ: INTEGER ensure Result = 3; Result /= Void; end legal_unit: BOOLEAN -> e: INTEGER require e /= Void; ensure Result /= Void; e = array.item(0) or e = array.item(1) or e = array.item(2) or e = array.item(3) or e = array.item(4) or e = array.item(5) or e = array.item(6) or e = array.item(7) <-> Result; end LUX: INTEGER ensure Result = 7; Result /= Void; end MVOLT: INTEGER ensure Result = 2; Result /= Void; end PASCAL: INTEGER ensure Result = 6; Result /= Void; end VOLT: INTEGER ensure Result = 1; Result /= Void; end feature{NONE} make invariant legal_unit(AMPER); legal_unit(VOLT); legal_unit(MVOLT); legal_unit(KHERTZ); legal_unit(DECIBEL); legal_unit(CELSIUS); legal_unit(PASCAL); legal_unit(LUX); end