From 41743095bd9c1ae3a53e3a368d43ea6bdbcbd7e4 Mon Sep 17 00:00:00 2001 From: peet Date: Thu, 6 Jun 2024 17:41:33 +0200 Subject: [PATCH] i dont like it --- bin/uebung07/quantities/plain/Length.class | Bin 2704 -> 2114 bytes .../quantities/plain/LengthUnit.class | Bin 643 -> 849 bytes .../plain/PlainQuantitiesDemo.class | Bin 1554 -> 1353 bytes bin/uebung07/quantities/plain/Time.class | Bin 0 -> 1751 bytes bin/uebung07/quantities/plain/TimeUnit.class | Bin 0 -> 513 bytes src/uebung07/quantities/plain/Length.java | 8 ++-- src/uebung07/quantities/plain/LengthUnit.java | 2 +- src/uebung07/quantities/plain/Time.java | 41 ++++++++++++++++++ src/uebung07/quantities/plain/TimeUnit.java | 5 +++ 9 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 bin/uebung07/quantities/plain/Time.class create mode 100644 bin/uebung07/quantities/plain/TimeUnit.class create mode 100644 src/uebung07/quantities/plain/Time.java create mode 100644 src/uebung07/quantities/plain/TimeUnit.java diff --git a/bin/uebung07/quantities/plain/Length.class b/bin/uebung07/quantities/plain/Length.class index d013456760c52c71b2ddbd6a56f8bcdc11e03449..028c7076346a4c4b4ae3ccab7f02f30dd1d489f1 100644 GIT binary patch literal 2114 zcmb`HZBG+H5Xb*p3Z=*KU@n()e8%UV{ixAl70gb(Cv zH9<)v(f7vBWSqU0N(iMju}$yxt~0-x`OnV&{Qd1afM<9bL5RWddCqqVv-7FbdqZ z>>Y?QmEJTpDy6+***<|-ni4G8KKZT1n>(7#O;qATIQ+PmV|A2LOMptm9$lgsBZ@m2~X?8H37hyN$hzn2tkwRYO;+tPRQd`+m4@2Va}GfIO9XoNdYtETB% z7v(bPu|sVu)11&|rW2En33YzZO3fsV30C9N}8>E3VVM`v@a4 zuNKD`{X_=UfE@v-F92)9feTHDC^% zVaDny#}G$wVxtb>_oK*5AFOb$~z*L=6(wdm6F_&pyD5jQB zJo?Fx=h`%OhNabO*6M9CFrxEYUqotc5@OE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G0s8b6yQjiyN~1VJkiJH^5e&~9@#+^z2Io_l-2&cexgfNGvF Q_?bB@5c|z75>{a83&%85hyVZp diff --git a/bin/uebung07/quantities/plain/PlainQuantitiesDemo.class b/bin/uebung07/quantities/plain/PlainQuantitiesDemo.class index 3df06d16434f6ef9cdc607168225f0a12659589a..df63b4d3467c8b50737fbd9acf98f95422b131ed 100644 GIT binary patch delta 168 zcmbQlbCPQV43L2GRrhVGILWk71E0Ga}`Q}G9{G-sR}-+dFdq?3Pq`DsYS&KCHY{P+|1(Q l%)E4nim=q2{N&7%N-j=h+a~iel}}#A;sc~LCfl-J1ppg^Go1hc delta 125 zcmX@fHHl{f4S a9FsbTh6yT6ZelE(#Nva@SD#$Mauopf`YH1O diff --git a/bin/uebung07/quantities/plain/Time.class b/bin/uebung07/quantities/plain/Time.class new file mode 100644 index 0000000000000000000000000000000000000000..f266978968e304a732b420236057f1eea6e1abc2 GIT binary patch literal 1751 zcma)+ZBNrs6vzK}47Qa5Isp|0>v-D6!%$I_5fTxJFQy3sGra7^bzJFsXM0QJQ>h6` zB8k5DLmAKQHZ+7$)}%dc&-tDIdFX!s`SBCLbF3r~V;Bo~C2(sCONEbt?JA)J_X`cj z7H(l%)OiANhD>Ll&1TRMLp*SWVwfm(cGkch@+va)tOznz8M4{+t3>3=l;MTk;|99W zYa#)Ya$Oo5X3CXQVCXl|jUI-9l5qK(pkCqLwq0>JL%JlZwo|q}q3>G{<7!{{3|53N zDx>?*b^^k%b&}U`0*YG8Mup{~9JJ(HCT?KRAZx_L9o%IwYh10_J});@c4c$xDU88N z;NGPpYIohleGD=f6=H1IRV6)5AJ@H1QYBLDbC0fd;p#Ht^}wNVj%U{+u4hlf`w+tR-BZd&KC)cv%BW+^wnoViHdnUPV{cW?EI-b)~W@ z+&XIn6=qxNsKE^y@|Fy|D&G)#$5VO(=5;X%EHfnA5L&6%!uP4LZHn?~J!p#b*Fax| z{#?jPl1$&MVt=6%ummqz{t;iL*G}rk70n${b6j1;tcfCagCl?;WHE0iKu_! zP7_UAIzt!PLl|!HHz`w$-i@Au?dFehbLKm4)3xsyqq3@v6J)-SLo;Dd2IuVAr#ogSpP8u)P-AG`i$@V9LeHXeYmKd9h2eRmt;|jGD5pF&X{Hk4 zl+ir1W|GMCkcYL)G)q*h9M63wEvax~QgNZVe45)X7=|ILXwcpJ+LRroc22fZQywn59JuL4y@*(!tqv3=??s^J@| gH?8mm^$%htGzkk0Xud{R|50HbEn*BCge7c#1FBMt=Kufz literal 0 HcmV?d00001 diff --git a/src/uebung07/quantities/plain/Length.java b/src/uebung07/quantities/plain/Length.java index b8a2b23..5efacf3 100644 --- a/src/uebung07/quantities/plain/Length.java +++ b/src/uebung07/quantities/plain/Length.java @@ -1,8 +1,8 @@ -package quantities.plain; +package uebung07.quantities.plain; -import static quantities.plain.LengthUnit.METER; -import static quantities.plain.TimeUnit.SECOND; -import static quantities.plain.VelocityUnit.METER_PER_SECOND; +import static uebung07.quantities.plain.LengthUnit.METER; +import static uebung07.quantities.plain.TimeUnit.SECOND; +import static uebung07.quantities.plain.VelocityUnit.METER_PER_SECOND; public class Length extends Quantity { private final LengthUnit unit; diff --git a/src/uebung07/quantities/plain/LengthUnit.java b/src/uebung07/quantities/plain/LengthUnit.java index c5a8e04..c98102b 100644 --- a/src/uebung07/quantities/plain/LengthUnit.java +++ b/src/uebung07/quantities/plain/LengthUnit.java @@ -1,4 +1,4 @@ -package quantities.plain; +package uebung07.quantities.plain; public class LengthUnit extends Unit { public LengthUnit(String name, double baseFactor) { diff --git a/src/uebung07/quantities/plain/Time.java b/src/uebung07/quantities/plain/Time.java new file mode 100644 index 0000000..99c2044 --- /dev/null +++ b/src/uebung07/quantities/plain/Time.java @@ -0,0 +1,41 @@ +package uebung07.quantities.plain; + +import static uebung07.quantities.plain.LengthUnit.METER; + +public class Time extends Quantity{ + private final TimeUnit unit; + + public Time(double value, TimeUnit unit) { + super(value, unit); + this.unit = unit; + } + + public Time plus(Time other) { + return new Time( value + other.getBaseValue() / unit.baseFactor, unit); + } + + public Time minus(Time other) { + return new Time( value - other.getBaseValue() / unit.baseFactor, unit); + } + + public Time mult(double f) { + return new Time( value * f, unit); + } + + public Time div(double f) { + return new Time( value / f, unit); + } + + public Time to(TimeUnit unit) { + return new Time(getBaseValue() / unit.baseFactor, unit) + } + + public double div(Time other) { + return getBaseValue() / other.getBaseValue(); + } + + public Length mult(Velocity v) { + return new Length(this.value(METER), METER); + } + +} diff --git a/src/uebung07/quantities/plain/TimeUnit.java b/src/uebung07/quantities/plain/TimeUnit.java new file mode 100644 index 0000000..9e4523b --- /dev/null +++ b/src/uebung07/quantities/plain/TimeUnit.java @@ -0,0 +1,5 @@ +package uebung07.quantities.plain; + +public class TimeUnit extends Unit{ + +}