From 7ac35f607a5a91a9a051f4ac975373e36aa29c06 Mon Sep 17 00:00:00 2001 From: peet Date: Mon, 6 May 2024 01:38:39 +0200 Subject: [PATCH] initial commit --- .vscode/settings.json | 7 + README.md | 18 + bin/oop/ch01/chess1/Board.class | Bin 0 -> 3095 bytes bin/oop/ch01/chess1/Chess.class | Bin 0 -> 1233 bytes bin/oop/ch01/chess1/Color.class | Bin 0 -> 963 bytes bin/oop/ch01/chess1/Kind.class | Bin 0 -> 957 bytes bin/oop/ch01/chess1/Piece.class | Bin 0 -> 3794 bytes bin/oop/ch01/chess1/package-info.class | Bin 0 -> 121 bytes bin/oop/ch01/chess2/Board.class | Bin 0 -> 2986 bytes bin/oop/ch01/chess2/Chess.class | Bin 0 -> 1233 bytes bin/oop/ch01/chess2/Color.class | Bin 0 -> 963 bytes bin/oop/ch01/chess2/Kind.class | Bin 0 -> 957 bytes bin/oop/ch01/chess2/Piece.class | Bin 0 -> 3794 bytes bin/oop/ch01/chess2/package-info.class | Bin 0 -> 121 bytes bin/oop/ch02/cards/Card.class | Bin 0 -> 1574 bytes bin/oop/ch02/cards/CardExample.class | Bin 0 -> 1765 bytes bin/oop/ch02/cards0/Card.class | Bin 0 -> 1576 bytes bin/oop/ch02/chess1/Board.class | Bin 0 -> 3041 bytes bin/oop/ch02/chess1/Chess.class | Bin 0 -> 1233 bytes bin/oop/ch02/chess1/Color.class | Bin 0 -> 963 bytes bin/oop/ch02/chess1/Kind.class | Bin 0 -> 957 bytes bin/oop/ch02/chess1/Piece.class | Bin 0 -> 4232 bytes bin/oop/ch02/chess1/package-info.class | Bin 0 -> 121 bytes bin/oop/ch02/chess2/Board.class | Bin 0 -> 3046 bytes bin/oop/ch02/chess2/Chess.class | Bin 0 -> 1233 bytes bin/oop/ch02/chess2/Color.class | Bin 0 -> 963 bytes bin/oop/ch02/chess2/Kind.class | Bin 0 -> 957 bytes bin/oop/ch02/chess2/Piece.class | Bin 0 -> 4232 bytes bin/oop/ch02/chess2/package-info.class | Bin 0 -> 121 bytes bin/oop/ch02/clock/Clock1.class | Bin 0 -> 1487 bytes bin/oop/ch02/clock/Clock2.class | Bin 0 -> 1247 bytes bin/oop/ch02/clock/Clock3.class | Bin 0 -> 1257 bytes bin/oop/ch02/clock/Example.class | Bin 0 -> 1014 bytes bin/oop/ch03/chess/Board.class | Bin 0 -> 3036 bytes bin/oop/ch03/chess/Chess.class | Bin 0 -> 1232 bytes bin/oop/ch03/chess/Color.class | Bin 0 -> 957 bytes bin/oop/ch03/chess/Knight.class | Bin 0 -> 1755 bytes bin/oop/ch03/chess/Piece.class | Bin 0 -> 1689 bytes bin/oop/ch03/chess/Queen.class | Bin 0 -> 2047 bytes bin/oop/ch03/chess/Rook.class | Bin 0 -> 1318 bytes bin/oop/ch03/chess/package-info.class | Bin 0 -> 120 bytes bin/oop/ch03/vehicles/AmphibienBsp.class | Bin 0 -> 2790 bytes bin/oop/ch03/vehicles/Amphibienfahrzeug.class | Bin 0 -> 195 bytes .../ch03/vehicles/AmphibienfahrzeugImpl.class | Bin 0 -> 1001 bytes .../vehicles/AmphibienfahrzeugImpl2.class | Bin 0 -> 1000 bytes bin/oop/ch03/vehicles/Auto.class | Bin 0 -> 169 bytes bin/oop/ch03/vehicles/AutoImpl.class | Bin 0 -> 747 bytes bin/oop/ch03/vehicles/Fahrzeug.class | Bin 0 -> 200 bytes bin/oop/ch03/vehicles/FahrzeugImpl.class | Bin 0 -> 563 bytes bin/oop/ch03/vehicles/Schiff.class | Bin 0 -> 173 bytes bin/oop/ch03/vehicles/SchiffImpl.class | Bin 0 -> 751 bytes bin/oop/ch04/equality/Example.class | Bin 0 -> 1388 bytes bin/oop/ch04/equality/card1/Card.class | Bin 0 -> 1802 bytes bin/oop/ch04/equality/card1/Color.class | Bin 0 -> 1056 bytes bin/oop/ch04/equality/card1/ColoredCard.class | Bin 0 -> 1432 bytes bin/oop/ch04/equality/card1/Example.class | Bin 0 -> 963 bytes bin/oop/ch04/equality/card2/Card.class | Bin 0 -> 1802 bytes bin/oop/ch04/equality/card2/Color.class | Bin 0 -> 1056 bytes bin/oop/ch04/equality/card2/ColoredCard.class | Bin 0 -> 1481 bytes bin/oop/ch04/equality/card2/Example.class | Bin 0 -> 1056 bytes bin/oop/ch04/equality/card3/Card.class | Bin 0 -> 1870 bytes bin/oop/ch04/equality/card3/Color.class | Bin 0 -> 1056 bytes bin/oop/ch04/equality/card3/ColoredCard.class | Bin 0 -> 1424 bytes bin/oop/ch04/equality/card3/Example.class | Bin 0 -> 1056 bytes bin/oop/ch04/equality/card4/Card.class | Bin 0 -> 1924 bytes bin/oop/ch04/equality/card4/Color.class | Bin 0 -> 1056 bytes bin/oop/ch04/equality/card4/ColoredCard.class | Bin 0 -> 1544 bytes bin/oop/ch04/equality/card4/Example.class | Bin 0 -> 2609 bytes bin/oop/ch04/equality/rational1/Example.class | Bin 0 -> 1258 bytes .../ch04/equality/rational1/Rational.class | Bin 0 -> 3657 bytes bin/oop/ch04/equality/rational2/Example.class | Bin 0 -> 1258 bytes .../ch04/equality/rational2/Rational.class | Bin 0 -> 3734 bytes .../ch05/generic/example/AutoContainer.class | Bin 0 -> 874 bytes bin/oop/ch05/generic/example/Example.class | Bin 0 -> 2722 bytes .../generic/example/GenericContainer.class | Bin 0 -> 1140 bytes bin/oop/ch05/generic/mensa/AccountCard.class | Bin 0 -> 2490 bytes bin/oop/ch05/generic/mensa/CashCard.class | Bin 0 -> 2995 bytes bin/oop/ch05/generic/mensa/CashPoint.class | Bin 0 -> 3489 bytes bin/oop/ch05/generic/mensa/Color.class | Bin 0 -> 1145 bytes bin/oop/ch05/generic/mensa/CountCard.class | Bin 0 -> 1498 bytes bin/oop/ch05/generic/mensa/MensaCard.class | Bin 0 -> 1392 bytes bin/oop/ch05/generic/mensa/MensaExample.class | Bin 0 -> 3630 bytes .../generic/mensa/RejectedException.class | Bin 0 -> 389 bytes .../ch05/generic/mensa/VendingMachine.class | Bin 0 -> 1829 bytes .../secured/AuthorizationException.class | Bin 0 -> 408 bytes .../ch05/generic/secured/SecuredContent.class | Bin 0 -> 2300 bytes .../ch05/generic/secured/SecurityClient.class | Bin 0 -> 169 bytes bin/oop/ch05/mensa/AccountCard.class | Bin 0 -> 2339 bytes bin/oop/ch05/mensa/CashCard.class | Bin 0 -> 2758 bytes bin/oop/ch05/mensa/CashPoint.class | Bin 0 -> 3337 bytes bin/oop/ch05/mensa/Color.class | Bin 0 -> 1097 bytes bin/oop/ch05/mensa/CountCard.class | Bin 0 -> 1418 bytes bin/oop/ch05/mensa/MensaCard.class | Bin 0 -> 1336 bytes bin/oop/ch05/mensa/MensaExample.class | Bin 0 -> 3414 bytes bin/oop/ch05/mensa/RejectedException.class | Bin 0 -> 373 bytes bin/oop/ch05/mensa/VendingMachine.class | Bin 0 -> 1765 bytes .../ch05/secured/AuthorizationException.class | Bin 0 -> 392 bytes bin/oop/ch05/secured/SecuredContent.class | Bin 0 -> 1899 bytes bin/oop/ch05/secured/SecurityClient.class | Bin 0 -> 161 bytes bin/oop/ch06/calc/AdHocCalculator.class | Bin 0 -> 2383 bytes bin/oop/ch06/calc/BinaryOp.class | Bin 0 -> 456 bytes bin/oop/ch06/calc/CalculatorError.class | Bin 0 -> 372 bytes bin/oop/ch06/calc/Example.class | Bin 0 -> 1192 bytes bin/oop/ch06/calc/Op.class | Bin 0 -> 776 bytes bin/oop/ch06/calc/Ops$1.class | Bin 0 -> 581 bytes bin/oop/ch06/calc/Ops$2.class | Bin 0 -> 581 bytes bin/oop/ch06/calc/Ops$3.class | Bin 0 -> 581 bytes bin/oop/ch06/calc/Ops$4.class | Bin 0 -> 581 bytes bin/oop/ch06/calc/Ops$5.class | Bin 0 -> 552 bytes bin/oop/ch06/calc/Ops$6.class | Bin 0 -> 591 bytes bin/oop/ch06/calc/Ops$7.class | Bin 0 -> 590 bytes bin/oop/ch06/calc/Ops.class | Bin 0 -> 1076 bytes bin/oop/ch06/calc/UnaryOp.class | Bin 0 -> 452 bytes bin/oop/ch06/observer/Observer.class | Bin 0 -> 138 bytes bin/oop/ch06/observer/ObserverSupport.class | Bin 0 -> 1059 bytes bin/oop/ch07/auto/generics/A.class | Bin 0 -> 1558 bytes bin/oop/ch07/auto/generics/Automaton.class | Bin 0 -> 801 bytes bin/oop/ch07/auto/generics/B.class | Bin 0 -> 881 bytes bin/oop/ch07/auto/generics/C.class | Bin 0 -> 881 bytes bin/oop/ch07/auto/generics/D.class | Bin 0 -> 881 bytes bin/oop/ch07/auto/generics/Demo.class | Bin 0 -> 957 bytes bin/oop/ch07/auto/generics/E.class | Bin 0 -> 881 bytes bin/oop/ch07/auto/generics/F.class | Bin 0 -> 897 bytes bin/oop/ch07/auto/generics/Lower.class | Bin 0 -> 1114 bytes bin/oop/ch07/auto/generics/State.class | Bin 0 -> 1482 bytes bin/oop/ch07/auto/generics/StateMachine.class | Bin 0 -> 3140 bytes bin/oop/ch07/auto/generics/Upper.class | Bin 0 -> 821 bytes bin/oop/ch07/auto/simple/A.class | Bin 0 -> 1286 bytes bin/oop/ch07/auto/simple/Automaton.class | Bin 0 -> 612 bytes bin/oop/ch07/auto/simple/B.class | Bin 0 -> 670 bytes bin/oop/ch07/auto/simple/C.class | Bin 0 -> 670 bytes bin/oop/ch07/auto/simple/D.class | Bin 0 -> 670 bytes bin/oop/ch07/auto/simple/Demo.class | Bin 0 -> 949 bytes bin/oop/ch07/auto/simple/E.class | Bin 0 -> 670 bytes bin/oop/ch07/auto/simple/F.class | Bin 0 -> 670 bytes bin/oop/ch07/auto/simple/Lower.class | Bin 0 -> 909 bytes bin/oop/ch07/auto/simple/State.class | Bin 0 -> 1365 bytes bin/oop/ch07/auto/simple/StateMachine.class | Bin 0 -> 2537 bytes bin/oop/ch07/auto/simple/Upper.class | Bin 0 -> 618 bytes bin/oop/ch07/calc/AfterDot.class | Bin 0 -> 847 bytes bin/oop/ch07/calc/Automaton.class | Bin 0 -> 1615 bytes bin/oop/ch07/calc/BeforeDot.class | Bin 0 -> 1082 bytes bin/oop/ch07/calc/BinOp.class | Bin 0 -> 1572 bytes bin/oop/ch07/calc/Calculator.class | Bin 0 -> 2603 bytes bin/oop/ch07/calc/Error.class | Bin 0 -> 728 bytes bin/oop/ch07/calc/Example.class | Bin 0 -> 1182 bytes bin/oop/ch07/calc/HasFirst.class | Bin 0 -> 1098 bytes bin/oop/ch07/calc/HasSecond.class | Bin 0 -> 1298 bytes bin/oop/ch07/calc/Lower.class | Bin 0 -> 1410 bytes bin/oop/ch07/calc/NoOp.class | Bin 0 -> 1243 bytes bin/oop/ch07/calc/State.class | Bin 0 -> 2384 bytes bin/oop/ch07/calc/StateMachine.class | Bin 0 -> 3852 bytes bin/oop/ch07/calc/Unchanged.class | Bin 0 -> 1107 bytes bin/oop/ch07/calc/Upper.class | Bin 0 -> 759 bytes bin/oop/ch07/calc/Working.class | Bin 0 -> 2108 bytes bin/oop/ch07/clock0/Clock.class | Bin 0 -> 1261 bytes bin/oop/ch07/clock0/Example.class | Bin 0 -> 906 bytes bin/oop/ch07/clock0/State.class | Bin 0 -> 966 bytes bin/oop/ch07/clock1/Clock.class | Bin 0 -> 1001 bytes bin/oop/ch07/clock1/Example.class | Bin 0 -> 906 bytes bin/oop/ch07/clock1/Normal.class | Bin 0 -> 757 bytes bin/oop/ch07/clock1/Setting.class | Bin 0 -> 760 bytes bin/oop/ch07/clock1/State.class | Bin 0 -> 420 bytes bin/oop/ch07/clock2/Clock.class | Bin 0 -> 1118 bytes bin/oop/ch07/clock2/Example.class | Bin 0 -> 906 bytes bin/oop/ch07/clock2/Normal.class | Bin 0 -> 765 bytes bin/oop/ch07/clock2/Setting.class | Bin 0 -> 768 bytes bin/oop/ch07/clock2/State.class | Bin 0 -> 420 bytes bin/oop/ch07/clock3/Clock$1.class | Bin 0 -> 892 bytes bin/oop/ch07/clock3/Clock$2.class | Bin 0 -> 892 bytes bin/oop/ch07/clock3/Clock$State.class | Bin 0 -> 500 bytes bin/oop/ch07/clock3/Clock.class | Bin 0 -> 1123 bytes bin/oop/ch07/clock3/Example.class | Bin 0 -> 906 bytes bin/oop/ch07/expr1/BinExpr.class | Bin 0 -> 1179 bytes bin/oop/ch07/expr1/Const.class | Bin 0 -> 599 bytes bin/oop/ch07/expr1/Example.class | Bin 0 -> 1440 bytes bin/oop/ch07/expr1/Expr.class | Bin 0 -> 125 bytes bin/oop/ch07/expr1/Minus.class | Bin 0 -> 575 bytes bin/oop/ch07/expr1/Mult.class | Bin 0 -> 572 bytes bin/oop/ch07/expr1/Neg.class | Bin 0 -> 1114 bytes bin/oop/ch07/expr1/Plus.class | Bin 0 -> 572 bytes bin/oop/ch07/expr2/BinExpr.class | Bin 0 -> 1179 bytes bin/oop/ch07/expr2/Const.class | Bin 0 -> 937 bytes bin/oop/ch07/expr2/EvalVisitor.class | Bin 0 -> 2189 bytes bin/oop/ch07/expr2/Example.class | Bin 0 -> 1637 bytes bin/oop/ch07/expr2/Expr.class | Bin 0 -> 247 bytes bin/oop/ch07/expr2/LukasiewiczVisitor.class | Bin 0 -> 2737 bytes bin/oop/ch07/expr2/Minus.class | Bin 0 -> 843 bytes bin/oop/ch07/expr2/Mult.class | Bin 0 -> 839 bytes bin/oop/ch07/expr2/Neg.class | Bin 0 -> 1434 bytes bin/oop/ch07/expr2/Plus.class | Bin 0 -> 835 bytes bin/oop/ch07/expr2/Visitor.class | Bin 0 -> 628 bytes bin/oop/ch07/trace/ConsoleTrace.class | Bin 0 -> 1299 bytes bin/oop/ch07/trace/FileTrace.class | Bin 0 -> 1454 bytes bin/oop/ch07/trace/Trace.class | Bin 0 -> 1517 bytes bin/oop/ch07/tree/Example.class | Bin 0 -> 2733 bytes bin/oop/ch07/tree/Example2.class | Bin 0 -> 1139 bytes bin/oop/ch07/tree/IterablesIterator.class | Bin 0 -> 1401 bytes bin/oop/ch07/tree/Tree.class | Bin 0 -> 1844 bytes bin/oop/ch08/gui/calc/CalcApp.class | Bin 0 -> 1063 bytes bin/oop/ch08/gui/calc/CalcGUI.class | Bin 0 -> 5843 bytes bin/oop/ch08/gui/mvc/model/CounterModel.class | Bin 0 -> 866 bytes bin/oop/ch08/gui/mvc/v1/CounterApp.class | Bin 0 -> 1415 bytes .../ch08/gui/mvc/v1/CounterController.class | Bin 0 -> 809 bytes bin/oop/ch08/gui/mvc/v1/CounterModel.class | Bin 0 -> 912 bytes bin/oop/ch08/gui/mvc/v1/CounterView.class | Bin 0 -> 1655 bytes bin/oop/ch08/gui/mvc/v2/CounterApp.class | Bin 0 -> 1415 bytes .../ch08/gui/mvc/v2/CounterController.class | Bin 0 -> 809 bytes bin/oop/ch08/gui/mvc/v2/CounterModel.class | Bin 0 -> 911 bytes bin/oop/ch08/gui/mvc/v2/CounterView.class | Bin 0 -> 1688 bytes bin/oop/ch08/gui/mvc/v3/CounterApp.class | Bin 0 -> 1424 bytes .../ch08/gui/mvc/v3/CounterController.class | Bin 0 -> 818 bytes bin/oop/ch08/gui/mvc/v3/CounterView.class | Bin 0 -> 1697 bytes bin/oop/ch08/gui/mvc/v4/CounterApp.class | Bin 0 -> 1100 bytes .../ch08/gui/mvc/v4/CounterController.class | Bin 0 -> 713 bytes bin/oop/ch08/gui/mvc/v4/CounterGUI.class | Bin 0 -> 1522 bytes bin/oop/ch08/gui/mvc/v5/CounterApp.class | Bin 0 -> 1100 bytes bin/oop/ch08/gui/mvc/v5/CounterGUI$1.class | Bin 0 -> 943 bytes bin/oop/ch08/gui/mvc/v5/CounterGUI.class | Bin 0 -> 1625 bytes bin/oop/ch08/gui/mvc/v6/CounterApp.class | Bin 0 -> 1100 bytes bin/oop/ch08/gui/mvc/v6/CounterGUI.class | Bin 0 -> 2107 bytes bin/oop/ch08/gui/simple/HelloWorld.class | Bin 0 -> 1539 bytes bin/oop/ch09/testing/Example.class | Bin 0 -> 1739 bytes bin/uebung03/polynomial/POLNYOMIAL.class | Bin 0 -> 759 bytes bin/uebung04/ByeGame.class | Bin 0 -> 909 bytes bin/uebung04/Game.class | Bin 0 -> 988 bytes bin/uebung04/OrdinaryGame.class | Bin 0 -> 939 bytes bin/uebung04/SeededGame.class | Bin 0 -> 927 bytes src/oop/ch01/chess1/Board.java | 59 + src/oop/ch01/chess1/Chess.java | 15 + src/oop/ch01/chess1/Color.java | 5 + src/oop/ch01/chess1/Kind.java | 5 + src/oop/ch01/chess1/Piece.java | 87 + src/oop/ch01/chess1/package-info.java | 4 + src/oop/ch01/chess2/Board.java | 59 + src/oop/ch01/chess2/Chess.java | 15 + src/oop/ch01/chess2/Color.java | 5 + src/oop/ch01/chess2/Kind.java | 5 + src/oop/ch01/chess2/Piece.java | 87 + src/oop/ch01/chess2/package-info.java | 5 + src/oop/ch02/cards/Card.java | 79 + src/oop/ch02/cards/CardExample.java | 20 + src/oop/ch02/cards0/Card.java | 34 + src/oop/ch02/chess1/Board.java | 59 + src/oop/ch02/chess1/Chess.java | 15 + src/oop/ch02/chess1/Color.java | 5 + src/oop/ch02/chess1/Kind.java | 5 + src/oop/ch02/chess1/Piece.java | 107 + src/oop/ch02/chess1/package-info.java | 4 + src/oop/ch02/chess2/Board.java | 54 + src/oop/ch02/chess2/Chess.java | 15 + src/oop/ch02/chess2/Color.java | 5 + src/oop/ch02/chess2/Kind.java | 5 + src/oop/ch02/chess2/Piece.java | 107 + src/oop/ch02/chess2/package-info.java | 4 + src/oop/ch02/clock/Clock1.java | 33 + src/oop/ch02/clock/Clock2.java | 27 + src/oop/ch02/clock/Clock3.java | 24 + src/oop/ch02/clock/Example.java | 13 + src/oop/ch03/chess/Board.java | 54 + src/oop/ch03/chess/Chess.java | 17 + src/oop/ch03/chess/Color.java | 5 + src/oop/ch03/chess/Knight.java | 28 + src/oop/ch03/chess/Piece.java | 38 + src/oop/ch03/chess/Queen.java | 40 + src/oop/ch03/chess/Rook.java | 41 + src/oop/ch03/chess/package-info.java | 4 + src/oop/ch03/vehicles/AmphibienBsp.java | 26 + src/oop/ch03/vehicles/Amphibienfahrzeug.java | 3 + .../ch03/vehicles/AmphibienfahrzeugImpl.java | 27 + .../ch03/vehicles/AmphibienfahrzeugImpl2.java | 27 + src/oop/ch03/vehicles/Auto.java | 5 + src/oop/ch03/vehicles/AutoImpl.java | 22 + src/oop/ch03/vehicles/Fahrzeug.java | 9 + src/oop/ch03/vehicles/FahrzeugImpl.java | 20 + src/oop/ch03/vehicles/Schiff.java | 5 + src/oop/ch03/vehicles/SchiffImpl.java | 23 + src/oop/ch04/equality/Example.java | 27 + src/oop/ch04/equality/card1/Card.java | 89 + src/oop/ch04/equality/card1/Color.java | 5 + src/oop/ch04/equality/card1/ColoredCard.java | 26 + src/oop/ch04/equality/card1/Example.java | 11 + src/oop/ch04/equality/card2/Card.java | 89 + src/oop/ch04/equality/card2/Color.java | 5 + src/oop/ch04/equality/card2/ColoredCard.java | 28 + src/oop/ch04/equality/card2/Example.java | 15 + src/oop/ch04/equality/card3/Card.java | 89 + src/oop/ch04/equality/card3/Color.java | 5 + src/oop/ch04/equality/card3/ColoredCard.java | 25 + src/oop/ch04/equality/card3/Example.java | 15 + src/oop/ch04/equality/card4/Card.java | 93 + src/oop/ch04/equality/card4/Color.java | 5 + src/oop/ch04/equality/card4/ColoredCard.java | 32 + src/oop/ch04/equality/card4/Example.java | 29 + src/oop/ch04/equality/rational1/Example.java | 23 + src/oop/ch04/equality/rational1/Rational.java | 117 + src/oop/ch04/equality/rational2/Example.java | 23 + src/oop/ch04/equality/rational2/Rational.java | 122 + .../ch05/generic/example/AutoContainer.java | 22 + src/oop/ch05/generic/example/Example.java | 54 + .../generic/example/GenericContainer.java | 22 + src/oop/ch05/generic/mensa/AccountCard.java | 34 + src/oop/ch05/generic/mensa/CashCard.java | 43 + src/oop/ch05/generic/mensa/CashPoint.java | 64 + src/oop/ch05/generic/mensa/Color.java | 5 + src/oop/ch05/generic/mensa/CountCard.java | 15 + src/oop/ch05/generic/mensa/MensaCard.java | 20 + src/oop/ch05/generic/mensa/MensaExample.java | 68 + .../ch05/generic/mensa/RejectedException.java | 7 + .../ch05/generic/mensa/VendingMachine.java | 37 + .../secured/AuthorizationException.java | 20 + .../ch05/generic/secured/SecuredContent.java | 80 + .../ch05/generic/secured/SecurityClient.java | 18 + src/oop/ch05/mensa/AccountCard.java | 34 + src/oop/ch05/mensa/CashCard.java | 43 + src/oop/ch05/mensa/CashPoint.java | 64 + src/oop/ch05/mensa/Color.java | 5 + src/oop/ch05/mensa/CountCard.java | 15 + src/oop/ch05/mensa/MensaCard.java | 20 + src/oop/ch05/mensa/MensaExample.java | 68 + src/oop/ch05/mensa/RejectedException.java | 7 + src/oop/ch05/mensa/VendingMachine.java | 37 + .../ch05/secured/AuthorizationException.java | 20 + src/oop/ch05/secured/SecuredContent.java | 79 + src/oop/ch05/secured/SecurityClient.java | 18 + src/oop/ch06/calc/AdHocCalculator.java | 113 + src/oop/ch06/calc/BinaryOp.java | 9 + src/oop/ch06/calc/CalculatorError.java | 7 + src/oop/ch06/calc/Example.java | 27 + src/oop/ch06/calc/Op.java | 22 + src/oop/ch06/calc/Ops.java | 47 + src/oop/ch06/calc/UnaryOp.java | 9 + src/oop/ch06/observer/Observer.java | 5 + src/oop/ch06/observer/ObserverSupport.java | 17 + src/oop/ch07/auto/generics/A.java | 40 + src/oop/ch07/auto/generics/Automaton.java | 13 + src/oop/ch07/auto/generics/B.java | 13 + src/oop/ch07/auto/generics/C.java | 13 + src/oop/ch07/auto/generics/D.java | 13 + src/oop/ch07/auto/generics/Demo.java | 25 + src/oop/ch07/auto/generics/E.java | 13 + src/oop/ch07/auto/generics/F.java | 13 + src/oop/ch07/auto/generics/Lower.java | 18 + src/oop/ch07/auto/generics/State.java | 47 + src/oop/ch07/auto/generics/StateMachine.java | 88 + src/oop/ch07/auto/generics/Upper.java | 12 + src/oop/ch07/auto/simple/A.java | 40 + src/oop/ch07/auto/simple/Automaton.java | 13 + src/oop/ch07/auto/simple/B.java | 13 + src/oop/ch07/auto/simple/C.java | 13 + src/oop/ch07/auto/simple/D.java | 13 + src/oop/ch07/auto/simple/Demo.java | 25 + src/oop/ch07/auto/simple/E.java | 13 + src/oop/ch07/auto/simple/F.java | 13 + src/oop/ch07/auto/simple/Lower.java | 18 + src/oop/ch07/auto/simple/State.java | 49 + src/oop/ch07/auto/simple/StateMachine.java | 86 + src/oop/ch07/auto/simple/Upper.java | 12 + src/oop/ch07/calc/AfterDot.java | 12 + src/oop/ch07/calc/Automaton.java | 55 + src/oop/ch07/calc/BeforeDot.java | 19 + src/oop/ch07/calc/BinOp.java | 28 + src/oop/ch07/calc/Calculator.java | 96 + src/oop/ch07/calc/Error.java | 12 + src/oop/ch07/calc/Example.java | 29 + src/oop/ch07/calc/HasFirst.java | 24 + src/oop/ch07/calc/HasSecond.java | 23 + src/oop/ch07/calc/Lower.java | 36 + src/oop/ch07/calc/NoOp.java | 24 + src/oop/ch07/calc/State.java | 114 + src/oop/ch07/calc/StateMachine.java | 122 + src/oop/ch07/calc/Unchanged.java | 21 + src/oop/ch07/calc/Upper.java | 12 + src/oop/ch07/calc/Working.java | 69 + src/oop/ch07/clock0/Clock.java | 41 + src/oop/ch07/clock0/Example.java | 33 + src/oop/ch07/clock0/State.java | 5 + src/oop/ch07/clock1/Clock.java | 23 + src/oop/ch07/clock1/Example.java | 33 + src/oop/ch07/clock1/Normal.java | 13 + src/oop/ch07/clock1/Setting.java | 13 + src/oop/ch07/clock1/State.java | 15 + src/oop/ch07/clock2/Clock.java | 25 + src/oop/ch07/clock2/Example.java | 33 + src/oop/ch07/clock2/Normal.java | 13 + src/oop/ch07/clock2/Setting.java | 13 + src/oop/ch07/clock2/State.java | 15 + src/oop/ch07/clock3/Clock.java | 51 + src/oop/ch07/clock3/Example.java | 33 + src/oop/ch07/expr1/BinExpr.java | 16 + src/oop/ch07/expr1/Const.java | 15 + src/oop/ch07/expr1/Example.java | 8 + src/oop/ch07/expr1/Expr.java | 6 + src/oop/ch07/expr1/Minus.java | 10 + src/oop/ch07/expr1/Mult.java | 10 + src/oop/ch07/expr1/Neg.java | 15 + src/oop/ch07/expr1/Plus.java | 10 + src/oop/ch07/expr2/BinExpr.java | 16 + src/oop/ch07/expr2/Const.java | 15 + src/oop/ch07/expr2/EvalVisitor.java | 23 + src/oop/ch07/expr2/Example.java | 9 + src/oop/ch07/expr2/Expr.java | 6 + src/oop/ch07/expr2/LukasiewiczVisitor.java | 28 + src/oop/ch07/expr2/Minus.java | 10 + src/oop/ch07/expr2/Mult.java | 10 + src/oop/ch07/expr2/Neg.java | 15 + src/oop/ch07/expr2/Plus.java | 8 + src/oop/ch07/expr2/Visitor.java | 13 + src/oop/ch07/trace/ConsoleTrace.java | 19 + src/oop/ch07/trace/FileTrace.java | 28 + src/oop/ch07/trace/Trace.java | 28 + src/oop/ch07/tree/Example.java | 40 + src/oop/ch07/tree/Example2.java | 15 + src/oop/ch07/tree/IterablesIterator.java | 32 + src/oop/ch07/tree/Tree.java | 33 + src/oop/ch08/gui/calc/CalcApp.java | 21 + src/oop/ch08/gui/calc/CalcGUI.java | 77 + src/oop/ch08/gui/mvc/model/CounterModel.java | 22 + src/oop/ch08/gui/mvc/v1/CounterApp.java | 24 + .../ch08/gui/mvc/v1/CounterController.java | 18 + src/oop/ch08/gui/mvc/v1/CounterModel.java | 21 + src/oop/ch08/gui/mvc/v1/CounterView.java | 29 + src/oop/ch08/gui/mvc/v2/CounterApp.java | 24 + .../ch08/gui/mvc/v2/CounterController.java | 18 + src/oop/ch08/gui/mvc/v2/CounterModel.java | 23 + src/oop/ch08/gui/mvc/v2/CounterView.java | 32 + src/oop/ch08/gui/mvc/v3/CounterApp.java | 26 + .../ch08/gui/mvc/v3/CounterController.java | 20 + src/oop/ch08/gui/mvc/v3/CounterView.java | 33 + src/oop/ch08/gui/mvc/v4/CounterApp.java | 21 + .../ch08/gui/mvc/v4/CounterController.java | 19 + src/oop/ch08/gui/mvc/v4/CounterGUI.java | 25 + src/oop/ch08/gui/mvc/v5/CounterApp.java | 21 + src/oop/ch08/gui/mvc/v5/CounterGUI.java | 32 + src/oop/ch08/gui/mvc/v6/CounterApp.java | 21 + src/oop/ch08/gui/mvc/v6/CounterGUI.java | 25 + src/oop/ch08/gui/simple/HelloWorld.java | 37 + src/oop/ch09/testing/Example.java | 46 + src/uebung03/polynomial/POLNYOMIAL.java | 30 + src/uebung04/ByeGame.java | 5 + src/uebung04/Game.java | 34 + src/uebung04/OrdinaryGame.java | 5 + src/uebung04/SeededGame.java | 5 + test/oop/ch03/chess/ChessTest.java | 168 ++ test/oop/ch08/gui/mvc/TestModel.java | 24 + .../test/AdHocCalculatorEdgePairTest.java | 2040 +++++++++++++++++ .../calc/test/AdHocCalculatorEdgeTest.java | 280 +++ .../calc/test/CalculatorEdgePairTest.java | 2040 +++++++++++++++++ test/oop/ch09/testing/ExceptionTest.java | 34 + .../uebung04/tournament/TournamentTest.java | 134 ++ 450 files changed, 10976 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 README.md create mode 100644 bin/oop/ch01/chess1/Board.class create mode 100644 bin/oop/ch01/chess1/Chess.class create mode 100644 bin/oop/ch01/chess1/Color.class create mode 100644 bin/oop/ch01/chess1/Kind.class create mode 100644 bin/oop/ch01/chess1/Piece.class create mode 100644 bin/oop/ch01/chess1/package-info.class create mode 100644 bin/oop/ch01/chess2/Board.class create mode 100644 bin/oop/ch01/chess2/Chess.class create mode 100644 bin/oop/ch01/chess2/Color.class create mode 100644 bin/oop/ch01/chess2/Kind.class create mode 100644 bin/oop/ch01/chess2/Piece.class create mode 100644 bin/oop/ch01/chess2/package-info.class create mode 100644 bin/oop/ch02/cards/Card.class create mode 100644 bin/oop/ch02/cards/CardExample.class create mode 100644 bin/oop/ch02/cards0/Card.class create mode 100644 bin/oop/ch02/chess1/Board.class create mode 100644 bin/oop/ch02/chess1/Chess.class create mode 100644 bin/oop/ch02/chess1/Color.class create mode 100644 bin/oop/ch02/chess1/Kind.class create mode 100644 bin/oop/ch02/chess1/Piece.class create mode 100644 bin/oop/ch02/chess1/package-info.class create mode 100644 bin/oop/ch02/chess2/Board.class create mode 100644 bin/oop/ch02/chess2/Chess.class create mode 100644 bin/oop/ch02/chess2/Color.class create mode 100644 bin/oop/ch02/chess2/Kind.class create mode 100644 bin/oop/ch02/chess2/Piece.class create mode 100644 bin/oop/ch02/chess2/package-info.class create mode 100644 bin/oop/ch02/clock/Clock1.class create mode 100644 bin/oop/ch02/clock/Clock2.class create mode 100644 bin/oop/ch02/clock/Clock3.class create mode 100644 bin/oop/ch02/clock/Example.class create mode 100644 bin/oop/ch03/chess/Board.class create mode 100644 bin/oop/ch03/chess/Chess.class create mode 100644 bin/oop/ch03/chess/Color.class create mode 100644 bin/oop/ch03/chess/Knight.class create mode 100644 bin/oop/ch03/chess/Piece.class create mode 100644 bin/oop/ch03/chess/Queen.class create mode 100644 bin/oop/ch03/chess/Rook.class create mode 100644 bin/oop/ch03/chess/package-info.class create mode 100644 bin/oop/ch03/vehicles/AmphibienBsp.class create mode 100644 bin/oop/ch03/vehicles/Amphibienfahrzeug.class create mode 100644 bin/oop/ch03/vehicles/AmphibienfahrzeugImpl.class create mode 100644 bin/oop/ch03/vehicles/AmphibienfahrzeugImpl2.class create mode 100644 bin/oop/ch03/vehicles/Auto.class create mode 100644 bin/oop/ch03/vehicles/AutoImpl.class create mode 100644 bin/oop/ch03/vehicles/Fahrzeug.class create mode 100644 bin/oop/ch03/vehicles/FahrzeugImpl.class create mode 100644 bin/oop/ch03/vehicles/Schiff.class create mode 100644 bin/oop/ch03/vehicles/SchiffImpl.class create mode 100644 bin/oop/ch04/equality/Example.class create mode 100644 bin/oop/ch04/equality/card1/Card.class create mode 100644 bin/oop/ch04/equality/card1/Color.class create mode 100644 bin/oop/ch04/equality/card1/ColoredCard.class create mode 100644 bin/oop/ch04/equality/card1/Example.class create mode 100644 bin/oop/ch04/equality/card2/Card.class create mode 100644 bin/oop/ch04/equality/card2/Color.class create mode 100644 bin/oop/ch04/equality/card2/ColoredCard.class create mode 100644 bin/oop/ch04/equality/card2/Example.class create mode 100644 bin/oop/ch04/equality/card3/Card.class create mode 100644 bin/oop/ch04/equality/card3/Color.class create mode 100644 bin/oop/ch04/equality/card3/ColoredCard.class create mode 100644 bin/oop/ch04/equality/card3/Example.class create mode 100644 bin/oop/ch04/equality/card4/Card.class create mode 100644 bin/oop/ch04/equality/card4/Color.class create mode 100644 bin/oop/ch04/equality/card4/ColoredCard.class create mode 100644 bin/oop/ch04/equality/card4/Example.class create mode 100644 bin/oop/ch04/equality/rational1/Example.class create mode 100644 bin/oop/ch04/equality/rational1/Rational.class create mode 100644 bin/oop/ch04/equality/rational2/Example.class create mode 100644 bin/oop/ch04/equality/rational2/Rational.class create mode 100644 bin/oop/ch05/generic/example/AutoContainer.class create mode 100644 bin/oop/ch05/generic/example/Example.class create mode 100644 bin/oop/ch05/generic/example/GenericContainer.class create mode 100644 bin/oop/ch05/generic/mensa/AccountCard.class create mode 100644 bin/oop/ch05/generic/mensa/CashCard.class create mode 100644 bin/oop/ch05/generic/mensa/CashPoint.class create mode 100644 bin/oop/ch05/generic/mensa/Color.class create mode 100644 bin/oop/ch05/generic/mensa/CountCard.class create mode 100644 bin/oop/ch05/generic/mensa/MensaCard.class create mode 100644 bin/oop/ch05/generic/mensa/MensaExample.class create mode 100644 bin/oop/ch05/generic/mensa/RejectedException.class create mode 100644 bin/oop/ch05/generic/mensa/VendingMachine.class create mode 100644 bin/oop/ch05/generic/secured/AuthorizationException.class create mode 100644 bin/oop/ch05/generic/secured/SecuredContent.class create mode 100644 bin/oop/ch05/generic/secured/SecurityClient.class create mode 100644 bin/oop/ch05/mensa/AccountCard.class create mode 100644 bin/oop/ch05/mensa/CashCard.class create mode 100644 bin/oop/ch05/mensa/CashPoint.class create mode 100644 bin/oop/ch05/mensa/Color.class create mode 100644 bin/oop/ch05/mensa/CountCard.class create mode 100644 bin/oop/ch05/mensa/MensaCard.class create mode 100644 bin/oop/ch05/mensa/MensaExample.class create mode 100644 bin/oop/ch05/mensa/RejectedException.class create mode 100644 bin/oop/ch05/mensa/VendingMachine.class create mode 100644 bin/oop/ch05/secured/AuthorizationException.class create mode 100644 bin/oop/ch05/secured/SecuredContent.class create mode 100644 bin/oop/ch05/secured/SecurityClient.class create mode 100644 bin/oop/ch06/calc/AdHocCalculator.class create mode 100644 bin/oop/ch06/calc/BinaryOp.class create mode 100644 bin/oop/ch06/calc/CalculatorError.class create mode 100644 bin/oop/ch06/calc/Example.class create mode 100644 bin/oop/ch06/calc/Op.class create mode 100644 bin/oop/ch06/calc/Ops$1.class create mode 100644 bin/oop/ch06/calc/Ops$2.class create mode 100644 bin/oop/ch06/calc/Ops$3.class create mode 100644 bin/oop/ch06/calc/Ops$4.class create mode 100644 bin/oop/ch06/calc/Ops$5.class create mode 100644 bin/oop/ch06/calc/Ops$6.class create mode 100644 bin/oop/ch06/calc/Ops$7.class create mode 100644 bin/oop/ch06/calc/Ops.class create mode 100644 bin/oop/ch06/calc/UnaryOp.class create mode 100644 bin/oop/ch06/observer/Observer.class create mode 100644 bin/oop/ch06/observer/ObserverSupport.class create mode 100644 bin/oop/ch07/auto/generics/A.class create mode 100644 bin/oop/ch07/auto/generics/Automaton.class create mode 100644 bin/oop/ch07/auto/generics/B.class create mode 100644 bin/oop/ch07/auto/generics/C.class create mode 100644 bin/oop/ch07/auto/generics/D.class create mode 100644 bin/oop/ch07/auto/generics/Demo.class create mode 100644 bin/oop/ch07/auto/generics/E.class create mode 100644 bin/oop/ch07/auto/generics/F.class create mode 100644 bin/oop/ch07/auto/generics/Lower.class create mode 100644 bin/oop/ch07/auto/generics/State.class create mode 100644 bin/oop/ch07/auto/generics/StateMachine.class create mode 100644 bin/oop/ch07/auto/generics/Upper.class create mode 100644 bin/oop/ch07/auto/simple/A.class create mode 100644 bin/oop/ch07/auto/simple/Automaton.class create mode 100644 bin/oop/ch07/auto/simple/B.class create mode 100644 bin/oop/ch07/auto/simple/C.class create mode 100644 bin/oop/ch07/auto/simple/D.class create mode 100644 bin/oop/ch07/auto/simple/Demo.class create mode 100644 bin/oop/ch07/auto/simple/E.class create mode 100644 bin/oop/ch07/auto/simple/F.class create mode 100644 bin/oop/ch07/auto/simple/Lower.class create mode 100644 bin/oop/ch07/auto/simple/State.class create mode 100644 bin/oop/ch07/auto/simple/StateMachine.class create mode 100644 bin/oop/ch07/auto/simple/Upper.class create mode 100644 bin/oop/ch07/calc/AfterDot.class create mode 100644 bin/oop/ch07/calc/Automaton.class create mode 100644 bin/oop/ch07/calc/BeforeDot.class create mode 100644 bin/oop/ch07/calc/BinOp.class create mode 100644 bin/oop/ch07/calc/Calculator.class create mode 100644 bin/oop/ch07/calc/Error.class create mode 100644 bin/oop/ch07/calc/Example.class create mode 100644 bin/oop/ch07/calc/HasFirst.class create mode 100644 bin/oop/ch07/calc/HasSecond.class create mode 100644 bin/oop/ch07/calc/Lower.class create mode 100644 bin/oop/ch07/calc/NoOp.class create mode 100644 bin/oop/ch07/calc/State.class create mode 100644 bin/oop/ch07/calc/StateMachine.class create mode 100644 bin/oop/ch07/calc/Unchanged.class create mode 100644 bin/oop/ch07/calc/Upper.class create mode 100644 bin/oop/ch07/calc/Working.class create mode 100644 bin/oop/ch07/clock0/Clock.class create mode 100644 bin/oop/ch07/clock0/Example.class create mode 100644 bin/oop/ch07/clock0/State.class create mode 100644 bin/oop/ch07/clock1/Clock.class create mode 100644 bin/oop/ch07/clock1/Example.class create mode 100644 bin/oop/ch07/clock1/Normal.class create mode 100644 bin/oop/ch07/clock1/Setting.class create mode 100644 bin/oop/ch07/clock1/State.class create mode 100644 bin/oop/ch07/clock2/Clock.class create mode 100644 bin/oop/ch07/clock2/Example.class create mode 100644 bin/oop/ch07/clock2/Normal.class create mode 100644 bin/oop/ch07/clock2/Setting.class create mode 100644 bin/oop/ch07/clock2/State.class create mode 100644 bin/oop/ch07/clock3/Clock$1.class create mode 100644 bin/oop/ch07/clock3/Clock$2.class create mode 100644 bin/oop/ch07/clock3/Clock$State.class create mode 100644 bin/oop/ch07/clock3/Clock.class create mode 100644 bin/oop/ch07/clock3/Example.class create mode 100644 bin/oop/ch07/expr1/BinExpr.class create mode 100644 bin/oop/ch07/expr1/Const.class create mode 100644 bin/oop/ch07/expr1/Example.class create mode 100644 bin/oop/ch07/expr1/Expr.class create mode 100644 bin/oop/ch07/expr1/Minus.class create mode 100644 bin/oop/ch07/expr1/Mult.class create mode 100644 bin/oop/ch07/expr1/Neg.class create mode 100644 bin/oop/ch07/expr1/Plus.class create mode 100644 bin/oop/ch07/expr2/BinExpr.class create mode 100644 bin/oop/ch07/expr2/Const.class create mode 100644 bin/oop/ch07/expr2/EvalVisitor.class create mode 100644 bin/oop/ch07/expr2/Example.class create mode 100644 bin/oop/ch07/expr2/Expr.class create mode 100644 bin/oop/ch07/expr2/LukasiewiczVisitor.class create mode 100644 bin/oop/ch07/expr2/Minus.class create mode 100644 bin/oop/ch07/expr2/Mult.class create mode 100644 bin/oop/ch07/expr2/Neg.class create mode 100644 bin/oop/ch07/expr2/Plus.class create mode 100644 bin/oop/ch07/expr2/Visitor.class create mode 100644 bin/oop/ch07/trace/ConsoleTrace.class create mode 100644 bin/oop/ch07/trace/FileTrace.class create mode 100644 bin/oop/ch07/trace/Trace.class create mode 100644 bin/oop/ch07/tree/Example.class create mode 100644 bin/oop/ch07/tree/Example2.class create mode 100644 bin/oop/ch07/tree/IterablesIterator.class create mode 100644 bin/oop/ch07/tree/Tree.class create mode 100644 bin/oop/ch08/gui/calc/CalcApp.class create mode 100644 bin/oop/ch08/gui/calc/CalcGUI.class create mode 100644 bin/oop/ch08/gui/mvc/model/CounterModel.class create mode 100644 bin/oop/ch08/gui/mvc/v1/CounterApp.class create mode 100644 bin/oop/ch08/gui/mvc/v1/CounterController.class create mode 100644 bin/oop/ch08/gui/mvc/v1/CounterModel.class create mode 100644 bin/oop/ch08/gui/mvc/v1/CounterView.class create mode 100644 bin/oop/ch08/gui/mvc/v2/CounterApp.class create mode 100644 bin/oop/ch08/gui/mvc/v2/CounterController.class create mode 100644 bin/oop/ch08/gui/mvc/v2/CounterModel.class create mode 100644 bin/oop/ch08/gui/mvc/v2/CounterView.class create mode 100644 bin/oop/ch08/gui/mvc/v3/CounterApp.class create mode 100644 bin/oop/ch08/gui/mvc/v3/CounterController.class create mode 100644 bin/oop/ch08/gui/mvc/v3/CounterView.class create mode 100644 bin/oop/ch08/gui/mvc/v4/CounterApp.class create mode 100644 bin/oop/ch08/gui/mvc/v4/CounterController.class create mode 100644 bin/oop/ch08/gui/mvc/v4/CounterGUI.class create mode 100644 bin/oop/ch08/gui/mvc/v5/CounterApp.class create mode 100644 bin/oop/ch08/gui/mvc/v5/CounterGUI$1.class create mode 100644 bin/oop/ch08/gui/mvc/v5/CounterGUI.class create mode 100644 bin/oop/ch08/gui/mvc/v6/CounterApp.class create mode 100644 bin/oop/ch08/gui/mvc/v6/CounterGUI.class create mode 100644 bin/oop/ch08/gui/simple/HelloWorld.class create mode 100644 bin/oop/ch09/testing/Example.class create mode 100644 bin/uebung03/polynomial/POLNYOMIAL.class create mode 100644 bin/uebung04/ByeGame.class create mode 100644 bin/uebung04/Game.class create mode 100644 bin/uebung04/OrdinaryGame.class create mode 100644 bin/uebung04/SeededGame.class create mode 100644 src/oop/ch01/chess1/Board.java create mode 100644 src/oop/ch01/chess1/Chess.java create mode 100644 src/oop/ch01/chess1/Color.java create mode 100644 src/oop/ch01/chess1/Kind.java create mode 100644 src/oop/ch01/chess1/Piece.java create mode 100644 src/oop/ch01/chess1/package-info.java create mode 100644 src/oop/ch01/chess2/Board.java create mode 100644 src/oop/ch01/chess2/Chess.java create mode 100644 src/oop/ch01/chess2/Color.java create mode 100644 src/oop/ch01/chess2/Kind.java create mode 100644 src/oop/ch01/chess2/Piece.java create mode 100644 src/oop/ch01/chess2/package-info.java create mode 100644 src/oop/ch02/cards/Card.java create mode 100644 src/oop/ch02/cards/CardExample.java create mode 100644 src/oop/ch02/cards0/Card.java create mode 100644 src/oop/ch02/chess1/Board.java create mode 100644 src/oop/ch02/chess1/Chess.java create mode 100644 src/oop/ch02/chess1/Color.java create mode 100644 src/oop/ch02/chess1/Kind.java create mode 100644 src/oop/ch02/chess1/Piece.java create mode 100644 src/oop/ch02/chess1/package-info.java create mode 100644 src/oop/ch02/chess2/Board.java create mode 100644 src/oop/ch02/chess2/Chess.java create mode 100644 src/oop/ch02/chess2/Color.java create mode 100644 src/oop/ch02/chess2/Kind.java create mode 100644 src/oop/ch02/chess2/Piece.java create mode 100644 src/oop/ch02/chess2/package-info.java create mode 100644 src/oop/ch02/clock/Clock1.java create mode 100644 src/oop/ch02/clock/Clock2.java create mode 100644 src/oop/ch02/clock/Clock3.java create mode 100644 src/oop/ch02/clock/Example.java create mode 100644 src/oop/ch03/chess/Board.java create mode 100644 src/oop/ch03/chess/Chess.java create mode 100644 src/oop/ch03/chess/Color.java create mode 100644 src/oop/ch03/chess/Knight.java create mode 100644 src/oop/ch03/chess/Piece.java create mode 100644 src/oop/ch03/chess/Queen.java create mode 100644 src/oop/ch03/chess/Rook.java create mode 100644 src/oop/ch03/chess/package-info.java create mode 100644 src/oop/ch03/vehicles/AmphibienBsp.java create mode 100644 src/oop/ch03/vehicles/Amphibienfahrzeug.java create mode 100644 src/oop/ch03/vehicles/AmphibienfahrzeugImpl.java create mode 100644 src/oop/ch03/vehicles/AmphibienfahrzeugImpl2.java create mode 100644 src/oop/ch03/vehicles/Auto.java create mode 100644 src/oop/ch03/vehicles/AutoImpl.java create mode 100644 src/oop/ch03/vehicles/Fahrzeug.java create mode 100644 src/oop/ch03/vehicles/FahrzeugImpl.java create mode 100644 src/oop/ch03/vehicles/Schiff.java create mode 100644 src/oop/ch03/vehicles/SchiffImpl.java create mode 100644 src/oop/ch04/equality/Example.java create mode 100644 src/oop/ch04/equality/card1/Card.java create mode 100644 src/oop/ch04/equality/card1/Color.java create mode 100644 src/oop/ch04/equality/card1/ColoredCard.java create mode 100644 src/oop/ch04/equality/card1/Example.java create mode 100644 src/oop/ch04/equality/card2/Card.java create mode 100644 src/oop/ch04/equality/card2/Color.java create mode 100644 src/oop/ch04/equality/card2/ColoredCard.java create mode 100644 src/oop/ch04/equality/card2/Example.java create mode 100644 src/oop/ch04/equality/card3/Card.java create mode 100644 src/oop/ch04/equality/card3/Color.java create mode 100644 src/oop/ch04/equality/card3/ColoredCard.java create mode 100644 src/oop/ch04/equality/card3/Example.java create mode 100644 src/oop/ch04/equality/card4/Card.java create mode 100644 src/oop/ch04/equality/card4/Color.java create mode 100644 src/oop/ch04/equality/card4/ColoredCard.java create mode 100644 src/oop/ch04/equality/card4/Example.java create mode 100644 src/oop/ch04/equality/rational1/Example.java create mode 100644 src/oop/ch04/equality/rational1/Rational.java create mode 100644 src/oop/ch04/equality/rational2/Example.java create mode 100644 src/oop/ch04/equality/rational2/Rational.java create mode 100644 src/oop/ch05/generic/example/AutoContainer.java create mode 100644 src/oop/ch05/generic/example/Example.java create mode 100644 src/oop/ch05/generic/example/GenericContainer.java create mode 100644 src/oop/ch05/generic/mensa/AccountCard.java create mode 100644 src/oop/ch05/generic/mensa/CashCard.java create mode 100644 src/oop/ch05/generic/mensa/CashPoint.java create mode 100644 src/oop/ch05/generic/mensa/Color.java create mode 100644 src/oop/ch05/generic/mensa/CountCard.java create mode 100644 src/oop/ch05/generic/mensa/MensaCard.java create mode 100644 src/oop/ch05/generic/mensa/MensaExample.java create mode 100644 src/oop/ch05/generic/mensa/RejectedException.java create mode 100644 src/oop/ch05/generic/mensa/VendingMachine.java create mode 100644 src/oop/ch05/generic/secured/AuthorizationException.java create mode 100644 src/oop/ch05/generic/secured/SecuredContent.java create mode 100644 src/oop/ch05/generic/secured/SecurityClient.java create mode 100644 src/oop/ch05/mensa/AccountCard.java create mode 100644 src/oop/ch05/mensa/CashCard.java create mode 100644 src/oop/ch05/mensa/CashPoint.java create mode 100644 src/oop/ch05/mensa/Color.java create mode 100644 src/oop/ch05/mensa/CountCard.java create mode 100644 src/oop/ch05/mensa/MensaCard.java create mode 100644 src/oop/ch05/mensa/MensaExample.java create mode 100644 src/oop/ch05/mensa/RejectedException.java create mode 100644 src/oop/ch05/mensa/VendingMachine.java create mode 100644 src/oop/ch05/secured/AuthorizationException.java create mode 100644 src/oop/ch05/secured/SecuredContent.java create mode 100644 src/oop/ch05/secured/SecurityClient.java create mode 100644 src/oop/ch06/calc/AdHocCalculator.java create mode 100644 src/oop/ch06/calc/BinaryOp.java create mode 100644 src/oop/ch06/calc/CalculatorError.java create mode 100644 src/oop/ch06/calc/Example.java create mode 100644 src/oop/ch06/calc/Op.java create mode 100644 src/oop/ch06/calc/Ops.java create mode 100644 src/oop/ch06/calc/UnaryOp.java create mode 100644 src/oop/ch06/observer/Observer.java create mode 100644 src/oop/ch06/observer/ObserverSupport.java create mode 100644 src/oop/ch07/auto/generics/A.java create mode 100644 src/oop/ch07/auto/generics/Automaton.java create mode 100644 src/oop/ch07/auto/generics/B.java create mode 100644 src/oop/ch07/auto/generics/C.java create mode 100644 src/oop/ch07/auto/generics/D.java create mode 100644 src/oop/ch07/auto/generics/Demo.java create mode 100644 src/oop/ch07/auto/generics/E.java create mode 100644 src/oop/ch07/auto/generics/F.java create mode 100644 src/oop/ch07/auto/generics/Lower.java create mode 100644 src/oop/ch07/auto/generics/State.java create mode 100644 src/oop/ch07/auto/generics/StateMachine.java create mode 100644 src/oop/ch07/auto/generics/Upper.java create mode 100644 src/oop/ch07/auto/simple/A.java create mode 100644 src/oop/ch07/auto/simple/Automaton.java create mode 100644 src/oop/ch07/auto/simple/B.java create mode 100644 src/oop/ch07/auto/simple/C.java create mode 100644 src/oop/ch07/auto/simple/D.java create mode 100644 src/oop/ch07/auto/simple/Demo.java create mode 100644 src/oop/ch07/auto/simple/E.java create mode 100644 src/oop/ch07/auto/simple/F.java create mode 100644 src/oop/ch07/auto/simple/Lower.java create mode 100644 src/oop/ch07/auto/simple/State.java create mode 100644 src/oop/ch07/auto/simple/StateMachine.java create mode 100644 src/oop/ch07/auto/simple/Upper.java create mode 100644 src/oop/ch07/calc/AfterDot.java create mode 100644 src/oop/ch07/calc/Automaton.java create mode 100644 src/oop/ch07/calc/BeforeDot.java create mode 100644 src/oop/ch07/calc/BinOp.java create mode 100644 src/oop/ch07/calc/Calculator.java create mode 100644 src/oop/ch07/calc/Error.java create mode 100644 src/oop/ch07/calc/Example.java create mode 100644 src/oop/ch07/calc/HasFirst.java create mode 100644 src/oop/ch07/calc/HasSecond.java create mode 100644 src/oop/ch07/calc/Lower.java create mode 100644 src/oop/ch07/calc/NoOp.java create mode 100644 src/oop/ch07/calc/State.java create mode 100644 src/oop/ch07/calc/StateMachine.java create mode 100644 src/oop/ch07/calc/Unchanged.java create mode 100644 src/oop/ch07/calc/Upper.java create mode 100644 src/oop/ch07/calc/Working.java create mode 100644 src/oop/ch07/clock0/Clock.java create mode 100644 src/oop/ch07/clock0/Example.java create mode 100644 src/oop/ch07/clock0/State.java create mode 100644 src/oop/ch07/clock1/Clock.java create mode 100644 src/oop/ch07/clock1/Example.java create mode 100644 src/oop/ch07/clock1/Normal.java create mode 100644 src/oop/ch07/clock1/Setting.java create mode 100644 src/oop/ch07/clock1/State.java create mode 100644 src/oop/ch07/clock2/Clock.java create mode 100644 src/oop/ch07/clock2/Example.java create mode 100644 src/oop/ch07/clock2/Normal.java create mode 100644 src/oop/ch07/clock2/Setting.java create mode 100644 src/oop/ch07/clock2/State.java create mode 100644 src/oop/ch07/clock3/Clock.java create mode 100644 src/oop/ch07/clock3/Example.java create mode 100644 src/oop/ch07/expr1/BinExpr.java create mode 100644 src/oop/ch07/expr1/Const.java create mode 100644 src/oop/ch07/expr1/Example.java create mode 100644 src/oop/ch07/expr1/Expr.java create mode 100644 src/oop/ch07/expr1/Minus.java create mode 100644 src/oop/ch07/expr1/Mult.java create mode 100644 src/oop/ch07/expr1/Neg.java create mode 100644 src/oop/ch07/expr1/Plus.java create mode 100644 src/oop/ch07/expr2/BinExpr.java create mode 100644 src/oop/ch07/expr2/Const.java create mode 100644 src/oop/ch07/expr2/EvalVisitor.java create mode 100644 src/oop/ch07/expr2/Example.java create mode 100644 src/oop/ch07/expr2/Expr.java create mode 100644 src/oop/ch07/expr2/LukasiewiczVisitor.java create mode 100644 src/oop/ch07/expr2/Minus.java create mode 100644 src/oop/ch07/expr2/Mult.java create mode 100644 src/oop/ch07/expr2/Neg.java create mode 100644 src/oop/ch07/expr2/Plus.java create mode 100644 src/oop/ch07/expr2/Visitor.java create mode 100644 src/oop/ch07/trace/ConsoleTrace.java create mode 100644 src/oop/ch07/trace/FileTrace.java create mode 100644 src/oop/ch07/trace/Trace.java create mode 100644 src/oop/ch07/tree/Example.java create mode 100644 src/oop/ch07/tree/Example2.java create mode 100644 src/oop/ch07/tree/IterablesIterator.java create mode 100644 src/oop/ch07/tree/Tree.java create mode 100644 src/oop/ch08/gui/calc/CalcApp.java create mode 100644 src/oop/ch08/gui/calc/CalcGUI.java create mode 100644 src/oop/ch08/gui/mvc/model/CounterModel.java create mode 100644 src/oop/ch08/gui/mvc/v1/CounterApp.java create mode 100644 src/oop/ch08/gui/mvc/v1/CounterController.java create mode 100644 src/oop/ch08/gui/mvc/v1/CounterModel.java create mode 100644 src/oop/ch08/gui/mvc/v1/CounterView.java create mode 100644 src/oop/ch08/gui/mvc/v2/CounterApp.java create mode 100644 src/oop/ch08/gui/mvc/v2/CounterController.java create mode 100644 src/oop/ch08/gui/mvc/v2/CounterModel.java create mode 100644 src/oop/ch08/gui/mvc/v2/CounterView.java create mode 100644 src/oop/ch08/gui/mvc/v3/CounterApp.java create mode 100644 src/oop/ch08/gui/mvc/v3/CounterController.java create mode 100644 src/oop/ch08/gui/mvc/v3/CounterView.java create mode 100644 src/oop/ch08/gui/mvc/v4/CounterApp.java create mode 100644 src/oop/ch08/gui/mvc/v4/CounterController.java create mode 100644 src/oop/ch08/gui/mvc/v4/CounterGUI.java create mode 100644 src/oop/ch08/gui/mvc/v5/CounterApp.java create mode 100644 src/oop/ch08/gui/mvc/v5/CounterGUI.java create mode 100644 src/oop/ch08/gui/mvc/v6/CounterApp.java create mode 100644 src/oop/ch08/gui/mvc/v6/CounterGUI.java create mode 100644 src/oop/ch08/gui/simple/HelloWorld.java create mode 100644 src/oop/ch09/testing/Example.java create mode 100644 src/uebung03/polynomial/POLNYOMIAL.java create mode 100644 src/uebung04/ByeGame.java create mode 100644 src/uebung04/Game.java create mode 100644 src/uebung04/OrdinaryGame.java create mode 100644 src/uebung04/SeededGame.java create mode 100644 test/oop/ch03/chess/ChessTest.java create mode 100644 test/oop/ch08/gui/mvc/TestModel.java create mode 100644 test/oop/ch09/calc/test/AdHocCalculatorEdgePairTest.java create mode 100644 test/oop/ch09/calc/test/AdHocCalculatorEdgeTest.java create mode 100644 test/oop/ch09/calc/test/CalculatorEdgePairTest.java create mode 100644 test/oop/ch09/testing/ExceptionTest.java create mode 100644 test/uebung/uebung04/tournament/TournamentTest.java diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "java.project.sourcePaths": ["src"], + "java.project.outputPath": "bin", + "java.project.referencedLibraries": [ + "lib/**/*.jar" + ] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +## Getting Started + +Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. + +## Folder Structure + +The workspace contains two folders by default, where: + +- `src`: the folder to maintain sources +- `lib`: the folder to maintain dependencies + +Meanwhile, the compiled output files will be generated in the `bin` folder by default. + +> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there. + +## Dependency Management + +The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies). diff --git a/bin/oop/ch01/chess1/Board.class b/bin/oop/ch01/chess1/Board.class new file mode 100644 index 0000000000000000000000000000000000000000..a33a5baa472b0401bdcc1852b2a73e951940ab62 GIT binary patch literal 3095 zcmaJ@YjYFV8Geo|du6f0w!jdu3nGAH$ri$ZO@fS5P(pBP8;S`Oa%tDA#a_JLRaYyp zTiRSo(o5RhdP&Hqd}!(qnare})FjSKl26G@|3JU=mt>eY&pErcY^=ndb9VQf_q>2H+Il(GU~p^t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CB2RFR;4GwOl(CP&u!Qn5wlFr=4gP-TPbdV#vg#PjVFR@*2^)KP@GL8XC;v;nQE#cwI(s~o5^&VOU zQuKQ((zL%9?bweFUMgu`A{{)r4JYZ7^ePitUh`@MMGVugz5GAPw-`n!)rwg99`L1i-0hg?ZcqGU<$qGs)9W_ZpB z??#^2^)N5nQGQ=wkXN}gMVVOwA;Ufv`W=Oxrgh%940}Hc@}6bbd1`rGzn}>f_gi&lbMy&hpp%I1C8k3-%(NUp ziN9c;BzI-5x!k|Woq7__M^JQ<%^PG*aQ6^pB!?1!r_sE^`fVZrVfZUlF5w`F5)K8) z3el~vMLSqwCDm6~C0p0&qE7z0ir7ESr)&@@3Dw7#U&e0$$!bj1r|c}iBg*x#E2JXV toA8{HdLA$E*~7l`JIelE&3{z$pVa)SnqOD*oA@hbWpDZ$-ohR1`WBe_pOF9n literal 0 HcmV?d00001 diff --git a/bin/oop/ch01/chess1/Chess.class b/bin/oop/ch01/chess1/Chess.class new file mode 100644 index 0000000000000000000000000000000000000000..bacd16452b07c05392304b4110b5010ea1982b47 GIT binary patch literal 1233 zcmZuw>r&G|6#llPNn4{-OF_U3Dr!rFP{A7k6sl;YAP!C)#$RdKX&2h0rm2pPWq-ho z%=iF4iVxvk>gzO#S+{rU}H1)CaT3|ZH0o3+MlfhOMR6wIPrG$;(| zJ^Pz&Hf^VFeyHy8n$Msv3P4Zc!L*!u(lZL7i zu%PsjaU-otn}v7}Q^o;i!{zA#7U;A@(G# zAigq-<&Y_gcul7Ss(6Dn%3~BC@fPo>EC$J0qTK-bnZ|qCDdcSo>$HoLWtrZ^u<;-A C%MuR& literal 0 HcmV?d00001 diff --git a/bin/oop/ch01/chess1/Color.class b/bin/oop/ch01/chess1/Color.class new file mode 100644 index 0000000000000000000000000000000000000000..2a3427662f457060d80151741b6d21c269eababb GIT binary patch literal 963 zcmZ`%-*3`T6#gy+3SHe01vWOFKQ^Uh!g$aZ$g+iCvdFf?Iuhd3rB>)H?NZ7N|CO?b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Z3JY)k zA4pDnNY1T8a(@Go7?Erzk{v`6`xGRN9ukdh7?{Fz1Ffj?q?VgKOk_Yh$=~gazk|9lFh9I|b1=R^|kd;;vwfzBJ zy^B!f>LLP>b8F7LD%o2VZfjNI1MsyBiwWN3pJCJzqo+3-9r!$>yp1bHkFq4hO;nIR z#tdIQ{Ox*z*8t(k=N=0W?7=F#(ba750{>iNxmsg~>l)*g?HNgrWpk8g`vsoRVeG{S zQml|sc907=29w0j^P8)Tlej_2Eq0Y3QThwc?=qoMc3y9}x0>jCm9o3Q?s1dd!$&Jg ze2t?9+8V^y-QH4WS-xJ?TY~LsU>UnB?M2BS&?0@6pFkDjKAN~a`d22_)4NsmM< znLHvnlBi`e)ET&gP?vuJEuDTD1>8heWuu*44mihboM$#B(8CivfS23|6Q0-A2v1ca z?4gzy;Q;q|5lTDSgh0Fc4|Xcms3IZxQmzE>R;7&hJ-{0mKY{=L^kcmB(ciQx literal 0 HcmV?d00001 diff --git a/bin/oop/ch01/chess1/package-info.class b/bin/oop/ch01/chess1/package-info.class new file mode 100644 index 0000000000000000000000000000000000000000..a776fccd2465d51d9d58b501a2328a90cdf28af4 GIT binary patch literal 121 zcmX^0Z`VEs1_nn4c6J6PMh2Pu`~v;t31As9%tnoSm4Ss+*aYme0<>!pIXw<4%E%yytV0i^Sd4*zk%1X#2?#JUumVXY G1~vdrJAeOo>vsVA z@l^yNfhNZ(W{lD89ekLjQfKCXqr3SC!U7E!^ox3?pxYyvBf}R=!xN|}TBc!^xUF9; zmOZPG+3&jgWWQDNvI4b3)`+cpW!DtgwwO*&|APk}l_s;j++5RR*_PKUP}Q0|DG<&% zc{7G8)M=peyly$IuHWb=Q*L zfiUciS`2070*@2~^ruSC=LOcZE>Q4YPM)mA8ni^vyaVv9S8S-4q9?ANC zY|*e4t#sOTE(wS}>03%eo01t$Ax41G8nz)L5K%PlC!x))eSOJ?#22H54h@~yArSQ( z|1^Q+t;vNx#FP7)x2x*<6azh~>HYO5n>2&&$BThz-O3a^?FpYn2Yte8y^ z)gSr-d3FiTV>AL160el;?5YL}7g+SRIYGGZPqKh_xxb)c95$UF)k}j)mCZut1KXD| zCc}GKg9|2G%+T$eUi5p>!;AP#oE@esjxf3eLd6dG=#+7B78`QPu3;XsWDkj{eAy;F zXR;h{9IxcLdU3$?MxA^qhS%^$1g{Hhs?cEB7o9OP7L7!(nFA+Yw*s=P{k+>l_6RIxV+4&DuXM>q>1$~ok%Ldg=& z4p2+#G^B1qOWnrO(>KxZD;j@R+ROM{s_aCWC$*^OzU7o@{vI@81;4;#m?4K%h*WA`a}dKKj9 zTX-r^N57XM&hyuy0UOcCmLF$}Z{*Hp*hinFR|)^*Ij?$=MGyU2$Nznth0sf_T7=^F zus*_y0Un(P$O(B_TZebXM>Aw(d zNK7G;p2mspFx8sEw{TkNT?vVnhUoV*|42*c=2^TVM6+D@sS;*4LzFN^31kCSGlVr* zk7kD7f;2DF9$tlg{65AY&v0d!I%5PvhP~7GI|w_@(|I2G3+^QT*GPoT`st{6ihzHCu*A;{y zWqt@N$+sVZbbJ{?Gfcwj2!xQCeIASuaOT*QWJ{kX0-pz_aK3%k<9-stG}}%}=7rQV zFQm5gHMF;p)8e;iqBdvDQcu!)cna}3Nm)te!o9;IRNP-zm`%|qkbx#5x{jE3V>{Eb z13CV_I6?06l-XRr#Fa`CPXtgjklJ^btH!pfODvxVf|JS06+X08kca8LtY+;zTeQjFJ^}lke9HzA^`V-OgoadU%BBMBQC|BEAsTpHg-NCL l3SQ+qK_=d!?%V2lMLpkB&kxk|BYZ+F*^oZP=lBw<{|7z$f6)K{ literal 0 HcmV?d00001 diff --git a/bin/oop/ch01/chess2/Chess.class b/bin/oop/ch01/chess2/Chess.class new file mode 100644 index 0000000000000000000000000000000000000000..60d893385a557d621b2ec3de51a6004ce9ae2e58 GIT binary patch literal 1233 zcmZuw>r&G|6#llPNn4{-OF_U3Dr!rFaPvmE2vxLF5C^9Y^a{#-`PL^e*FfpiY*N>hOFzh%xZmlh9=%_&zc3fXiyl^ z`}Q~6Y}iiC{7~8FRi8m!6prwh8TxYhGJ{fZ_jn3@Na~0~W#}&nhi`S774ChqD-F(Y zqvTfYM%ng+JfDDyUl(nLp;BaUiySv?;V=y5zLZW$?D(E=YF56i;d%t|HP`m`Qb;4I zVIbmuTktARVh}eq3^5E`jJ+Y8JsrasVTgb2a4zFtA}EclByQo3hT9QA3U0&oblk-l zd8st)>Oo|h(#lF9gZr{@4;YHM=unr?Ab@oV4wAQu#e7+kd#K}4z~Fmb_(9G&9eJ6V zdf?U3Htu>8U`x2g6%DZuR}5ud@FhFOM8pw9Vg z9rJj~ptabZ^=c*&6P-B4VTC6_;AeImIGXi2||7rgaaLV8=) zu_Bu=6-4f}!>W!o3CF3yr5uXw)u{P05v?UPlU)?0Sy*9)SZgNgI_NIy+*pgs5^K%L zX`Z<3xE-&`*My7 C{1O}h literal 0 HcmV?d00001 diff --git a/bin/oop/ch01/chess2/Color.class b/bin/oop/ch01/chess2/Color.class new file mode 100644 index 0000000000000000000000000000000000000000..a503af667d9d0cb86b9f6ecd4c694962b2f6597f GIT binary patch literal 963 zcmZ`%-*3`T6#gy+3SHe01vWN+Z%WIA%|u@y%NBykBHI${NQh6DTA{PFOIv36uXKCZ zqH*!rKgxJ+htdb>!@c+X_`dU9B&}MZM)Yo-ZTG zuz14Hc-`Udpx$=JBZgGp;pQiXQs=**24#F6+M&g;&^|mqSnuw2j@t&q^82}fOw)91 z*A90Wq>9#MNVdEWRt6~r3`;6}%aD<=#<|LOKIk7)2E_ z(&DwOB7-bZb!^u<9FO{z|Bm+^l9=y!CU?5rw}l-!6-Zbj3E|KVsOlMa#uh!w6>VMv z3LfIIj7JQ)n6OC@S|b%tu+EU>zRxG7cRFFvgQv%71Kx*`su_lC)$a}ayg}d8S|C*-xwL`0Hd z{!~BL>$dLn>P;scFr>bOrs*&gTGKEpL;AC0_4)zBT=VewV70x|I&NwV#gDT9nTBCo zjumV%2$gD^A-U_Gm>HxbFf7Q(;V!W@#wCS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m+p;qHjkubnT15oC>Bi? z&mR=ps}fWzWDUy-dp}*3{CfF8jKxyNJ0-{;yFQDBO3ZO#1&0MDElHkd$GU4ePZ|MBOHtW4bMKn@t(hMetQU93v(nx!H5EPVxX=CEdy;Pco!w%n;-@E~7fd4YJZmqW0a# zYj+TeTvTAFq(+2gOk9rGCFy*>kBs zu)=;ppVCDhp!Bh9j`~F*8W3^RFMe*X{VN&}Gq>0N>E9q>*gd&}ESnQN+b{Bj4xtCb zNU}o4*+I@@1SW}H;x|_bqqt7VO?H(ZQThwc?=YcKc3y9}yPoK~<+3}^?s0?N!$&I# ze1)Sr+8V%D-QH4SS-w%xTY}B1Zw&{_?M2BS&>(%4pFm~e-lr|;N@Ef;1FFikq(>r_ zOdgjUNz^hKYz^E-Xpesx4Xu6|1>8heWTTl~4mitfoMSeo(asaxhnL+5`2*=71 zwo}WCu#bDZ2&EluL!epx2M3g@SCNo>DVGCyyIjVH@8iu2AH#od?h)Sp@bBUA_1Aq+gJjoSm4Ss+*aYme0<>!pIXw<4%E%yytV0i^Sd4*zk%1X#2?#JUumVXY G1~vdsKOSQM literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/cards/Card.class b/bin/oop/ch02/cards/Card.class new file mode 100644 index 0000000000000000000000000000000000000000..2114ebbe6290857806da9a14450383922128612d GIT binary patch literal 1574 zcmZuyZBNrs7(I8J>)rqzA_9U_LAIex#dq*^f|3B5U@*onUP=R%(k|^Ck+1#=e}o@= z4GAXt(ZnC6p4(O!uqJEo%X7{>&v~A9zyIv~0Pp~h4I~7*J+DzS*DhVDnbKbgYIWWX zqy&z>k(;vSNO!gNboq^CDuI+MH!OkT+}_rr@@;o@Qou01rmHMpK+FoH-R8!!o@Ay> z$98RXS0GugERmz`tyozIbQWMBBhWQxyVgP&{#-6QA-`uzXG!|Dp2v&nshFmxeE9gv zQVvNRFW?yR22KbJ?I~PnI?glC*4n1unpQ*Eo}0l*fr8GaWCtae5jpgrU*n5f+o=MM zAgxD31!T3#lv=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!?@GsE?k)9SwK!K0|U> z$gBep`t{Rr{?^~=-t7>On%c62H%Hm;cRQuCn(Ffm z1a2L6#E|R#Ob+Q@52DO1t8PkB8jIu81ezoymK82Z%d%u4fo+D7fY|JvEKA@kGG~2q ze3K+ov2Ed&E$(^3Q}HdsPnRM`=1iI;K7&POD0mPG3gf z*uoJKe+I`%TK!{kVw6^`x7TovtP#A1G4fC_TcUe0^8NZZQqA$@n@99h{0o_@Px0n4 zy@)5c9Dj!CW;A`Z-c-^{^=2%s*K3O>&yZS=URVCW{8C2ogBLSO@d(%I6iuFD0Ps!# z@RPza%HqlI&;Rw$f`gUdAT-}SM(NaiirdHdAh7&OqVOvzQvRT9N0Go3c?z^!A>S>k zrb4xB(_YZzNsQx1r11+Tf~r@-%239AiXX+#cz`vkyMPuxBwvJ3zQ#ksh~fr$Kf=c} zqE)&(iO6$;kEy7sNCoRUu{lc@H|RKmO?*P%EIsgu06*_rzX`X#}G5@z@Y90o4@ E52ysLj{pDw literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/cards0/Card.class b/bin/oop/ch02/cards0/Card.class new file mode 100644 index 0000000000000000000000000000000000000000..f53355471d6f3df5911a606e1dbd26b944479e35 GIT binary patch literal 1576 zcmZuyYfsZq7=F$+)~(yP%y9>u3bGBQh&Ob2V}gEQ zr(33Nibo95La|016{l__!O)q8f&@d?vS}Nue)t;SuzY?;=T?oord$V`@wtGew{ZUW zVogO9xior^Qqae6@kHTj)3RPUrqs6ZPB$9DbnFBM7}7GEyy@j_icryuA&JjQZ6j%P zATDPY(@08{F|lQO41LRCeo^|Fs^I$03UByw6ZlzlTLU8lt79Y=V=<&70XY&msL#Vj5u zxX&4$bDL3E4o1-I*#;f+x-cAAayd7IjHP65~U z8%9X@o3{8?ub12X3@9qxvZ|&q%3X2XOMp5$xx$6J>Q3cZ0#B$1qz8GHFW63=6{*3N zY};@v7WX{EQ&3?TKbL-3LJAg6b?~Vag52p9Yh{niRJ}oP>4^mMO_AMi!pMj`&!aD8uxz z)>#rKF`ZH?{YH;)6F4h6-*#?iAUcZMgp1$~?n*q(=7{N`e}7E>2(oh+=J5=R82ktJ CG&{in literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/chess1/Board.class b/bin/oop/ch02/chess1/Board.class new file mode 100644 index 0000000000000000000000000000000000000000..39f3acd8eb9e10cd09f2b8594d975c2f990dc4c2 GIT binary patch literal 3041 zcmaJ@TT>iG7(Kl#%(58**@Q#_hK)%GENoT?L6apYSrc6aj3Fi_UWeHcCJZy{?rZ`Y z@9}=WU!L-y@?cq|mXb17sZUzvAMnLrVx`2>Jp&7ZLUs2{_t)R|opZkK+28-Z`V)X* ze5fHJ(Cm4|j5&2(w~eU9 zif=oa;Zn(%8?noNR-k^|o^%brQnCd0t!Fbh^6!AhrOWIPH`fi?uI&#A)O2>85{Tx! zf)z&%8g$enuAxz2^EzSU*ocOD2qbjWqE4W3#CEN*%FKjSI%!NeOeHbmnTB)9DB1Eo zoQ(QYHlb`=laZo;`P3MNg2499H3mV-U8myMjy4Ug>(Ho7bX<=e0mQvpt)g#xZVWdFY`9SJ+{xsG)GCg4?3N7eVH%wQ z=SsA3zht|U*&xlmIy%usj+x5|?}FkuFZ1u#(X+IW^PD(&+@~Xh8wE6__AqsC?ab%b zCLYiro%HG0kA5Qcy&$T<79y>p33ExX@&@Xt-;s%vXESF)Ah2R8kJ>;BJ9k$z*pro&MjJprZFk&QD01DB~JcWZaWF z?v?Iqm3yh_X&v|B3OTGcTFmv@D0&657r zMHkkA++Wo37#KpEGRkAhly{7*58is_w1ivHaURS!ZW?aRCUi&ynX`C~c%EPOOGa_j@~6B)IgV%XyoTolc2{Mw z-SghGl?l#Fa6*n5CMlYe#9tElc;x{JtpkU57;eF_%DZ{VOjnB8wOX&3S+()xT+v#` z{Qed8OUG)(ROljSILSV&IHB}ELckSCFh;WbKj zF)5$kAS*0>vd*Sxmv(RQ3qXMT)0vw<^5XeBr{rLI6v{fLccuAu3AZ2Cr7Z)U$y z`H8Vk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uRMHTA*c8}=q9V5NlMW%~UQ_+tww%Id`o2j_8Y=xG`U5uNW zMur8YXBjn9n)F#vyO=N!F&(OBhghJ~60KLK2qz$Ms)!SUVZve3Zi&!sll?Q{wh1pM z#Deh3Dwac}DBv}n;;7&a)~SwRe8gM4qqdktXOVV&6lW6eX{S)M5p2*-CC?JQi(&IW DAm0)m literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/chess1/Color.class b/bin/oop/ch02/chess1/Color.class new file mode 100644 index 0000000000000000000000000000000000000000..f0f8308c30eed687c6f3e23d96bcd4f0bd9b8c49 GIT binary patch literal 963 zcmZ`%-*3`T6#gy+3SHe01vWOFKQ^Uhf|%$FWZ6P6S!7#c9SQO2QY&D@^qgP6zg+{^M@2@AA?JB#RdewC1s&FCRI4^U$Ma>x z8J17^Ij=h0?N?jwc*v0GIo$ljP-y=bRHuy313R!7mRd(Ahg+Tf_DRcNSbe_`kZPEY z?b^XEgH+Nw4DqJ-!Ac>afMG>N2DcfKjaf>*)ShcH0^fG~^#iSwrrbL!5=f>X3nQ;W zMpC?1Riuz6sbKmC^(>t3m=u!E{y;I8!>IadI{<^3o201K${E?v? zh0VIw7W`4sLP^CoG=`T^T+`vBQ9V-ZAJJU6m@*AfF}$&FTCZ*Ko0M=LDk6!RG3>s} zgRxHmEy5*$jRlH!>w7gCghV?h?X8I+0d&)RfJ{+Lhaz#h6)aJnO4eJl#aHS7LXjI8H*B;& ip+|6RJqA3}x(u_p?7va>f+^ literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/chess1/Kind.class b/bin/oop/ch02/chess1/Kind.class new file mode 100644 index 0000000000000000000000000000000000000000..e070e20d921f77f8d40445f3eddfbeab59446fd6 GIT binary patch literal 957 zcmZ`%-*3`T6#gy+3SHe0HxM?RZd0L~ASU_(S+*>gEMr?@9SQNNbQL;FJNsh^|CO?b zEgBb}{iBTMb~qXXeYp4h`o8m>p8NaH_ZtAasECL$EIQ74RqwxgO^4xmwd#RspNfbx z%%5o&TGi6*UbSfl1BS$xz%XovTx%Mp&XD|Uo4vlzFxNafIoxRPwoaNVL;m9|K&qiz zrfvG$3__{gW{B@Or$!112@DG|GPqByjd4k?)S5_Aeb=;m_5E@?O|=hXB#=x&(*Y_g>{R`1V3}V>*_|t!| z@zCYz|C0|;lJN{>hBwh}dzR*T^+>Nfo{4V0Vp^f3I)SSj?@a!a()=w{cn#UA*|Rl2 za48<;=D5amJ=^u28ZAMf*Cy-~_<{hsX*WQo$TvfoINcKFs7@yDJ^B2r`~d4@?+I6! zzeF~47UQ9_l=w+0VT7#OiI1?PULyaE5HS?!l<4N1Me14%qdY^;Xv|-uIM*X8n=4mX zo&b|nKr%y+9NHpQxKI-L2#?3`w=@KY=SIkP4g}?<)8J|jh2?9kZhfW9t&CeXb|)cC fOL;!#P^gCYlCn&>#*1HIvvDyfA?GHx!u#c4hC;(d literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/chess1/Piece.class b/bin/oop/ch02/chess1/Piece.class new file mode 100644 index 0000000000000000000000000000000000000000..0baffdc281b37e68e565454a1643352adc2e1d41 GIT binary patch literal 4232 zcmb7HTXz%J75Wd)Vxh}IMy@0*y; zPG%0BnH(M&JJ3hZeS(({!P_UE6#}OzAKqKEiq4QiHre3c1=z6ap=wz6pk%WHQw%v{ z=glZu(4ixSI8h}BrZlW4uo^$vQpub%O2g&3>Vj!G2QKE!MW<+6?PR)3$0K-@5ic0? zX2!O1hBIAs3LI4&!*VL5Gf7utHER=2xoFL$qv%ABINiuJB^&n#rdpwp&=EpdMvv>z z5Rp-zj#flv^n{Kz&}Ed=u@-t1DQwlSrAgx5pml7+cE)JrN$MkwG`iK17GB!Mik5k_ zx-e^&Cym*Xsn9-V=Zw;nQ7+2dUko~hB13FUw`WOV?Sy0G=8qVQu7ZZA6*`(#mxeDj z0qrJGL7OujuMjpQ2O84p7iWY*zI;~`DX$h3M9k$vp_$lnnT9ELTq>3IAhqWiCzM>l zC?7W$-Hl9?%s;DR9S*RPk^`r+QS8EVIu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s^FCjS1$s3#my~)gnc>M+gkD&|QcoRK%0t0+|oyj|% zVHc(}7;)c)&>;?`%&v)@2cjR;Z KeP;MNy8Z{+Bt-21 literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/chess1/package-info.class b/bin/oop/ch02/chess1/package-info.class new file mode 100644 index 0000000000000000000000000000000000000000..3458711446cebad184815937d22f03d8c67a11e0 GIT binary patch literal 121 zcmX^0Z`VEs1_nn4c6J6PMh2Pu`~v;t31As9%tnoSm4Ss+*aYme0<>!pIXw<4%E%yytV0i^Sd4*zk%1X#2?#JUumVXY G1~vdsMjm4T literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/chess2/Board.class b/bin/oop/ch02/chess2/Board.class new file mode 100644 index 0000000000000000000000000000000000000000..bb77ee1d2878860e1719b41e2ecabdbbbb168a73 GIT binary patch literal 3046 zcmaJ@`*Raj7(F*lyJ^_cHc${+X?VA3L!d%YQ&EVZ(Y8W^AP*ngWNDXfcjIOQt>PQs z@3-QwI{nERb)bweql`1^jQ@cD3&V)#-rdqb3z@lh?|%2Y=YHQg-@TiE{=4)WfZg~` zLqwp>b<3IJ_|`slW~I`X+2a~sNkdei<)m@S$k>K6mU&|Iq*?R@>Q7jvT@qMz?AYL~ z3-?=Q(aZ`ol;xm8=s^Wg^({NI+w+X+L961^p|N0%Ifh^LOo1(n`3&3!dzVBXupG@1Zg3k6X-Z<$~}OXAG{+D3P4iT?-rnZn_V}(TTMhl8f-J zTy(6%dV$!O=_^b!-POGSE!a-OMuBzn8s%-<95d|Q-dJ_gbo{+jMYHT%t`oy%fhDIs z*BMKWN^#@ZfNn`wieYpG0w|RWzGpdO*&xhb9cgSK;f!U(J*^1O%lNnI*fuwjbL}{J zyhq1&>=4kD^t)Lo?Opl&!oUL>B*;!3_u@Wg>bt?N0?V1{d^TY$36^SB#{eE6?~}%a znRA_@;UBjAagHj!;rLW!(_&dH1e3ZysG|c9-I91v-r4S>tZ5@Gh}m$bxfiJ znhL&AoES37VS&WUBrs5}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100644 index 0000000000000000000000000000000000000000..0cc845acfb37f746e5ef323b05b6ce6d6b1d625c GIT binary patch literal 1233 zcmZuw+foxj5Iqz2lEhV_At2xlMNL>?xp^a8geV#bh=mo4@@W&Ml7VD5ZZ=wemU)0G zsqzE-6hFeUXO{}MeVFcQA`cT>DRi8my6prwh8TzuhGJ{fZ_jnS0NElF|G4z*&!?!xk3im$Ql?G?H zQF5zxqilOZo==R5Ul(nLp;Bb>JOysr!eJQ9ekq-T*zrB#)bhEqj_VP?*Ie7%OCp7Y zj)92#ZNaNNfkE8VF~l%%G53aW_6!VTghBn<;aujw1W-EV6S##tI&McKDYy;SGjJF8 zC`zSaR}Uh~lwSEH(zq`h_kf|8jZSsR8YIYHG6%)yi^W`7f_rG-QGnokUHC!GSpzv) znReiaTHQ~;#H5ZV=Sbf9(e`=Mz!WSZ*zFMCnXvuBwYI7EJ~6=UCIO$poQ_$BbimH} zYXkFm%AmL8iw1QulRZOXI7vjJWa_zr7kJ4K_uY_Oq9vO<<9$N8OqiE(7cWHXjf9N0 zY+ywWVKT_v8;4Z`YtpRJfJ-_Q+pE#=r6Wd5awexJinFl846)Ws)O9djG`X=BwI$Y? zlVYB*?6@7T%GZVb3(4SbP05~N4Af)#hd_*W^m$0?bh1b@((1$!;y;7yBuRMHTA*c8}=q9V5NlMW%~UQ_+tww%Id`o2j_8Y=xG`U5uNW zMur8YXBjn9n)F#vyO=N!F&(OBhghJ~60KLK2qz$Ms)!SUVZve3Zi&!sll?Q{wh1pM z#Deh3Dwac}DBv}n;;7&a)~SwRe8gM4qqdktXOVV&6lW6eX{S)M5p2*-CC?JQi(&IW DOaT%r literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/chess2/Color.class b/bin/oop/ch02/chess2/Color.class new file mode 100644 index 0000000000000000000000000000000000000000..3a6bfaea3c3c78ea7aff081368decf9c0cea10ba GIT binary patch literal 963 zcmZ`%-*3`T6#gy+3SHe01vWN+Z%WGqw?tnc%NBykBHI${NQh6DTA{PFOIv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 0000000000000000000000000000000000000000..c518697fa3eb6763763c307baae5e33201bc0360 GIT binary patch literal 1487 zcmaJ=T~8B16g{&oU0PZS<(rmL6{J+9fZr4~*hpvs`T)TgpN3`9F5T`n-6@fOqTvaj zeKC=cV50B-DD}>6u~mxMWcJR?{W#~`J3oG&e*>_FXF4>75yz?LjmqM3-mn~_nlGw# zNk@=j;D8_Uyv6Nu{?*=rFeF2;;xro!ti%winRZhOGFDC7lusFYvZd1eE;$vQeGx$b z(I|QmV+dsDcXh-WuD3ImEK8KRwbm#%Yr>W<-Wj4UO~+0Uw!tV87-AT!@v0~~w!!6V zQ&z}wCAX!^Fse#zwzF-^hG~}z5%gn36&)pF*~|CyyJ0YlN6~|jvL>U@5n_mMnzne^ ztnG=$4&SqgRASRHxV6h0rrNg-gR){$@v+UWniUvg+majAEnaU0=w%@{JjF-?(oA(RFM1p)-5PisCmyFN4m1X z>svxroP9Tf1uW{wGt9JgGwnmCD)PR3zS8U5kWS-B!CGQ?->G8D+fTT`?R`tQGbBc} zSub1`yW`}qz@4MI=;Hpi!`~mbLT86tDT>^(woNGt@euCx;vNw#*@xUR_cPM0i40p| zy?DUTe{re?HbZBRIz0W!%`k>&$+ktKXmQsSt`2J9>?Lu!(be&UA^m?>dKtbpxJG>r z&|GWu(d2m+%^m%F=%yEH6eG0zfS~8MoI68b@)$$Of$@)srH&C!4XmCZ@fH1VlBshH z0B0Efo=cu$ESEaP#Ak{QAW7?_mzUlz3})G`p^0JVqV VuD9Oz)`xgZHxW8r!783&;y0LPDYyUt literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/clock/Clock2.class b/bin/oop/ch02/clock/Clock2.class new file mode 100644 index 0000000000000000000000000000000000000000..8c5051e91f8cf1fe27ccfc373d21a74c6de8effb GIT binary patch literal 1247 zcmaJ=-)|B@5dIb@M=2DfKY)VT*46^n(pG(u#-tLPl2Co1!5ClM9virF+>yJbvHywM zCw=zC#HLA2^xZ#7oxLL|T4FA@J3Biw-+bTA{rq+L9l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+TQXi=+h%}vJgapC~A%Y1)xlZ$M6GDcvS#LTnVUi-k!Q~Ds_m-twfEWV_1b$L$ zPyr*SFi7O4aMh={Kt+^9B>xGi z=pjjPaT0l#Kxk*E@7VJ7do-d%$8}*4<6WZ?K9wM@(boXElB53!jhdrhfgA$)#K?y` HxQEm)zP}H5 literal 0 HcmV?d00001 diff --git a/bin/oop/ch02/clock/Example.class b/bin/oop/ch02/clock/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..aabca4bf58725c034e19b437c378ceccd77df53c GIT binary patch literal 1014 zcma)4O>+`K5Pbs+3uKclK}ggXjf(Q2SxnSuKvSux6{?8Q!os3F4V#f{fL&@?QhN7~ zc=D`=#M06q;J@+W&5s_~GLZ7%VY_E$yI;T8-QRwF`U+qJB^3dNl;d;_bFZ*$m~F>w z84q9aPPZ*oC=B{OKj222+f8Gqu`f)IAzZR-%e&7I%w%f}%BHg`VhAFtA%rl)bj7m8 z<9??h+-JPe77Q~L$K>rAcP)AM9~E!U>M_h!{$0ID$Q^FkL@)EAa?GOYxt855W@{?q z49OG8n^M3^3_22$%_)XZrd-a}PEr(5*Pk7LPMaJNa*N{puXDAeP@-Z0FboaJyFl+G;r$_$fL zkDIM+-u0ItR;5On;*llSMDrJKNy@<@sDZSlK!8rPS!7kZ8RQxHQ0@qk_k-Utvhp`5 zVS=nS3?M&Aw4_J*BT6(Q*dwy+bU2h~%39o7dI1zkhtd+{{Ag z3xf3^y4BdC_fQbp|fyawq=dp0x13gxjfq` literal 0 HcmV?d00001 diff --git a/bin/oop/ch03/chess/Board.class b/bin/oop/ch03/chess/Board.class new file mode 100644 index 0000000000000000000000000000000000000000..8eabe046e2727feffefccbdb15ffaeef76f6e2fa GIT binary patch literal 3036 zcmaJ@`*Raj7(F*lyJ^_cHc(!zG(5yMZ3q-7NGb{uFxpmV5CnW}lcim{-Hn?Kw2E(h zzu&K4b^4Pt>OdJ`Mj2<+8UF$Q7l#qgy}PBMt!C!lz5Ctop8I|0eD`kt{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nNI)HNnlKKFI!h|npy3AE#0|8tHItE?_#3T%(=OzHP_= zz;$#Ek~P*tKY0tM_eN(hur@m9Fx->=7QHC&Q29|aF}CZ)OC27D0{7g9841$uN()RVO#4HAFBZ>E08ViCtmP-qX3- zE-t;k9?!`V?(2BazUXVwb}bbT1)?2|*r?crqN`y9Ln_7vA|3dS;~Z%i!%zq@Osa@q zQfv2n-L=X(5_n9doCbx9dX2Q56_EXiro+BcsmyR74- zT=sKNr9g^ND{zV;U4}%eCD1;m6 zCLm? zH_)(0Dkkwml5k1k8%g}2n3CX*M*^?-uLJrGtRO>*{V4G4DmylgPgtYZ!+h&_OHU!P bh)`Y+x29` z85U3Y8L!&h=~bJ~aKMo0+T8fekZaB2)ClmUZv`g9Li6zWV57a)I&SI=`498(sk&iX zjuq@MNTqU{A>MF5nkgg{Ff6Ia;5I|DK7r&)t*IhC@GPfS+b_4%guSC8fn*A@aB?bS zB*pEniWJgRs%1Im;c(D3z4yFplfrDvHMrg8o+bP+s6fIJNeKFuPhHQrJv8Z3D3#~v zSMUIjWISZZM0Ab(z#OP}j17h~_dGr_+|v<*7FB=LJu!`-wjUYjUx+4Rki+grpZ=pw zhAz+kpJITLiYF*Dyoz>f*xdJPkzO}-rn<$3X@iRH4n4zsV~L-ngm0lDKs1YP^&B1y zJxWB23u1k?pq<+8Hf=$o*Cy>2#D)N}v>YH)6sw_3oUDQc!l~rFBVT-#A7GvAE$IS_ z=g5Z6ay)ca5_$SG fw(@jRLnDmnrDU0QiD$pS=JR6E!kU}d3hnd1gO|kb literal 0 HcmV?d00001 diff --git a/bin/oop/ch03/chess/Knight.class b/bin/oop/ch03/chess/Knight.class new file mode 100644 index 0000000000000000000000000000000000000000..84f0e7d9a140c17a2b67f8d9a09593585752bc00 GIT binary patch literal 1755 zcmaJ>TXWk)6#mwi$Z^y-4YiY$q!^kM+X-9>yXtX-#?6>E9=c4`l&8xov+{SkX5(0V8>sPJL zTbz?oNh*WP31f80gp4nLwO{tJ?S1)BWo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zOxTc3G)Rb=6NvlXo`5LOB9?$=mo2~ORJl*3^Ew224D_N;plQBa?{aS4|- z44fA+eAB=cB-zwn*$v3}!b)J-ThFcPDOugNDtW6K?D`D$o>MtIhirOHHZ^SEI&MTw zg;W|g6_J#(56h)TE~5s z6J4j(o-#+~w~rp9`xE*P(A4T5LTxP`(HkcY!p=ZsS<#5HPb&`6qav1EAXO5&7J-U+ zzL;R>Jwb=Yjxln8ixQt^>Huo|h(?-@n;+0hbAsm7hyVShFSs>#7Ll8r%)YcftH{)W z^;z{0S7;8Iim4vs?sxgJsmKIVm0?qnCH7B#nW}`@Kl!Qr1=UyzubotU1go0*rE&(6TY$RLoF zSeB@tlbDyT@1K;Fnq0!jz!jWdT9lmXmYI{v$RLQULl2}_jDdlXff;BA2rx3R0!bzY FHUKp>9x?y` literal 0 HcmV?d00001 diff --git a/bin/oop/ch03/vehicles/AmphibienBsp.class b/bin/oop/ch03/vehicles/AmphibienBsp.class new file mode 100644 index 0000000000000000000000000000000000000000..f94fd8f44f36656bd8471d367caa43e778c9a1d5 GIT binary patch literal 2790 zcma)8TXz#x7~Lmra*{MiDZK@eRiQu&g`gm6g0-c!QcX)G$hBT3=_DDN%*4#3(u#st z#OsR>F8_cJKIvLoF3Zbb#xeHPqjX4*~g5Fvq$X~Wc~Yvrt7J*j0&x(uAbuSd-;SDKv6c-W#+7BSz}7~~Os;6;^RDgawKI_`u5AyxBpwmi-H2ZmEw2@;OM0!~xxHFZUJ)Ak zb;O-Su@yU%|9*ksz&H;O!7dC)>|Q5xX3=)^atwpmLy4^#74P!yZCHsJUfSW+b*-EV zV@M!6;rrB+QS8S7iG;vrSElvw7#_pp0%4 z6T_2uN+4k61&-C5dTEiWBm3W#K@YUbnNr@8F{E%rAZ$2#RdcMWigZ14(qAWf7$XwT zGNIPawz3;zS|4R#P5mMj>s(=|%iNU2c+*T-kuZu09Fur{eK_1ai(wKkP`w4MRMU@B zf?Z7{@DJ^}^wYBqV@Ss^g=q>}(48sm;<;K$o2!`xw|>Sum>M%Nyo3`1J!NfPAG6Gy z=A1U1B4@UvnGTC&cfB{Cdc3K-VVsQNWw0(~QM0FAF<7VP!Z^dq9c4|}Nu~NZ70>em zhwGUiJa7`PFicHKfezX*i*yGBX2Q@ISFfD(q(n}jx6#JiZ$nmD1u(-PYSjX7y}3!f zbF*NT7=YepeS_ZFFQj8oH-p}`Gy!?;2#aW?l2Pz7Zf6rqIWgqC9qSyUDEp}^Pm+3lk}!eg2_ z#|N*U3eMLm_1()aFHekmH=f~1hNB6*K2`lPs;^Jq_ZU+y!#+oylP&W^o5Vc*`Neb;d?*&1)Xfu{wMp>MG(9=d^N1b)L?;fp6~qp@>c^BJ!L~1{F^6NW~+4p4ntb@q`o)4PR9}uX#L# ztns`~9(A6x$&kV+p0MHx`#jmCR6J7g&~Q%i=pGLt9*m+MEsSm|)6dxu z^*co6($p=-vCKauHEhBqbl@xEzvK8Ly6`hCen$`fLNET|_%GtF`gxc64)Q3FyN!EA z7}UQTf8zq?8Lxi)i4u8R=;t;}SUgRd3>Cb=Kwn}VRk;?Vw;tHE4be{$4%b5T*2B}x z^UMom?_1?~lN_GqMOu3JMdFu;nnma?Mj$2Ll9-jqN?elkE%{nw`(2(Ve9zYU-ALo^ j8h|Hwhdu(hj4K>F`TY@Zdv)FKHSR>Y`UyV67l{7{R)yFV literal 0 HcmV?d00001 diff --git a/bin/oop/ch03/vehicles/Amphibienfahrzeug.class b/bin/oop/ch03/vehicles/Amphibienfahrzeug.class new file mode 100644 index 0000000000000000000000000000000000000000..00850b358cb0573a0c5b05f94e6e9354b62b699d GIT binary patch literal 195 zcmZvWJr2S!6odWBPoOMJh@G7vae^+a3_U>_y)>ypQiC8uwh;?=zHJ|MqvLZ;J5+ zb-t9o3|}!MtIcL@pCR#jcqnqvkk^rgL4_*S)40a4`aiB5Oysj*xUM6O41?K{zIYc6 zx+2))T~9C+Tf-jr_IV&x9v2g#E5{7A1%obhiDotj{G>sq97G;JjC_ZIH5m$2ovn6R zH;%aPzmX!?C7*>KZ+W2BE9NW+q3RND&}|S02%98afsi*TyFaZJaSJPy5gxZ;5vPhu6e(3QFII7570a#= z``uF%?5`+RYUj9jillayI3u7oCuWe8NkYb)m~|m$k^D@|q7{|c!zrGvkRDkbt3IFZ z3Yhi;kCfm!D&JB4Oue(kQq%}iRSW6U*o-xpGCHQ&rf$`jnNifQ;;lJ+<^un0s(s%=bSThyubha_ywSjy)>2>DnT%?9d~!nJ`t{TJTbKE z{edexQutl&hM&Z!_ohGaYH1`G*5|9+jw`!eRgy-EVROD>j*lV1M^Qj@%>~tTqu8D^ zq+Up0MlTtXl}4j_K(JTAk;p+qUPl%NB`TCp;~K;2|Cw?ykhIXIP&<>$nP<*219|eQ=hK# z#xeK(*HVQ0mouG-!p6Fe^b9`%^&ghECXX_i6M*)Z(XC z)LNz5P(0f@HnF96wsWZBQ5qJ5@sXc!+v9%EZt=*~@fc4SH0m&Jf%;u0#=7GUJwA*S zd{@T~wit5lU=%uHUn&jze9iX=!Olfwq)IlPm}lOHf6GRX_@Cg1YF6i95umjve`@Af5yy z9-$IKLPcW11MpCY$ie(L7B~lmipXF6y`@ z&>V)bdR0uvDt#@-krKE*Oney~$uunEDrx0GmVok0Z|HPu@Shz1SI$++UwR`(N;C!QJz~%1Hg7r1nXwci#v5gfp8L__XjttHc z>lLfd8o{$#?>jcW(wU=dopdzDoflLXekxkkoVDy<&WBp!MKvs|@G7Rn@Yf6PhO0>gyr4c#)G z@?rZyC@^Jdr|xl6s8eGS7S76;ZAMiWMn=H#!!U^X`A{~MrYI{&VDd*TI*Kd6dE5=K Une4zt*TDPjJ_hV?0#6I0FYOF24FCWD literal 0 HcmV?d00001 diff --git a/bin/oop/ch03/vehicles/FahrzeugImpl.class b/bin/oop/ch03/vehicles/FahrzeugImpl.class new file mode 100644 index 0000000000000000000000000000000000000000..b5d7bdf1ad1f6d9d57a374d4307406295cc0f1ef GIT binary patch literal 563 zcmZ`#QA@&56#lN8o6f0eR%8+Nl=|R;9*Zy%Bd~fXeCX{uFWY2pGB=C^*jrowhiS4@l!w}WR9Sy!X6 zt3qa28}cbPT<%%MZGR}tP=&%!UCm_3jrh|;+sI}?We?&@*k zkDM@QmIyD!qhs1(;?`DLFD+UH$h1J%_43HtogW3J=s2-)X?Z2hcpLHoktDilx|Mif zl93?OS2U{RDCM#zD85maLW$l&f+*Cl5+j2$)iw#EZmg4De6&QBmWK_( wW|~dvVT8#QY`s#PsVPY5L5A>8T|lnW<^%KuwGc%o>_5j0{}C s`K3k4scxA$sXzq~^YuVR0}TVJ0b*95lNf;(vNLdiSPYy%l8J!}0FGxVqyPW_ literal 0 HcmV?d00001 diff --git a/bin/oop/ch03/vehicles/SchiffImpl.class b/bin/oop/ch03/vehicles/SchiffImpl.class new file mode 100644 index 0000000000000000000000000000000000000000..f8cee9e928d541fd79b80f173852fcefa89fe97c GIT binary patch literal 751 zcmZ{h!EVz)5QhJ;9fvq>(^AqlP)ebPCJ`b?96=R`sDKo>q$*NRY}}2#t>Z+FT@X(K z5|2;`A)z91-~o6j#O%fjktz<}nfZ72+keNu|NQ&~;2Czyun1e@@uU+(4?> zGOiJ7J(b8e`Dh^1LotXY;d*Zzi1!GWbf`El`7+8sh^49?6sH_{=NP7sow+}LefRoH2XbXgMZr&=cSye~*&7fX?=+p!Ta{nYS!{H^%DGT%^?&n%W zR_j%#T$o9&NgNRvJlLPNs+*IUMcQse$aBke4TKO?1p5S{iB7`;h~cP2ylv;z=e4?B zGBJQb&T$)DKl-QHaWgBVQ70MOD$N)e#)!l*frv-6J#FGRP6)_~>L_v{J#jC&)^+tK zKLmf>IL+zH%PR&FNJ%8yIe6=uNMl?eP-|?|ynx!{X7b=B-8d_tEwAtpt6HGKkq+9i zB0niG+(G=7c+_9ZpQCYDDsC#Eye;KjS3r3+df|gCRK`o6S7=J$&}!YvKfYyEyw5K& zAz-Y!jcVRra?~9$o44+)l8iQ0k)2@K98L--`F* zhR*(;|fub zXGSnbWa26y{4jPg0-wY+i4Y$MiQ!$fT`Qz9BzDmU|6WY+t2PVUg3Zza$bF?g-(K-w m;bwUZfwppq1fRX8j>%^0Ac7rQ{~GY05^oG;p6ALM7JdV5#qq2F literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card1/Card.class b/bin/oop/ch04/equality/card1/Card.class new file mode 100644 index 0000000000000000000000000000000000000000..f258dab71fe616008520daa09b5543b70d758c51 GIT binary patch literal 1802 zcmaJ>+j84f6kW%5EL(P**16H72?`|CmlC(MKp~;fnuG>o!{Crk;e``Llc-T7Bg-A~ z%2&V-@RSE`B{S&^mnUZUC}15)b?n50Jkq)Cz4qE`@8iG!IsFa5Jv22W1g?5syJqg+ zxLvcp>Pp8Bj%ud#cW>6}{Ax%ETzV{@$eJVFz1qh+k1aD0NV)RR5-4t-9kl}AcK22U zG}G(4f#nN`4S}@VJ={@?%&O_wt{vPJNS4am#Hf3_Ru%$ohr zJySZ{(zn$*-b}B?Fq5T=;mg}Pl9fX7hPu70XnxZ+E!d{6F0&!)Pmz=0QWYL)sc%9uP88 zi)f{d@^+EscqNZ(C<#m-$^)zJxuy&r+QB|&oj|$)BTmxvV!}G9%}`RxOzHQmpcz(X zqBO)-Agc`Gg0Kp#kItR?^MYjpFCtbX>T8P8ErDx8WFE$ZwGKNdq}oR`>Y0`D=Q>`( zn|a*E>ue2guzO;oP+rLf(_3EGH?4JBwLw<3;<73vHN5Y6K_~EKyI}?U-fl<7ySS&} zJ%PouQrqqm@4%`>$wX?dOEd8NBbC&Bfp7bhimfBS2h!bjtj;3qd(dsK^d%CZ_3sQg zZXLC){=?Y(i#~+sQuJ-b5OwJ|EjzGQ#?rW(!5Wip$iQ#<%ZA9{1GbaWzz{~s^$byF z&u+M`<<}kA=~x{N9||m8NPk#D8a4+m#Xt&i?yO{#Jr>vpNp@!vMRgB2)74$&SX8%x zV}?H+Iojp9TH>glk>t-9{gIOd#`sN#+m~@E+yPg-Ua`wJ1W#~(sd9qx>R%XrhRH|8 z=@VS}y;6OO*~(8CO?~-@cuz5>Ad?~FOvq*qDa@0>i-a>UO}>k4G8JYj0_BOpm13s& z3tE8w;$J!>Gzg965ue4FPo0j6Pp&e1N-vzCe3pnF9#xoewJ%Dp7bS-Z*|5ENemw@P zg==b3`318-5V>EITOmxICNzj)1YX7R5a+q$bIz+noU^F)oK;HdNm0V{zH6bcN>t!R zkLw+hQ$7X7mG9gsZUW~?H~QihdZc-;W70=NQC+i8seX@<)N%Dsi0?2_{R5(*fUooY z6>l6T6{)D4Q_LRtl+D#b0b3ZyX9Rv21~MYBp2!QhgSQxJoGte@3eqtNPk^m92v&WIHDd>nPGZbLW*%hVnc9-|Ek4< zPCIpa?jP0Zw~PsjBJNt{v>qk;PJz3e~-il|n)RLq^4YWEqmxF(p@QOpF?VZ@b;feyN!z z?gJGGBvX(Dc%(uWASJ+piWHJ!wx}Wvg<-B?yVlX5*S7o*yzP+hY{N6T)8xJ_aJZ;I zLWcYVr*@w#TyP3VlhtBrS}Fx=cp>9C1&FvE_5-V@VjV?>H1~ZzG`;g7gBHzn+&;6+ zpt2u{`FDwOGRUEg<4+8)qq6Z;l%`y_h_tDqgqI9&qx!nT`~6Df(7S?@0ODOx!xh6D z_@?#V7T2bPFKA1UD3oD$T^vT zZ(O4Am5Ri$M1O@wam+dydJ?XR9eRr6Bg?cdtjgNP;uV%B!Xyze772eu!HV!s&Yxm+ zEPqG&ggiGwp>-f>H?6AhbSM?B@oe)8?cCb9t;X&wq^Wb-xQ0d?QD4b2?HU_D!Tzm_ NVJobuV>=wne*k^d-^Ks{ literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card1/ColoredCard.class b/bin/oop/ch04/equality/card1/ColoredCard.class new file mode 100644 index 0000000000000000000000000000000000000000..be4d802050769c2d0e6a4604a77fd711bd2251e6 GIT binary patch literal 1432 zcmah}-%ry}6#niy)-gJMBceE_3}ioKps47Gi7p|U42c=RM4v9*m6ertws$1^KYWmX zfF~a`(O`Hm`s$x#jPbN9GT6X0ZO=XTJKsIuIj8;k=ja=N$5>GjVwkq=dS0(CEak=9 z1~(1a%0X*;4)q=kww!{oU@LNN5`9-d*UbS};V6c{2ahGob{3`=vR9lpo& zCbzcpW$75!cHuwK=}m@k(XNOX6!d9Op)rhg;Yn}yf}vkS4GjhIyX1DV|eSp8J1PUWth1*iB?TWh*A?xkEufhLsZ%=K@6jF=}trpmvKeK1jFFj zXbo2}$)N6Wvmw^sFwC~gTi@Cdx-4|1RFKdxhD*cL-lT@>xWO>K%WI-&TRN974Ou12 zmE4k~a=D%MxcX<4>2?rx&>t1zI92)M)LwbLnbk0j6a%wQS115c7iE=8hIm)Jf00ymm<(FOjx4S!srHdjDVC%QT!FD!b*a;vqxgVkq^oC6Y=)=h4tG40+!R zSqj-IqV(*g)eD6D{k}~05V1_|3*w*19l`)T`~5AI0;7l#e2{#}7M$q3Sp@npf>9## zEbo92*)*sDeZgM?Lz&Nrf5mv_5Z8_{1$?A{)*%r;IPQ~czC9F>(;p0}fao2eJsr7B z_5eNM57{4J`cW36@bM8HV{{H$6;3b|JhzR6;e_%TYJ2hK<9ZJs)k8MW= zon8CYci9_w%0N^gc__b0+mrpS{jPneoKRr#x!ZTc7Xk~#QcEDZ=XaEe1tcuQuqd$9 zaQo`*u-8_>2if+NK&s(8(rd}U)%p3)Xn5cr2^1Qa(5SOSPr7}9Z1Gd$f=)9G+M|8uG~G1T{n@#nr2uKsLfz_$@5YxfeqX>usJol=J8RedKT{CJ{#c=ImOIG zz3bcW*~gIGRIqOsXrmL<^knsQynVHx`4Ubqi$L}#C LE#nDKB6#`_`ZM4) literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card2/Card.class b/bin/oop/ch04/equality/card2/Card.class new file mode 100644 index 0000000000000000000000000000000000000000..aa76b9e4396d9b58d79a7129631ac89f4fad13cb GIT binary patch literal 1802 zcmaJ>+j84f6kW%5EL(P**16H72?`|CmlBt@Kp~;fnuG>o!{Crk;e``Llc-T7Bg-A~ z%2&V-@RSE`B{S&^mnUZUC}15)b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BAL|XB(c$ohJ8ffx|@w z5;Ei`IJNs^;et~@nyeN}(^4r|!wVVDDL};Supd}G73(N6q`B|&q3N9u8MJ7o+)dW(?&T`O9-n|ob6Wj%G4lK~9< z5Zx0D>gNnp;@=}=5f)$VJ6J0_D_vpk67wN=7!N@%1dkIT$R~dgPa0v~XvIg!8Lh+! zdE*j=uT&(4CHgBgieuKv(35ag?9fvjA6ce#VO7>P7O${85hjU%u}JtM3RZ-7a{d&n zWBFUkC*-*i3a$5&cGIc~Plr62 literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card2/ColoredCard.class b/bin/oop/ch04/equality/card2/ColoredCard.class new file mode 100644 index 0000000000000000000000000000000000000000..485cac7c105b8b227f0dbf72ee8c9de4f0f3e854 GIT binary patch literal 1481 zcmah}T~8BH5IwgoY$;p55kZ71rP3BDAPQK-XcM9dNK6SP`gGY|>C$DlZf{BYPvj5q zV0_R-#qePC)t_XHaqf1}7AijM?#%3&bLY&=?)P6OUjRJ7eGLJI3CAgCjN6{3LuypEz7zU=2=MfQH#)yVthMu$8 zI<8=pK|A19RcyXwNHogZ+}RU`%(kQqVob*%F7?rPV>+(kI>XRDFNvIE8(cm!Ws$6k zJ0i_NNocJ5|>ZYo?lCPs4i7sH!RS&~ao%y1cw0WYH;9BACa5hFc8rzq(BO zz$poT-Rg~5JIH&AfcL&Ll|Du!HT@CM_Y@AGo9|E%Y}14eSu(>91fLihG)_BScfv$Cx}+fS`f|57CiMeZmcLDLLq= zN_fKis0sa~aDeWE7^8|4^i0urJ%?c|Vx&Rs@*lO!gh*3K{TRYDbs&J7#2ZCO`-zwa g_5)0(V`e;c8O+jCb@~oni&!QvLe^cZU=_o^0rD$la{vGU literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card2/Example.class b/bin/oop/ch04/equality/card2/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..7d38d7b197b7d08b9ea024b243b47afdb68f9642 GIT binary patch literal 1056 zcmaiyT~8B16o%i~7M8B7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A~=sGJ0=l+=}=glA({f>@QP!1WWZH%U@NU>^T&7BeWS>(UC7RNiZ#qciwBbgsZAJBRy Scz%d=+SEt4hP(I}m;M9iZg&d+ literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card3/Color.class b/bin/oop/ch04/equality/card3/Color.class new file mode 100644 index 0000000000000000000000000000000000000000..19ad9cdddad571e4621f67d8d6af0a0945051354 GIT binary patch literal 1056 zcmah{K~vK}7=7EcO&cQAqSaCmM3golp`u>eVd!*lhOxjQ(wUB@Z5m6MG{H1wrvFOI z0Y*p0vp>r5+fZpP+8na`cHjHPsjBJNt{v>sk;PJz3e~-il|n)RLq^4YWEqmxF(p@QOpF?VZ@b;fL8+N0 z?gJGGBvX(Dc%(uWASJ+piWHJ!wx}Wvg<-B?yVlX5*S7o*yzP+hY{N6T)8xJ_aJZ;I zLWcYVr*@w#TyP3VlhtBrS}Fx=cp>9C1&FvE_5-V@VjV?>H1~ZzG`;g7gBHzn+&;6+ zpmGq2`FDwOGRUEg<4+7bQQ7z^N>i>|MA}qQ!b^rXQGMOv{eC5K=v~1{0P!xU;fmo6 zeA9Yoi)&ND7qlfv6w0u>E)NDiZImOmgs?ir*=}X8ObwFg)yDVoqLToP)WmS4{sEZ< z(LKSSe$GH8{yjn#Ve!?zgSE1=(iP?|F&~15@et%f@Hi2IeDVkJq!H$gR(yn<(MpVv zH!e~5N=0H=qQ63;IA)y;JqcIE4n4*3k!4yJR%LBt@e0cmVUh?Ki-bR-U`2Q*=TEUZ zmcONZLY^C;(0VUvH?6AhbSM?B@oe)8?cCb9t;X&wq^Wb-xQ0d?QD4b2?HU_D!Tzm_ NVJobuV>=wne*mDO-_ig8 literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card3/ColoredCard.class b/bin/oop/ch04/equality/card3/ColoredCard.class new file mode 100644 index 0000000000000000000000000000000000000000..82dd6db1c7ce7ba68116450d4b72b7cd4bae9684 GIT binary patch literal 1424 zcmah}T~8BH5IwhB*iyE9e~2PfDM&x0D5z+Oi8djc6p1OpM4v9(D_y$m*4mu zQWW~Tu@J)@S}vAk4BAu65>CE3}+#Dm&G!;sL|d#Za1KOC+^~^3l>T40^v8 zvJ|pa#OU2ar{{?H_r00y5#pKLXCyw7JA!_C_xV>U1;!93_yGBmEjZD6y9o4R7$ZdH zSzdw&*|ewueZfBigPBiAe8G6;2v?6W4Sb-0R+4T%IN_6PzC9R_(?1we0nuARdpdHN z>>;|M@3Y^*4ltel2Da{T=jb^^B9lA9?12YR=tFqL7cxerfeKcs*gh(Em`coGJR~Uh zS5OW&Fi%;B={`*{5kdkQ6!jO9D%elDQ;;QJ1UcNKZ?Bh2^ep2po#JHO!+jJm@dt>m BS;GJT literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card3/Example.class b/bin/oop/ch04/equality/card3/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..f0ef12a8660c5748cc127f33d20ea2900e4e3188 GIT binary patch literal 1056 zcmaiyT~8B16o%i~wk%y&sja1c@L>h9EiH>s6)l>W2Cpg-Ynlk&EX!CHx81sIjr=UR zkVF!%yz)mG-)RwSLLs}EIcMgaGtc?>{pZI|059=ehbA!X`yI>KT`XJjbJzCV@W68H zU}xD{`)ap3p41T)NbK2PY|FFTP3z6}o^(QikyW?thA#vnxqL$)TJ?9Nfe7LzVi*w^ ztGR8t-feBm;GMngNr7a|cWkd=2d>gj4x{0&yDyNfU4l{J6D`|q3ykNsYG*k0FmT(= zO1`1vy1>M+C{?C3iWF%-`o4h#(h752Ae}ou*iC_%p}~C559E%D8OLo*=(r;=d7-t5 zNlXdEnt_zeVR~q~RTaBpAcMP#Fe^|#hwu{jd_!@~n3z?MM#vh+9CA7y479R-upi2n zi98Cl^1JM6x?c^~w>DVUkkyrTi#Q1sO_Z>}zW2t2EgPs@e<~{ZO#_Qq((zCr)oapV zBooUh3+Npc++!i4xy|16*g=yaQ|EM6K>NgKQ^Qkc8#o=BLo3Z$5-{q1H*n-DR}Gzc zGR6yv23ass4nLq#;+%5Tsaf0w_gLWwqu+Yh23K_rI$Ysu_6@jSr549EjPXP{|3Z`> z@ZlJV_sQfDZq$yEp>&8_N0@&7Pq{~B{Sfzy^WVYWqBvhX6-)n}mQGKLC*m2?9N#7= z4AN!z{w#Hi+A~tFk#2*0TclIWg+3P^;W0G>Z}9{xq|VUtDJ6~GEA(7pjsg|hXjuIV D1Ss-; literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card4/Card.class b/bin/oop/ch04/equality/card4/Card.class new file mode 100644 index 0000000000000000000000000000000000000000..51bbe8a980f81591c17007961979d6019e362891 GIT binary patch literal 1924 zcmaJ?T~i!I6g|x@JNq#}vIH;?aFc-94`iZ2O$4K61%t9AW|36Pi_I_v6NZ^}w>KrP z{sCX*5BQV^zY?mj%8w_j{7IIjo}L+Cfi0KXneN;7o_p@Ox0gTvIrs&@`*>iWN8nNr zG%S1T`mE)A(UzX8b}d^rH)gFWp9Ycw=bp%?((B}8QAisQkR98*c z-<%UL?4a!{rzs$o1X6x`XI*d7^S0;uuDUIdD3;cUQ4Kbn3D9&FRf*fzy%ZMkuxwXFmcRqrR{n516Olf_|kS7$_@N9 zUJ@{MH3hd-@ad7o5Jq);UUR!-q8BN>nlO>kER$->ZE?H&f4WhIzPgh3c1<=y+6Jzk z5HeDWXvL+{TAuBA#l$rf1x9w{wo?s!TdIey+TyCEq_3E9h^}V~&XU?FC8f-ie$!Da zVP`HByZ8!Zv_sqwc7grL(o#KaSXu=Uu{=><*NkomTQnntno3^v)>KV!CIi1m6 zroeZCK($m;HfoOA3N~6T#LhORaReQzVrI3@U5R&tU-I)u#Cwi$4VefbM?*H_NMeEv zUM5@tBjh{DVbf`bBT$|cxYNuue?bp0Ui`~|9s|Old&Fll=2K;$=94Rr9WV;}C>g{Rf4 zm*5PnqhMW<{v;{k>DYxZRu?L8{fO&LlG8E$nk&EK2Y3xQO}f^RxBrMV?{`f4Yoh3> zvC5Ti(VKi$`5j^pS1P|j)TYZX@a7%{b%JSrU*OiB_DS%MAyIROsRi(WqgF>hRxyZA zsma4IZ6Sg_lH9@^=9zd9qj(1eroPNr6A9yQTxEy<;+fFDNHMuveCx7%HLKIAJPuPt rvvb%E-I&{9iUi(eU=QBoe^zS5)rSPT8$Lh6GHv?zuZDa01Q-7U!IO1A literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card4/Color.class b/bin/oop/ch04/equality/card4/Color.class new file mode 100644 index 0000000000000000000000000000000000000000..507010cfb8d382747f384f4cc22e49f1d0419fc8 GIT binary patch literal 1056 zcmah{K~vK}7=7EcO&cQAqSaCmM3golp^9GGVd!*lhOxjQ(wUB@Z5m6MG{H1wrvFOI z0Y*p0vp>r5+fZpP+8na`cHjHA@& zv!mBN$Ma>x8D`J;1=k(!cJ+OC&|{E%tHZF|_^-6Wkm&lB#8dI9ya9 zAwzzGQ@c+VE;t3G$!f7QEtP^bypZvn0z}*n`+?O{v5q1`n)^Ni>|MA}qQ!b^rXQGMOv{eC5K=v~1{0P!xU;fmo6 zeA9Yoi)&ND7qlfv6w0u>E)NDiZImOmgs?ir*=}X8ObwFg)yDVoqLToP)WmS4{sEZ< z(LKSSe$GH8{yjn#Ve!?zgSE1=(iP?|F&~15@et%f@Hi2IeDVkJq!H$gR(yn<(MpVv zH!e~5N=0H=qQ63;IA)y;JqcIE4n4*3k!4yJR%LBt@e0cmVUh?Ki-bR-U`2Q*=TEUZ zmcONZLY^C;(0VUvH?6AhbSM?B@oe)8?cCb9t;X&wq^Wb-xQ0d?QD4b2?HU_D!Tzm_ NVJobuV>=wne*m%x-`D^E literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card4/ColoredCard.class b/bin/oop/ch04/equality/card4/ColoredCard.class new file mode 100644 index 0000000000000000000000000000000000000000..32300eb5ffd926cda3494feb204f235003fb780b GIT binary patch literal 1544 zcmah}TTc@~6#k|c7Rr|URS=LnZKa4+!Fq2bniPqFV4_dMcBD&}-MXEU@K5B;C!T!J zM8)u6^wpnajPcBN!37GY+1)cU-}%mWF4LcX4!;3-hzA-%3}cQ{P8-F!Oj^9Da?6yv zX@k3kOgiUSjw=c|T4;zc44w-l1VhwNc!uHpxi|&LGBn&VZByQ3$V}(A_zq87+}=#D zO4qbEv;Xm)S!amkoPvlUjAk7gbcXIaJTvP}U}(`1MFT@?-n7ND>h^|k*Z77d7&`Kf z!L4=fnriKDMr6^fFic!5qE-`1BwP}^is?)e42{yMCB)D*J#!WjLmw__=x1mbfc$(+B>4-3Pu@vw|PnA9NXaXg(-_fo`!R^OtuvEilbd0G@=A0~>?@6td zMJ^fQtCAa~WnT9C5_M!z&}_w4ovLeyB~x{*Qb{NtO%y}Bx=dt6$kxzE??LImEyO(2`2%bZQ_1gO%c;Z{Ozfdg#YoY!k9Z<=fayI2 z4AYPN!d^n7ln6+;Mxt9tb|*<4AhDC^#VpzL=no{BIZiTz1d^nrlccA}KZL8qqa&>S z#H4AJ!T64 literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/card4/Example.class b/bin/oop/ch04/equality/card4/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..cf2d0a814acbbe8068256ed0fc36ead05e820f6a GIT binary patch literal 2609 zcmcIlNpl-j5dNMld9;j|c+G??4q33XDHyX^#y~_&0ou%aT{EC_L1zN`} z$MVMoS_X%*0^zi~V8+pcn2rcq1v)a8V@{O|^QJc|=WSD+KA-8eeYtIF&X=pAep zEQ+1Xx8z7)!!CgXTZVOQ*E1JX^cZ$yuZBGWd$#q~u@3_RktNSGd7FJ(UOcU0r{Xa1 zw5s)hz(|u?A9H*ttLi$WxKQtTwyLN1Fh(>yN6tOCW6i4LdAz{x zI_4T_+*6BCNA6S%FJV-}%MHYzSugo!K}QN>MA9wuaBrnd%T1mm3w?6Ylm)hI9It73 zRiHb_-e}f2d8Y)lqB>!d0SyeSB0H2-9DPH_X-sg`g308RG1k30D$T^b@73i(lL#50{sP-Dcn%?7 ziBNu6E$n?LNB>YxZF9kPgkz`PHfHF2m|%2TQ|@bY?`wRh){C{r>f}SG#@Jkza8T6X3LFf` z6m-dQR^7artl(Q|&4kQxBGy&UE(u(zZ*$eV67Y<47HqS0kd^1l#rmPHcB`&`4F_il zLlgJDf9p;W_I#rkA#5 zsbrQktP31^1cqi8)9^XDvb`$@tAYadlb0=|JP@M9pD(T&cS(K)zmX%Gi2f9q<6M;) zh$6vNuQ>4A#$62U=%9v&Lsz*f-QC;hJm1x|iJr`TX)=)dshheDgVyVKY7_fM!?oQ( zwTm?DT7zBxbp$r;=&|EQ*oYXdhIRwbj7E*#(5E~TH}K{yOadEt=Nh^nsAd9{IyftE_1+zoB9OjSxP+l_ znZORNasDOHLqzuS{>O;OC^0$1_biJpEYflrz4!`!_#XZE5j$}kyYM^rf6?|2f36g+ z#bCXQ_i;Xm`8O`$B9ZOEANYV$h|zz=hm=~F<7a$CDa=ei;A2V==DUJVD77-{*N~Jn z=Kc)x$gy*mF^2`}VyxjfOiBq_E8VPkEzxV4nm-Y_2M-AimWIw||AUM?4BX@IdfPT$ z!O`KG@8A>oR!=Z;#}jzhBFCPfR${ioyM>U4&2Kv;kJy%iwTw@xi*vt5yuN_(A36?s A9smFU literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/rational1/Example.class b/bin/oop/ch04/equality/rational1/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..baa940bbb2e848a1752f83e5fbe5bcfea16bff68 GIT binary patch literal 1258 zcma)5+fEZv6kTUJWoRjKDXpTYAQxM11BjrsqQrP1DQK)I0TYu$nUuk{Q`@P5PcZS> zSAEiFeSj#5AK*uc>rBg~L|3(0a(C-0ZpLaaY|-(b7I=G-d1Ja zc6ZFObZw_7^ONSIZCNPgEd#nh`<8qs&Acq;%xCLcR@N10O4>!+ofq)M;u!(`p|fEH z;X@z_9MtQI**zH#Ssv z$z%vqDxx{-6kU#)-RQEM;}QPHv<0;Cq`=Ub4|h0jzMNK`qNp&Wt;WzJ z!afyNAr@_1kDb!tip)0pC(l=Lo_Sl-uFSq!k|l513``3I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F;-9}>91q3zsH3WDK(aD>y634LR&n;jOZ2SfG19bQvV8{0CGNfuiLuq!?_a2+;HT9;2*)^LKurQ fUg9!I?f@MUguBbG^hIRdC>c)kQJk literal 0 HcmV?d00001 diff --git a/bin/oop/ch04/equality/rational2/Example.class b/bin/oop/ch04/equality/rational2/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..a4a2862da51fde3a725c0d4183633df2b115ef12 GIT binary patch literal 1258 zcma)5+fEZv6kTUJWoRjKDXpTYAQxM11BjrsqQrP1DQK)I0TYu$nUuk{Q`@P5PcZS> zSAEiFeSj#5AK*uc>rBg~L|3(0a(C-0ZpLaaY|-(b7I=G-d1Ja zc6ZFObZw_7^Hb)dZCNPgEd#nh`<8qs&Acq;%xCLcR@N10O4>!+ofq)M;u!(`p|fEH z;X@z_9MtQI**zH#Ssv z$z%vqDxx{-6kU#)-RQEM;}QPHv<0;Cq`=Ub4|h0jzMNK`qNp&Wt;WzJ z!afyNAr@_1kDb!tip)0pC(l=Lo_Sl-uFSq!k|l513``3I(@wRVwI17QBSZBaA6J7z zA2=<39e_rSOH66-X7Us~{lj}`{^r3!N(C#~LK&(#@NDHRfD34&g~6gg4?k_6_tCzp z`}g=2D9vwBTl$X3$mkas`d8?_U0m_*yXd33kHOVF+*}?ziu-|>hLzKIhK%ikR?mG- z@77NR)D2CnSIfYN2HS)N)>FK6C|)xjhi2*lbWskFp-I~;Sv?`I6|U`TbRvf^w(0R6 z5q#puqvkMOqyWydW0p9uq3g2#NyBn d&;VBDGcNwDM6yB*#&ov%5)`WYZ}Z***L2d!F}spYxvgZ2tQ9_3r>KVI_=! zz?f;S=Zck+6FKechFaCF&0I~jbkk6)r*gO4Q5YeCz7=&t%~e&SoV&5Sq7^NHpwU

AYoRiMnjv|i!F!}`cY=O?IRz<-8 z_R>dPu5)TSpUFodFr;7@`vi8Ci!=I$UeanVets9h4;jDtw(hw}^8}fNl!8!RHscQB5LPa%X{GCP5EIRAEC~+>z zK*t4kmus48anWq3coX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z3QA;aT=v%g!bf=@5}%t( zq%{l*^wlv~_ME`R58>4T46CbW2r%y7Ob86WlbjhEn00KA-byzz{ZnWqj^P;M7}H^3 zTtF{LFH~C>_&6TYUF{rAk;W)4U_!&ieL-K|E_t$`;}Sk&z@0Mb>k49EImUekz+)Js zSx73nFYCC1t3KV{iX}I)OdElb-8XAfZJ!s(#9RkyoYZj*Ot0ewb5jy~#`GRqUXH7h zXWAYk*F}D66Cs9a+|V$?$ofgLAE1s|%n4{kg*ne;>WbHzNTfUH#w63o%;&AF={c^z zr}Zd1m=7vRvrc|Ppr@X?Vpu?A1U{Gy4T}PacgBA{DB3W#ZVV|E`4q-fB)(LUSP~dJ zw*sf@)b>H7&3KA66%odtO_OOD z&4i^}wPt-rm#wUAdS#bg^TGd!U0vS}!l0vxIh7($1Y*lh+0DpXmg>)XrQ?sOx?%a> za2&7Xxn^-udO2sk6hi@y1{TfGUi-D|EoW02K^G3n^p=@n#cZqkEeiZxU0@aMz~F7u zUT0SwBC(t0VzRalt0em_t}vVGs8=`gU`i#c`$NUVENgn%@?^3tg8Wgik2Hr(>T16r z3kx<|>1^ICm1If77AwET+j{slJQp~5xGJY+;4B7MosIsmh;YS$$*;z}!GFR3BWGXZ z=&xKfAjYpc29BbcUp-LZe+zd}w4#j?b@>W^N>6)(_BS}TcfHkrOHJoyn$oMxXz0dq z-wfww#mq~t6t=}3^sIKGuM;O;EsQ2g)(5V3QT_5zl0QCL0SoQ(#Zdd&64npm_=jhHog}>2{ z#W3FmP7vECM0JXI28d{o_=kx!jwS9MV$}EHEHSkbZRo?)t`8Gzmuv~wkC`gu=e{7KEaUX;-st8{v zX)1{{NCIV-QNw{}8~)9#pF#`Vs}yRX@f?lsnhtyq@^GRmfm&!b%?k>BkeN!d%3UKY dejD%%oBZ!16W`IaTj%TXT#c(TzQ;Ct{{v;Knc4sV literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/generic/example/GenericContainer.class b/bin/oop/ch05/generic/example/GenericContainer.class new file mode 100644 index 0000000000000000000000000000000000000000..c62e4a899ce4ae380e68ed839951085734cd19f0 GIT binary patch literal 1140 zcma)4T~8BH5IvWE(GLn#!OBMk{9xNEixOXekTjsir0PSPMjtQBO}n_=ZQ3n?XMcom z{sv7XL{0SFA7wmux22*I-G{w1b7#)XnRCDY`1}<>1se&B2^2lAV_L2Chh|f`s%u-O zI+pE@qs%9vzw5caw0V_4RAA~*9!b-YZqt0Rf2b^9Al;V76|2>&${szjCy=xTH3tIu z>Y%}fd8Asl<*1%n>HFRm(`t6pm43gg1S0hcBk^t9wf!A|sIgaU@YwYZR0{5*8U(E^;>pNpgf%A-()$=>_w!L z&Jb<=|6#UCYlm2wrt*i2=L8KXL?ulZfuZE_^)DXF}`M9r7h>u0hvkSA61`dv#swzYsW zzrVXR4JBZ1S2i~KE;A277d8yc!CSc(#x~!BC$v03g_esSPNFCrwEDbJ3R$^@h-)=P1;;( Po&&7Y9K-zq;|D(h>UZm; literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/generic/mensa/AccountCard.class b/bin/oop/ch05/generic/mensa/AccountCard.class new file mode 100644 index 0000000000000000000000000000000000000000..b4392b621c5d550ed02420b2b4913e40ec9e5c5a GIT binary patch literal 2490 zcmbVNZBrXn6n<`iEQIA%UhJ!}3M2uWYDLjdl*VGC&{l&~tZ$diC0VlUW_E9=^p`mP z3Uw4_=#2Ww5B?~}b9a|y%P!UN%kJKD&)aj(bI$(t_sMSnR?*auVz}lwt)kJmu~@7N zTezlC+!waTi>rp=v~5}DZcRfkL-riK4W+HL7&IQ(Fyz-`+MY1luBa8O!Mp6(QrNP@ zFi6k`m1j~k|>bg#zKjVPBg=)ns*1~9>JGby3xg(~H@G)ytf z#gvjOnZYDpRKYGVOyw#Ou=jWNgdxe_02nUm=tG)eWZksIz4rc&a5wpmMPSC)9fMn2 z+%?rX6!yx7=`p-|9?%F&sQf)mai|={dc)A);-2@|Q8Zx{hD=?^(3W8$myeq$Jaam7 z$OqaXVa{rY;55uLjGm24m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`$c+n)oLf3a6;t z7uxJdwd_d2L({ioEU;rZu6_iDXa9?5D{B_+V0G~yh~8fK7_WWux5S0)9ekBa>A%Fg zUts4AcH*0zH`$49cD}<-Y_sz=J6h0L{0mlZGjR;lym72kI+GO2I)!qS^sSS=)4Z>B z-q##1^BYhdglE6+ijssPEseqR8h-FUrUSvRdadI^mlrX9$n_EY2tVd`h^_bO-Ut5s S=lCVZRC@XqeuLj(_x}Oj;SOH_ literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/generic/mensa/Color.class b/bin/oop/ch05/generic/mensa/Color.class new file mode 100644 index 0000000000000000000000000000000000000000..d71152e3ef9553dac3b1f97d2043658c1c7e142e GIT binary patch literal 1145 zcmah{T~pIQ6g^AYqzw_U3i2h0ptc1Gpx{S43=D%aj0GMdoyqu=hBbsq6DCb@_znIU zEe|j{GCupG9Pcg_@*?CRchBygyXV|{fB*S@0bm_(HS{oyN70e#9xN=I9uIl!yJnMz zEyvu5f+*IIVdy(_jvX^_LeJa`+f9b77jqsmOw?}TRv46+?=xf?L7Nln^MRjG%y_YL z!qB_9v$s7{U$5gAzQ*NH8qHXjXzT2_C8vOi1uZlVB?MlQJkB3|e-kgJH|gb}(kyY6laRt#vSE zonrbMJ=KFJ^w%j0G3#XGsoWJOG}m2Wi?lBcYUSDSGd#N{s&oNek|Ea`iozjHa0%ru zeTAwb=tCV$+wYa~g(w+1QnYJhgkNo1;v3#9MlSmCy0w7uf%K OJy?-BU*WZkZ~g+O67BK; literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/generic/mensa/CountCard.class b/bin/oop/ch05/generic/mensa/CountCard.class new file mode 100644 index 0000000000000000000000000000000000000000..abafd75cc6a6df002ff0f992d8d54eb6efeadbd3 GIT binary patch literal 1498 zcmaJ>>r&G|7(LsTrj3DOxrrba1msdFig+ttAi~H@5ogNaIR0AFwG9nPC)qOg4SWP& zfCtbY;^2(__o37;y-}fUGfg&M&YrX1`M%xXf6jgaSjVP<07JrYN-3kTyqd}jT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WvPddes zpk3}EOE2ACAy)JEWfs1}%q)II|7SACFi7u#n#-ibKA5mDM7CrUPH=jzL7owe5|}>e z0x>#|VZ08%NzvLjmidDIADGB|!*zP5&oK*pB1crHyB0K5D_}(lQ33h~Od(B{48>~j e1>7b`yOz0(JM^oW+^6RO9@0%OU>1+CiOE0m#A}iO literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/generic/mensa/MensaExample.class b/bin/oop/ch05/generic/mensa/MensaExample.class new file mode 100644 index 0000000000000000000000000000000000000000..97589bead60865f688d789627396c81073f4b7a7 GIT binary patch literal 3630 zcmb7HNpKs-6@5(*8~}nM5)>taq9tgt#MQ7w$&yJ&76nNbV?tI$iVow%@o>-tMg(S% znE@p_ij!Xhg43v#5W(~n{U3QDwWqWAPE^9+Tj7+ z)BXGZ_y2$Yck>_rz42!NWB5Qri@UrPoV8?(=xrI0+HUnX@S<9U62Vx5KkhCHi1nOrX|nRDznm= z(r3$3AT?nddU;xRO!Zw~Z1qZ}D{$MySAa4~GZo#m1h(`(II#+8(sN9!INCR@p@XVI zG)+sZK(V}Tl!z>bPHHR5IWK{BbScnVl-_2w<9*XH+#(Ql%woxlp<5t6bv~c*gQTHH zAQNISr@N)IwrTOuc7YA&E%W%r;8+6N(4}Fgz^;(9V}@bZEH9@!g&1}VBn;b{la90u zLcdKw8y+6of8eeo31qNOq3;#wT?74^{%Gi52lcAmL83n8=+=B@vSNCrIBv%s8nOaC zA*ge9*>;lHj{^*D(a{$LwufcbmmN)@4+j3JHmvRfFOc*2_#SJ zmYd1{^-txpbd)QjN!+b~MvIP=Rswh8r~-12z`_3;h)Kd zQzg5i)3Ux8*gcuVDL+87_y%)YkX73?SzHsnVNtu8#iL@dh%FRQm-&U=P;#VQlQhXxSO|=I1g68 zR#hj;tjw;)&;`AMSyD>ArDWTbzu!*cL41b{sp>9k|K3n%{Sx!tSkF(t#At*Hb*D&$ zooh4)I=N8UFR(96(-#8k%PVqtwaPR@m#A6h>_s0Ci#ANjO2w;Ir7BinPnc{&g;P2) zr|Qfvvvu^Z285MaBA@d$spu@QGtA5i6UfA>B4?eORN(o<^m&}K5 z+iYmoR)e4t@1mxG?CK4v(Q{JWC$ezzk|C>}Xty={`d~9uc z9{|s6ob+^KKCf5(dsp3g&#A8S{FfzixrwCEqI_sss0hRq_`r{-tT{HLEXJ9!NxSA4 z@|3AA`wpKk^*6-rs&laY9Jg)H^&GvLmyA=vP2gAfjfP*dN>*=k(^|0SWj2U=kkV7S z;n|L#>sJL{ZOmw0I#9?CUnomgmE3%-I@+A&hLxKRPAyjD8sd$8WVx3$tH|l)@}%j> z(M@f5C5AUxSx%kQBN-9HZ~3m!Nesshc#)aY8KQ!}_ZF$E_Et!+>Ww@+*$7VG~z)xaAlnC@qdGp?xNm>PQu@Ve^Flu{HR}`yc6!O#z4 zIDQ2u>JssRwAP-uj(Z2vu^5NJbUeyosJ?my_YGXdH#rOj!%#4!wfY#VkMUroiuhIlXpvh^bkC)J5Y4UJ}2+~ypM4`#K@oE z$~i{dV9Y(1^OH#7MRej7Y{nbt!h6_?k8levBaQ1k`4>Jp|BfE~6Sv}H?7$~{IR2Z- z{|vkFIriW`d{wq!ub>6d&e!Btz7cm|Kg<>jLi`YV8r*bpO|S6KOs`}H;A9o5B6%#Dzt%vqEwmh%D-~=RQ x>q8RaSaKvZMj!#Shi9+Yevw;%SaRG{Ta9v8xc{v}2YW)I$3D7EuLGd~hhIhUT`B+o literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/generic/mensa/VendingMachine.class b/bin/oop/ch05/generic/mensa/VendingMachine.class new file mode 100644 index 0000000000000000000000000000000000000000..5063a6fc83b8dfbcc234a2b3c737007214b39f83 GIT binary patch literal 1829 zcmah}U2hvj6g^`**~DzVoZz<9w2qq++iAPyqfl@uq$Z(;q)1IMs(4|t9@*R2yVmYF z5FYszyzmcr0EtkkNbt^&LY&!k9S5gWtDU(sd+)jTo_qKH{m-*M0c>K&LQ3Fj5cD0l zbMuzdR=x^7*Xb!gl1@|kEzfW7O1IK9VS}Kb)7H!yA5=fUT%~=R6+n7bxNUz$kFk_^1HeSJuz`_o5dNAnitMHNB z@5WICuIx5t=$Z5IGNU^lgIM30NbxL=81|Cek=?HH+v=f;`hg!2Ia6*_nC-~Y9{8@*UwOJiDbmu{Cag0lnM9+%w$fV(p=5`_SS{5L zB9Aq>T7FS-bs2T)GHlginzLKqxvH-{y0@?);7m~Ryy}|+-3dbPdufzMRu--clujz$ zAWd!A-3;3Ua;ZmpGjK@CgTTKY2k0HD;xN`MuHj8n#ZTDT=}c_O-` zV9#^1v5xlyHeQ(g>F!S`$hc%fVD+Vh3C!(j=^pIL{;-j*z>fiEllI?47S(=!}N>2 zWV94TvFrxEmYyFKx4wK>6cqux;d2<(yBrvb4R@c7Izhr&X<7J8;L`uAa;hX8V3i{w z&3B4x&ddn@cS~k!a8H>@!F`I~ZOn0<=V_n!Y3?i4r&y?N93xjP9P^YuM*i2>>O9vx ztw8$>EoW&v&u1A6xWL{zNR92vYP^!0SVQHJ(%aW?iiQhLs4ciV=+&h9N+viW{+QZGmdvY#%VHFlIb8GG0fSE-Ez2(6kz}ctqK-SStL4xj%62aqh-b-27{!T3Bp#e#hI@ z$Am9@GvqWKC!BCvq~$6xN;t=UU&Y!Or=<}ACEUjQaiFERiYa_RZ>;n@mm0+s?%+f2 UhNU{+Pq58XmeQwa;B#E~7k%-qfB*mh literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/generic/secured/AuthorizationException.class b/bin/oop/ch05/generic/secured/AuthorizationException.class new file mode 100644 index 0000000000000000000000000000000000000000..1d5031da4e55657a7a185426020779d47ec10b77 GIT binary patch literal 408 zcmb7 zaR~?pSnx@w`<=f#e|~#^c?B>=5+NW6=axd{XXhf*R(qpFsa5UuT#V}~ciue8$~b%V zp!BjSB7}tgoxGQ#kTw(F7lh7*v8Eakb`R4Z!KCuWX2YW?A-r^R9b*OSU96%*=%vQ$ zn|d+R{#MQkO-NFwWHFWAH2l>JtK5`?LHbXxLqfFBWht|E^Dj??c;afW^tEZ;-v9f@ zr_CG=Ky17@#KG=4M@%CG96;yzNd!H(FvB|`GY@yfg+GYx{ F^8wAgPynAsD48*eDkzNX2?thsiNa2{Uo#1dER@ ze}r%T0DaK41hidC-~CN4m;1~N>Cm8%wP4QKXYX(C{q4(N|2+HyzyiL|kYKp(x~-zM zbK_>QAspe^R?!z$+Y|L-E&NtoM+!%3NHGlF=li_ajvIXN`s#Gs%_I;oapG7!@LG6LToB((zBh0fww?C ztL^h(sZHzh8n}v zrEcrn{IpD>n_FFMfgXu}eQs@ZM&DiYGf%;*u` z`-#qRau#Fcq`Syb66GhMHfV&nLbn9Tv`;MH7s01qXmOE)vaTRi6T zeZ2vkFwc%C>w6IQB` w#;~pV#-VdIFd^L*yMnMN-QX2pw25r}uiKBNj6j&gGXO>V6xq0t$4oH$0SoagI{*Lx literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/mensa/AccountCard.class b/bin/oop/ch05/mensa/AccountCard.class new file mode 100644 index 0000000000000000000000000000000000000000..f84741482bcedeb64372044321b11f8fcbbaf5d7 GIT binary patch literal 2339 zcmb7FYgZdZ7=DI87Q%8Zw_YfrT$%)I>IJM)t27oHg;EVtvEGKwkStktb9N_G`b#|i z3iT*>=sD^qKlr0OzO%a|+hp||zwFGs^Io6#d1wFn`}{Wm>p0TT#c;)O>UpDjdnJD) zY>(&H4Z~^JvcTQ4hHi$bw)-umrEVEC9_TX6ZZ@?%VKiJ(&X3JHwp&@jrd6qi7p>$U8zhB1bj=4E_!DO|#Yaz07%GsQ?T+xv&YkmRQi z43~BEAjvSaY1-mZ<7i*FJAB`wq(?U$gIl}YHPty3cFU^iFEQd2vH3~uXq6>~%%BG-`; zysqO7tPlq+VOM08P|IYC8s22M(aOJQS)#(Nb+^(W=E$bUQJR*wbi55hd-90a1i@l( z`NWh}+If=OlG?NwL#kMaSMiRb3Jt<|oXM_g!h1T+=luZ6W)uD&luhPQ)rJrBzmI9F z7YqX>$&K0;uZJw`l}<3DY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GoDN}PM27R8MYOgo{ zD~2}l_Mh0liMbzXry~TTQUv$2gWK%?`5e!ObM$ z3|KFPzlF*UXaNOK^)pAli=o{Pp(#uuzG^$L{xFqM`aep*#^`5;pv=fm0?H&%cS2BR z3`%hyLSbrl(UB6!EJ0Fi4&=A+Nz8XBfzN=SXg|&PM2hi&I1mHJa-3F{o>yQcepTVK zDh;7{jXde}1ac&&eCTa3e9tDZvv?4~&R`|H<6xDZy<`;-P8t5M;UVp*&(j9J#Mc=9 E7dX|NrvLx| literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/mensa/CashPoint.class b/bin/oop/ch05/mensa/CashPoint.class new file mode 100644 index 0000000000000000000000000000000000000000..92d9932d7931535c3719559ba0d501ed28ea27ab GIT binary patch literal 3337 zcmaJ@YjYFl6@Fe>^2+jJY!fcV4k%POvP=;K2uWlJSb?Bm13@m1OWS0~HR=S!Ug{O4*`(ZGSCau`S0}h*ynT?Uw766jVVW>KH4Q!tl%%T+#PzXDO$knQq+Q_7zLuT2iR4ix7x@y&`u2UmeG+mgW8-2|w zGUvM?H42ZUCpx`K(9Xwoq%on8ShD>5CVOj0AkX<{YLy=q!j-zJY5&NDJi*ETcbY~3%rp8c93i<+x7Tu?|h z7l&%OYDtD!rRJ(Wynq=E7a6y`1>6vwo|)HSU*ie%k( zYV{j8Y*R8cSvA&psGq>|_=02xQ)Oot1x#EM$d`0XV?kkGS2BWXkz=-r9oKc7#mUVq7;f4lAt)*-g*J{4CqGJhV zCcj&!Kz4>%WxH9b*zuWema&pc@Q9l_mT@pltOoEfo#OT^97Z=?=uF5iDUv`Ho`$a~ z><9|p!zbye3Edi9cl-)r`;9GMsknB!T0G22mAWNaH6ZDRz;|_gPX=O3o@F^Q@&g?|l#w1*dFlUH z#~Zm~G`z`(Y!&rOZn18b&)Zg|bk6f!axg$Li*DUBt@E~&&w=Lsa#*%8RMW2O z*L=^Y&RWcrQZ0dZ@iPtYDWtZ5ZD-Y8wz6Sm4C~ikMGa$U__F)~Z&Q<=0!*hj(JGRRRr&JZpWC4CS`>;+;6&r+CEkWL2)# zq)Mh$a>X(#wL@$N*IqKLIHid=e$5(|m-@pCvN`QK$%aglN>#U~`x^ehH2(ifsi%-DJVv$k@QLw%ST0H4Btvp-@*9z>GWhbM1O{IaQL-;ZU^@o+ z9%65q>w5Sd$$X6A%;bIS%#7W~?o7{p4)HbmVF2+c-+R%^w~i=*`Uo{Zm>mS#L!f<} zNrph!&zAg+1cs=fC8kAqvHCT+|JuEWdJgj7THx2JLIv z9BXdoMc!reX#3^^T{cJLK4@%yw?W3#Cpb2_fhQ0Dg=X;Y2|i*`luwe6^vC%e8dCkY zF*u~G+ei$lf89p3N6zdC7z_h7PR}04VZM*k$Y+q@O*G!Z>Qs}}DY>I~&M6|q5lhEn zu`_Zi?+K2IO7cXOVD)DfNKNz=iepO`iC`*AVI66K?{C8Q;|zby3g9$>B6yCiUVhK< zY7_AH2rd#lnwh+Z!Ukqfk%G%(f5x`I;`xQ)s~=NvWNrzfaMqrvtM>c^++=brfI1muXfX8Tv{fPw}7X`!_~IV_$A~ z?=%cdiGi<(fp=k!(H8pwD!>NZhiwXVJRC%Aiuk9P3a6>uXItz@HSI{jM?J7(G_+$d zE%HLG;uL=7hk7RdM`8f^Xz~ z+wA;^9WCrEe1z3IEF6P0Zw%{{&Nzj#PN5tlee0y}4CA%Vc+KJpzaiCOdiDmch$Mux zH2N=ScLt>a>s7cqXq^%49OZ}U6A)-UMZFN625@EeXvdHOAWk3VAMe{w<7 A-v9sr literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/mensa/Color.class b/bin/oop/ch05/mensa/Color.class new file mode 100644 index 0000000000000000000000000000000000000000..03c8602b96b96325e9f9774cc8a0b39011173d1c GIT binary patch literal 1097 zcmZ`%ZBNrs6n^g7wOgq$CybXNilA--8K}dTErf+&LLBg+vZV1-H)<*ATGDkGeuIBT z%Lj-?;%9%9@!ZRV#Xvvw+~?l&ob#NQ-+#Ve0I1`wiUh-G5FC};2g{Xm$M(Bcc_Z+G zP=(Aed}tk8WzX`R@}}SGFeIJOwta?N<0ej(K??1C2D#<+Z1Vnm;6`L+C$vr&hBkNh zw&$Dm#@?pEF#hqj7^zy@bA2~jqi}^{llU9KzMVo+14CBFJ&ZCawZ2QP(70A(FjT)vbZL|6Nhx464Y!`{_SgzcrcPx%5x4w>_O~x=h3(D&V7K!USQRl};kB@D F{sL~B+j;;1 literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/mensa/CountCard.class b/bin/oop/ch05/mensa/CountCard.class new file mode 100644 index 0000000000000000000000000000000000000000..3fb923e145b162d3daff9ff343d6e2d9c9990716 GIT binary patch literal 1418 zcmaJ>>r&G|6#lj?O&bHn0_7%H5D;jkc)?ro0u@GPia1jS$MM&au5D;YI?0x?Z{Q>N z0z82J5C>=UzYnFJ^hPBeo9Slv?03Gi=R0Tf>-YH&02|m+5MUUy?P^9ZudZc|h2`>0 z&aPQ9$DN{rkbigA!+5(4;dR3@YT-g}0H?j-jPkAyC>Oa8p$r0g{f zQMG{Z2`9lz~Da>nw8C0^Bz4~4VO z4^6=k&)YgT54dA^>y|Mj%LWCW@GID=c9ul0h`Q%~Sqs|g(`~9BLw`YXy|T-zZQ3e# ziFRty$IIRFYum6$qyrVVkWsMW@1|TErC}Af8)4`;z4$tP*XW_B-gfMjQhSfitrqN> zql<0B6K0^(+ACg)RP{~UmacSobyvu;U367E#A5}I80IcSFsu{1B3g~zEax`YrR~(c zI#ZBO-KA-vn}jd9RWyY=N9t5+)vRCHF3UfT`}L~m0e{zp@6m%TiX1o1f+0mV7RG}J z=!TB(Sk%ZyG1*Zd*(hj|F=#uMC7hf|g%qxW4TgDN?!B^6kYkwsKa@Ta&D1di>Myz* zK!9d+?`c$M^^vTeePKD3K0_q^1?nj#={0zY;qMrFoBoE8b4&tfxc>7qA%mEuF^&+8 zVS4DYBZ7HEaf2+$CL89+;{6urxk<6S*&<>TeTn9Aus;L{Dqso{3VlC7m}R6|r+P}b z0NKK+<*!J4Q3H*rYQx%3=O1W9OEgiPXkpyJUE&DhUc+Y%_vsxW%R2p^;2Et{nmxxR HUSRw$vrB9{ literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/mensa/MensaCard.class b/bin/oop/ch05/mensa/MensaCard.class new file mode 100644 index 0000000000000000000000000000000000000000..2d18853f39595cb142a05d0f965e017d65fa5aeb GIT binary patch literal 1336 zcmaJ>+foxj5IvKGEG)}K?x0{$E=fQZQB(|yn39sJASx6-_%v)rvas1n?M^81OZ*J2 z@>V?f0e+NaPc{`}lJa49XZmuw`*ipI`hEEmz&4&3h%rn^S+Skc>bhMPe#q@T{m%2C zXduBbT-UDI4v9irD;T;Q>B)d$tkB||*YX@ga?|x)^_XEPT{z|E-1fMCVjrl$^-pr0 zoiaxZiM%Wd6LIufFkmr^c5u%e^?;$@LKl(@0|nO?FRJBZ5ghVkPcRG>q{F=<9=Q5m z7baB64H>3dV>ha$q!T_b*ZkWuX6RNj%AR2)ooTPh!~~`cOfn3%dRw@PYYfIY_o`z5 z9m7I%QTxZI!cn=7kPI^xt|P_Jb0Sn!Bttx%*)@rQ8y0S2jDWR{G9RL*&RbZ(BExu@ zpNYKm9j@NEszj$yabFPw8_mJ%4cTq4r$atOP=$vCF`aH@G0(%&OX>Pl2X)bW_TCW{ zDX-ma>W4BQV~Lp6*E|3Fp)N9?$|+x?9W zu4v+k|EE%_PzAiQC&<4Tnz(~?19utb{>Y4tJCcE;NJp7(O=hRJV=* zpL4(HiExfcIIC82?c6m<{&76KsE7{cZ=38pOhX+a&pq$JRU$W##9B8t7_CQ2?_`Rl z(kw&QUEdc$-lG-?;(e20zOCF&1sI?;o%z2hEp$|EVwMIkPJ_m9MeiS-;z-c0c9W!s zZm$rl>3g$F-(hB#zoPFmiDMX`cYjS~l4CDSSQsQ(Dl#WHJ-;B$Fh&SWpLBp2okuZN zhuZp4m&x0iQ?_1xnV825SMV$RP?qf3!3*B*~Jk24BK0g0yR% YtGG>HUCDiV9^fI}^rGeP2wRx^1GNuU1^@s6 literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/mensa/MensaExample.class b/bin/oop/ch05/mensa/MensaExample.class new file mode 100644 index 0000000000000000000000000000000000000000..9a52cda2475482c6fbb98d2c6675721d1fd75ad5 GIT binary patch literal 3414 zcma)9TW}NC8UBuCc_kr=E!%*M0fi8-EjtPj0ffWetgW|D_apZe0g34QzOGqkHKj@r2 z=f8aa_y7Mn$AACNjlTkz#Gf>D2yCi6U&y<90t4V?nr7xZO4 zQ_`(M=D~#v((nYjj+mC|9Tf--4bKU5X6?L;A%tigVRQ*>nl>$YrdnQ*&aA#rk^+fo z+t5pMx?`&E+G3|yG+lx1)3<;yLGxwZv;;N}Jvv>7GUGX>RhSr_)6hc`O%~>)mFIR& zH;P0OK`*V8e&YsVud{Q(F3T$oil-1qh zS=+QIyhC8adCNS0F%XYo8~QceCNR*XGiexh)$+2slaJtbftX=ii_(#nL8x~KXa^3A z?c0Cv;TTfbtI!S!47EYq7Qcp(HYn@5>qqq}yX~+olHKEMfCEJN( zANG^Hf}^jHvgSMMc2 zlX0B#30NpqS>ghxu;}Xx>&OqavIjkSL~cMnmqVHk(;- zJz0+9L7Zia*;P8}4{~kVnX{~WkJT^rGKoKjSq(D+y?$rhydB4RusgMi(kQWm`Wq<< zdYM^JM!u^sG@v^L8t84)v-i8LFcM2AgFXI*(GZMb!s>8?>=k50o8K zWF6+JQk9`Vvf1oRaCW_qN3*)lwVIVSg2^QTibKpl_LM!JkDBJuLq|R=Ax>B zRgr4yopVy1&oY1Vk|8UeX zwJk&U9_9(bnd|A6$7JqlETFX$xYd}dsPCzY`hHW*t*J1CXH*E!3hZ4E!IehUk@?JI zm7F=|Q@RRZJ(2`#lP6HLtga_jew-U?XRm-@V7r>r(n1GwK3o^NwL{8oobhyHDW_Nb z`%2v%ud43<;r~j|T2m*`p|Ex=mjxmUWPmp;tBy?;#S}9#V^&(SM6Nj~y!3_r&&G`uCSyM7Cr*0Q}MGXbwb%1-HqXFGl_-xhegF=I99 zz#vc7d`Y^y$;VQ)GSQmFhLxKXXICn+jd)|9ubnNeCbD{|G-G;lVpA91jNl!1h*K-t z@sx<*H@swY7Jy?1`A;qCq$uz2{f?!n_STD|zRA9uvMlLjOFXrttKnUNJ6dRJ7r2J^ z1$Nw8ln7^RvRO=F&d0l@o-X0c3#IkRn~<%xtZ+p zmy_XOhz3I-TT^M!R2q#I8r{_SeiggOtwx6VbR)-m$?HKfe}XIL$hbkyJ+|?SNZ`ll z#hd8EJLt!I*n&S}D=s66>(u<1Pq)8e5dXk-e1@I)oDZ=tnEbDBJN|{;_%~l^9oQr2 zL3HzVwuNu5ok)wl7!?_ei9>v;sGKhbdBx*+f?pd&8sEZ`%=&=X0iClB>i1xQvk>1- zA>zxkuujm2q;8m)zeE8=){%jK!o&r}=HXK;aTZ||AELxrlwNpe2i1hX(5foY(Ge!9 z`~mjlf@C>2a0$4I?|y*Z+S1cE@SMMNnL4UYBfMGExQ)kiNMXkgRiW6=wFBI}o4yWm z_Yk=`j5NmmC`X8y{_s4Js=raZz&Ln5lkFGr5^WFqvzIx0h5H*2I<3Jyr{S4Rbi(IU z4f@M;s!R=xqzA9!2LyVC*jZr&`lA|9)lgkDy#{bIp#ev^b{|)d(cUDJm~8+yz*Ij; z8QR5bq)S;C!0UK}aAGxJAs-n3ADZ$(h42#!b>OG?8OJ`t`X$wV<^TTL|NSj~&z%@o L|G?_`Ba;6Gon&3U literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/mensa/RejectedException.class b/bin/oop/ch05/mensa/RejectedException.class new file mode 100644 index 0000000000000000000000000000000000000000..b7d1dcbd6594b91b586724959e5dab59cf7bb002 GIT binary patch literal 373 zcmaiv&q~8U5XQfWX`-=Ot=O}A@(&m~ebdI}z_^uA4pbW5^ZlCAh!o&*m*Kp#q+ zMA1VJ?!d6W*>7jQS$)2L0JuRnghx2Cb`htutLwO6Q>plo=bSp8-o2!}aN3#>KH*@l zo>iPHlf}OegkYeJc0Nugw|2@AHn7!33jv{%Xu}W7V#4K+in|G6kW%5GLCU>PH-FQG>#jH?X-2d6bded)Fjl96sayo6)&8OkL+pe8EfV^ z5FYsoUibqZKq6Es61?+Kh&7i^oZ6t#%(=|oYwxx8KIiX$p8pA87Y7Cs0_%=5teL%A zw`&7sd$QJ6cE_^2htlj>wla_sSb8c?WUVjlZtaVsr^?g@W(784M^Bj}S9NMFf3);z zqi-o&3#5nA^S*W5j(}(iq-;4*0=a{8xR!Pqt1d93My}%t%-*$ZOWza7mnY4dl{Qft zPDf>s#8MVnEDI#dmG&G2RC$CQNtP?8$y#*n(1s$m0}W&@w!Uyg+fvlCS!Ee(D5wRV!iw_ zsfP4=4e563fvlOm?@Tq+7Q-6YVbEBD7uDSz>7L_S-%H;pwl;7>pmbi*CS~c${;t~{ zQ9B*mrBR~@4;}kPkdSqvicxMET*sS!E#G40rckZ4Gk6E@8n{i7;;h2Lyx@? z{w=^U;h%htGyI>$JiiNE9dSR&akcski`AVoCR&mFjO;{o!X$6YxXK(f|bYA@iY0 z3~Ashfp}?RgWgfDy(X_^cO zhng1Yxk-!?F0tP?u{EY?DHfoFJ9s}xv=me^fe#psm0sYd&S?U7@gYZFr3T+mu+LS7 Lvro~)=UDp}t`d~s literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/secured/AuthorizationException.class b/bin/oop/ch05/secured/AuthorizationException.class new file mode 100644 index 0000000000000000000000000000000000000000..7fbd226902b2472d256f2c36e02487c7c5384e2c GIT binary patch literal 392 zcma)%u};G<5QhH?A%RdRq=JQs2?`QnVQN*WLNG-vMcv)hN{rIDavW6gR!m3?JOB@c zI0pm+4EUteedqtqzu(?pUIB~|hwuo;S}&8VxVTJenKeevlW}7UZPcT%N>|sbOfFp! z!YB0Z#e+ynQRT_^1tA!!O4$)%|0MkpOsr8=KIl&g{*|7~2y58vU>yOWo2p9QHj9}w zcVbpbLY(SMlv81pP=|4RV2;oB3waD9zzq}BliEd0LZrBi>kL_+yKQf0 zaN3i$W3GjJbeik(Ao$wz+YGEp;JdbK%SDD_xjAgCvcZsPcx|C0jl6*|j5DOml?@G( zeQF8wIwp`G1;ZHw8ggoO*1#xqHJdUpf-FOR*>=T~-p;1**ZHO+6i?6M&Ib2wwT?G4 zvSSAfv&;XJBnnC25;9I1L!n$5j)O2k0&}Z;f>m4YH5{8#Umv!ia-lzZVTrD^JvY!W z&v0dk-2I;Hc)tA&SD*n}r}!@$xPmgnDObFZjShDl;cij%l+NZDs<^75cA_Q*#0;B5sO_r+H|n{?I3=y(S=HN4v|U8t&-^lf*`z%9H- z(%R)tPpp1Pbj!!2Ah8u)t51@iZyUG+s>9hGzAdN_7MD+L*`Zk=xhtuPM~uZclVysx zbj;zNQW@#-Owxb<3Y8#hg#|iU8G}?2qtQW{DDN%Ft?d=w4F#s8`q025RS`{9r0LSj z(pz57x5SdIWO@4NYrLkO8fET*=gC0&yt^W()a^jW$5__z3B&xqkI{B_y=`GeyrYyX zaZ7ssp32n8ZchO>4 z7|O(Pv1$06;lh7Iso+r}FiXl#liJcqsYXJxN!4V+ky;FmBZL@(LElrf>JU=l&sPue zM)egYo*m-!J_^<8eH5!#_i^rLI!)m`eT#G#Vd73QARe#MQKcpo^#-9HA=q!ZEHCKq=ok~$V}kNV4E z=)4-49Yj;Z2ly~17ezCI%k&SW8vX+!K*ayT0waRdya=ZJ*8AjitpD6ouWJ1G#My<`}*~j@Om+V42WtWDJ6lW(A`IPtSFGlC-hszXS7mf KS;IOuF!c}o7Q2c7 literal 0 HcmV?d00001 diff --git a/bin/oop/ch05/secured/SecurityClient.class b/bin/oop/ch05/secured/SecurityClient.class new file mode 100644 index 0000000000000000000000000000000000000000..aad3c94860def65e0e40238f30c46e7f8e2b917e GIT binary patch literal 161 zcmX^0Z`VEs1_nn4PId++Mh5x(`~v;t3IQt6zNnVMI^&cMRR zAdr<b|A^bzySayqbVl< literal 0 HcmV?d00001 diff --git a/bin/oop/ch06/calc/AdHocCalculator.class b/bin/oop/ch06/calc/AdHocCalculator.class new file mode 100644 index 0000000000000000000000000000000000000000..6a5e39e47ffb7a57517e0b29af44974a8408fdd6 GIT binary patch literal 2383 zcmZ{lNmJZb6orrIrW+bD4>n+IgBiMop&0_UF<>ywlrR`WCp6m6(IxykA8V2KgWTIb~cwkvi5tSC3-SBKNfseHbphz6WQIX)-clOP`v$yu0eYfxIBJW}W+MU-bK1F#~crVs|LiHOvtd`e+ zGl@EmRd-yE20pRExX!DyxyV`5-lFlxg3aac*<2*fb2rbBUlfG2u2VE>XK1-dUtzCQ zQCT&$)YvCAP@&K}7&5wTWAYn=HuucGSObaL6QG}Q=NO-J6gftN=08P5Yd$(dw^n(I zo)e64rKj?nZ_%bnv^+H*?Z+ixgX20x_wBeEtq%PXvEO`TufE0L?8KCIOPZ8O0x$&+-}V$ z9qE>dGmHtYjZ|wF_5@{%B%R{)8(U`=Nv7ReciR3QCgnZW<30%=kZ^?Dql_9O?>N~e zY`WV{TCc8yn8h4V?50!Z@gdzJ#B|MzAf|&{_=xRsnEz(sg?YncUU8Vo`3Guk*PLQe z=7vtt!Kk5ExGB@3a#41jVOfO9P$IieG3Y8=^OP;}3v#Z^aZ!xQrm1X(^`E6*=5U9s zouus{-UI>Xumsun1S|Y~if356q;|toyTSePty;OFwiN!()>&8Yq-Uw`s8?Pdc`+PI z4RA!4xUG^0{#_QPID!_~s&!9LFZw+}ZTu$!;#FgVVm4{1En4U~BR*w|K4bCqOZFde z!3SJi$Np^27cT5G5B51*BmQslU~4qn^R}y`B^U2z104w@SXG1jcbIUOZ>DJ{c0O)R xm)y&98+r7GmulHfRbP-m6ZIG0EGJ8nxn43;irXz_NMFiQ?`Bb02>D)b{Rd0ejT!&| literal 0 HcmV?d00001 diff --git a/bin/oop/ch06/calc/BinaryOp.class b/bin/oop/ch06/calc/BinaryOp.class new file mode 100644 index 0000000000000000000000000000000000000000..24469365aaa880b880e06b0293da15ddcd96c117 GIT binary patch literal 456 zcmZWm!A`A@Q&DMB>2@@S}`x zTR0GQv%7Eh&Ayr4{r&s?0Wd_j0*%l~lBFBW@9y0|M1lJ#W08K0mKErP#$j%>B$OXy zEVBWjZTs(HBiu;DGk2V&GM@FF2|<5K-a->4oLDeWCe(cyhcD~JG)!N`Gztk#KVhwj zNTtHNO+A~-6`|`NYVQ5?xpFKP`ROBF&V?Hh5e(b&9FI`VlEM<9Wjn`4mA|%yCN2o( zI9aDb_$-yR+FtKgiRf1#W~x?#uCBwl!e{`EJ5cW3Y*GEWgG#W1wJth{2)$Grbz7G+ zJtA#!N#5TtIYs_JY-Cz6D5FleXJwo$JhdUoLd9!Nh)SqSwyaVhXVR345tl Aq5uE@ literal 0 HcmV?d00001 diff --git a/bin/oop/ch06/calc/Example.class b/bin/oop/ch06/calc/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..f4e2f3ba4541d26b4586f6321da1b9313b5bcb0e GIT binary patch literal 1192 zcmZ`&TTc@~6#fRbY+DAo6j}rkytfotP{B(PE#<1EEf$)niDuev%98DFvuugH`C#Ik z{uX&Ci6;I4f0Xge7DHR{VQ1&e`OcZ|J9Eyj-`{@%NMc7t7sH5c*R<09+@e+zW=UK7 zAgVP}SD`Qr9Ec;KnZl}Q+2Vm-av6G-49jqr8M>pf0)vvW%X$#q2ypn&!_c2LEIm`N z7IkM=6iuCBC~Z^Xf^ZCJpB*ahzH!J9Nndz*f)ZDSVKIcGZ`0=_@~&f8l|-zdVvu2? zJvLe1v`ZDl>AgI|Xh;243`;o2*_y{_ zp5q?wlklQpWor!M(f^^F^;qCol=bkHOkFsV#3PQ!-fi1^>0K!@!LcMEihd+aiCE@% zhUW~usm)|&W9@x@Ya{dTv+lL9TH#1xl~U9_Qe&N@{$iVDSm)S~`IY?6E04hz#|z28 zFHAEfd6G{!73!tX1)V}p+0+b^9nw3Rg&HoHx9d(xUpHjW^0O(Jm2ZYA&|A{P0A2J^ zo0F~5PNP4QC)20!fAicyTBREl&`T?C0_fjIRsfgKPbU=2B7~6XzW%_#>r82L5;aer1roJHvXayv>lj3ikh=)s9fqOP=-Cu? lga|%j6rX6~zF^ENO}Hr^FOjBu{P>J*WT-d{S+cv3`vZc)`2zp| literal 0 HcmV?d00001 diff --git a/bin/oop/ch06/calc/Op.class b/bin/oop/ch06/calc/Op.class new file mode 100644 index 0000000000000000000000000000000000000000..e1ed32b0c5d87c96cabe275e6082dd7544772d09 GIT binary patch literal 776 zcmZXR&2G~`6ot>kPMjF0O-ozKPr#Hw?G!L8HXtO_Pzk9di&T+dH!-G}Hnk(i$-D3r zfCMT63HCe`;*1@rN^Olj_s*Sjzd7^k_qQJap5uXql0YL#CP6rQ^f(CRI1G9d3nsHi zaxR0hj1Pm}@F)s10W+2-k-+Ny*-}4CRebnFpz>73Dtjid?p<8=2i&}yyp3!axa7cs zBVc&`pay{@2W3Bjk)Y&5Z@k6zVnTMq8(2DX~MjNfVNqAIp&hFU~!E+Qc2 z936prKa=6{D>+%%VE2<*8b*6c8)fw-5A~gxF8wrkwe&}u%9#OE_hhEVXb&a6fZaaj z*!hC`Cq^YK^ShMqtmO4I?r1Q#QB-4vdit?*RTAMc))txp|AK4f_Gi>Ta#F}u@}!f? zI7Pui#>6^>3!s!uHE?VDE3Ujp{X3ekS8tu-_D?46{7u};6CYS-Q>l=V$lyXQhOe+;Su2BmP5vz6vO?{g>Mvg6#ukuN(3)jJ03RJBDOX^a$*L6%{n=}U3d>$XI6%Ugk9 zm})ALyW^2>>S5E0Jzo=T^RIGZ>40Ih%%zfpuIlNUVfd#_%A(H$hD@biuh#RR=?a*^ zEOlH@xDWK8LI9O2l8{%jK6HUeb+OuB*6G~A_#J=M-(m7)00 zB17RqN)ep~Tx&sN*jGZw=Ss&Yk&!g597s{nMySqFwokR`WH+~7U_T{z-qeJfbCk}x zuNNp_j4IO|#{}UFlPC^(8pN3)%--Cny3d$;q&$URCOcs&B_8Y_CY!kD6D1o9l%-)| ZG5K=|%XC{

vJGEYdhK-#SGKE1yU?Y8wCm literal 0 HcmV?d00001 diff --git a/bin/oop/ch06/calc/Ops$2.class b/bin/oop/ch06/calc/Ops$2.class new file mode 100644 index 0000000000000000000000000000000000000000..21fc36ff03e962dd58f824d6e1fe5fa517af6137 GIT binary patch literal 581 zcmZWlOH0E*7@Td>HrD!nzk3jD6^wfDpdzSM6sjH+?`yi)*mSofso<{?FA5&~0sbg) zHog!8yZg;Io0<9c?fvByz#hs4WCTWx>3Du~ZPW8*=zHg#cyXfuM_~Lfu^(s|-Jf>^ z@;iYJl3jtZO8r*eNiUT8#=A(OK;LXvuLPU}(@;fZ(NjVWd4Yj?pw(HoeXXKPc^xW& z;ku#Sm5c(5znV_c3}VXG|2n6Uwgq|@r8fG$ZMyNARru#kXLTn-fn23ltJaF(bR~>p zj2*wJ{1z`%ND!KiZmbK4?|MU^cwxGcuZ{wn&!y?AHDLHd?T04jaHlG1nnnS00z>~I z3Y1Q?R?$Hy<5+PF_e{mfv56Cu86?Xm2QplI5#j=?En?frFRwhqeN6eH#pHn!dby8( z-XQ8DvRpp~$O{Z&=u78_nmKar@=~?+gy9F)8T=~sr%L5CgZrc8QhOqGaxuv&3kOr_ YpVOG(>0p-oJePe)o5+3(Tp7%M093?kF#rGn literal 0 HcmV?d00001 diff --git a/bin/oop/ch06/calc/Ops$3.class b/bin/oop/ch06/calc/Ops$3.class new file mode 100644 index 0000000000000000000000000000000000000000..14cb4c4ce0a69deeda3dc40552064650f2b14a9c GIT binary patch literal 581 zcmZWlO;5r=5Pb^;Dxe4oek%tO0TYXwco1WvAkhTzpz*$z4OGi6X$y(J%6QSlgFnC@ zWt^?3F*cdqnR(my-pu>Q>l=V$6cdOr%qcar?0#+Evbk$pmqWj_mw>@g_zRpkl6w!A zLx%XFBc0%gAzyCa@iDhtE_>Eh;5o8auiP*g4b>G%L@|{{3~`1`+mWI(8r%x+n%}yD zA=g$Ucf&nL*OR6Z^c|mQ+kcfqOLc}+iAyCP25RKjG{Zk_QWj(GGQ`TwW~G?~O_#mr{5Qm;1h;G0cwegEQp^D3XyVtsIC@&_<|EPEGFEF1%JgIBKfgDnF z7QS8}jcKYhHiHb|4712icv{36Bh0LBR(j9KJyIUQFVlR;R17_sKTIZZFN8`a7AcFu bz*6|I(?6~v^i|5Z*cZ3*<0r8fHh)^y?(%kWQ|%IZ#r0@+HfR;?Al>53S^ zC_8>j`8Rw}A;8kKb#qlfeCKNdg>%!1e03ODe=bFrtpLp*Xg@SDhdWV8%QW+t6&Ua~Bt?<_SX&%rp39no5~UsR#Fm$tCxAs^n5@oT!7z Y^v@|w^L8-9bBbo{_=K2WbXsQ2+n{ literal 0 HcmV?d00001 diff --git a/bin/oop/ch06/calc/Ops$5.class b/bin/oop/ch06/calc/Ops$5.class new file mode 100644 index 0000000000000000000000000000000000000000..a4f804c32c0f9e63f305976a6001b94f6afb9733 GIT binary patch literal 552 zcmZWlO-}+b6rA$42q=Q$2P)w}B4FZj(SsNh0~$>b4k-7sG_bm~WOu>vtBe;-Jop3r zQN~v!DzV9HJDr!A>HGM6dk1iioPhwtno=Xv8dQ!=i#wLt8hM2y10jaYB5^0VJ8g{^ zBB!>r{WEGPHtzX^n+}(Kv+cXK>{m-2hEPrQL<~VJB@jl0A=$8{XpV)JXOiSe+r(R%6!^m$r@*C67a`M_DhVKWK!Nc~I1khqpoxHX4+ zo}kpxrtthL<@v~yagYWK1gK~Lgbli#5Y{h|^1&;j&oe%zG4VhSaoRV&JCMLKAF!U6;RPyddwRFWe{HslsMVm)-l&a;bgFy`27-H!A zQ6BLma8W>xMEW*P959T!7&D1(KM?*k5vnO046MrF)Kx3?#eQgd&QK$(#)<~olYXQ$ z4SXb$Ks9X4GUWcX&EOtNDdOFTYb|KB%(2kPfzk%zSeWeSr!Y;Yg&ErCD9n4AM$DS0NMYs!`TK5j literal 0 HcmV?d00001 diff --git a/bin/oop/ch06/calc/Ops$7.class b/bin/oop/ch06/calc/Ops$7.class new file mode 100644 index 0000000000000000000000000000000000000000..792eb97415b218934edf02c3f7a926d8ca0e2a34 GIT binary patch literal 590 zcmZWm+e*Vg6r62i)5dtITJLuYY8B&?f;SMWC{+8P_I;Z!O*HO?Bo+Hr;){w8et;h( zo~_~q17|n0b22k$^Y;Go3Sb`#CQ=N8N`;Q=t#3Fk4_v1j#>Gt&21DU5aVdG!u7(Vm z9bfv%9yKgguJ|o?0xp}*c@p`uxxHLtFb-5hSV$vhqYD{^zKSo!S?i`Qq6=OR1j9f@ zkz0*NzQ$jNM&kJ~$yWXvcM@$gbQif)vVEgk@w!&{=S|MymIt&gm6yvF22n6E#L)ZG zdCC*d#xU{>X>k`?U>LPArg4|+3HO>lR-tS#urh;nu3C{Rj(izd04XZEB*G@WZ4uTdnbOJ= zvJV~J(wKOlgl<}gKRaNfhmhua(MLQ(Kk{EXyQHr5bEU;+3_N1wo|cv~*QikvFF(h{}f0@j8V$9OG@;ZRi-WpG=tzl+13n!|2cOrqbL?t^3O(sO&Jmr z0$%nNY>L>T)ZDL5S3)jQyp|zz#ZF&EPDGJfnBO}R3Xxz>#vLRWMl{Pdt5;vnOy|Tn zYncp+)~4%nYB(1E4~r6FIO5@tP~Yx_m=2KAm4`kad3YRPPFLoAJoE58Kw4K8eJpuc4v^KARUhjf zHUi{y<&}?Z5BUHEU3ueU*F))7*lwTRbJP?x77u<33g+pZ#SHTFb%YE~u#AI{%?G6D zdgG~tjOv3KABWd=Lt!x>pWs@Z2PbvZ$C3@05%=R$X!$J?M PgrlK8MVd5?n?vD0hZDNv literal 0 HcmV?d00001 diff --git a/bin/oop/ch06/calc/UnaryOp.class b/bin/oop/ch06/calc/UnaryOp.class new file mode 100644 index 0000000000000000000000000000000000000000..63965e5cc9b5e9091cc9ee1fc1593350ef576ef5 GIT binary patch literal 452 zcmZWlK~KUk7=7Q^7|tn(AYMI~Y?wGtUN9s?;%Sis%Dv15YR0yVLE^vC6Nv|ZfIrIk zb=!r|rtSCI*Y{rg`}h3=V1!E(8ljscsTVBo?!7=nf%h7V>|>Ie&gsK_Dx!EKxrv zF)tk`o|T$h!pOi@T9A@hlFG=ytf3jk$iNkxUs{x$>Xw-U6yk+x)&uEdV`KoT0@}vF Tzz8&pm4OY!Vqgc7Obi?Vb+aG^ literal 0 HcmV?d00001 diff --git a/bin/oop/ch06/observer/ObserverSupport.class b/bin/oop/ch06/observer/ObserverSupport.class new file mode 100644 index 0000000000000000000000000000000000000000..1ad26b095b7c4f5c7654d0e8cb6424c48803b52a GIT binary patch literal 1059 zcmaJ&o-c1z^NAL1YI z*+fIo#Q5w_@kfZ~maT0}=*zu3Gdt&;Idgyg`St_A4jvi^2^L(pU92@WHj8exV|z!o zS9~6PRJ!f9>-h#Eg5;q(QpKif9k6_8*L=Z5zoEl&xmWM{PP15cI(~`eigVCXe%G@F z>;ILv$``Yiw%I(k<+L1sTM*9W_XUy1ZrwH!M$EzlOalo)X27`PdFoixnusGd0YTcr zC5#CYWv6BDb>CHO?}e&1DJ5NYYpS`gJV(btGU7KJPO&&bR$vCTC0efUygBZ>)QRE> zt{RvT#0QeJ8Vj?S6O22)?J3{&1XH>EkQ2{>d?|`~EEu>>bpwQc)xr%d(t?)#o~CE} z2t%tV8MrB!x!BSumat+W2b0cr+jZsJnzCSF6>9>cp*nj#bh`aoAg*9`gcbB4R`FHs z?XGGE21ZrA-Zw-rpBvSk-`9@awQvvjxnOn*CUfV$3{Rz{m=(9{)$FH^UR}1&5bR=I zn}r3gJIn`7^YqSn8;n92XO^!JCeJ7{k9skXES$h9d`JA%36fut`rP|F!!zE)8AF5! z2_j{gv)IiZOk#?+VEP~42S%EArSJu*Q(PA8enMvL6xRelu~c3?#j=2LUhwhkx26e0 z)1*lN!c0@v9Pee4XsRiSCR{)@O#!#CPLd+CDTK}tL)c(!aCOut*uZU`dbTHQ)y=A1LX|NQs~K*u`;5rHwsscEH?jZMv{dyZB%ZPT?% zr<$%HDliqYTJ#Lh6zHzkYNjhNT?p~}AlI{WtT_R_ATXk$8$AlH zhg1FQ#W9Mc+%Ta+L9alfVA_Ue7xxw16Bzhpd^WU-VVAYy*{Nq%Rczt`Pju=Ga-`rdTaLExTDDj8T+^s# zd+~_%)Yo$PIJS^e@K|7|gQJQkcq*XOf@cD= zAwAscHwDkb-wR{Tisuuy!d6=mW^-B0vcbCez#~Y?wxpGm-NsSc43F#AXnjPKKEQNl+^u%p3~{r>r8?qnw{S(~+t21V+(|xcAWNS93%i%dA2!VkylCK6 d`vD6q)*_Es`tN{LGn)~-VL2k$!&`sc{|j^`I+*|f literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/auto/generics/Automaton.class b/bin/oop/ch07/auto/generics/Automaton.class new file mode 100644 index 0000000000000000000000000000000000000000..32c0cdb7cc96dea108328888f2af15c35ca6b4f2 GIT binary patch literal 801 zcmaiy%}&BV6ot?5S6eC|qN1W!4GFNYCN5l*5Q&K^bb}#rIn)M5p*5wL_*S}+L=zvt zhcezN1c^y?Gc#v;=DYVy=kx3B13(jof*6D0c@L)DKRz}2IPlD#<2t^uM`n}MkO!Wt zAi;1L;c5pwa4xys7p}vQstZ>H4TgB7+F?kXd$*2;I8+@;Xbk(6)?XZ}+R?zE>sUsL zA?dh*|HP1O5&UXA>^lB6?+&O=zUA3`(BZz2dbXJe`eMXz5LIFx$f6RmPr(Oa`wXQ@ zHS(0DV2z;|(RWir0UI)2k)a$J@29rB7bCh{*pMY}VOvKYs|;G(8~e6%A!P8(9CUQY zA31~C7Cn~-W1l|WM`c+2N%bhxoNWE?Xjm|)#W+19gkusZ(h8|MVzdIZ8k=CL_KNfi zsTeXeW@cXLR>_^EJ$>p%4lAS}GtWpT^fgc5Ph43IB`usQd&wWrGZkCl-A|MA(bVF#3@2ZhDaPYVdZX>c&*JEiJt{R ztppO{%#T9Mt}SuFJ=orvdHd$gJpcal{U?BzcLwE;)L4X>BZ1@g`qP zg?`7UbL!a{s~Mk9xRy39lMQnrmkhgADn>&Rn{h2t!?0h4Dzq}NDMP*2pR{oY+a9(U z)-U-d9?p51gz@L45sLtKu|p`86XDj_m8A;bYMGkYXu%i57Iy8>C($b(d)W8zfMN4L zzyJ?%z~E)}?mQ*BUcpziGn7tf7i};+3b2O9H%w40&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MPJkP7nM$zq{ zPHh+I-2w&r$PUF8?Yb1lnR5H^4wYX?eU4T;!^KF4;@N|QV!~ra!mT~zg zC7H%=EZ5%N;$8a&jX&6Z!2U(Hy+iXB?U~GcV#-DZb7av;q@0u_lPchtL<%^8oBU7z E19@81wg3PC literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/auto/generics/Lower.class b/bin/oop/ch07/auto/generics/Lower.class new file mode 100644 index 0000000000000000000000000000000000000000..f29f996e19d72d2f189f21496dcb75e860b34ddc GIT binary patch literal 1114 zcmaJ=U2oGs5S+`G6Jwf?G@+EXq?Ce_(z;L(53V92N_hzgDJT+8=n_teQDR5V1;oDs z9$JY?`~ZFwV()BG32`Wj?cJN5o!Pa2{`&p{Ko^fKWEeK0Xzq!-rGqSM5b3J{|BlP;r{f$w{za*fJ^5rhF1R=dlPS!@3FCC6uEa z1$?Sy(4^d!34P*QSY=o<7(cO5LqplU{y)2kIyECUWXQU$K?ygpX<>t*@_~Qk-js)9 zum5==#mvDLZV@V4l8t |w{5Iu1hFm$Be8zld!bcXz+@+{O-eE!<(K{R8OWF77c{ zb5%PHiOx;j+mf0e;aM7^AaNohcT5D+>$tWFN(>%Il$Extq!8KGF?0&S2 zN8&V4Yqs@J4wP!5><8nJ%VkUl?@YVUgz0N}Yyu^tHl23;j*liu%F>4d^uuD75#^QT$3z8C;>Ot+RQJbSQ2lC|tz~MTAEg72<$$nQ|Rb2bC#Zp!T+Xj`|l0 z5<1mRkt!-D0sWy`!;O^S1&LF*`Zugsn`gM)zJRNk+Gp6i)V89Xlu;xFtJMFJw4RVw io>KN8CEcaFBFz(t_qQVYEa*rLAcF_``VdF@{^&Ps0{R#L literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/auto/generics/State.class b/bin/oop/ch07/auto/generics/State.class new file mode 100644 index 0000000000000000000000000000000000000000..b8724383cd45094f795ac5484f054815618bd6cd GIT binary patch literal 1482 zcma)6YflqF6g|_HKGuaIAjm@m0cp#l_(W-KVo-@m1H=-(ZKT($z)SS@?Cn)C|{YFfT@ z8NFEUmxGb1ic@o~pzTY6=*clH$)a6%Tqh{ekjb73#P+>2X&{Ze35*M*yJ`39R;y)V z0+RxXnhXxD24SW$*_+e?-*IaN1NShKz;w@@LfR(oW0p(^5MDrFD{~v62ejwDDG1D) z7(txu%8n}!+l{L9PpoR4bSBE4ZPiaL-%1&}A<5nR=(2HjZrMs;Phh6oB0Zg{x>vVoY>5g+`6)zLd)AGsaV00MDQz{lPT~$s zT1IKv(@R*bI4pXenXGqEV^kzn#&qqT}%ap z@CvkR2|=@ip;m^3$_<8E8xm?`Fx2{xP@99HvO_`fe}PGAsT$=S-%8nJ?h4yic>0Cw mu*jkMTQ?Asx71e_rG6AII7jfZ(?Yv=#l0%=YyQUy@zg&Fi}RfT literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/auto/generics/StateMachine.class b/bin/oop/ch07/auto/generics/StateMachine.class new file mode 100644 index 0000000000000000000000000000000000000000..5a2a43912e60edbd5290510294a47091ed181bdb GIT binary patch literal 3140 zcma)8ZC4XV6n=(;Y>2A}RTOJwm4G2B2Iz~H#8g4vY!EewMf1Kmcjy?Su zJ^kMAt;a%ZPuuVPQ9ZqPcO`+u$OkezckVp%+-L5+!@vK%`WwJa>?mjx=(p{1y0|`a zHLX`&J6)2Nbc|vpU2t_*&g;c>!;%WZ0_R&f3ba>vgTRG+E5D3DN5Lprx?6R~xxb}z zcCnDj(T+&gunadRa52%+KQpvM&WXjl-bZ-SUX?L~a6&}~Vgj9c3gu39b45Cf`ie=% zcjxV*ZZ7GL!SlcvcGr!Hz(C8R0%4e3S$Cx63iKQV+b+Kb96kyX$4bOG+z^cdD#vW- zrgsklT4Jar4DA?ri_2>{J4&`|2e5;!74^3aEp>9QeqavSF zFmXVhg2!3KElde0Te?}53u^+D2sOahLDZT2ZJBQB95X6rF-LN4>Kk&>wu-v@&~Vr3 zi?~`Y)z0mDuwZ8+R-%}KqhfWI0~;5q$2M_qR*sDjle%dZ3|D44B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K0E_YqOX0E@--3&`Rn5{JbLOq^qqep>m{=g53z zL?{t%FFe0nY2nt7QbV%izS*&7dQUG6TOn- zEHuF<*#pbqmn$&m9ge#d;8q85Y2v1cn-0ZsSHf}m09PEu%@Q|9Ts9QPJqyR(4se@; zxEygy#4U&7j4Rw5_FMHX`wd&Ehh01(Z}$>=hss{yc^CVG=oOA>m9?(@gUF6Pd@AyMVDV3h|c{t#)&^o=$siBxKG?oV}R`Do6&nS49jLuMRwpR3b zCbk%AODFEysKTN@x2ij#dwQW=2Ni5G*nK&T{oq>Y9g2&IPM-KPM}v%6dJ!b2fjnuG zR0kQV0K3g*SZlwd@J1?wBAvz5tKAm4OLXVV-6&&&6m)V*IwQ9xS)Zuhw`Zuml9+>Z j7*O~Fu;zgBB>}cmz%hNb&!8!G{x{P*B{-0!o>Y6kgO_{E literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/auto/simple/B.class b/bin/oop/ch07/auto/simple/B.class new file mode 100644 index 0000000000000000000000000000000000000000..4a317e8cb6c9425ada233288840bacc964d67b02 GIT binary patch literal 670 zcmZ`$%TB^T6g>k-X{|3*RD7WL0*uz33k->vxI$xsA#pk41jdvODT9fhr7@al;s^Lq z#yh2n8(g%VbMBdQPw)Ny`S=2GhKhv*Lr$r_*X|ylczmdpH;}!)FTA>i6hnS&t*N;d z4CzxDNL^znlp6o*s^u0#>RjCm2T9m2CXi;BX~;la4SRPYyy15~xn&!w&HWY+rNJ?o z(p@=VSRU_RuTqFU4@ICE*2Zh1tfXU{Az3Q7Y|LZP!UDtW1ApY6&x4NFd>UxcbCJUm zsnn3{78_AnD(^a!fo|$h@Ln~875bU_VeQ<(D%LHmG0cw9AD zCb~m|vB9wAVj43Rw*T7%wJO3k!`pMQZ-!@glveQ)oTeIvZE+#Z4Ab=^69${)o1_&3 z33_PYge^MN2pc9{Ie16rIjTGKc4D1TP7=uGRi@h$9ikQ_GWV6d} p$X8ym`HAAK`MzW44ZD90rlU9xGGw18ThqiHU5}eEl!!~9{0pLmist|T literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/auto/simple/C.class b/bin/oop/ch07/auto/simple/C.class new file mode 100644 index 0000000000000000000000000000000000000000..c2b12af88623c36f18eb555f72b203bc33d12d2a GIT binary patch literal 670 zcmZ`$%TB^T6g>k-X{|3%RD8byqjl#3L!u7j5U9d*;LO2r6xnFrtXD&=u{qR$h_KE)7vA nzhUze+jr*sj@=>l{u)e2aU5jGzCgC7i95O;H(@9emq6(ks8WjR literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/auto/simple/D.class b/bin/oop/ch07/auto/simple/D.class new file mode 100644 index 0000000000000000000000000000000000000000..7cf7ea83e6115cc7553ac4036bc42cea94355311 GIT binary patch literal 670 zcmZ`$O;5r=6r2U5v{pq_RQ$#-z-YaBz>pZx6B-i?iN_T;xTbVTSxo#{8l#CO{s4cJ z@oj111rKd^=FQHVzW4p}@de-n6$=T5yiz@{eSdi5@qt!eUv_)G@ah&)426-krsi5O zq>p7Fb&X-I)c9XlEw>m_r|M2PNWyk8hBU)eLk8k<(7hGmHNW-AE!R+O?zea-4UWl_ zzL$N5h0*@?Duw9rPz0J`d9)_VN;<|FlBIIX#th~x%rayj_#^jx9(26sQ(ud&i#+B@ zr3Pd-*NDnec~_wfbW?|dcdHpJ($CcQYiACYuwr4EVP=HT#VXbqte&~+2V_?o`VHG@ zqB}Gg8w?vRCNX7U^S@0{t0HVOyd4+2W_Wf-X%#QQX{tfk7U$B;FkL?|VX#iVNm?~(=u#4Noams@y4 oq4J9LPZV#=_Z?er*#2uU8O3psA^QT^nkMe>dfbGeL|g*pU$gUy^8f$< literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/auto/simple/Demo.class b/bin/oop/ch07/auto/simple/Demo.class new file mode 100644 index 0000000000000000000000000000000000000000..d2babc6afadd3b716ff92031f4c1b05ec7a3b853 GIT binary patch literal 949 zcma)4+iuf95Iviwwc{GaHy0=r5`?Izc#5DRC<4LD#<3DtzC?+Q#Am@n zD}lrZ@ISmF&e}i~DM;+Y&g`C@*)wP6`_C`m034#JAt$gBMMK*e>>b!Li6eXL1w-Gp zkK7>AkQcB{RVZT}LXjl|j zpBjJ2VgeaQp#ckp0+vwGP@br#{c#+-fr(34W-U>|(#qK{USuEhih!MsRh6wV+EFrc z+~=O^a6t{su2KaXpqd;oAV-fA!Cm9YrWLfan`h8JrLe(W!C=5VcQboHdx56{E@FW< zD)pZl6B-i?iN_T;xTbVTSxo#{8l#CO{s4cJ z@oj111rKd^=FQHVzW4p}@de-n6$=T5yiz@{eSdi5@qt!eUv_)G@ah&)426-krsi5O zq>p7Fb&X-I)c9XlEw>m_r|M2PNWyk8hBU)eLk8k<(7hGmHNW-AE!R+O?zea-4UWl_ zzL$N5h0*@?Duw9rPz0J`d9)_VN;=kNNS4Yi8#9=*Fw2mA;E&w%dC>8iPkk-AF7lWs zl^T%UTq7z=O>ETbxTX!*uR!iGs#_TG_sj_MA*omgj-v0o?5^)KXe*wE_iuV8j literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/auto/simple/F.class b/bin/oop/ch07/auto/simple/F.class new file mode 100644 index 0000000000000000000000000000000000000000..2fbdcc71c26f1f0e95025c4399869614ab797110 GIT binary patch literal 670 zcmZ`$%SyvQ6g|_{rit-YwQ7CWS6k7zb5SXXkX03-QgAuep&dyxC7lX>mLduYet;h( z-bn*)>LSUUbI+W6a_{%g#}|NeR4t?!3QG08cK77e<3p{yf$a4I;rSLa48^gvrsi5O zWY1(Mb)8|e-1uKttF#z07wTR(NW*q9fh@yJLx$pN*t-+a4ZjP>E#FXW9<+EQ4Nl06 z?#cnf@_2v0Mj`q<5}{^T8?TA8l8)Uoq|23-jd?6uSYVia;E&u3c-ZlpPXjG_E(%y8 zl^T-WVk0g~DOk>8v&VQSrRwdYGc>696%<$}v(kfYk(^SK#EqrNanDviM7;KSmnpO;? z=%IlVw&+wRY?y5I@Ey75xbD!~NpwazNw_dl!Nn9I(wm6n0nB19@w!ANW>#O2&o95B oSbfFTCrY>G`;Of=?EN*Ej^jAUk$sVDO%r!?J!!&FCN71_FTA6Q_5c6? literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/auto/simple/Lower.class b/bin/oop/ch07/auto/simple/Lower.class new file mode 100644 index 0000000000000000000000000000000000000000..105c48a35ed631c373f6eaf0c4149f362e28bc91 GIT binary patch literal 909 zcmZ{i(QeZ)6o!9yZPSFXcHKH)jExNnX~vdGTyRlTF)`pKOh`qQxO6+K^_0d{>Tcq# zfQwFI5)Z&bA&!%ZNhnnm$H)Hto!{r=_n)7?0G#01LV;mRsYx&x9lr|rOsilj$CF3| zp}G=@g(AaV?tWKuEk5$WNXCMp{949RcNliPaJjtQ>M<1Gs&nCB1-6S4$_&+z5NES- zUnHM-KO$N^R0AIMcp^=_SS;$1oHA_Z^HaNRGBV+bi1kukYMXSf@hf?h##95ZmCrqG zTUck<%)Qj9gF0*m)@NApT0I;0v1Q=_L+yfJ@*v{zFz9}rYB6^45Zk0uGxF95(`~7O zPl=3mS0{px+ZF6kbxsaD?;JeFzJ)!8^&Fv#CwR(WP0ZOSCY+b?vUHl3hg4|`&zAY7 z1Wniu7+NlT(*t{`v|7|+XIU+>+L>dAE^1g~aJp)i48(hBy5^)kI5LjOKi!r7F`!5< zwV7gzW*rph0m}ZtH7eg}R)9mJldhIhiK{ zud(rsf(&QU8K^BIge}kqWJ)gt7^|qScq>2jV-k|Ka i&_)KWy`i0h1++@F(*N@FZW z6aDUwGTxasw2j3!nVFrr_uPB#xi|g&=lf3pud$~g!jSg7hH0H|Y?=Hr^vuAnHymM> zLmmnZF@~`V{+^o-cWdTp^+H%7L%ei)bae2BVXo9Mmal?P)R#(LttR|!a%ym2xa2)w zx;+E=C3Y;wcI|MNA)3oq7-IY0nb0weQ4J#uqn#A{4i5qYV;E=9Y9c)0b-^&1%XiZV zecP>V>zKflhRGiOEs6%FF~g9g04=f%Yq@_T^aSmxEeWdJz!2iZu4KF78OD}@=dy{zMK?E9JG0b$T?-@Ngo@xeTSyC`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$_PHXk|)>{oH(`k z40uIKx4GR0+Gqmm@<<8brDOF4zNE8*>P$$pb>elt7y`ThI`aE-bRi=iHdk?Z+q7p|Bkp*vOMD3I=B6v@~|o}rQX zeUOMm-U-iF6Uk7#R1=kS84jEM<@Qc%$dJDYpCv~QB?ko*8OnV^+|R}%89#_oK(uN< z^h7WevC?{x%qPB@GVEvb&A1&JBoeWlBujl}Z1OpJUL^vfX$Q?#Hn-QYvB^-&yi|{) ziW0-Yvg))O2g8no3N{${Ae_aXyjA+1+)RD?B3=cK$dseM0uyO5q-|1NSo8qJ_Q@P8 z?{u=jDRPr7=oMm>bS-tk!5S&@V;yB;K=)m+&WWuvr7u*U+H-8Zkw|g6orY?ZlbTXg e<%$5?3&1hGwXe|rK<$4qGsSvVhFyvl_Wl634S!<* literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/calc/AfterDot.class b/bin/oop/ch07/calc/AfterDot.class new file mode 100644 index 0000000000000000000000000000000000000000..6a3d4772d37d0699416fbe2cae1984f2c52811c8 GIT binary patch literal 847 zcmZ`%!EVz)5Ph52N$fhbq)jPpfsg{SQ&Sf>aBx&qHL6r8^b+JN+B(KH7`t-U@Ckea z`~{aFIPd{{6k^tH8^scqcI}yY^XBba|M~mtH-JODXrjijo~9R$f4=|H@p z7*tyeZg>2if8tKelhB!nEK0(HY(83?%_T|i)cL_=X9jHX^muK&%i@j(x`OIeVQh-I|d%%F*RJ?G$`iC z@*1yxewEKR39<|fBuFDr*~-ACv`%RG44eO#%%D%wJoAI&Nc!8pHf>K{2r*8gFySK4 zsAgAKikll&lBJ;sE_!5QoqjinZj~O$`op*07If#ryd`U;((o literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/calc/Automaton.class b/bin/oop/ch07/calc/Automaton.class new file mode 100644 index 0000000000000000000000000000000000000000..273074e72b422340beaadc58e940017657f0dc7e GIT binary patch literal 1615 zcmah}+fvg|6kVsZ^g>#o3gr%>NE?uH6VxJ#jF*QZI#nDWLyaX;k{VM+zQ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z%PAe?G|`sR?FOec%_%CJ(oHf6FYpbLnQ9>tZ4ili zB1>4-&TBj^xkgj-=U5C9nI(~A2O`oR685vUimU_`nQu#EwY?%MK_Y1qS?EAS8dMbE z7|}_s>!jjR?D-3<1>x>+@-4Q&#Tx?0@g>$hI1UjF_cP(7frbfpop4*fqGw;$7ubHo zGay!f~BF3MD%R=lj zojqDJsGK6sa E9}gXhKmY&$ literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/calc/Error.class b/bin/oop/ch07/calc/Error.class new file mode 100644 index 0000000000000000000000000000000000000000..5f2c4d431f4f862aff904926b222951aa33c9fe2 GIT binary patch literal 728 zcmZ{iOH0E*6ot>!XxbR9w$`@3-)IHXor_3OMBNlOm5R%04Q({d$T;GQM zn`uCdx=1qj&b=S!9P;t`@&@1tTP9Krc_HqccDK6kw0Y2WPNWplgz@X5p}6uG#t!_@ zS2c!(?fTEnqrMV7u0-hWG#QLzaqXp%VHouyq=gZT+Zct-P)V+8wp+j958MfO*l`+4 z`e8?dvUNZ7&ilQVCogy_APKp;AgN6*{iu$chU)tF426U!ZO0|qcU*d*VkjpDzEv}% zc@P{29+wOw+dIt+7-nruqxhRURBWQmQ2Zwb6Z5q9^YT*2TQX*04vSG3V-`wSwy}a$ zhD=8&5yxEmJEACAt0DTb?Vb8j7M3=+7bQo4hTjRf>Pxz)CVXn{L8AF>zUGn!vQ0k* zkfMjQQEk%ckh)PPUD?g02e2OX#00&qc+#ZVNvdaubI4+fD%zmzazp|0n2Bj;Fm$I} nc|zeGrB}>d#m4~_p0Sj~M+uEYF77I<(L^Ca$vSizBmMxJtA547H z-y#ns(ZnC%k1~FYo~O3FSkg6Kwo!-pP*e%-7X=~}s9 zID4XC84N?ZO^x%yF{RyfD(<0q%n;EpJv>Q`%fhTMgk$gY7Kohdn3Ym8o>wu*Fxpw0 zBJ?#&xV96-00MFu<`_Yk!FOPmOaiaOw&Qsj80EMs(RLr$ZUAGrreeHstjYX|7ADkF~>14=iw__hHxZ^Cmc_`({}dtJxMaju_#j%<3w08V~JxK zFBp1LTPx|!^$)r2&2-z1Hev0zp<3lgVU1eUJW$bpL0#lF#<0P$Df=tA-Paz1ZH|`` zfnQiwO5&uLa7rYj&?O?Fpwu%%^n!X*;4Phy%z`<)<`j($Q!14=wLdMd3lpGgq;~>z z(U-(cwn{sVewp-4p2Pp$3kPYHVVTxTD{t;O`p6343i`=I#VkTCWxH=bG4SS`-bTV# zM<}7nrH)9#Pn$DDX+KfNox~X?>zGOOG{TR`UXZpTZCTisTF0|C>kQB9Sm|)AcRK3W zYK2=g-Xcu!RQT!BN6?25Bu_8B5l(XM!xWL3B|38?iA4<3zsL|a5JDEi*rV6>p0W)@ oU}F>~^vFITiqBO2731D$!VUU(1)a|E;|q3>rr|JT$nHY+FHwl~tpET3 literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/calc/HasFirst.class b/bin/oop/ch07/calc/HasFirst.class new file mode 100644 index 0000000000000000000000000000000000000000..35b2a4748aab82460f9f9abe26c2a57e04bcb318 GIT binary patch literal 1098 zcma))S#Q%o6otj2 zp;Q71@yw4x+_BxXabI}wc;?QX&u7l@pT9qT0XV>}4vnGY`(wL5+}^eOeAKsJ@$g6l zq12IOSf1bONG=_Qg+1X3xzA9kwdWgN3h&LhRqrxn5B-6YhrwVBdHCU@LYm0niiI33 zhDQ2m#BQ}e@h{vSanH3oG7z2{!4})Xb6!tA_nhDz?~O=8vF(%EE)RrSC&jEBijY*L zM4jEJMasuKa6HMdlIn?tGvo%s6||qNoz%Mq$Q=tyC|^Dh%hgf6WKx9EvBprIH-~g| zoWAc3OswLD@?pV51-C5R#vSs>^`)OUe974ObIMpYpyz}kGw?}grlxASp7NbxZD#6D z942Yu!Ph7flP*)Y&_I)+;5zbr&i@MO>p5ouK@SL;;p@ zJ)ylNx}sGZ-?8!=m7iFBpG;4&KE=&6-lCif7x2{?zKXlJ7vb;YL4rRfy!zmOMY8bCL)LWCTrS{=r z+&i_}0<#fS{hEr@-jc3qdjeCDq(Hhr;#k!nFyGg=7C6HM>3;Fc(;+ZzUcA-oV2GD6qZ4P3{w%kBrw*YNz(%=vxMusKjX znAAPXZF@S3D5;?u*0F(YgOk0Z{Bt}foYzZZ8nCG`jXCr;)oWP93yzDZ)BavKBp&pN z35j~slx#a4C!Ah&I&R(Ev($)Q?a$q^8ft2)S`Axz9hbp;1k{(b895AQvQ$Kx)(!Ee zh5u%$+-uxzb06b3nOho9o;AdMtR${-KON*@4A;2h4fbK2D8K|JL$t5N zRV<}k7gLA%d>6BPZt=O>#r-bw>WIsg{8AT>bKkM{8yi1S{17hBvDL+kfrdHa0jf2l zNKr+a?2F{zBDd0%4%qsdO4vo2S`zHzEA07-_i+%a+ee%$VD|sSLGe>0o%V^0;9^J= O!)wCC@CI-FZ{;6e*c`V2 literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/calc/Lower.class b/bin/oop/ch07/calc/Lower.class new file mode 100644 index 0000000000000000000000000000000000000000..62a8738962eee035a17894eaf0f22c0dc3963be3 GIT binary patch literal 1410 zcmb7@T~pIQ6o%jJ2W?{t*jid?Q327mC`D1w3Bw@xG2>LZsMPUt8!~M)CY_Mt_^5p>s=bG@Va| zn?izNadM;OanE?g^`2=P3^Ti?ZF+kYRc%hjy>;9Vrrp(QZHC05b7G{CVMtnnt00a` zDw0qc>d}KTf!2J_&v?V)cDK>;+z>R^q^z$8A3KKohIcFykZU@mx6NHs%!9>**E3HU z3K2=tlSZQZ+%;^Ep%@7WH8ZHfmdPzChM`=oMM95ly+`7V6D@@WB2Ahf?kXstB%EGl zC`Fz6dSrnH_ECSlh}(V_j&1IKKI&5u6)-HRxQ6QtnXcnGfwC#6Up@hiIfNWqj1Z|6 z9aAPP4`l@*2j(ys<}8MheXRgo;ITL!1bGSpPmvCfd~8r~sYrGdpg$7QHY z)o`?{DY%P93LBJgvXY}16`Q!nkUllMHn#@U`$YArNL`!)`!x_^9;nFU3WL&e2Ci;A zH^rS%WZ^f&4WnYV%&yJ7flC`NL$kq8AUVNZ-;M0~&5JCC7idqz4ay#;{|iXblf(?o z#n(Qq#%N5}*K_F$C|~J2hAh1mf1RQ-n5FqbFrULb&FBO!BS#bnO95?*XksPv9ff!G z3lzW5#K(z*Ah1BGeh@;`BFX{a84@y0wjL7BQHg5G5g*|!uVD3mkVQh4 z{))UQk!!dWAT?4c-TX^sg^){Qc1J324?!;iP@#T~>g+l0{24eaTenOlU!hX3jzJ5) j_4$1&$o)Xw8jV6-lAv4B1~7S8bUcQK^1Y26IX?Og4;&Qi literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/calc/NoOp.class b/bin/oop/ch07/calc/NoOp.class new file mode 100644 index 0000000000000000000000000000000000000000..d7edd1b43e0529ad8b0f969cde7b63b7749abcc4 GIT binary patch literal 1243 zcmZXT+fNfg6vn?PE!(aOXn}$S6>r#^6ubaZBXH)Xq7KC)`Ig1Ers z@Os^qt}ZaTX_$t)B`}+-4j(wSZQZHl8v^lt>r_u7C6F+!FP5!h1h+IKpa~SBX})fy z`c+=Ya$B0Ma@}U=xVosaUQ&GPB0MaqVB3@;8B0DAG-%uft(J+Hqfw7kE?$fAFTe_AbFrUju zbO*Z?6HLsEx{!%!L?;|bCA3)$w7 zJMdDnSk&+gIjWua)x15vNzCFEXL_W=Vl+uKX+Uo`?1TX$4zOMAvOo3dEe zu!1Fl6bY*G+^zBTvv{fDRgbG?o2M%&I=ZUi4%TkIOVAMt-rVRx|HTv#C(@jR@Ct3< zt=DFwD%P>BVF$YeX<4onHt&s|4N7_b%=RuHTGPLlfLgaYPE$WLyar5pUA5$OE9Z5i zWlFc>aJ|&a56$zHHzSKd$8A;kxO`^*gYds3W~?yUVI1R_EELnpE2!T&k70~oHCX4V z6vi26!gvC=88L%irl|rfhM9HuG97|!9%dko@tkOlf6jXXq_<`4du>K1hpTp@DHoMpwl+RGq mLrxG{#Wb&wVX2vG7{xwDkr;bE#$t#O!#=ZPIKVr9Jp2#zFA5+4 literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/calc/State.class b/bin/oop/ch07/calc/State.class new file mode 100644 index 0000000000000000000000000000000000000000..5c4fb29c81474e31f56edd5a3243fa634d2a03b5 GIT binary patch literal 2384 zcma);?Qhdo6vm&Mq;Zs z{dUnZU8`6R&Cu465SV*ozB7xi={1VA{WrE13M8ww&CN$I1TI&5ll7xkXdf=(<25*!Y?^`Xku+Z&;g$=g>rTTn!*)PIe0PVIRLOE3&k4&kr=;SVt(K09m>19*cDSvCT+A;IOG)DrE^EjQgc(JmV*yvFgn%d} zfwlZFVE{Uif@uhRtYZpEs;fGlz1=?Cw}V}C-&J|>ndm(;aO8W(m@IWd%;iTWM#i1Y zGat))Y0{T;EaJL=F?#g~u`+MrYo{fUtq%Aog?7*|d+9yooF+^O%olhk0pGhK2l*ER!|o$0!jXgFmDflt#6 zE26?4X}e}9->F)K`K$pvtK(%{fkzvMpn#7Tl1<%o(+;{b4C2;m5j$_bqj@B98*%P#^ z@+p6MMjT`APh@|`)!+CY!za8a)occzDhqF{ug^Fau|8LXm-HFqjApEe54a{jj;oK; z%DhC#bp^;q%kTx|$e$)lln!oi+?&gH=XB+q{nd52tQ@xaE<>F)KENiy~uPR{|EJ&$*S?^};F8MNVqUSV9)lKCn zS}r<{WPCkK1pN|U5g<2Ulb1~25USLdv=fx{`Zd1ceH8TOczyRL)OQQF$LV`=hQ4p{ z-5L7sU}GG#b|$oR2K4Uupm!$>x;!5B(}bvd<590BM14OVWlf0UA=ue~hkVKcP8ok- z^%#|3IgYwEs^hnP#MDq7ON*>yfk&9{5P$9vvm_S&!HjW?$2?Jf;kiJA;5cTBr|IV6fdH?_b literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/calc/StateMachine.class b/bin/oop/ch07/calc/StateMachine.class new file mode 100644 index 0000000000000000000000000000000000000000..fd141682618857ce95438881ba6c37760db61a61 GIT binary patch literal 3852 zcma)9TUQfT6#foLm;}cQsN9s2Dq=`fzX3|KAk3tb0i~4Q@AvCk zU48F+>$1?=)%LwVs;hg?3`s}^%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P+xMLJyw6wr>-V=G01mM)BgHTu1Q%7OwX;`s?6y;V={qgk zcX?BW#4t0w*$}qi4B49Jdt#qqL8}ip)PwgtG!cjIAGbPs?-`h^{GUogy#H1(J>WSXAq(Y~ae>XrhAl8SjOFig5!9Faqvwk?8?VMWtNMhtdM z1xr|wu}l^X8#L%qaUC}pa+h3KcDqBGB<)zY@&vi6Vj64X9D5eYxHT3`%wERESe(!J zc@XmBKqy$pX5@WVK^eLV0~N}~4MdQnIu>RRE(()1>3_xa4_z!8UvTp$%HOg6DtWxZ?Jl$d zP9bKbAdd;GLH!4-+{Y?o3wL6yZB!F1Kfy90ta_zDV3k?ybaA(jxjVqz8^SEnD*@7x jAq@(tm?jN6sTk-q66_2%@DPs(Glj==CIu6<`2OS%PwwsD literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/calc/Upper.class b/bin/oop/ch07/calc/Upper.class new file mode 100644 index 0000000000000000000000000000000000000000..f1f00a5d0051b27011dff5cdbf61fccd2802219c GIT binary patch literal 759 zcmZWn%TB^T6g`8KN3DV=5AlTy6TrlpxNuQpG$t+#>H;5eIn)M5v2AMcyL6+8CVqe) zWxO+m1>=iYPAJ*Vx@@8>swV{B%TVpt4<&~^vA`?kx6u6-SbUX(?ep+4Q{#ys}U zxjPWP$B;P?zK9Qr)$C03ZiDDi_ICHXhDSo;aWNea#4|%#v!pUPWIE)L=f@0H zjWF@dV98j550x2)O0%U=FM`X^$)Z9IrgO`Ni85+3-!el@&zHE6uci7=HOX#*Vb#JS zmKe-#Fp6C7RLHQVn%$AFh9Tb-eV@mph#F^_JEb%JNC#Rk*{>BR$qyYgX!{KP7*MBy z4B;%HBf=@VbM5U??gQoW`&u`-w^TuFE+ph$=&uz(V&Kt>v??U9~yIyThZ_yekOqvHSo literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/calc/Working.class b/bin/oop/ch07/calc/Working.class new file mode 100644 index 0000000000000000000000000000000000000000..a08ce93a8f42254fbc053b21c35aa1241b2adb19 GIT binary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@0MCT2}bPaKY`8w2uh#0-bKCWTg4cNoXzKPva=CA}l zHY@mz;9Ugo!7yRdoJw7;eFHoKEuqTW8@on-U-Kfj;*2&T?4vHc7B+14e}S3k`afua}sdKvnb zFkld=2HRgSaYphn8qkjnHIHDNd)1Jt?bSCU=82qMM3xLZ`AcsU?y_XCA`59eWrB)l F{{RhEz?J|2 literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/clock0/Example.class b/bin/oop/ch07/clock0/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..ffaa8b2c2c734dfa90cb2bd55a96c6468acae901 GIT binary patch literal 906 zcmb7CO-~b16g{sWOgoNJC~YkuAS$*+naajRiP4}&l153|G!jCxgbz$O8 ze~vC7(ZnC%k20P&g^*TVxR`h6-giIFIrshi_3a0MN7&Yo5GVz~z_gF*_f6Xk>^F7u z$y>`CxQ>RDK(22cTc&IIJ@ZAk@7R&R%#QSB^gtk4sdfZXyTL0*M-o{BY0L=BHl^=8 zA9-CTY+GH|5twfVw&ixLP%8f{n2L_%P@vrW$M^3|zwsvw{%`7sk_N zVD58tL;#NEHB|dG1J|)Gp!J-nEj?1DCVM(=Vnf3%fqV>mve3Y7R9G@lykcvUDIsPpY{0elelhy{KH4@q)ooy1@ zVa7wu;W6g%40$xMfPFrsHi~$O61sdtuTe&yU3@G-^*`o|dC!g?u!>Jui^VFA1;HKM R<@^jja>7{SI{gIh{RYd1vfcmy literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/clock0/State.class b/bin/oop/ch07/clock0/State.class new file mode 100644 index 0000000000000000000000000000000000000000..61bc07ce09f744cb21d3582c6bc46136418ea440 GIT binary patch literal 966 zcmZ`%-*3`T6#gy+3SHe01vWN+Z%WGqd{7@C%a#R`#f~M`kr1CQwX)9AE~PBtzf$(F zMdRYLf0Xgu4y6y$hu(XBeBb%bJ?Gc&Z`T0!P?M2hDER(a-8yN!u3N5eeQwmvkcYO6 zB*XG4Kj(FqdxLu08xI-M9X}Xym!V|*7u95tO*;%7Z@{qB?i?R(cK3|qw#l&iVId^b zvRub=!W{;wqIDUP`~F8egOmb>6%{$$rqZohO0iwVDT7H%qy9RHTs3Ko&+( zg^aYgt*Xc%OH_vA*`4vQZwK#r-?bU?hHr7V%L7N)kyC+$6_OC1I3uch&fT$1mvTj0 z)PRDAcr4=)LoOz4G79aXiYM4)$nqfI6U#rFFz9jlNBvXV3Y!P9j{dr+C3?)L{Lv?d zY8*D}T3hgWQ(u%9juqX zC0%0q0{O_en~aP?>Ia3SDe`77IYq&|KcoG!>CrLhe!SRdNUJxh2=}T`%eIyKl z)`|bw_hNr?Ogh47$o27ml3M>zbuzmGoOF(c+>XaY74CN{<%o&+v*P&Ah2Yk22)jC8xnPa<{+AcduQWO zI6d%3F{QQ#N#Msre;TPiKQz+gXjWz;V;88;!cfN6w>bwg z8hl!0bXecwiJhTw8!PO9Rouy$-{`vm)7>E5A0|^Hq(*l+!-+ZC#9ej_68CUF=kat8 z)Z9xr=Nzv<3Cd`!Ya(iMng`mxvbQ}KvHF)COJCfek>-DdsIZg}?jaZQDi>0xkj@u8 kDq32+rlp>15o&Mc_+Am;DaCWm<@k*v-YLaD*NJWZ26Z)zp8x;= literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/clock1/Example.class b/bin/oop/ch07/clock1/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..6e4901d5f5195d6bcdd6ef4d51875d97bb6cb4e0 GIT binary patch literal 906 zcmb7CO-~b16g{sWOgoNJC~YkuASkv)8DQh0#Ar|>NrNP98V#%I_$*WBqnS>Lx-fC4 zKSvjkXyOm>M;XtXLP)DFT+F+3@4Fx8ocn(M`t}3BBkX8M2$X`LZ`#LO_f6Xk>^Ixy zled=Fccq4uK(1$oKF^@$J3u7#s?*@_d4BWsHvw|TB7e>>a zz&zyWhybMJ)m8fy12?fMpmk-`ay(L{Ci^;WVO_&*fqV>mywJcMR9Mniy7XCE&2&;{|44Pvf=;$ literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/clock1/Normal.class b/bin/oop/ch07/clock1/Normal.class new file mode 100644 index 0000000000000000000000000000000000000000..69cbf91397fbf8a703b62f745086053c55f7d75a GIT binary patch literal 757 zcmZuuT}uK{5Iv)-tLv7fW%m7DYLNBRgB64j2-1ro^wzd5b!*oRz4pI?FevB;^rND= zyJoS)a(C~{oO5R8?8oQpJAf0Eb;Jk--+!puw|fUw+x6}H{py+D^(_Vof2707YJ@~EDq-diB<#+;rLgY_@lv^+1|e@^99aX?n9))AXR&~1qKH|7 ze&fh<;qiD(Zz$5di3KcjrT1OYN)5GQoD@<35HT8@;Wb7NoyX{EGbViQ}0 z6cdML{^Ma#2|P4fe!puwr$V`v2@Tl2vmPxLYSCDwv?j(phIIw%_OBM zZH90~^o6W4Wb=*blA6Ml3oQn%=G@x`f{1d25N3!qMBlz1_S*K~#%y;9lxR4X*=?Bv zp<@3~laJzsVQmKOODi*kT(P8nrpCLTE|mVG6ZTiiF`{~V8BDQGyD9?o0pa5D2O@8@ z3&5bi;hu)v$_0wkUKKbNDWZDi4KWzvSoT@Rbk5ZJ$Ea(72o!>QNgqMaIc}_wG*y=< zz9XsD2&s7GZiMw|k}*L_j7i&L(glsDNG|0Ixm!j1!0rfp(+a^(8TJ=gT};=aBB2`>3zFyWTCXC6#vVEG4bFB_)*5` z%E@RpGdnYR@9mrY{CfWYaDxLM4xv{RPm!9PT|_D?)Z#pvRSh6ND@@o(C=W?vG#E0de*ns7M$2Qx|tVq84v04}yd_y`H^aFnz_XoqOPBXnYu z>)Z7*)#bfRGfn8mg_2n!OH=oop{QnN^_LyH1=|soQ45w|X?8D`{3;=s7VA>!iK%4+ zi#)AY6-R8q<-g(8YZqJz4j)aPw78nU;R6K6ZyYDD*nZ*8L5FkOGCgMajBT<4(EmYW b7hUd{XH|(s_Yhj~{mtF0Z+@lE*}>o&oD)zM literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/clock2/Clock.class b/bin/oop/ch07/clock2/Clock.class new file mode 100644 index 0000000000000000000000000000000000000000..eb75e7cff72ce7c17243f1437ef07bf0824319ae GIT binary patch literal 1118 zcmZ`%U2oGs5S)u0J28f)4QU_^rR6hmX{PUK3D1!-I zpmgSa@Z6y{?z?Y#XMrCJ7~^O%@`eJ{b{f}-y*StxFsDHrhvU9LekzXy1cBn1;8)=| zj1L5~MzbrRA4cy23mTSeT!C$3SztBIdZOl8D4{I7t_#!}|BP0W_nX}!$Y3K6!^910 zOp|pIWfrO^%ic8`CJdR~vQbE~+ct`@1eV(2I5@c&^@7Q%*BkN~EA7blhFxzG%6fjN z$AfU1Wk;e(pg=p6HJQp2)1(`MEM`B5Ps0&s(IFZptxRgYajYzhL;u{uHe3@s8M{+- zHnw1sf?(O&vau^`eWdK(#xomF-3UYN&3W? zlP;-9j~GpMa&`P(Wi=o|FgngxTywso^p?rW3>D^8nctkD<~W~GnW64zGpv77TpRq> z6t6~xWNMxDJ@PlHWRv%D2AOdOcNxLE`}3(UsVc`4!`UM3C8MDbMTK5XIu>XH56Dl` z@eqwUkE?1RPl4+nNtnZiq~)<3e<>orplMQ2^7Mm+h_%0-WvRi^#^wJAkw!`(+}WI~ trD~u+A@whKlzvkA4=shc79n?>jenfRS2FSZC9?5P)A(v8{<(5&?>DE1qsIUM literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/clock2/Example.class b/bin/oop/ch07/clock2/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..48191d7c059128f24f0d56dc83156bb54a1faa1b GIT binary patch literal 906 zcmb7CO-~b16g{sWOgoNJC~YkuAS$*+8SKVIiP4}&l153|G!jCxgbz$O8 ze~vC7(ZnC%k20P&g^*TVxR`h6-giIFIrshi_3a0MN2qH^2$X_gVA@C9_f6Xk>^F7u z$y>`CxKcw(AlJ8!Ez`C9p82BNmv$sDv*Y+q^gtk4sdfZXyTL1|BZ;hmG-d>5n~pD^ zkG!r7+g8_=0`twlw%m>tI?6u_rlKQfC{S+xV|;_HJmve3Y7R9G@lykcvUDIsPpY{0elelhy{KH4@q)ojM8a zFykTS@EG%WhCG^Bz&;;R8%4ZC30=OS*C?aUE3E%VTQf-`u}eo=KJUK3&0f$Is$~GS|z0ZN&M#HW8W(fgC6<-eW>Wn z?q;E~%rfVk|M{KEe0_g>0=Pk5M}Q&iI4?!3eQ{N^x{lSkEH-Q@MZcv(V@S>gr73NO za9Q+)tT1e4>$8%o!jy6k3|iHBvJC_g=GzZcPz8}U=D<` zeWxbdV#u&LhxS`5F@)S^srxyNSDuPXVRaaSS=C8!Xv-)V);U%XGmyfDj`V{0+-#0b zY%%C9Ti%NvbxDw#O4{Mr#U4cn=S8$^&7HJIlSWB#z;TEpT2S8^^vv#}1{-RHC51cT zIK>%5gmA8R;XXaRs$w*p(ZI5Ah1wkVmvR1VzM9C;a6x)iK%+y;CR?Xl1p)eiaK7-4 z$Q#`PFz9c%-jJ(YB0J@&z_Cmg>D8Wy!4Su)&nl3gsq=?XWq=42f_p(9K~FnPEK_Sr ym&lK?rp^S(c=>UH?OBrXkCd2__NSz4YEzM7zoaoT6CBTC_&-c+ipf%90J$F`c7`7S literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/clock2/State.class b/bin/oop/ch07/clock2/State.class new file mode 100644 index 0000000000000000000000000000000000000000..73f0ca6dbfb9fc6260e88022607efbf92943ac25 GIT binary patch literal 420 zcmZ`#!AiqG5Pg$ulQzayt8K-T$5z3J7Y~Xcg`R>QD!Fgg#crD>lBWKb2N68@0e+M? zS$h&?nc11)y|-`n^XvTszzq(3ID}qNJVk1Db`hzpP>b_uTFFZL5QLq%e3nrr^T+5e zooiJQ8Wuzt#J_3dnte&|u1s#KYr^61AIvBrh;i|t1Gv}<;Ugrt!%@-#p&gr7g bU39r)o>e6l-9u=__cwR1zWJ3tX9t6Cpwmzq literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/clock3/Clock$1.class b/bin/oop/ch07/clock3/Clock$1.class new file mode 100644 index 0000000000000000000000000000000000000000..4e21f04ffcbde9f6ce4e0b47efa15a0e0b170d53 GIT binary patch literal 892 zcmZ{iT~8W86o%hf23D4-d=#;2{i@gkejsU@rlD!lkT#N_HyWRdOu7nV{*qy^U=Y95_b9nss_W{6H9NMrLmV@9|-Rm8Ftb2pN>%XtJ%u#OG z;0$ZCi)Y%^k|CvgDl8unqcgLwNiCn1uk;s&MrBUVoOHFzz+1tkOoJgKkVMKs0xtw? zEHbRl!x>$+qkMUKJ-m>kbN6CEP79sDa|c~_q|EO)$&G!6mDvu;4YJR*^7;&kO10~t zgjY6}8J1>VR$v9I4EB}O=W0mbBvIRlUJI;agDT;3g;(0fW`Yv*iD7if65a^xp#0RQ zm4C&sKF3)!{$`rkZw1~NO)`Aih;tTPk39KZnM*s-CJ%qQzg?QiH=p(!68A*vUU11E z+P*JGt$`bclE#pXm%4B&Lwy{C8e25^1pQN3E@#G15vRw-0_D>beSj6!GqwFYIJLb$ z5I2;zkfnEungD@Z^fqw@c@*dbUZNNynglSleC?J9^xR{K|G3B6G-z=GlpljO$Dloe z7!aEl<|l+~EZiCkKapP}%sxA~#r7R`r!mC|Og6@FR7hx{iW;4q)&UqFg&0X8U9W_F KZsCAp3#I?Uv!R#( literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/clock3/Clock$2.class b/bin/oop/ch07/clock3/Clock$2.class new file mode 100644 index 0000000000000000000000000000000000000000..c028b124688c5beaf38848054be9d1ae026d7e09 GIT binary patch literal 892 zcmZ{iU2oGc6oy}?ZnLI_c7YMP4>q;}UH8#3gb-SVgenk~%5FC8dRb z!5NmOUmj^+ONNpjglS`s82zbn2Nco?<4}KKc-@>4GsC@k!oa)gT$aI55h$YMpnwMg zHXbr8&cYd8wI9av@M?G_lVkrZqD?gews?^LNTA|+@VbM7nN$PQR55rqp(`dbe}9v%f=k}%VfQUmEBib+qZC9 zTR$PL$!(!Zdx?TT8P;eQnO(s=Tsi@d@Hj_o(aFTINnw3V$VS42k+4HA8=>2}p{Hrx z;YqD?dWYpn(()L|9g)^Xr1zAtAyxmAZt(mTFD5aoW0-1=;b@Z3!X{eu8_MjPCu;E^Cy^pl2T35Kv0Q|PuZqGPL};&H^=F2U5;_cKJUUfuLd>axPF!nDG+_p3( z41wyv`{21lFY3E*dV|1E1l~JnOXu>8DDI~zPu_JwB zqy%=bZ(~meth4xP><6zx*|w$Dy(>2@V0WS@7`KOBk_2qKq-X`EPlF_V9mru5tWgi0 z|Br#1l#;ial!;c8A}LFWXv@sxMtR<%H(<7)-FCj>w(}j;w+?T$3Fhh4m2+=`MaTJ! z`3aUCeS*d(#kR_GQ8DYRYGalQYTyALVI5oSWsUE$3b`3wrxn=1!@RCbE8j{aZhYiL z!zxeN97wUoGXs}$u*T@)9DK}dO=dew|FvVOsKb%A6vIN6l`}|oDS<4^mE>Ie$_FZJ zWcdp={|=Y+vhzv*>i&y5%3Ti5Ze0=$j`POsq!p3*K->?*DN>Y3qx QCh*MAa7e$R-s^CF14bIHDF6Tf literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/clock3/Example.class b/bin/oop/ch07/clock3/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..c98c5b7cf77055e3cbe90ff996d1298089c1c0b0 GIT binary patch literal 906 zcmb7CO-~b16g{sWOgoNJC~YkuAS$*+8H9z45~D$lBn^_ZX*8~;<5*suk7hb0>cYgG z{v2IEf{8!CA7wmm3L&k!a53-Bz3+aUbME{3>+}bJN7&Mk5GVyf-?R@m@0+$8*l)MZ zC+{q;?>ZV%0=b@bWSOqzcg^RWo?}M>Q#;a^(F1{GrP>xq?FO$M9Z6&jq%kEh-H^Vs zKlD0I*s?mVBQVRrsRoSby zRkxaf^%$&2MH#okE(OZ}g}gvI-W8YkhkUUB6i;sk!_an~O0@ywY^NIv5HS-dUjUHc zAD6~cqi50z+H~y%nXmD+&Qo231($dlqXgQ^^s=~uX+~Hqs%(~E?8|rLUY>C0>&M9R zD}F1>hE z4l^EN29Gg|XUL<0IUMjIwNS(hl+fWDdV?~0?BZhqs{avR%m;S-h-G}nN-S1!Bna-{ RF6U?Pi4#T|Z_-cT-f!!uvg!Z; literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/expr1/BinExpr.class b/bin/oop/ch07/expr1/BinExpr.class new file mode 100644 index 0000000000000000000000000000000000000000..a6d1491dce645564dfbc9f0b2020c818668eb322 GIT binary patch literal 1179 zcmaJ5dXq=^!45Xx=GlOKA=dotV+ zd#)r@+I~m4yCQV7ojMDu>qLaw)#B+$xQ#*OZ>!Mp4hZA*M*CtsiMLh4UCbJ|cWHFV zn~D2)Krl{(+mlZ>_oEUXVcEbEVeX=P$2;+l zq?Hs&^lgfc^21Xt+#-DKmzPE-gl~nn@5*S7XMWTRTGu7_c`haHoCY!@{8L|i#!yoV zTe$AFqhzaG#Nr@$H3#ZM)ZqT#d7cbyS45GF3_K&uU+XhVxq&sp%>P4q?~^tQv%IEx zJ_Gz6)qBf7c~oyL-xa;HeCJT$4Zq1z!)&>+4U9K`qTF0OL#4TN#@6&1s^8=28h@+I z2xciT*AVjzGt(HeOtH7gUe3oY+~!*&U6*2{E9PRPHE3nixRX}ih;5+O{DI0Z%}GI#@xO9B{%Fu(0aJ1;)e>Nk|%5VAz-Xgp%5lQivbrLKBU~g&*KY z8E=O;V4Bz0bMHC#p3{%dw|4;N*q4xED0<#Rw?>C2I=`FvM|#V1r-1~4VP$O2P2Dlw zq23*gxkc3sLt%k`K`I7uZaOp0z&Z?>Q`@zJGX|m7srTt>dDmP;8p|3KWEs-6dS3x8 z&>%r($QicFFK4#{?q8V$hsNX$&oZ69>DwVrib625rwnCd!9nD>NxSE?i<6OP0~wJ6 zuNU~XJEWAgy73byt~OOvuq|QhPt>@lVF$YmQWUFu!%(6u|0gi0J#Xe)ylscJ)yT?0 zxCm7Wn5HArSq*d2KM%12mEKE)+DOp@sErqBjmk4}kAzah2C~EjG7w0qkTy@K9J5hC zkr3%nq7LPz&RQ~4k1!xMo{+mIQamn0Wzf=aj23;1$ry%pY$W32L@bBmS8P5k=(E4{ L^0$63VpYEYMXzRj literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/expr1/Example.class b/bin/oop/ch07/expr1/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..71bf30c1e1ea5428facb6f2ce12543776fbda229 GIT binary patch literal 1440 zcmaJ>TT|0O6#f?4210~dXaPk9<@P=AIr534{i2rXWP!u(u@zgn{)PDzw>4P{5}5-;1zNTx)@@%UC|4r#bsTbR-7e0eag!f zQz!^9gpc?M*G+B}^__zwQScZ-D~4rwYYg4-M4lm#vJZudZuDvhBE&F|H7v1REguMH zj~|$VA(FKV+{|;wkaANQ@JfcuFp~Apo}|cSZdg=a{8RR_ik#;dRxz2#E4a=uc*S|w zthx#YDdm-mZBbMZWf;1m-!d%eG2D5RvMtwB5yPnL>jsq*&m{6HhA<`-w;1N*owZk- zq_0wXMsP=Zj#JbAp3*3cv0mK6l!D1N^mAvfC(0V8F+<4PRT@OJ0gGYlyM&2H$Ov9e zsz_i?!EC#C9W@R2G0&i!aI-3QJ~K?mTaazcH<@TrHNozKjwJ<)op`5-Fd81Qr1BqGBGe>Y1DUc3~J7qy96NC7hJWU02Y5 zv%@ge(WhVK3f?o^{=X?bEsZuY0U{ES22{>->)n8V1xtfA@2$iNkxUs{x$>Xw<4%E-V8(xwN}!N$k{Q~|Vrfq@Zd Q3M&H}h{eDTB$*gE0Pf=&M*si- literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/expr1/Minus.class b/bin/oop/ch07/expr1/Minus.class new file mode 100644 index 0000000000000000000000000000000000000000..98e3f2887fa71605222b7c9cc2d02220d9e623b3 GIT binary patch literal 575 zcmZ{h%}&BV6ot=)LTRajQ1Rd34p2bcxWJGo(Zq;uH0%pZ!We8x`H2tZ#>B+v!Uyo7 zjCV#>4Q?jq-udR-b2HyRpI-pZv2P+qaD!l6?+=ep>*9GFHtM(1pG`~{ghJ%zLi(4C z5Rzxom(v!ZTIxg?1vHm7%Uy!e4hF(T9F~IwY(j0hLHl2aOh@|SZuZm@;e*#32|}(D z^u1Bn3#F}qQ77kCeF6aWAK literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/expr1/Mult.class b/bin/oop/ch07/expr1/Mult.class new file mode 100644 index 0000000000000000000000000000000000000000..86b29abdbe7d3dde7adb590d4904d62db282f50b GIT binary patch literal 572 zcmZ{hPfx-?5XIlpLTRajfcW3&4NyV6c)*Y-(Zq;eG~5ep(lwQmN{JuJi;0QRgCD>T zWt>?#Azn6bW`6tTZTt28@d@A*+ZGZ6g)kh|`~Kl^T|SMXM*TVt#uiM0(#+sY4bO=X zNS&ym8n*-v%AFa8f#%$1r7K{z!+~^Qz;=;@BT$=f(EisU+fhS#6F>B1bm#Q~DUk1k zeJ|*Gk>YyVG{?Sr6j+}1;kPvfjBwPLGu7es^oX*`i5E~&u3Xw6*hLn(3|6paVfF7< z2dvD@lml%V70gxb-M2b#}sw(E&GE>F746o>lxAw&(lt=5zM}Y!k^qTyE&OM?lK}7F S7<`}oU9F2#e}PR+ZT$cT6K>Q1 literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/expr1/Neg.class b/bin/oop/ch07/expr1/Neg.class new file mode 100644 index 0000000000000000000000000000000000000000..dec0d6b22e6aacabb6e2556d0e00693f1f10afbd GIT binary patch literal 1114 zcmaJP@{J$(Rd8E`1r>RyG0{c>NreYUeeh}8j&xz!X?CYX{)s=r z2Te385B>mul<{tN6I$Gu&FsvbIrq#tckb^$7ry|!#4`ga!lY6?yWL&ivgL=KzhUpm zBLf-2wPSH6Y*%u#vFaGSz+!Z_Z{=&lnGrmtSa zrdUZvo(Xrry*rLE%$u0OEFq`Wf%YBmh!d?!M-kCa)c631`WLvbg^3Owsj|d-! zO~vSla7TC@R|aLS_esB38}c5@9oiX5JUs8o1o*old_whNin?&!14qkRDGMtHn_t#i zr3%5^^*rg$mMUpPuJ8YnUr$Rfj;dCm=6VKzcz3ey~M-hh>ujTWm+8@voP9Ozx zt+49{Z9h_6Pn*W5r-lN{vp)Q`x@v%!xoPGfiBb7jsPLrxj7`ktjE7{84 z8&WSCNz-W)3PMu^JEV4gK`daAD!}4+WW$PfYhy|?HE!q{aLcc7-%$`Cv9874Gu?@S TcW?~8&;E|q?$lpkQ&U?%4r^}H literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/expr2/BinExpr.class b/bin/oop/ch07/expr2/BinExpr.class new file mode 100644 index 0000000000000000000000000000000000000000..d4e76ca7264f0d0c17ff0d71d7123707d11b3d76 GIT binary patch literal 1179 zcmaJ0m`6vDi zO(Yr~`~m(bQ)eOSIw7HUwRk!bZeuV~+fm?n2ZXVDqkS=+#M>(29%c;Ozcjk! z&BOydBp4^c?a8grg!y`3elp%x24#i+)trfWJR(dSiz8_(uOp(5PSj--M#76&^Ljs7 zD#q^PPhA=OgwnR^1s%ER=)st2vrD=+Zev5KD2xK(zn4*0?S~~i#*%?W!t6!&j(4Jt zq?Hs&^lgexq=Hi|+#-DKmzPE-gl~nn@5*qNXMWW4Th}G`c`haHocb~&{8L|i#!yoV zTe$AF6UkP&h=oD$Y7W$isKNce^E?^Yt_VXJ8hA#SyVhrxasz9G>HmlF-Y0DqW_V5W zdADmnT`?CUtwAfB!rip;Mr;GM<_}bUVVbWh xpD~8#m<7IZUJkl?F=i{r)yx>z(rS6sdXkLX;Oyx$H+(lr58T5f9%nkr z0xReK)OUw|JaA9@=V3r^MPRLff5j|;rKvxhgaYDNpwf)uC~FCn?c+v|+hOuLG*QA8 z3kGTeCA-lxzycO@R0ZnoC=O31Z~I}|_4`B8thSTDANKq-lJ?A5&d#E-z-GIkKq>ZE zd&=5=5QL*l;IUnV^`dcN$;As)v!s)y zQ9R&4*z@&suV>;B8anKMrXr77aIhz!s|h%LBe20|pX=X@LBQ-JlQamABKg9my6V1s z3f$!^l(?3-uF8?%cuL!V$^SB~BWU~p)A<6++5U|BM_L-uK#f?Sf-*A==C0D(%+XlG zIxXg5gAtAhBi9()qEEwh#eKq)6i=o64rZ$~6W&Bw>>lW4OF@7k=0Z6LhCt4!8P&^b^k#jQA?lV}q55Wfkw8j8 z(o4WUt4L#til~*#dYyuu@;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Aq2ZnmEGLW*O5zaJ2j~)5@Bw|GTAM7f~Pc}q`zn6eIAY*4*KEKV?s3jjjQK!N}O literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/expr2/LukasiewiczVisitor.class b/bin/oop/ch07/expr2/LukasiewiczVisitor.class new file mode 100644 index 0000000000000000000000000000000000000000..d53c14ffddb90ac95f2f36f3bcf84468ca98a73f GIT binary patch literal 2737 zcma)8+jiST6y4(_R_qAk+PRPb#c9*vIBnbpN(v5!)--LvNeT`rP;QE%+KLrPNOGV& z@Ev>xti|Gz2NutK6pJ&`ELYLUS$XhWyEoTs z#t*KyR%`Wpnr|B4oBEIYrf&w0r(l$!aHO4RHA}NQwcUdwLk|>W8D7eo$X-JwHP`@Jzc?&!L2A1yc-D355`%Vg|FEShM<+BHPMi z4lgU1KjTNlrQ#L5%Aka?yH6RWD_bdw#6nCn=@~LCOSwO?`hI%qSFotyDnlueI!CCu zh9z>}ac@y3Nwxb_>G}jJs47^N3HaA4R&br_sOh@llBw6F#6+#nlx&(t_6?Hpd0$E*#TAgPDL(|{3O*=>4c$cX|1qr+Qa-@=YHOi zTOowxu#VLt7|2hldJ$<_^|t%gkj86pwfAK6IU1ZJ(Lq#gcj?p<&j6sjz z#{&hM^ok`Kg#aoZ@*-s%w@7d2hrC7~F)XE2BGvb)WM}alE|QyQlsp-_tD=DBh0Keg zKH;d1i&Z!V`;^0Or-@1LSq$|VN0rmW;V)8Jy}nzQvxq%81KfM&8Y$sVV)5d{ z@s<-5P0g~}W?gN&qjM0TRK{Nf<(U_xMjb=vkSoII&f2BnRDvjCj z;Rs%!wHgKBMNHC;N{CA|a_|Pt8Jfpeenat3yz~pL4NN1QHs&G#zG=;(g@`$@sBGM0Hq+2rSe2la-Fs4Mt zw7?2?$@*|k7>we} muwB2x*WvsPzNLAdow21Xw|A)7kDh;^U2>=2QxIdwg(|1qIU@=~ zqQ)H_)ETNf%@9Wr^s&ien<3V4Z)_D&q%w#@W!N1r(3q%@ZF0wM^&dL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0=34f6)eA0CFj@;XF zJ5IVBtMohr;O{!{(NK0ZM4O_-EvsTmp=XlVRPmU`E4#*W4BBhk7GBBXzAt7(LNqBCkYS2 z{9{!AGOD&yd|0>Z0RNL4gD=3PNCwPk4KVL*(y8r+H literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/expr2/Plus.class b/bin/oop/ch07/expr2/Plus.class new file mode 100644 index 0000000000000000000000000000000000000000..0ca1ccd0bd0a6216085f69a06b4d8c8bd729ceb5 GIT binary patch literal 835 zcmZ`%%TB^j5IwgPO92%{@cmqgpj9>+OGwnH8=@u>_N6v>O>LV}jQ*9bj4u2DKgu}w zA{u#Yrt>)W%$b>fe!YJHIKqYog(2(vfnne7?iO%@sq>WP2jBoTw2MjT0oo#6y0BN--Z+;c8E_f03PTTRztn6CM@ z?F11+X+UFxw|V4;W}$XxJy?co zc`f6zdFR*>aqHK-6+2={SO+bZ z{yIP*FOD&?8b#+&WnSMZW{Ra(Bwi#WMOHvS8AGapC^Igm@cLGaTCcYIyr)3Y3StXB=4#B?u4R+JQ AdjJ3c literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/expr2/Visitor.class b/bin/oop/ch07/expr2/Visitor.class new file mode 100644 index 0000000000000000000000000000000000000000..8b5da9c2a9aa563e9bbe029140747073498c6d91 GIT binary patch literal 628 zcmX^0Z`VEs1_nn45q1V9Mh3C``~v;t3?o#B6bEAMh1bb#Ii*F zoW#6zegCAa)Z`LI2G%l=JR^gah7X!X=ls0l5^GH#bUoIL44lE4>3NAIrA4WX4AQtX zhJ*lBYGTL+r2eR+uqhhbhFy$iT?J3`_?M46MMI vW@TUl^4WnrCI${LpA*jK0`s}yd>$~L7tZGc^ZDU?0iYRzV3UNPCJF-pc3z=b literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/trace/ConsoleTrace.class b/bin/oop/ch07/trace/ConsoleTrace.class new file mode 100644 index 0000000000000000000000000000000000000000..5b2deb264def7d7d2873b7b0f1f538392748ecc4 GIT binary patch literal 1299 zcmaJ>+foxj5IsXK8)8BrBp^l*6z|1eY*S1?Ee09@e9CPywNbkkhAS>QE#np6s5y;Q7qe* zYn$RoIU2$YnQH*=gdw_RScZJf5Xu*h8Ny||A>s&OIDrVF45_MNi4VO_T{uU)ZVHBU z)z-Or%pF7d{a{$O43}ZLdaX*ZjS@qoA?m#*!$iJPJ>jRkXmYDrtVzePnx(>V91LR# zq%qErYzn!f&{c6NOs~JnFtV7`Fu^by$UbwW=p=9(Q-rd6k|FDp8+P#{F-zhXyi-b( zT)719Vwz#H!`p(I)4BX?$d+nTa!b+(OZfqv-3-NX4|5u38OFUQ@btt7vsyc$8~8tXG*^( z3}1uu^wB=ydu}yM;V#fiX!p9Mo5}?uR}zoTx?%wQO8|dRKM}et6#}6?MVXss&5)v$ zilP|9bB5T??)Im5o3kv27v$|89v&Q$$B?L4mT<}@cU|FXpjWwgWAH(vXn4gi^M5FP zPyXDPqk9R_g9E~}qfd#fMqZItMr&mGCt}}eGlV!RJju}N3^2kO!P!usr%8*s0vwmWqlqj%(MXyj6OL#!Uc`u)3 zC|JOJzv3<(4ADW7Dy>{#`LdGVcHBEmc&w_*gb%)~lJvOM#4DEytPoBO%dStK4opwi j*O>YXqs$}w literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/trace/FileTrace.class b/bin/oop/ch07/trace/FileTrace.class new file mode 100644 index 0000000000000000000000000000000000000000..50cb18ebb841642fdc19ec6db6d5917c24a06022 GIT binary patch literal 1454 zcmaJ=>r&G|6#lj?q{dK6r4_^r-rJ%U@0a2Q3TT}o4qzSh*AjNxKu9vlg7PN*^%0y= zn1LA|z=v`?n}kw@@lSI0T)uO@Z_obvz4sHqBwlMsFbuh_S25e;4=d8=rl`zXwpdb@ zh7`l#KhZG4knlb+zi&reS^47N;`QEpr@T&~H6P9DiXOvKkGHmX&DvOemTGdjM zL7(|-3QtpXwiQrS;~$wiB9a^_kIS~I4~Og4f}v+stZcRz3dQ=-aH*-&L{|)4#WjY$mXOmb zyCJrO9jZ~!(LELolu%|ky}{Q-&2>yJ-&?XxRv@_}X}W92UBl6KN}n4BZX(T~dFn=O zhbFY6cC1d`4G{#qMPl?VN^Y*taWB@PNBF+$=V;s_m6*00(9LD>z`#9qbNZsY>6=2S z!jS2Rb4w}0kezZ}8PN85b3(S=)j&rTPc=*s`9sYtXUkm|@ft-uXSpd|e_IJa+xDfK zW}F=XzT(cRErKg_OY56n^(gf&&tHX0+nzWk{bN`D{K}dzWwq4hiXm#;wioG1RQr4J zB#lXi^z_WsyO&Q!SsFDu%`7a;FVKm>s5_4EYc>x8K~G|q;p!3M$5GMnisAhKQ|UcM zym67PCrKMayQr3&tQ6VwGLXQD_@u)i>m5ZC^dBzoqOZJCFz=jlW+xPVb=#b|^}^i?f5<)~o_Bjp`j{)%k*JBDxU z;X1H`F@>KD@%0cZi#!HG?9r&IgI&NaR0vab9j7h{+zxA5o}71xThwlr0*X;awHe#P z-Arpc$?{S02Bj^RJm4nbxB literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/trace/Trace.class b/bin/oop/ch07/trace/Trace.class new file mode 100644 index 0000000000000000000000000000000000000000..c49eb39a7ab42e945d330234504d1e7ea06c116b GIT binary patch literal 1517 zcmaJ>(QXq*6g}hE-eg$_4Iz-G5Su2{F(FH#El`I*F$63*eF~LwU=ymtlddO zp8FI1h(1uMfCLgB(2uG(vuhOxyFBd9%$amsANZWA|)`>)`5(k$|SVwfw5?MVJa}!9!IM| zxKx=3LnMl|mQ8%Jd)!PqWLL`Q60O#1e=KI(Bw^fb*szjH5}gQ~t^Ln_5b2auC&Sq2 z&Cs&0k8>T**1<)A^Pd!AQ8JBPTtLOjH1FV&z``efO&zEDKi4WwxLC$F4lWCv$!ZC; z-+J=!MWFg7)Uk&eR@flwu%*&ec1d-%wlZ4Q410gY!z!){oZFXsiirYgehE#_rZh4( z)c^9>Dn~SQ*Mh1IZvOhQq?zTQi z0+q||W}2;8Y@W>fTAP$%{VipBdN+0PBi0=dZ0Te6Fh10K%Fo-KSGg$zqmv_B{vClo zhKn3{=YWr8yc?->iGAHW=r=}78nPS<+&Sv2G48((`R8}3G2EH~L{mo5c4$;%x{TYC zxF=8*m8+HCXy$>fbf`|n=t_E&8ns`^R9h49T5+tBW+c;8r4E_`%Oe_$tIEMcfs3Da z*c8}DWabGg?5f&LjUK1-Oz*#VZ%(XuMl|AzM` zCpn>VX7q-LlyVrpdUH4j`}*-rXXBSF5v09X ztzLPJrMIX9ud%lJGD|bb;AI9_CFaNxWH-f`%S1Cwv&ckNkxCAVYxtHcyL%lsh%m$5 n@2FA%-_uU&EhoeKfvW;;;uc5Sg$;gp`K;Smf%|xXP0W7)06th< literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/tree/Example.class b/bin/oop/ch07/tree/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..cf785ac2ef7c3f7add7e87f9dad231628d880ecb GIT binary patch literal 2733 zcmai0TXR!Y6#jObvn6njVt0$vH7OsV!bm z@P3^^$8j8=oN;*5fsukZdgtDVQ!vfQp?M>h&zc&10u3|9oDs)u@gNN;GS7Lhz7LEY&Nhq-4zCI3Fuu~Y?Kz81O{tZ+?A9JEM802Gr0;6 zqC-P_RjJ1pijJ8JVKW|Lne7s*-t2~vu_MP=0f%)kjT|HG!d4Ais&A_r$z;0)w$zBO zGH0)#VU9y@2z}VbmgJ0CbJ(_$hI1n0q{$T>!*bZHDzI`ZD(d5jg4ltb8X^Ksst46U zhtQ8*>_T4Vk!6RgN?b-&B_0T2H}(kV8OJObj$M!~^P(>~nQSEC$>Xc>Fk%|^aVC_@ zDs2dH?B_sP<~%F8u8dGI)huKa4utRs9+loKXHt%c8u5h8W=IA-Ob8Clr1W(tgu{58 zS)`5Pn1batoYs-xo%6P><4H18#swXtWQ?h#j-y~&7RT-TM&@!BCZ>{*=?m1KZzs9x!Xe0i;VYB<f{s@O{7(B|yU=lo!{zk5{Ogk6G74hW7-z?x{UCH=$os>L969gBMnlhFk-lYxrvw?!#J2c)9)?>UBWe`5q0Y8hURbte8fR(Rtp) z{o*DbQ1attgQ%-eLc`^0!@rU1XzRO$&fDk#7O}l=5z(=$XxaW9_6q!nrbP@6(q`i# z4pR1*z~@VUN|^8wMW0Y~q{3-|QmFEFG!~Gsfn`{~g!M~U$|_)!jGd9iT)jduT@)HeW12+KmQex{B_L5K zb5Z0-_#j8(3OY#x8~_brwtW-1Hu4?R_Hq#Ra6pF0AEM0>PFRBDa+1UHG8%E2H{Rj9 zeg*6BG5Jr?j4$|A{0c4jn*24|e9I5{4YcAXY{1{xC^UZ2*P~4gqFtOthsa{H_ynEe zOLU3r{LcQ4t!g~;l8QSxj}+reh$~1V!vW1Pwi(QF-fxI4$Wm5^-;^wedZPadi?Vvr z$6RJ;?W32AuqpG2OP1|qDbty1Xa;sLoVtKaGJI18HZMOs_N+)MG8M$HE4&mkBl#Wr9eb07kW}%{C zSYWdI@tQ9^m7*0KeAi1Oi!lwO0>j54)*N5fq^Bc?aRF`Ds<-9FJC$gy5X;nYGY4=Q zXEmG=I2FWb`*z(Z*)3nkIh+?rxP1FGAA1=xW&V$)lki_mGmQ);6_XbQ#^XVw+E{uD zmvC9bbXR-I`z>EKbX>sWHB#@$ zJq8%f#|i0_mBu_4G#CQe;C**^9XGH@R+}ngo$VWo7tsk(s3;J(bS&XEeYdUFdXSG3 z^_s~oug1y9p3ru(Z7W=1VF7Cqat=(cd(QTo(X7Q;j{J+U_C&2-VUWSHZ&lwvx0;mQ?6LrvqFleZ+K&cjWC4}X3tFi9vdGfb)yXQ@pS(h|=m`cWjLRf2j(xk*?GY%TcVTFbSR{sJ#xD2NN literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/tree/IterablesIterator.class b/bin/oop/ch07/tree/IterablesIterator.class new file mode 100644 index 0000000000000000000000000000000000000000..e5c6cb9d61b0450572ea345de006a5deff585ab6 GIT binary patch literal 1401 zcmah|T~8B16g|@qwzOLcr4);NtI#gWBBBu6kPs;eNyUc}5`EjQBV8=J&9XK4Q}EeG z9yC!2ny61c`0Vdd@67gth6b|PoteAm-g9#9o!@`Ieh09DH3b2NDaWbnW_4**_gv2P zZI8P~rN)os#&cW+A%?*NhSzX8gWdyD@MDs&rKqr5%&*f!*=ECax$SLx44Gcp63Nh4ux!g)XBf@)sF%;} zF)a7`a}~Qt3O#XN@+g8xs)%ElA(+kW#V~?V1?iS8UD{RLK!zbAy^%Jhv$-D1^Zj7B zsX{@7AyKkyzSB6YaCcXh%VGHG^Fr|c57tLCPt-p)n{&M7m7O( zp;(vI0wc48qmdz{zFkXF`KzY#jP?chPZ0NIk<<_0u>AZCD?em<$GCBlG(mDEFOX+0 Wk&8%+occLLEDxzrfYkf!tN#J8cQ&m6 literal 0 HcmV?d00001 diff --git a/bin/oop/ch07/tree/Tree.class b/bin/oop/ch07/tree/Tree.class new file mode 100644 index 0000000000000000000000000000000000000000..706fb95fce6d16bf640ba232b39d0585580559b6 GIT binary patch literal 1844 zcmZ`(T~FIq7=BLT;3RdRO#^M$LMbh65};`}wtj?W>nQzFwq69GqF$NQfLjwI$4u&f z+5K)eX$Z7wyPdQju%9#byvI)BC|M%g=e%Ff^FHUb|Ni&4KLI?&YZEDjqVFHp+WYq& z)WX1VYMZ>7Fci*zuz#>?p5582z1jKTv_lgUj2>8Dg-&4ac#eYMc+LTR&4DvYsVn4K z?q0_Zj{?S}H#cZ8JZCplC^bic>Af<>yvDo+eVM@B+h^*;n%i;1hQf4t6tc3#fHE^= zVXXV_ojizUVG7dI@oc7&8Yce({J0}mL0gVkBvsS?{*bt zhJBw7d;W()a12J&>Hj(^TY02$O?sK7oaM?^j=f#CU?MB48y3#NlGRNMldu%Bq2CGv zx3fnH%9Vs#k+q)19fka2x4hV0o?q-%@~B|RM0M!=qgV^eSfRGNesEy(6dom|jLW@C zAjBgu29&g18J^G&s8NsBQRsR#Jyf*ww6BhJL<*VsoP7@uP;VZ)y&8F};wuwha!&MM zYJhd$^Ek||-|1R-fQOt==io5>)O5S-sW^lwwz^b#Y@v=dg+iA~dQRwfqVQWu35NUC zV7kCLH1LgyuN5W-G{j@^9sE`yQCH8(dG}JY%Db3n()4Eeu+KY;{Sg6I}d->ojI~pI|&#;}Y*P zQ4B7#qWrQk_LU)Dq3@H=grH6L(LU2?KXPv{s#HC})#}nQ=Bmrbn6IuJV_|?i!~Q^~ z27AacZxR>zFKH&#D8J976f-M{ow(w(Ov>;~}>JBb%|QG7x7CGiEV>n$wOC%U{N z2Z_2~ygl&;(%b3kub69X8+^>SwljPzv`$g}nITEJE^Cq^J5ytlLStYN8VYw&>q~P_ z1O5{OuKteu+k)~Ja;Ny>Cz!I~HFt_f0-LlioZ`s|)`f+k53Q)>nWgY^xJCvmm`yNR z9bqIEVf38WCX6#Gu1xYvW#y1@CaTCj9qmnI&Uh5sWb{oY8vVdb(#mjl`GU1mco~n~ GtN#Ewuyrp0 literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/calc/CalcApp.class b/bin/oop/ch08/gui/calc/CalcApp.class new file mode 100644 index 0000000000000000000000000000000000000000..110acd2c5d1cc1bda8b1e2be9e5bc034fb0f78ad GIT binary patch literal 1063 zcmZ{jZBr6a6vzKp7m#g31r#+c?QubJd)C67Q5qW?%4RGY>eU5TxCXn-?j`zKy@4iX z`T%{XrgL{OYQ#6^vgh9OKfm+9uirm@0@%e)3=<5CuG_Y1jeA>Gy(6p|Z`Q0Lnca3f z2906nlz-t?lRI_muzG6OBtvvtI703)Oq$s;gI08pZ5@+{8;BsvFkKRk{if5Z+TJ@} zZQ2aUl1sv6?g{lhbZW98e1VF54SAHPxpX}pNyK%`U|w-&7*@*Ax~Rbk&-(aAG&Gj1`8s-*CJ89&b^t zSu-T%U1=3vM-sp76~@t1b=<2{3sPf>i(!rWrfU9b`CTg4dKDzlv5FfC_$I^LFjX*} zzfDmuZX37*lOf^TQbE{`e9Il8%Z#PVmQ_&Bz`B~B*5yQte`w$l9@7LU{DpnOJ55<^y1sqbwmmL|OLNuCgJ6Z) z0bF`q=NKYV$Z(6!tpHt~gl!LF|L+y;kAC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EY*TgpX6j zpum+am-wQVE%Rgz5?|G_m7Z*^#5c8UjVI$J?z>vH(UY}GJf>wWo@}$k54Eh_lWmuH zT+6n3vMz~VYS{&zY>&jRv~0I0+bi*FE$j1S2PJ-^W&NIPNa7D#Ht5L?OZ-vGhCSI) zi9c!C<(}*si9c)E)t+oj;_q5E>d7V~{-I^#o@`R$Ni9owvWygET6R5UqrdUl}!--eM8=<-hN@8{M zo3CXYul%m#e=To!9R7fKfcjvD1 zd@1o^7mpBM=HknVuW<2|#8;M;X@?e<7K(%%rud8H(#7Q)g?eKu zloBKKippq=+>5&MJWi_b+Ie|AJ)%$~l*hC4c)k~mdj9~nkQH0WhYq^CO&gPiZCqnz z>fOjSF-Z-jQ+Eb8A8k2}7Z0|z=JB#fTcjd*^PQw)C+T+qbJV3bj}$hTjf8o76<)0k z)-gM;WkfZk=j-r#O-x?RUDLPow|Y6>a|XANj<*i9GN{`^=^4DKfD$vfqqTkpZ)>fX z!8=+2q_R+TVx-tR?y9y9mhLwS6}OMaL-Aml7&fO=z~ItN*)dQE`(>OghQJXhUcwjbs3v$@`{@#%YI<9u}W+uh)+RO6P!zSgH* zRg9gJv_v~7^mT#SoVlf;R|Obf?^E{@&+!}(`fme5-{8~tLgy$iah}IYN$4AW+Fs}! z`X$ii#~_t41AShuEo6r?^mDq|q+X zEqXNS75l_~jSh&5MNFdsaY$UE(WPQU9MR}9afP^2qpQTV;yR5?5$AiX^7NRn#c_>J Zh@?nqlonaxh#ccl_wgxlO5A|D{{p=4sOta# literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/mvc/model/CounterModel.class b/bin/oop/ch08/gui/mvc/model/CounterModel.class new file mode 100644 index 0000000000000000000000000000000000000000..f2cd1eae14e1d6a1507960c1c3982925fd7016e4 GIT binary patch literal 866 zcmaiyZ)?*~6vm(1rp=mW?V5J;-~3a%%`Jn)S0YS=F%iV7FD8Y(Gfl5uMw^r@DfpfC zMsOQU@B{dv#OJ0-t041D?mg$8^SkGHZhro{{sG_sPjnOnI$=0*ypyNTonhiTJA3EGJ%KNdD}mP z@9*@~c%_FUUt`9cHRBd;GZM;x41B<=3(QsQZ)ogZ;@$#gqz6@E z%oMUVE6gBl!F@a+hPLBThI7&wC=u5@C$|7KSD9&WqQxww`7G_Z$XA(2%RXke_KDKe bRF`cq?w^)n3lj`;#0Q8X3uj>>o}dv zhtNlqHXu3jD{AOPB!qr}$u_QeQ`R)ZF{nxz5|~M}W9I|=3~tf24Q$4?JjX5;rK4dO zgDS&V6yunnzQ*BU&aSvJYr3Aaq$4n$XqIWzJY80$<>^-(m@teffzbI&X%M&_#U0!g zh`1+qZPPJI6g_zfMiHQf(n(*ZAQd*8W4=ZF8i55mOG-c{`M(xKs!~GM(9Tz>%xBdK z7qSS(^LRGt(jj^P?%;*b?`?4u7pAt*AOk8yWrkA ze}?ckegvR#Ro9@y4X)9q1NWP>BIrgBPgL+%f(5zHHqg6&#(zQs@%@D}4CERZRv#lf zsl_@*Q?beKm~Nqu5MLpMnX8XEMu6lH1IfVCor(PQ5U$t(B@1VdCWPm;1Kd|qgMoB-oXrJ3FVH8&aXbHV;iEBRx6!jv#d8bK2uuH^IatCA zp6Em-huIvTOxCi4m%rg78>@I_p-!kjWTt~PV@FX%ek?=of*H~Iuq5_AJrCK^MAgGSr#=p+~hEat)J_%wL<^^ literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/mvc/v1/CounterModel.class b/bin/oop/ch08/gui/mvc/v1/CounterModel.class new file mode 100644 index 0000000000000000000000000000000000000000..c3c2687abb136b1ffa2aa58e1f2e0f3eda91c65c GIT binary patch literal 912 zcmah{(P|Sx6g`vOWSe!9w%a5&Rhv{>O}60bo6sUiRS;4IQv!YKW;-O)Cc9xfiTXjl z`65^g3i{@QA0^(IENSo|vM@9E?!D)pb7p@3`St_AGk6v<4D~o3`C9|Td)f73nVp=2;8g1=+fYApchP{|&H6;AOO*eizI zzKDc;%3w5_9l|-FDK-og9OPl=!LaPW!V>K*5%JgKVV5U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CounterApp.class b/bin/oop/ch08/gui/mvc/v2/CounterApp.class new file mode 100644 index 0000000000000000000000000000000000000000..b9cd5696daa313434ac3652ae325e6e128cc1802 GIT binary patch literal 1415 zcmah}+foxj5IqwDA?wPWfZS1m1OkhALqn+;M8N=7VZ}n9mShNv$!=U_0j1*0%=S$8>CAp9Q^HN|Sw-0(0466mx!f9 z=qE}WkUjFtYv@Bbgdu_HHm+$)Rx}JEqDmPNn2WY!R|l>$xJB1Cut~@ET_>NHu7*)W zRE7y1lbE8uW;VO$lsuWTJYU+<6_|}S$}}s!A9`|)Tz(au^Px=a! z;=VI&iZybrSh2JUdaPqz^>wglWP3#l_+@q#9q}(X@BUH+>G3|6hLol=2sLHX4z65{84}_q0q%OM9bhVxOXm| zqx%~_0?@dsYtZ2aSH0oD{U)t2deF-g75tT8LGJT4^c|h^pHRc#(b74F_i7kbA7lIR z~BzC!9|u72hiBla|L=ZLH_E;dkU&(rG06c!L=&VCFd#@j$WVhM5P z*VLFa`8c#yk&`tntMtZRe6fnPcomQ0!784_yQ+BpH;n-j8D#Py3=n<<5lnDZG-euL aNMef?VetyvOckc@YrG*1fgPR)u=@v0Cr@es literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/mvc/v2/CounterController.class b/bin/oop/ch08/gui/mvc/v2/CounterController.class new file mode 100644 index 0000000000000000000000000000000000000000..7ed18dffcd2404a02c323966bb0b1afe334c2da7 GIT binary patch literal 809 zcmah{T~8B16g{^stX;OWh*q%(75UiGhBZE!U`$9OiAn1Vrh&&{JAr}SowDrKAJkt! zf{^gQ5Aa7B@2u56sAZGcy>s^5d+t3m-+$cQ1K5LWAxGHIdf@q|Z{B$)sq(_1?+xF2 zZJkDmjN3X&VjToBwoo9{&csl7;%nl`p^Or*tJ6!l*B1k(5@tf(mjPj|Go@nJaCQl^ z?^UFd4=nFKOmFlEg*Io}$Yaid1&5G#8@(b3^A2V(ODK0#BtNI&v5dcn<3JJ~ceF2p zo`{v%kHJE6sxApz(^My8bEi&drfdhwKbL*Nire{@3m=UkyN#ZWDxO<-Mp*hU&A}30 z@I)svIn3txWU`hWy!;Ix*;vIZ3w1*MAu}DU89Rz9@?#lt7X;$rYg5`JlnxT%pLfMz z?23J$)7Y2$%J^3O>-2ZbEU2^FdA>R9tg)P<94`xx7%6hJ&wGQ|+qb-$-%z^BIAwm% zXPHG5U^90P6~?N+*jV6t=CQM?+&&iZWL)!NT(ecNn>Tnm!iM=&q7jxeq&C7LBejY< qV$ExmZm?oh^O&fXvCeu;)|sfb{;0O_n*Z}f%(AG-;U~9f{-eh66l+o?T}1OcEe^8^auIo zi(n}#=$jAzDDlo@lLoOY?9AM`_uO;No!@`H{Q&SBj)4S&9flLvA3l2O4ram~&wY3P z*gXhmf#lIqc*;ixQVgXtZ|=DxFBrJ5`)Ayj4B4DBypt@qLQC-xn#!BY%Od4N4(urWUgCCBV(Y!uytv|8}dht`HS~H zpGXk~S=?Z#A4eZVFtBB4N1PhjOEXN=aZ}0LVW_q`moQx!QNf<_q0p6{|L(|}#H!2z zm+=_1RpeYw1b)QFJdkmAL3))d{)Z0Mh-(>~oZT21EymXkb3@w3h?(Z8q>(o|tkMH-tFvliJX z;~JfS3aT;Ekg^jLX*yp}`-Q4nc0Z!<9rcs))&;hII=knnDflE5e3^i$F*b-ugMfEX z&@E~Um{p6W7C-~mm8?PiY^_i6cj=_~r>R}>6KxV2JEMc8HOlE2kKWcw{2?(>#TDm- fs#9-Cy<+_pcNqS)p+Z$v5?x!vtgJ9wx^w$47RIi} literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/mvc/v2/CounterView.class b/bin/oop/ch08/gui/mvc/v2/CounterView.class new file mode 100644 index 0000000000000000000000000000000000000000..f5e9e2629a7408d121b80e73e7df032225a69e58 GIT binary patch literal 1688 zcmah}e^VPp7=D%j2iGeJsX##`P^soe?bU*{n)(B-0%=1*f@x{1&T`q3E0?>>-6mMa z58~I*(J)hI{M+$EIlgu92)ZIL zx8oOvk(S>OF2j}TIU%+brpz#U$MGEb1;f?+o8g5z!>~msb)<07z&IutQu#uC91Ix) z8pd>F@s@^53=40HZeR-23>QKn2jX+5GS0}YT&Qcf9NS{@V`<)XTEYt*-_tRJIi=`r zG9X{66zV!@de^`_a-@x7>;&SO2m;ZlIX?-8nS525`+pV+z>uywo_Nq{9f)9$AGn0g zR(+ehbsjis9xo2drV}zOo@bjXB$+(X=8h*Vzt#3V;Yo(+MDUG(x0{X~Qfy`G2L_gK zbsPnhG!*IVsY=Ut{lLIAe8`|zD;t}8KWyx-?o)PyOd?EKhl!6g++dhIJ^d<-fty%n z7$Zj_FvF#UnErXC#Kgx2Zs8MxK66}mSJiQ^` zy9U0-IuSPle%xOl6fg-^+8Ed&B{lHmRpzSOJM9LS)V>V&4OCV8YJrHVL+mxb6WC(i zQ6#CkrK!2`bQ#G-_LWM+tLqSCa@$Rdy!a)!}JgCy=aRw;7=0x?Sto3!E(~zn8M<&TXUo+ zr$@0fhKCHsPA6SqZyG#A?bQkUtb*X=Q!X>v2=p>OTQuC!}U@| zr(Yv8-@^(m-BwG*-;wU2{1RURnY7xn1}f$-O8isAH4TGqsmt`sVHV4nODI`6RkDH& zY?1h{_-sfnur@wrDnl2iT_P80~#aqmD;3Q=abQ I3BJSZf4WMSrT_o{ literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/mvc/v3/CounterApp.class b/bin/oop/ch08/gui/mvc/v3/CounterApp.class new file mode 100644 index 0000000000000000000000000000000000000000..2b10b86d1cb1ec8e39b37797c15aa8975213e863 GIT binary patch literal 1424 zcma)6Yg5xu5IwhqK4RqAmhuJ>NTCoEA7~jBizwKFGdOk7Poce(V4HN3wDq(9$S=jQ zGyVX7l;hr{Qm_o;Wai%N&E2zS&+g{e?;k$_Y~gJP0fs5ds%nMPwGFLQGqg&*pw-v4 zj8!vTZf{kqAxI1ZXL?=N%DP$74vx=w!DR?;8m8esW9U(nc?KzC6}gNaL=^NQ$k3lP zOuk>M9CQ1<_6|_AsWf?126Scd?5Njv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I>R`!V9fJtOiRiWcU1-BR`PQ6dk zX!rJ#K!)FpocD24@Jd~xs ztKoA{L#YQccGS{Qhtvvm0lw7e4y=;yZGI>W&oz1Y*bZAX3qtOOq~zsdtrRnHIQ4xa z^r`(LF84Kjg*6In`TQu}9~3ZcEU_`L10prhQMBC z*Y!=YX3LW2Q+M*F6p^-8JueJGD%Yk6Tb>oD_!*0F8{D-V5iC+i9d{Ps|y*=MhlwEyL{pn^H+) zwwR}yWN2h*6y#$yF$i|BhTA)mOL&36;Snt%mRjTl62Lvu|iL@q|`V L(>*-HcbNVU3mco( literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/mvc/v4/CounterApp.class b/bin/oop/ch08/gui/mvc/v4/CounterApp.class new file mode 100644 index 0000000000000000000000000000000000000000..e1e139596c7a0522405a918cdd416c8e6ff7de02 GIT binary patch literal 1100 zcmaJ=YflqF6g@+iE?rk1r94EyB0jcISs$oqkpyZmm?9=<4f<&)Lm6y$o82k(Z~3J) zHt`4eql|a9)oR-CWoGBj+;h%7_wLVM-+utu#+Hd8hDG16xuvuF8*aHS-Recjy;yhi ze%(_d*sj$~7!2d*{DQj`?v>qx<8x6`4Dn6rNwvigb23E+Bk!LG3o#^Y3?t4kR*;@} zQ?DM2;2l4%2!>?AFY!u|2U4HAK|`I%kRe^TTt$u;s$6;u)6S5uUY!V9UFJyFpP#mX%WIxZ@EY6W(KOu6m`;yjaA)TqsB|0b>Na8U9y82R`b%-j>lKx+_@OwciGVBV zQ@;&oFPg7fBrY|`Ifh{+RcFNdMuRR-JGOUn|M!aK$~yGxK}qaN4KUUl{51`QCF)^} z{ua9oN(#fTr(LTJ=!pK+p7=lHsz6KJwLaW_*K>O7wHi|Kd=;R$3(Os&I@uN19 zM=hjUm`cum!(0!`B1{m{Bq8+hQdqNh&~yp)GF_eyCfUgyVZ6Rz6+@> zQXlvLJ_<4GQb0;omkPqIR z{q7*dQ#=pwjPPOsKWbR_>r|Catjw5!Ks@}$LmGte#7u1>kCb0@ZSH5j@&jUr?J06B zakRZld?^YXRfJr5#9v38`%2jRj#}^K6`J4jo)$kFj0Ja<;2p0s1F&}6jTNkN#<-l7 tC&ptwyX8FKx96<%F44TklYfk1UT-m`{U2N9FIxp0*km+ei}3|){|2SErMUnA literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/mvc/v4/CounterGUI.class b/bin/oop/ch08/gui/mvc/v4/CounterGUI.class new file mode 100644 index 0000000000000000000000000000000000000000..a94fa685aee7146a7134885626096a4845c08450 GIT binary patch literal 1522 zcma)6?M@Rx6g>mT)@7kkE8CrBcUtugd<0*^ zL`#B+58y)??`&6FQeylu?aZBf&$%CG_UEsI9{?WWrGXxX87XT{sd8o6*{!=ywNY{! zOHNMKeIfYb9a0|-}=B`k&jH9XNQzZI37P7d@Fj3`ug1S`V>b0vXv*HE^Ktr}qt?w^v2b5Y!3c%g79SK*Y{`015^JtbJlTFTm$kGQhF7Ijp$d3yU8ssI zhbA6j&A?-Z1?|xilj}F+o`^NoN@rpBF8;%%T*$q>_;wvXAIV#7c-k?q%JG(lcI7S z4?__eSSPJ^m3veH1~%w(^lw+vPODmaH#AmS$Iye6et0zAlzxiz-$RQePq%}#`-Hy8 zvTW~T$o`IzH>uHmjD5qTz4#5&i*^&I?5~*oj`=r>`&ek=ysgho*stmC@|OtlD*et! zEQ5qMK!O;;IFdMtVc2xKPVBcZifiOI-r^(M5}knMC_hH|ko@DUR>_Ca-3d)aYr2UW y2e=J1aj(s2Mo1HcI~gJCnkXhl?!^N-_0YF`mHrcS_moy1&*`M!TLCYyiK*Y0AA*no literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/mvc/v5/CounterApp.class b/bin/oop/ch08/gui/mvc/v5/CounterApp.class new file mode 100644 index 0000000000000000000000000000000000000000..2d1301ce631ff6df52c477d71a5ff85d4a9eda2b GIT binary patch literal 1100 zcmaJ=YflqF6g@+iE?rk1r94EyB0jcISzjnxB!LcTYhPc zP5c4=DC3=NwVF13nc2BB_ndRjz5Dam_a6YZv1MY2VbS+%Zt3j)hFh*nw|Y@>FV@|> zU-y&S>6LStqKS#i zOL_Hv&%`9davxEZlvn;#ysr-yl1Nw>$FweHhQV?A_4TKbj1gR8FuU$qV7P8$9t#YK z@XT-Q2E0l}WSmX~yrGEJQ&g7-a)YX(s(DZ*eY_Tkes%nStsuMV+)_V^ufTsPWQg9k^#>4K9O4 zC`B2{sL_V=Q8(lPRsXNL57ImF8^jeV?x|3xKeF){>kPA${!*OsdPU_cekcxVBH&8; z)NjMti{`5qiAxP~j$v3y)futA(V)xIj_sY?|GlEQvJU-vP!hXR1B~?se@#PSiFz2L zzXh}s6ymg+baH8Dv=6VeF!Gf?hG5aEuYm-v&}w%c(0(6c%xV;+CGPE}l=~w8(`v(nqT;+}zKuG;urIL?&xA zks5Psa2rp*Ekg_XCxv9-{4h-@E_Kt+hD8f;RwAp!lKrl$3j+9+|u??PfA z@qr(}k3yV7(Nv|HCHw5V=kA`n^Y1@De*rkau7v`_mQtU+aI*K@8_$F{O+znz=JnM~ zY97D+c--8#P-1Y;gEa7>K#sk$;W-brg)+l>rVYMmkEdK}?;zAdNna$IOCB?n^+Y7i zJxbzVou$W6O@pX8RU;lTwDR!G@}JjI7sKT~U#4QIaxXn;(8)(fJlAq3|Lmqz!h7o6|`zj2gK@bb`o-0eH3k=(N z3JVmQ`&3aa$XfW0$DdR@RXfGLD zo;8)p;2cZ(RQ)JO5>D-`obp5;sYGLoMpUGI4F%UVGXvbZnHc@@0__zzWW7$e7xXTY ztaW!UaHIR=0&e#Q>R&V9DxGBl0(CU#G)@G?9o!|!a1ZzAVP2Cofh*l_aKGchrN5o& tSBXR;i_!Rpo5vszBKwfMOV}p=0(Q_OSwahs(V?47Hj~w?F6{zZe*sNY;6(rc literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/mvc/v5/CounterGUI.class b/bin/oop/ch08/gui/mvc/v5/CounterGUI.class new file mode 100644 index 0000000000000000000000000000000000000000..7161c51800d0ae1309ef360165f89d338e1de267 GIT binary patch literal 1625 zcma)7>u%FX6#k}!I=EiarnHm-Z3zVu2QYUi;o9t$hD|TfQiS+5Nk)yS{^L(BA!ZR?;Fdf_8abzVFL0bgQTD)O6 z+K@HjFczXOP+um;XE%nf+&tK0l_6B%64 z@Gmkf?|J-9nG1(xRCAKGkb})IMxdWol`H+S8!F+8fFTp}#NR7Nw1uynehorz5>=Ni zT)|bU2DxCcdyI;*(Ud+J7IIz2wWocdHoj)zx-R8#t6AepFr><^FIHQPiU>A&#Un|& zEUVnx;(@Eru`r?PZb-xprrO6`L09mug?m_FFt>$@hau{nQkq7mVBrBCGMsGi9Z{5i zm8;jTs?#o1+*cH1B3p{#_cn|s@3Dm^x}l6vs7>)fQHTxM3aVns)xcBxlXq1&D8uNY zlqysKZ>|Vcm$lHuUwCF!`vfFf` z&=EjJfM^8?cUIm&cOlY9khctN-_bk@I@v=XF|`3cdTo}>T( literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/mvc/v6/CounterApp.class b/bin/oop/ch08/gui/mvc/v6/CounterApp.class new file mode 100644 index 0000000000000000000000000000000000000000..777979b80202a3dd732970c0daafb6b84529f2d6 GIT binary patch literal 1100 zcmaJ=YflqF6g@+iE?rk1r94EyB0jcIS)Yg&NuUOUDPn@wpr3{^l)-kl*_~4VmS0+9 z6Muj|%6Mm6t)>lMW_Iq(J?GqW@BaMt{Re<;Y?&BhSoHmxTROYH;g;*ttzMMei*+~e z*F7bI?OM%*!7zT#FSuLbUfDf3J{Kj$5Z{!ZR9g%&CsSlF^8Sgi5JSSoFyahj1?h=5 z_3E(*-tps#U`Q7H60a0_AoaN$G}M_48PbKzRpf}F%B9CJ?R+Zq)EufndgWZEXky~> zQeM5^Gcn1q+(%R;<&{4b@9TqwBoY?JF|CW4VQ`#&ef?=9V+7Y2%&vPD7_Qrx#{xql zJo6j70k4t~8K+YLZz!Vm6xAhy+@PwcY95rypUDA5n^+=KwHII9ut7GsuOk8rX)J5u zw-~0nR8i~xnx$Xdv2hm;!)Pd!79l+KmV2abW}v!EQ75g~Sk=unYP|GW2kzNegUetM zN>PR~YP8{e)D3w+)&HyRgY-`P262Uodn(lFk8C`~6NXtze<@CRy`u6JKNJTw5pX4a z>bK$SMe|jQ#H9u~$1tp<>Wo<5Xwc7&&aZtiDSnz)^9B9k?m z$Y$eBJnR9_kxY=71WouTCTQ4`m?4^Zq#~kp2Mp_YO79338+b-k3A%rd9LZwXr1%hC F{03n{_sAw26#fpE4202yK`!DA5!xhJhhC(%v08|tu|a6TP_^2gBu6qbm#mqSs4viG z=xcPXifhre`T$)%ldJp83?wuui$DD_nKS$B>$ktX^Y@4SzW^*lXy{|O=y?sZT3@_j z?ldjaX;sbEl3DPYt`z>gM@0<-48}{|;;+r%mF4c34>q_fYz+y9>DYG3^eTbyTf#Tj z;{(H>|5BnKmZ`HlJ%FXK2DR^sjycRTq&PI>FiPniy=It= z5&2IC*>aLVST?n;U=o+-xZcTz)vcT2}@MI9{=a!b6H#4MXTl^UO0WVmy( zCiU*oUDYq*fl9xiGQ^#kae#XB=H^AG?b|CN+X&B%WZkP!YqYVks^OVWc2(uIv!%3NbR&m4DUN9D7K88 z-{)@47Qq~KYq#0RcMn>J#`lWFTROhQGMQ|Kf*E_z+WZ8#L>324aaf-Z+(1@SL1X4JMG_A=|x;JngWB82p zCZcHg9AD5E#SOEg(Nqg9&S`~o7~P#wq3D_3!}Wc9rNV#Hj+hKRO_JZK(6g$DY$DI; zq@q^r&!o4iagb78X*)=S2I&stLEObEN&9h+)cbHBMS2@_+925vc!V;3qWfp~ndFMX Kzo3E|&i(_knlkYK literal 0 HcmV?d00001 diff --git a/bin/oop/ch08/gui/simple/HelloWorld.class b/bin/oop/ch08/gui/simple/HelloWorld.class new file mode 100644 index 0000000000000000000000000000000000000000..ee80d82eea3e97d6d1905506843d4e0af549b765 GIT binary patch literal 1539 zcmaJ>?^7F96g>|Do21($q%BZrX=i(?qVGO zEBz20nensZALV%7Zc1onoG=;QefOSo?zuPb?|=UI6TmXQGcX~rYf{tRQk2^DYH#pK0E5Yl>UzW(qVPJ>2++UW&28>N5O>c9|QuI&Jj-8eYPi1 zX#T%1H3L`QG$vA<#yl2v$JYd|jI_UQjm}syaRUW`Odvzum2^XGtH9j3?Uq`)=q(es zw2_q9`B4YnHt`PL6-X1Mr2-YToG9*NsDH?fK}THb7| zt?zulwzb@*q%m0CV-DMEV8g%@ftl0lS2QM?cq)*LCeLIp;u$e$qD6Z?1M~T!5!TVZgLuvd_sT(QkcRt&jwE$nBWJono@6U?_O$5?n;Ee~gOt zVu;(-=^@HvnguEX2~#A<5I9fhIl^A!x27z_V2s@1iLkJ6msBa{zK;*0F8E@N$k*AS zVAgE;7$25TaIZaszxa2IkB9hl%o;a$m7Xk+Z!uyr<4Sx^X6+UiYlP|(ReMz~v!5?3 zzv0mk>y=!ZpS|4D5YHIe(xJSW%j&?_W2U&j8$>9;r0WynDNB{r; literal 0 HcmV?d00001 diff --git a/bin/oop/ch09/testing/Example.class b/bin/oop/ch09/testing/Example.class new file mode 100644 index 0000000000000000000000000000000000000000..401f25741a77642d12db1b59a4f35c316e4eae59 GIT binary patch literal 1739 zcmb7F+fEx-6kW$N_84Po;sgk>NnOgtb`nf4NeecljT?$v2&o)V5!8ploWjK88Ot+9 zq3R<~{emiQdCE&)+6Nj%6(7*AsQL%}fP}8&af1=0Rb|b&?6db;Ywvw#{QIjHM*u#> zR|Y}?mtD76sO`?q6@2OWma|j1``BzWZD~Lk7<^>znFZUVd2Q>FtoZ_wlI2+bqJWmo ztqbU7cU#7wp)ZawA_9pO%aQlmjV;-FU~bt`Ai3h!OncpIS!&-k>i(|f30zru6Ms>_ zaN3QBvgHbdvzwJ%ML;|j2yJo^uDNZ8YJ@Uc0s~dwtkqY|W*0u%4Sk;q8>Zz53}-i2 zPO_=`E#_Lxt;awSaiow|pu4hG@3N`f%+?MyUOXp|tUG;p2k#mfKUJpczURwE921yi ziQG0d4h6iHTeweBpVZQ96r-3H=>LxCNiSnLnavn-xMm zOD2i}>vKJ$px#pvD*bFF$nwKDhLK3J_qXEs2pWz*TVr8mKw zRc|+oXVd7hoC1=27wtb4>k*qLDW#8X-(jn>vMuNOLW!*`>&Du?;P}wxJIiYa3y0 z?Kws}ChZ?nSeZ`BpJXubHdD+X&EDlP-cd9hKw=D6d9GucKB`7PsP9vk_)q$%N>_eC zCOLJ8tX|4*%!iL|>DuBmWJbedGYhFF=vT)xJl0BFr4KQCpoy^|{ps-^+~=R;gBQ37 z9AZw%3R*ZtLBJ%-H^r7tlQhdQ$6p?^T+Q)|vWy!&#jAAN8N+Rqut13^wsG-wJ8wce yX2l~0Zu1@rPQWo^ItKCD(0|&4az3Gu5dWm^aE=monNI~@a;HAnE4YXI82uYzaagzj literal 0 HcmV?d00001 diff --git a/bin/uebung03/polynomial/POLNYOMIAL.class b/bin/uebung03/polynomial/POLNYOMIAL.class new file mode 100644 index 0000000000000000000000000000000000000000..6060e2cf1cf1aa49a7d7340a0ce15cad5b5df21d GIT binary patch literal 759 zcmaJ;%WBk682(N!lTJ+M=3F#(dRYkV40HsSwuPby1DTFk8IZ0r>FJm@O-h;(-0MTQ zbmhj4cmt6>fRE$e%XiYC2x3Cc`TvuAw?AKhe7*p%i!}?H!17#9=ke^;?ZH_RJ&Tjm z(2oWW#@^oJ@o2c~Sug}@$Np1)5c%C)8fWE#l5iss1hq4TTMF$oZ1gc&b%f0#ORHl#oX+&JZO9DTd_-Uy6;;^(;(3tB7 z!;Ogz9akOHU@NYc0}~~iRmZ_KTo)+MWOlFckt68E$ex7f0;}HtL*8M8RG!Zx1`{ET z?q_~*GV;#~C-#0aPXl>BR9>rphO?>Wf;F1ZIZ=%_J+ZP?PVNTRGCP4Q>~3;bm#M#l z^Ol8%3fEG8Y@(WKCL|#$0_{ z-+7Hnzq|PoW_SC!F1r1TS3kckz2RFuAAy@stw}_SlWSuU9kRE`=H@EBOQzpZ+#-t7 cTViyj)I^t+j%Bizp?`-Zgr(B0@Ib@rFHwMRj{pDw literal 0 HcmV?d00001 diff --git a/bin/uebung04/ByeGame.class b/bin/uebung04/ByeGame.class new file mode 100644 index 0000000000000000000000000000000000000000..5ffee6329a6a04689cd004b57b6fe347b961b295 GIT binary patch literal 909 zcmcgqOHUgy5dItj2}>X$H$xQ##m-y>Qeiw->p~x`%>1?#eisT74&b zyla!8(!wii_|REuo*eLK`f?z-9}OkXJMtt;Jy*$);?j8TDXz>wI_0T|=%n6>uIGvL z1KZ~hQ;vvC5FYuOR`~1<1g)(vHI>b_lYL0l4u`m{W#h%{HM`oUg@~4 zQr{|LgCTpb8IH+3@QW^N=DPA!g{!IL+t~|S#y05S=vILuz39+LmdJ`pGt!g0_bC6M zM*$JZ5C$d8kgPlcNY4T_hB;Kp6Owlb5pdBj)Nbnado27RimGz`{}xDQ%_2&sIR~R^ywbNn@hHU^T(utIKwSQ@2aA>}vcsee=Z! zzZw%C`~m(bY9F{+XaePZ z`@L;>wm-674EJ3p6v#T`$Pe8>Ky(FCa*tbwp8e4c?h90UGeAEKq(6Fedi+2j^FjK) zg62AoCw&=i3#6N^fq?dSyyqHVM-w_S0;Qhx-QDP5=mxLsq30^@v15A!JCG_*HZz@= zCXX~0OYB9c6rAQCKu2skS5;*k zqo(GGBd3WYhiA<3YobWp0<(2S_0iMcQTob73YYlI#M@a^;vF#Ky(ExltWlt9`zL?j zP&!79PwmY)h6)9M7>#WTC=p+d*~}>x%UI#Lz!lUJUW-xj>g^w>edgkfehOa2 z+6Caom;b=k3&Gc*%u^mri0Ou6*st*B2E2iWO2T zwR=9Q>X=s|0o$?}d&XyGj?c`^-=Dt$?1Gn2V3^NkGdG=$FY%FUDq_LLT0S;KqI5`%P$N8_hm$$h^k`EXmF=9%Xz?GZ>C±Z=}M4``8%VZ9UQ8#W zb9C(*YxH41JTPO}exsq%Gec1E+*Tw?&+q3aLWCWrdJZDsh}-tz^*bOf)-N(VxYs zQjy@!k3x8w&=je?!o?oj&-Sy&KYyKl2XFw{KuutyqG4snJ1^4#QBL_gRZs(Uf%S_( zbP25NYpcU6fu(NmNTB}O<&6^ zkJeM^%rWJ1uZ`2P5MfjYnV?pQY1N?8lm z%g;~I{K}6S5|%LxPPoBxZ3bYy4zvYsqQ#z={EQJ1mwZF}Q>Sx^%^z&>N?6V-F#Zni XUWvbV4gSG3_=i{Fx$PCuv6Sk+ literal 0 HcmV?d00001 diff --git a/src/oop/ch01/chess1/Board.java b/src/oop/ch01/chess1/Board.java new file mode 100644 index 0000000..7060164 --- /dev/null +++ b/src/oop/ch01/chess1/Board.java @@ -0,0 +1,59 @@ +package oop.ch01.chess1; + +import java.util.ArrayList; + +class Board { + ArrayList pieces; + + Board() { + this.pieces = new ArrayList(); + } + + void add(Piece piece) { + if (piece.board != this) + throw new IllegalArgumentException("wrong board"); + final Piece existing = this.pieceAt(piece.row, piece.col); + if (existing != null) + throw new IllegalArgumentException("already occupied by " + + existing.toString()); + this.pieces.add(piece); + } + + void printBoard() { + System.out.println(" 1 2 3 4 5 6 7 8"); + System.out.println(" +---+---+---+---+---+---+---+---+"); + for (int row = 1; row <= 8; row++) { + System.out.print("" + row + " "); + for (int col = 1; col <= 8; col++) { + final Piece p = this.pieceAt(row, col); + final char c = p == null ? ' ' : p.charRep(); + System.out.print("| " + c + " "); + } + System.out.println("|"); + System.out.println(" +---+---+---+---+---+---+---+---+"); + } + } + + Piece pieceAt(int row, int col) { + for (Piece p : this.pieces) + if (p.row == row && p.col == col) + return p; + return null; + } + + void check() { + for (Piece p1 : this.pieces) { + System.out.println(p1.toString()); + for (Piece p2 : this.pieces) + if (p1 != p2) + if (p1.canCapture(p2)) + System.out.println(" can capture " + p2.toString()); + else + System.out.println(" cannot capture " + p2.toString()); + } + } + + public String toString() { + return "pieces: " + this.pieces; + } +} diff --git a/src/oop/ch01/chess1/Chess.java b/src/oop/ch01/chess1/Chess.java new file mode 100644 index 0000000..4e73286 --- /dev/null +++ b/src/oop/ch01/chess1/Chess.java @@ -0,0 +1,15 @@ +package oop.ch01.chess1; + +class Chess { + public static void main(String[] args) { + final Board board = new Board(); + final Piece p1 = new Piece(Kind.queen, Color.black, board, 1, 4); + final Piece p2 = new Piece(Kind.queen, Color.white, board, 8, 4); + final Piece p3 = new Piece(Kind.knight, Color.white, board, 3, 3); + final Piece p4 = new Piece(Kind.knight, Color.black, board, 6, 4); + System.out.println(board); + System.out.println(board.toString()); + board.printBoard(); + board.check(); + } +} diff --git a/src/oop/ch01/chess1/Color.java b/src/oop/ch01/chess1/Color.java new file mode 100644 index 0000000..262e8c7 --- /dev/null +++ b/src/oop/ch01/chess1/Color.java @@ -0,0 +1,5 @@ +package oop.ch01.chess1; + +enum Color { + black, white +} diff --git a/src/oop/ch01/chess1/Kind.java b/src/oop/ch01/chess1/Kind.java new file mode 100644 index 0000000..a047b75 --- /dev/null +++ b/src/oop/ch01/chess1/Kind.java @@ -0,0 +1,5 @@ +package oop.ch01.chess1; + +enum Kind { + queen, knight +} diff --git a/src/oop/ch01/chess1/Piece.java b/src/oop/ch01/chess1/Piece.java new file mode 100644 index 0000000..31e7779 --- /dev/null +++ b/src/oop/ch01/chess1/Piece.java @@ -0,0 +1,87 @@ +package oop.ch01.chess1; + +import static java.lang.Integer.signum; +import static java.lang.Math.abs; + +class Piece { + Kind kind; + Color color; + Board board; + int row; + int col; + + Piece(Kind kind, Color color, Board board, int row, int col) { + if (row < 1 || row > 8 || col < 1 || col > 8) + throw new IllegalArgumentException("Invalid pos " + row + "/" + col); + this.kind = kind; + this.color = color; + this.board = board; + this.row = row; + this.col = col; + board.add(this); + } + + char charRep() { + return switch (this.kind) { + case queen -> this.queenCharRep(); + case knight -> this.knightCharRep(); + }; + } + + public String toString() { + return switch (this.kind) { + case queen -> this.queenToString(); + case knight -> this.knightToString(); + }; + } + + boolean canCapture(Piece other) { + return switch (this.kind) { + case queen -> this.queenCanCapture(other); + case knight -> this.knightCanCapture(other); + }; + } + + char queenCharRep() { + return this.color == Color.white ? 'q' : 'Q'; + } + + char knightCharRep() { + return this.color == Color.white ? 'n' : 'N'; + } + + String queenToString() { + return "" + this.color + " queen at (" + this.row + ", " + this.col + ")"; + } + + String knightToString() { + return "" + this.color + " knight at (" + this.row + ", " + this.col + ")"; + } + + boolean queenCanCapture(Piece other) { + if (this.board != other.board || this.color == other.color) + return false; + if (other.row != this.row && + other.col != this.col && + abs(other.row - this.row) != abs(other.col - this.col)) + return false; + final int dr = signum(other.row - this.row); + final int dc = signum(other.col - this.col); + int r = this.row + dr; + int c = this.col + dc; + while (r != other.row || c != other.col) { + if (this.board.pieceAt(r, c) != null) return false; + r += dr; + c += dc; + } + return true; + } + + boolean knightCanCapture(Piece other) { + if (this.board != other.board || this.color == other.color) + return false; + final int dr = abs(this.row - other.row); + final int dc = abs(this.col - other.col); + return dr == 2 && dc == 1 || dr == 1 && dc == 2; + } +} diff --git a/src/oop/ch01/chess1/package-info.java b/src/oop/ch01/chess1/package-info.java new file mode 100644 index 0000000..ca7751f --- /dev/null +++ b/src/oop/ch01/chess1/package-info.java @@ -0,0 +1,4 @@ +/** + * Using objects with methods for the Java solution of the chess problem. + */ +package oop.ch01.chess1; \ No newline at end of file diff --git a/src/oop/ch01/chess2/Board.java b/src/oop/ch01/chess2/Board.java new file mode 100644 index 0000000..6d2b483 --- /dev/null +++ b/src/oop/ch01/chess2/Board.java @@ -0,0 +1,59 @@ +package oop.ch01.chess2; + +import java.util.ArrayList; + +class Board { + ArrayList pieces; + + Board() { + this.pieces = new ArrayList(); + } + + void add(Piece piece) { + if (piece.board != this) + throw new IllegalArgumentException("wrong board"); + final Piece existing = pieceAt(piece.row, piece.col); + if (existing != null) + throw new IllegalArgumentException("already occupied by " + + existing.toString()); + pieces.add(piece); + } + + void printBoard() { + System.out.println(" 1 2 3 4 5 6 7 8"); + System.out.println(" +---+---+---+---+---+---+---+---+"); + for (int row = 1; row <= 8; row++) { + System.out.print("" + row + " "); + for (int col = 1; col <= 8; col++) { + final Piece p = pieceAt(row, col); + final char c = p == null ? ' ' : p.charRep(); + System.out.print("| " + c + " "); + } + System.out.println("|"); + System.out.println(" +---+---+---+---+---+---+---+---+"); + } + } + + Piece pieceAt(int row, int col) { + for (Piece p : pieces) + if (p.row == row && p.col == col) + return p; + return null; + } + + void check() { + for (Piece p1 : pieces) { + System.out.println(p1.toString()); + for (Piece p2 : pieces) + if (p1 != p2) + if (p1.canCapture(p2)) + System.out.println(" can capture " + p2.toString()); + else + System.out.println(" cannot capture " + p2.toString()); + } + } + + public String toString() { + return pieces.toString(); + } +} diff --git a/src/oop/ch01/chess2/Chess.java b/src/oop/ch01/chess2/Chess.java new file mode 100644 index 0000000..3a7964e --- /dev/null +++ b/src/oop/ch01/chess2/Chess.java @@ -0,0 +1,15 @@ +package oop.ch01.chess2; + +class Chess { + public static void main(String[] args) { + final Board board = new Board(); + final Piece p1 = new Piece(Kind.queen, Color.black, board, 1, 4); + final Piece p2 = new Piece(Kind.queen, Color.white, board, 8, 4); + final Piece p3 = new Piece(Kind.knight, Color.white, board, 3, 3); + final Piece p4 = new Piece(Kind.knight, Color.black, board, 6, 4); + System.out.println(board); + System.out.println(board.toString()); + board.printBoard(); + board.check(); + } +} diff --git a/src/oop/ch01/chess2/Color.java b/src/oop/ch01/chess2/Color.java new file mode 100644 index 0000000..94180cb --- /dev/null +++ b/src/oop/ch01/chess2/Color.java @@ -0,0 +1,5 @@ +package oop.ch01.chess2; + +enum Color { + black, white +} diff --git a/src/oop/ch01/chess2/Kind.java b/src/oop/ch01/chess2/Kind.java new file mode 100644 index 0000000..acaf4be --- /dev/null +++ b/src/oop/ch01/chess2/Kind.java @@ -0,0 +1,5 @@ +package oop.ch01.chess2; + +enum Kind { + queen, knight +} diff --git a/src/oop/ch01/chess2/Piece.java b/src/oop/ch01/chess2/Piece.java new file mode 100644 index 0000000..6ebbecc --- /dev/null +++ b/src/oop/ch01/chess2/Piece.java @@ -0,0 +1,87 @@ +package oop.ch01.chess2; + +import static java.lang.Integer.signum; +import static java.lang.Math.abs; + +class Piece { + Kind kind; + Color color; + Board board; + int row; + int col; + + Piece(Kind kind, Color color, Board board, int row, int col) { + if (row < 1 || row > 8 || col < 1 || col > 8) + throw new IllegalArgumentException("Invalid pos " + row + "/" + col); + this.kind = kind; + this.color = color; + this.board = board; + this.row = row; + this.col = col; + board.add(this); + } + + char charRep() { + return switch (kind) { + case queen -> queenCharRep(); + case knight -> knightCharRep(); + }; + } + + public String toString() { + return switch (kind) { + case queen -> queenToString(); + case knight -> knightToString(); + }; + } + + boolean canCapture(Piece other) { + return switch (kind) { + case queen -> queenCanCapture(other); + case knight -> knightCanCapture(other); + }; + } + + char queenCharRep() { + return color == Color.white ? 'q' : 'Q'; + } + + char knightCharRep() { + return color == Color.white ? 'n' : 'N'; + } + + String queenToString() { + return "" + color + " queen at (" + row + ", " + col + ")"; + } + + String knightToString() { + return "" + color + " knight at (" + row + ", " + col + ")"; + } + + boolean queenCanCapture(Piece other) { + if (board != other.board || color == other.color) + return false; + if (other.row != row && + other.col != col && + abs(other.row - row) != abs(other.col - col)) + return false; + final int dr = signum(other.row - row); + final int dc = signum(other.col - col); + int r = row + dr; + int c = col + dc; + while (r != other.row || c != other.col) { + if (board.pieceAt(r, c) != null) return false; + r += dr; + c += dc; + } + return true; + } + + boolean knightCanCapture(Piece other) { + if (board != other.board || color == other.color) + return false; + final int dr = abs(row - other.row); + final int dc = abs(col - other.col); + return dr == 2 && dc == 1 || dr == 1 && dc == 2; + } +} diff --git a/src/oop/ch01/chess2/package-info.java b/src/oop/ch01/chess2/package-info.java new file mode 100644 index 0000000..fda7a58 --- /dev/null +++ b/src/oop/ch01/chess2/package-info.java @@ -0,0 +1,5 @@ +/** + * Using objects with methods for the Java solution of the chess problem. + * Qualification of members with "this." is avoided where possible. + */ +package oop.ch01.chess2; \ No newline at end of file diff --git a/src/oop/ch02/cards/Card.java b/src/oop/ch02/cards/Card.java new file mode 100644 index 0000000..c903159 --- /dev/null +++ b/src/oop/ch02/cards/Card.java @@ -0,0 +1,79 @@ +package oop.ch02.cards; + +/** + * Represents any card with a name and a unique serial number. + * + * @author Mark Minas + */ +public class Card { + /** + * The name of this card. + */ + private final String name; + + /** + * Counts the number of instantiations of this class. + */ + private static int counter = 0; + + /** + * The unique serial number of this card. + */ + private final int number; + + /** + * Creates a new card with the specified name. + * + * @param name the name of this card + */ + public Card(String name) { + if (name == null) + throw new NullPointerException("name is null"); + this.name = name; + this.number = ++counter; + } + + /** + * Creates a new card for a student with the specified number. + * + * @param num the student's number + */ + public Card(int num) { + this("MatrNr. " + num); + } + + /** + * Returns the name of this card. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Returns the serial number of this card. + * + * @return the serial number + */ + public int getNumber() { + return number; + } + + /** + * Returns the number of instantiations of this class. + * + * @return the number of instantiations. + */ + public static int getCounter() { + return counter; + } + + /** + * Returns a string representation of this card. + */ + @Override + public String toString() { + return "Card " + name + " (no " + number + ")"; + } +} diff --git a/src/oop/ch02/cards/CardExample.java b/src/oop/ch02/cards/CardExample.java new file mode 100644 index 0000000..1d1a094 --- /dev/null +++ b/src/oop/ch02/cards/CardExample.java @@ -0,0 +1,20 @@ +package oop.ch02.cards; + +import java.util.Arrays; + +public class CardExample { + public static void main(String[] args) { + Card c1 = new Card(12345); + System.out.println(c1 + " erstellt."); + + String[] names = {"Franz Mueller", "Hans Mustermann", "Peter Meier"}; + Card[] cards = new Card[names.length]; + for (int i = 0; i < names.length; i++) { + cards[i] = new Card(names[i]); + System.out.println(cards[i] + " erstellt."); + } + System.out.println("cards = " + cards); + System.out.println("cards = " + Arrays.deepToString(cards)); + System.out.println("#Card = " + Card.getCounter()); + } +} diff --git a/src/oop/ch02/cards0/Card.java b/src/oop/ch02/cards0/Card.java new file mode 100644 index 0000000..474fef9 --- /dev/null +++ b/src/oop/ch02/cards0/Card.java @@ -0,0 +1,34 @@ +package oop.ch02.cards0; + +public class Card { + private final String name; + private static int counter = 0; + private final int number; + + public Card(String name) { + if (name == null) + throw new NullPointerException("name is null"); + this.name = name; + this.number = ++Card.counter; + } + + public Card(int num) { + this("MatrNr. " + num); + } + + public String getName() { + return name; + } + + public int getNumber() { + return number; + } + + public static int getCounter() { + return Card.counter; + } + + public String toString() { + return "Card " + name + " (no " + number + ")"; + } +} diff --git a/src/oop/ch02/chess1/Board.java b/src/oop/ch02/chess1/Board.java new file mode 100644 index 0000000..65bfeb1 --- /dev/null +++ b/src/oop/ch02/chess1/Board.java @@ -0,0 +1,59 @@ +package oop.ch02.chess1; + +import java.util.ArrayList; + +public class Board { + private ArrayList pieces; + + public Board() { + this.pieces = new ArrayList(); + } + + void add(Piece piece) { + if (piece.getBoard() != this) + throw new IllegalArgumentException("wrong board"); + final Piece existing = pieceAt(piece.getRow(), piece.getCol()); + if (existing != null) + throw new IllegalArgumentException("already occupied by " + + existing.toString()); + pieces.add(piece); + } + + public void printBoard() { + System.out.println(" 1 2 3 4 5 6 7 8"); + System.out.println(" +---+---+---+---+---+---+---+---+"); + for (int row = 1; row <= 8; row++) { + System.out.print("" + row + " "); + for (int col = 1; col <= 8; col++) { + final Piece p = pieceAt(row, col); + final char c = p == null ? ' ' : p.charRep(); + System.out.print("| " + c + " "); + } + System.out.println("|"); + System.out.println(" +---+---+---+---+---+---+---+---+"); + } + } + + public Piece pieceAt(int row, int col) { + for (Piece p : pieces) + if (p.getRow() == row && p.getCol() == col) + return p; + return null; + } + + public void check() { + for (Piece p1 : pieces) { + System.out.println(p1.toString()); + for (Piece p2 : pieces) + if (p1 != p2) + if (p1.canCapture(p2)) + System.out.println(" can capture " + p2.toString()); + else + System.out.println(" cannot capture " + p2.toString()); + } + } + + public String toString() { + return pieces.toString(); + } +} diff --git a/src/oop/ch02/chess1/Chess.java b/src/oop/ch02/chess1/Chess.java new file mode 100644 index 0000000..555b382 --- /dev/null +++ b/src/oop/ch02/chess1/Chess.java @@ -0,0 +1,15 @@ +package oop.ch02.chess1; + +public class Chess { + public static void main(String[] args) { + final Board board = new Board(); + final Piece p1 = new Piece(Kind.queen, Color.black, board, 1, 4); + final Piece p2 = new Piece(Kind.queen, Color.white, board, 8, 4); + final Piece p3 = new Piece(Kind.knight, Color.white, board, 3, 3); + final Piece p4 = new Piece(Kind.knight, Color.black, board, 6, 4); + System.out.println(board); + System.out.println(board.toString()); + board.printBoard(); + board.check(); + } +} diff --git a/src/oop/ch02/chess1/Color.java b/src/oop/ch02/chess1/Color.java new file mode 100644 index 0000000..4cfb647 --- /dev/null +++ b/src/oop/ch02/chess1/Color.java @@ -0,0 +1,5 @@ +package oop.ch02.chess1; + +public enum Color { + black, white +} diff --git a/src/oop/ch02/chess1/Kind.java b/src/oop/ch02/chess1/Kind.java new file mode 100644 index 0000000..f0db5d2 --- /dev/null +++ b/src/oop/ch02/chess1/Kind.java @@ -0,0 +1,5 @@ +package oop.ch02.chess1; + +public enum Kind { + queen, knight +} diff --git a/src/oop/ch02/chess1/Piece.java b/src/oop/ch02/chess1/Piece.java new file mode 100644 index 0000000..9931f99 --- /dev/null +++ b/src/oop/ch02/chess1/Piece.java @@ -0,0 +1,107 @@ +package oop.ch02.chess1; + +import static java.lang.Integer.signum; +import static java.lang.Math.abs; + +public class Piece { + private Kind kind; + private Color color; + private Board board; + private int row; + private int col; + + public Piece(Kind kind, Color color, Board board, int row, int col) { + if (row < 1 || row > 8 || col < 1 || col > 8) + throw new IllegalArgumentException("Invalid pos " + row + "/" + col); + this.kind = kind; + this.color = color; + this.board = board; + this.row = row; + this.col = col; + board.add(this); + } + + public Kind getKind() { + return kind; + } + + public Color getColor() { + return color; + } + + public Board getBoard() { + return board; + } + + public int getRow() { + return row; + } + + public int getCol() { + return col; + } + + public char charRep() { + return switch (kind) { + case queen -> queenCharRep(); + case knight -> knightCharRep(); + }; + } + + public String toString() { + return switch (kind) { + case queen -> queenToString(); + case knight -> knightToString(); + }; + } + + public boolean canCapture(Piece other) { + return switch (kind) { + case queen -> queenCanCapture(other); + case knight -> knightCanCapture(other); + }; + } + + private char queenCharRep() { + return color == Color.white ? 'q' : 'Q'; + } + + private char knightCharRep() { + return color == Color.white ? 'n' : 'N'; + } + + private String queenToString() { + return "" + color + " queen at (" + row + ", " + col + ")"; + } + + private String knightToString() { + return "" + color + " knight at (" + row + ", " + col + ")"; + } + + private boolean queenCanCapture(Piece other) { + if (board != other.board || color == other.color) + return false; + if (other.row != row && + other.col != col && + abs(other.row - row) != abs(other.col - col)) + return false; + final int dr = signum(other.row - row); + final int dc = signum(other.col - col); + int r = row + dr; + int c = col + dc; + while (r != other.row || c != other.col) { + if (board.pieceAt(r, c) != null) return false; + r += dr; + c += dc; + } + return true; + } + + private boolean knightCanCapture(Piece other) { + if (board != other.board || color == other.color) + return false; + final int dr = abs(row - other.row); + final int dc = abs(col - other.col); + return dr == 2 && dc == 1 || dr == 1 && dc == 2; + } +} diff --git a/src/oop/ch02/chess1/package-info.java b/src/oop/ch02/chess1/package-info.java new file mode 100644 index 0000000..1ce45e6 --- /dev/null +++ b/src/oop/ch02/chess1/package-info.java @@ -0,0 +1,4 @@ +/** + * Using access modifiers in the Java solution of the chess problem. + */ +package oop.ch02.chess1; \ No newline at end of file diff --git a/src/oop/ch02/chess2/Board.java b/src/oop/ch02/chess2/Board.java new file mode 100644 index 0000000..8bbcf20 --- /dev/null +++ b/src/oop/ch02/chess2/Board.java @@ -0,0 +1,54 @@ +package oop.ch02.chess2; + +import java.util.ArrayList; + +public class Board { + private final Piece[][] field = new Piece[8][8]; + private final ArrayList pieces = new ArrayList(); + + void add(Piece piece) { + if (piece.getBoard() != this) + throw new IllegalArgumentException("wrong board"); + final Piece existing = pieceAt(piece.getRow(), piece.getCol()); + if (existing != null) + throw new IllegalArgumentException("already occupied by " + + existing.toString()); + field[piece.getRow() - 1][piece.getCol() - 1] = piece; + pieces.add(piece); + } + + public void printBoard() { + System.out.println(" 1 2 3 4 5 6 7 8"); + System.out.println(" +---+---+---+---+---+---+---+---+"); + for (int row = 1; row <= 8; row++) { + System.out.print("" + row + " "); + for (int col = 1; col <= 8; col++) { + final Piece p = pieceAt(row, col); + final char c = p == null ? ' ' : p.charRep(); + System.out.print("| " + c + " "); + } + System.out.println("|"); + System.out.println(" +---+---+---+---+---+---+---+---+"); + } + } + + public Piece pieceAt(int row, int col) { + return field[row - 1][col - 1]; + } + + public void check() { + for (Piece p1 : pieces) { + System.out.println(p1.toString()); + for (Piece p2 : pieces) + if (p1 != p2) + if (p1.canCapture(p2)) + System.out.println(" can capture " + p2.toString()); + else + System.out.println(" cannot capture " + p2.toString()); + } + } + + public String toString() { + return pieces.toString(); + } +} diff --git a/src/oop/ch02/chess2/Chess.java b/src/oop/ch02/chess2/Chess.java new file mode 100644 index 0000000..b7dd76b --- /dev/null +++ b/src/oop/ch02/chess2/Chess.java @@ -0,0 +1,15 @@ +package oop.ch02.chess2; + +public class Chess { + public static void main(String[] args) { + final Board board = new Board(); + final Piece p1 = new Piece(Kind.queen, Color.black, board, 1, 4); + final Piece p2 = new Piece(Kind.queen, Color.white, board, 8, 4); + final Piece p3 = new Piece(Kind.knight, Color.white, board, 3, 3); + final Piece p4 = new Piece(Kind.knight, Color.black, board, 6, 4); + System.out.println(board); + System.out.println(board.toString()); + board.printBoard(); + board.check(); + } +} diff --git a/src/oop/ch02/chess2/Color.java b/src/oop/ch02/chess2/Color.java new file mode 100644 index 0000000..17f158f --- /dev/null +++ b/src/oop/ch02/chess2/Color.java @@ -0,0 +1,5 @@ +package oop.ch02.chess2; + +public enum Color { + black, white +} diff --git a/src/oop/ch02/chess2/Kind.java b/src/oop/ch02/chess2/Kind.java new file mode 100644 index 0000000..18341b6 --- /dev/null +++ b/src/oop/ch02/chess2/Kind.java @@ -0,0 +1,5 @@ +package oop.ch02.chess2; + +public enum Kind { + queen, knight +} diff --git a/src/oop/ch02/chess2/Piece.java b/src/oop/ch02/chess2/Piece.java new file mode 100644 index 0000000..6e6d02f --- /dev/null +++ b/src/oop/ch02/chess2/Piece.java @@ -0,0 +1,107 @@ +package oop.ch02.chess2; + +import static java.lang.Integer.signum; +import static java.lang.Math.abs; + +public class Piece { + private Kind kind; + private Color color; + private Board board; + private int row; + private int col; + + public Piece(Kind kind, Color color, Board board, int row, int col) { + if (row < 1 || row > 8 || col < 1 || col > 8) + throw new IllegalArgumentException("Invalid pos " + row + "/" + col); + this.kind = kind; + this.color = color; + this.board = board; + this.row = row; + this.col = col; + board.add(this); + } + + public Kind getKind() { + return kind; + } + + public Color getColor() { + return color; + } + + public Board getBoard() { + return board; + } + + public int getRow() { + return row; + } + + public int getCol() { + return col; + } + + public char charRep() { + return switch (kind) { + case queen -> queenCharRep(); + case knight -> knightCharRep(); + }; + } + + public String toString() { + return switch (kind) { + case queen -> queenToString(); + case knight -> knightToString(); + }; + } + + public boolean canCapture(Piece other) { + return switch (kind) { + case queen -> queenCanCapture(other); + case knight -> knightCanCapture(other); + }; + } + + private char queenCharRep() { + return color == Color.white ? 'q' : 'Q'; + } + + private char knightCharRep() { + return color == Color.white ? 'n' : 'N'; + } + + private String queenToString() { + return "" + color + " queen at (" + row + ", " + col + ")"; + } + + private String knightToString() { + return "" + color + " knight at (" + row + ", " + col + ")"; + } + + private boolean queenCanCapture(Piece other) { + if (board != other.board || color == other.color) + return false; + if (other.row != row && + other.col != col && + abs(other.row - row) != abs(other.col - col)) + return false; + final int dr = signum(other.row - row); + final int dc = signum(other.col - col); + int r = row + dr; + int c = col + dc; + while (r != other.row || c != other.col) { + if (board.pieceAt(r, c) != null) return false; + r += dr; + c += dc; + } + return true; + } + + private boolean knightCanCapture(Piece other) { + if (board != other.board || color == other.color) + return false; + final int dr = abs(row - other.row); + final int dc = abs(col - other.col); + return dr == 2 && dc == 1 || dr == 1 && dc == 2; + } +} diff --git a/src/oop/ch02/chess2/package-info.java b/src/oop/ch02/chess2/package-info.java new file mode 100644 index 0000000..7fa0868 --- /dev/null +++ b/src/oop/ch02/chess2/package-info.java @@ -0,0 +1,4 @@ +/** + * Using arrays for speeding up the Java solution of the chess problem. + */ +package oop.ch02.chess2; \ No newline at end of file diff --git a/src/oop/ch02/clock/Clock1.java b/src/oop/ch02/clock/Clock1.java new file mode 100644 index 0000000..7b57fba --- /dev/null +++ b/src/oop/ch02/clock/Clock1.java @@ -0,0 +1,33 @@ +package oop.ch02.clock; + +public class Clock1 { + private int hour; + private int minute; + + public Clock1(int hour, int minute) { + if (hour < 0 || hour >= 24 || minute < 0 || minute >= 60) + throw new IllegalArgumentException("Invalid time " + hour + ":" + minute); + this.hour = hour; + this.minute = minute; + } + + public int getHour() { + return hour; + } + + public void setHour(int hour) { + if (hour < 0 || hour >= 24) + throw new IllegalArgumentException("Invalid hour " + hour); + this.hour = hour; + } + + public int getMinute() { + return minute; + } + + public void setMinute(int minute) { + if (minute < 0 || minute >= 60) + throw new IllegalArgumentException("Invalid minute " + minute); + this.minute = minute; + } +} diff --git a/src/oop/ch02/clock/Clock2.java b/src/oop/ch02/clock/Clock2.java new file mode 100644 index 0000000..72063f4 --- /dev/null +++ b/src/oop/ch02/clock/Clock2.java @@ -0,0 +1,27 @@ +package oop.ch02.clock; + +public class Clock2 { + private int hour; + private int minute; + + public Clock2(int hour, int minute) { + if (hour < 0 || hour >= 24 || minute < 0 || minute >= 60) + throw new IllegalArgumentException("Invalid time " + hour + ":" + minute); + this.hour = hour; + this.minute = minute; + } + + public int getHour() { + return hour; + } + + public int getMinute() { + return minute; + } + + public void tick() { + minute = (minute + 1) % 60; + if (minute == 0) + hour = (hour + 1) % 24; + } +} diff --git a/src/oop/ch02/clock/Clock3.java b/src/oop/ch02/clock/Clock3.java new file mode 100644 index 0000000..b3a6e4e --- /dev/null +++ b/src/oop/ch02/clock/Clock3.java @@ -0,0 +1,24 @@ +package oop.ch02.clock; + +public class Clock3 { + public static final int MINUTES_PER_DAY = 60 * 24; + private int mins; + + public Clock3(int hour, int minute) { + if (hour < 0 || hour >= 24 || minute < 0 || minute >= 60) + throw new IllegalArgumentException("Invalid time " + hour + ":" + minute); + this.mins = 60 * hour + minute; + } + + public int getHour() { + return mins / 60; + } + + public int getMinute() { + return mins % 60; + } + + public void tick() { + mins = (mins + 1) % MINUTES_PER_DAY; + } +} diff --git a/src/oop/ch02/clock/Example.java b/src/oop/ch02/clock/Example.java new file mode 100644 index 0000000..1d9e9d2 --- /dev/null +++ b/src/oop/ch02/clock/Example.java @@ -0,0 +1,13 @@ +package oop.ch02.clock; + +public class Example { + public static void main(String[] args) { + Clock3 clock = new Clock3(22, 55); + for (int i = 0; i < 7; i++) + clock.tick(); + System.out.printf("%02d:%02d%n", clock.getHour(), clock.getMinute()); + for (int i = 0; i < 60; i++) + clock.tick(); + System.out.printf("%02d:%02d%n", clock.getHour(), clock.getMinute()); + } +} diff --git a/src/oop/ch03/chess/Board.java b/src/oop/ch03/chess/Board.java new file mode 100644 index 0000000..ce68e0a --- /dev/null +++ b/src/oop/ch03/chess/Board.java @@ -0,0 +1,54 @@ +package oop.ch03.chess; + +import java.util.ArrayList; + +public class Board { + private final Piece[][] field = new Piece[8][8]; + private final ArrayList pieces = new ArrayList(); + + void add(Piece piece) { + if (piece.getBoard() != this) + throw new IllegalArgumentException("wrong board"); + final Piece existing = pieceAt(piece.getRow(), piece.getCol()); + if (existing != null) + throw new IllegalArgumentException("already occupied by " + + existing.toString()); + field[piece.getRow() - 1][piece.getCol() - 1] = piece; + pieces.add(piece); + } + + public void printBoard() { + System.out.println(" 1 2 3 4 5 6 7 8"); + System.out.println(" +---+---+---+---+---+---+---+---+"); + for (int row = 1; row <= 8; row++) { + System.out.print("" + row + " "); + for (int col = 1; col <= 8; col++) { + final Piece p = pieceAt(row, col); + final char c = p == null ? ' ' : p.charRep(); + System.out.print("| " + c + " "); + } + System.out.println("|"); + System.out.println(" +---+---+---+---+---+---+---+---+"); + } + } + + public Piece pieceAt(int row, int col) { + return field[row - 1][col - 1]; + } + + public void check() { + for (Piece p1 : pieces) { + System.out.println(p1.toString()); + for (Piece p2 : pieces) + if (p1 != p2) + if (p1.canCapture(p2)) + System.out.println(" can capture " + p2.toString()); + else + System.out.println(" cannot capture " + p2.toString()); + } + } + + public String toString() { + return pieces.toString(); + } +} diff --git a/src/oop/ch03/chess/Chess.java b/src/oop/ch03/chess/Chess.java new file mode 100644 index 0000000..fbaf04d --- /dev/null +++ b/src/oop/ch03/chess/Chess.java @@ -0,0 +1,17 @@ +package oop.ch03.chess; + +public class Chess { + public static void main(String[] args) { + final Board board = new Board(); + final Piece p1 = new Queen(Color.black, board, 1, 4); + final Piece p2 = new Queen(Color.white, board, 8, 4); + final Piece p3 = new Knight(Color.white, board, 3, 3); + final Piece p4 = new Knight(Color.black, board, 6, 4); + final Piece p5 = new Rook(Color.white, board, 7, 1); + final Piece p6 = new Rook(Color.black, board, 4, 4); + System.out.println(board); + System.out.println(board.toString()); + board.printBoard(); + board.check(); + } +} diff --git a/src/oop/ch03/chess/Color.java b/src/oop/ch03/chess/Color.java new file mode 100644 index 0000000..38e2090 --- /dev/null +++ b/src/oop/ch03/chess/Color.java @@ -0,0 +1,5 @@ +package oop.ch03.chess; + +public enum Color { + black, white +} diff --git a/src/oop/ch03/chess/Knight.java b/src/oop/ch03/chess/Knight.java new file mode 100644 index 0000000..85cc962 --- /dev/null +++ b/src/oop/ch03/chess/Knight.java @@ -0,0 +1,28 @@ +package oop.ch03.chess; + +import static java.lang.Math.abs; + +public class Knight extends Piece { + public Knight(Color color, Board board, int row, int col) { + super(color, board, row, col); + } + + @Override + public char charRep() { + return getColor() == Color.white ? 'n' : 'N'; + } + + @Override + public String toString() { + return "" + getColor() + " knight at (" + getRow() + ", " + getCol() + ")"; + } + + @Override + public boolean canCapture(Piece other) { + if (getBoard() != other.getBoard() || getColor() == other.getColor()) + return false; + final int dr = abs(getRow() - other.getRow()); + final int dc = abs(getCol() - other.getCol()); + return dr == 2 && dc == 1 || dr == 1 && dc == 2; + } +} diff --git a/src/oop/ch03/chess/Piece.java b/src/oop/ch03/chess/Piece.java new file mode 100644 index 0000000..cd5b1f7 --- /dev/null +++ b/src/oop/ch03/chess/Piece.java @@ -0,0 +1,38 @@ +package oop.ch03.chess; + +public abstract class Piece { + private Color color; + private Board board; + private int row; + private int col; + + protected Piece(Color color, Board board, int row, int col) { + if (row < 1 || row > 8 || col < 1 || col > 8) + throw new IllegalArgumentException("Invalid pos " + row + "/" + col); + this.color = color; + this.board = board; + this.row = row; + this.col = col; + board.add(this); + } + + public Color getColor() { + return color; + } + + public Board getBoard() { + return board; + } + + public int getRow() { + return row; + } + + public int getCol() { + return col; + } + + public abstract char charRep(); + + public abstract boolean canCapture(Piece other); +} diff --git a/src/oop/ch03/chess/Queen.java b/src/oop/ch03/chess/Queen.java new file mode 100644 index 0000000..eee11c7 --- /dev/null +++ b/src/oop/ch03/chess/Queen.java @@ -0,0 +1,40 @@ +package oop.ch03.chess; + +import static java.lang.Integer.signum; +import static java.lang.Math.abs; + +public class Queen extends Piece { + public Queen(Color color, Board board, int row, int col) { + super(color, board, row, col); + } + + @Override + public char charRep() { + return getColor() == Color.white ? 'q' : 'Q'; + } + + @Override + public String toString() { + return "" + getColor() + " queen at (" + getRow() + ", " + getCol() + ")"; + } + + @Override + public boolean canCapture(Piece other) { + if (getBoard() != other.getBoard() || getColor() == other.getColor()) + return false; + if (other.getRow() != getRow() && + other.getCol() != getCol() && + abs(other.getRow() - getRow()) != abs(other.getCol() - getCol())) + return false; + final int dr = signum(other.getRow() - getRow()); + final int dc = signum(other.getCol() - getCol()); + int r = getRow() + dr; + int c = getCol() + dc; + while (r != other.getRow() || c != other.getCol()) { + if (getBoard().pieceAt(r, c) != null) return false; + r += dr; + c += dc; + } + return true; + } +} diff --git a/src/oop/ch03/chess/Rook.java b/src/oop/ch03/chess/Rook.java new file mode 100644 index 0000000..dfc8b4c --- /dev/null +++ b/src/oop/ch03/chess/Rook.java @@ -0,0 +1,41 @@ +package oop.ch03.chess; + +import static java.lang.Integer.signum; +import static java.lang.Math.abs; + +public class Rook extends Piece{ + + public Rook(Color color, Board board, int row, int col){ + super(color, board, row, col); + } + + @Override + public char charRep(){ + return getColor() == Color.white ? 'r' : 'R'; + } + + @Override + public boolean canCapture(Piece other){ + if (getBoard() != other.getBoard() || getColor() == other.getColor()) { + return false; + } + if(other.getRow() != getRow() && other.getCol() != getCol()){ + return false; + } + + final int dr = signum(other.getRow() - getRow()); + final int dc = signum(other.getCol() - getCol()); + int r = getRow() + dr; + int c = getCol() + dc; + + while (r != other.getRow() || c != other.getCol()) { + if (getBoard().pieceAt(r, c) != null) { + return false; + } + + r += dr; + c += dc; + } + return true; + } +} diff --git a/src/oop/ch03/chess/package-info.java b/src/oop/ch03/chess/package-info.java new file mode 100644 index 0000000..0277055 --- /dev/null +++ b/src/oop/ch03/chess/package-info.java @@ -0,0 +1,4 @@ +/** + * Using inheritance and dynamic binding in the Java solution of the chess problem. + */ +package oop.ch03.chess; \ No newline at end of file diff --git a/src/oop/ch03/vehicles/AmphibienBsp.java b/src/oop/ch03/vehicles/AmphibienBsp.java new file mode 100644 index 0000000..5d83ad6 --- /dev/null +++ b/src/oop/ch03/vehicles/AmphibienBsp.java @@ -0,0 +1,26 @@ +package oop.ch03.vehicles; + +import java.util.List; + +public class AmphibienBsp { + public static void main(String[] args) { + final Auto golf = new AutoImpl(500); + final Schiff titanic = new SchiffImpl(53150E3); + final Amphibienfahrzeug alligator = new AmphibienfahrzeugImpl(750, 8000); + + System.out.println("Fahrzeuge:"); + final List fahrzeuge = List.of(golf, titanic, alligator); + for (Fahrzeug fz : fahrzeuge) + System.out.println(fz + ", zuladung: " + fz.getMaxZuladung()); + + System.out.println("Autos:"); + final List autos = List.of(golf, alligator); + for (Auto auto : autos) + System.out.println(auto + ", zuladung: " + auto.getMaxZuladung()); + + System.out.println("Schiffe:"); + final List schiffe = List.of(titanic, alligator); + for (Schiff schiff : schiffe) + System.out.println(schiff + ", zuladung: " + schiff.getMaxZuladung()); + } +} diff --git a/src/oop/ch03/vehicles/Amphibienfahrzeug.java b/src/oop/ch03/vehicles/Amphibienfahrzeug.java new file mode 100644 index 0000000..425bed6 --- /dev/null +++ b/src/oop/ch03/vehicles/Amphibienfahrzeug.java @@ -0,0 +1,3 @@ +package oop.ch03.vehicles; + +public interface Amphibienfahrzeug extends Auto, Schiff {} diff --git a/src/oop/ch03/vehicles/AmphibienfahrzeugImpl.java b/src/oop/ch03/vehicles/AmphibienfahrzeugImpl.java new file mode 100644 index 0000000..0accef3 --- /dev/null +++ b/src/oop/ch03/vehicles/AmphibienfahrzeugImpl.java @@ -0,0 +1,27 @@ +package oop.ch03.vehicles; + +public class AmphibienfahrzeugImpl extends AutoImpl implements Amphibienfahrzeug { + private final SchiffImpl schiff; + + public AmphibienfahrzeugImpl(double maxAutoZuladung, + double maxSchiffZuladung) { + super(maxAutoZuladung); + this.schiff = new SchiffImpl(maxSchiffZuladung); + } + + @Override + public boolean kannHierFahren(double laenge, double breite) { + return super.kannHierFahren(laenge, breite) || + schiff.kannHierFahren(laenge, breite); + } + + @Override + public double getMaxZuladung() { + return Math.max(super.getMaxZuladung(), schiff.getMaxZuladung()); + } + + @Override + public double getTiefgang() { + return schiff.getTiefgang(); + } +} diff --git a/src/oop/ch03/vehicles/AmphibienfahrzeugImpl2.java b/src/oop/ch03/vehicles/AmphibienfahrzeugImpl2.java new file mode 100644 index 0000000..c9ac8b1 --- /dev/null +++ b/src/oop/ch03/vehicles/AmphibienfahrzeugImpl2.java @@ -0,0 +1,27 @@ +package oop.ch03.vehicles; + +public class AmphibienfahrzeugImpl2 extends SchiffImpl implements Amphibienfahrzeug { + private final AutoImpl auto; + + public AmphibienfahrzeugImpl2(double maxAutoZuladung, + double maxSchiffZuladung) { + super(maxSchiffZuladung); + this.auto = new AutoImpl(maxAutoZuladung); + } + + @Override + public boolean kannHierFahren(double laenge, double breite) { + return super.kannHierFahren(laenge, breite) || + auto.kannHierFahren(laenge, breite); + } + + @Override + public double getMaxZuladung() { + return Math.max(super.getMaxZuladung(), auto.getMaxZuladung()); + } + + @Override + public double getAchslast() { + return auto.getAchslast(); + } +} diff --git a/src/oop/ch03/vehicles/Auto.java b/src/oop/ch03/vehicles/Auto.java new file mode 100644 index 0000000..a14fb18 --- /dev/null +++ b/src/oop/ch03/vehicles/Auto.java @@ -0,0 +1,5 @@ +package oop.ch03.vehicles; + +public interface Auto extends Fahrzeug { + double getAchslast(); +} diff --git a/src/oop/ch03/vehicles/AutoImpl.java b/src/oop/ch03/vehicles/AutoImpl.java new file mode 100644 index 0000000..e1b41e3 --- /dev/null +++ b/src/oop/ch03/vehicles/AutoImpl.java @@ -0,0 +1,22 @@ +package oop.ch03.vehicles; + +public class AutoImpl extends FahrzeugImpl implements Auto { + public AutoImpl(double maxZuladung) { + super(maxZuladung); + } + + @Override + public double getAchslast() { + return maxZuladung; + } + + @Override + public boolean kannHierFahren(double laenge, double breite) { + return aufStrasse(laenge, breite) && getGewicht() < maxZuladung; + } + + private boolean aufStrasse(double laenge, double breite) { + // TODO implement + return false; + } +} diff --git a/src/oop/ch03/vehicles/Fahrzeug.java b/src/oop/ch03/vehicles/Fahrzeug.java new file mode 100644 index 0000000..c66caa2 --- /dev/null +++ b/src/oop/ch03/vehicles/Fahrzeug.java @@ -0,0 +1,9 @@ +package oop.ch03.vehicles; + +public interface Fahrzeug { + double getGewicht(); + + double getMaxZuladung(); + + boolean kannHierFahren(double laenge, double breite); +} diff --git a/src/oop/ch03/vehicles/FahrzeugImpl.java b/src/oop/ch03/vehicles/FahrzeugImpl.java new file mode 100644 index 0000000..07911a0 --- /dev/null +++ b/src/oop/ch03/vehicles/FahrzeugImpl.java @@ -0,0 +1,20 @@ +package oop.ch03.vehicles; + +public abstract class FahrzeugImpl implements Fahrzeug { + protected final double maxZuladung; + + protected FahrzeugImpl(double maxZuladung) { + this.maxZuladung = maxZuladung; + } + + @Override + public double getGewicht() { + // TODO implement + return 1000.; + } + + @Override + public double getMaxZuladung() { + return maxZuladung; + } +} diff --git a/src/oop/ch03/vehicles/Schiff.java b/src/oop/ch03/vehicles/Schiff.java new file mode 100644 index 0000000..7ed16cb --- /dev/null +++ b/src/oop/ch03/vehicles/Schiff.java @@ -0,0 +1,5 @@ +package oop.ch03.vehicles; + +public interface Schiff extends Fahrzeug { + double getTiefgang(); +} diff --git a/src/oop/ch03/vehicles/SchiffImpl.java b/src/oop/ch03/vehicles/SchiffImpl.java new file mode 100644 index 0000000..f53d8c4 --- /dev/null +++ b/src/oop/ch03/vehicles/SchiffImpl.java @@ -0,0 +1,23 @@ +package oop.ch03.vehicles; + +public class SchiffImpl extends FahrzeugImpl implements Schiff { + public SchiffImpl(double maxZuladung) { + super(maxZuladung); + } + + @Override + public double getTiefgang() { + // TODO implement + return 1.; + } + + @Override + public boolean kannHierFahren(double laenge, double breite) { + return aufWasser(laenge, breite) && getGewicht() < maxZuladung; + } + + private boolean aufWasser(double laenge, double breite) { + // TODO implement + return false; + } +} diff --git a/src/oop/ch04/equality/Example.java b/src/oop/ch04/equality/Example.java new file mode 100644 index 0000000..5dddddb --- /dev/null +++ b/src/oop/ch04/equality/Example.java @@ -0,0 +1,27 @@ +package oop.ch04.equality; + +import oop.ch04.equality.card1.Card; + +public class Example { + public static void main(String[] args) { + Card c1 = new Card("foo"); + Card c2 = new Card("foo"); + System.out.println(c1 == c2); + + int i1 = 42; + int i2 = 2 * 21; + System.out.println(i1 == i2); + + double f1 = 0.5; + double f2 = 1.0 / 2.0; + System.out.println(f1 == f2); + + String s1 = "OOP"; + String s2 = "O" + "OP"; + System.out.println(s1 == s2); + + String s3 = "OOP".substring(1); + String s4 = "OP"; + System.out.println(s3 == s4); + } +} diff --git a/src/oop/ch04/equality/card1/Card.java b/src/oop/ch04/equality/card1/Card.java new file mode 100644 index 0000000..d8015b3 --- /dev/null +++ b/src/oop/ch04/equality/card1/Card.java @@ -0,0 +1,89 @@ +package oop.ch04.equality.card1; + +/** + * Represents any card with a name and a unique serial number. + * + * @author Mark Minas + */ +public class Card { + /** + * The name of this card. + */ + private final String name; + + /** + * Counts the number of instantiations of this class. + */ + private static int counter = 0; + + /** + * The unique serial number of this card. + */ + private final int number; + + /** + * Creates a new card with the specified name. + * + * @param name the name of this card + */ + public Card(String name) { + if (name == null) + throw new NullPointerException("name is null"); + this.name = name; + this.number = ++counter; + } + + /** + * Creates a new card for a student with the specified number. + * + * @param num the student's number + */ + public Card(int num) { + this("MatrNr. " + num); + } + + /** + * Returns the name of this card. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Returns the serial number of this card. + * + * @return the serial number + */ + public int getNumber() { + return number; + } + + /** + * Returns the number of instantiations of this class. + * + * @return the number of instantiations. + */ + public static int getCounter() { + return counter; + } + + /** + * Returns a string representation of this card. + */ + @Override + public String toString() { + return "Card " + name + " (no " + number + ")"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o instanceof Card) { + final Card that = (Card) o; + return this.name.equals(that.name); + } + return false; + } +} diff --git a/src/oop/ch04/equality/card1/Color.java b/src/oop/ch04/equality/card1/Color.java new file mode 100644 index 0000000..da0403b --- /dev/null +++ b/src/oop/ch04/equality/card1/Color.java @@ -0,0 +1,5 @@ +package oop.ch04.equality.card1; + +public enum Color { + red, green, blue +} diff --git a/src/oop/ch04/equality/card1/ColoredCard.java b/src/oop/ch04/equality/card1/ColoredCard.java new file mode 100644 index 0000000..b387af6 --- /dev/null +++ b/src/oop/ch04/equality/card1/ColoredCard.java @@ -0,0 +1,26 @@ +package oop.ch04.equality.card1; + +public class ColoredCard extends Card { + public final Color color; + + public ColoredCard(String key, Color color) { + super(key); + this.color = color; + } + + @Override + public String toString() { + return color + " " + super.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o instanceof ColoredCard) { + final ColoredCard that = (ColoredCard) o; + return this.color == that.color && + super.equals(that); + } + return false; + } +} diff --git a/src/oop/ch04/equality/card1/Example.java b/src/oop/ch04/equality/card1/Example.java new file mode 100644 index 0000000..ddd868c --- /dev/null +++ b/src/oop/ch04/equality/card1/Example.java @@ -0,0 +1,11 @@ +package oop.ch04.equality.card1; + +public class Example { + public static void main(String[] args) { + Card k1 = new Card("foo"); + Card c1 = new ColoredCard("foo", Color.green); + + System.out.println(c1.equals(k1)); + System.out.println(k1.equals(c1)); + } +} diff --git a/src/oop/ch04/equality/card2/Card.java b/src/oop/ch04/equality/card2/Card.java new file mode 100644 index 0000000..bd45a6b --- /dev/null +++ b/src/oop/ch04/equality/card2/Card.java @@ -0,0 +1,89 @@ +package oop.ch04.equality.card2; + +/** + * Represents any card with a name and a unique serial number. + * + * @author Mark Minas + */ +public class Card { + /** + * The name of this card. + */ + private final String name; + + /** + * Counts the number of instantiations of this class. + */ + private static int counter = 0; + + /** + * The unique serial number of this card. + */ + private final int number; + + /** + * Creates a new card with the specified name. + * + * @param name the name of this card + */ + public Card(String name) { + if (name == null) + throw new NullPointerException("name is null"); + this.name = name; + this.number = ++counter; + } + + /** + * Creates a new card for a student with the specified number. + * + * @param num the student's number + */ + public Card(int num) { + this("MatrNr. " + num); + } + + /** + * Returns the name of this card. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Returns the serial number of this card. + * + * @return the serial number + */ + public int getNumber() { + return number; + } + + /** + * Returns the number of instantiations of this class. + * + * @return the number of instantiations. + */ + public static int getCounter() { + return counter; + } + + /** + * Returns a string representation of this card. + */ + @Override + public String toString() { + return "Card " + name + " (no " + number + ")"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o instanceof Card) { + final Card that = (Card) o; + return this.name.equals(that.name); + } + return false; + } +} diff --git a/src/oop/ch04/equality/card2/Color.java b/src/oop/ch04/equality/card2/Color.java new file mode 100644 index 0000000..a18aae2 --- /dev/null +++ b/src/oop/ch04/equality/card2/Color.java @@ -0,0 +1,5 @@ +package oop.ch04.equality.card2; + +public enum Color { + red, green, blue +} diff --git a/src/oop/ch04/equality/card2/ColoredCard.java b/src/oop/ch04/equality/card2/ColoredCard.java new file mode 100644 index 0000000..5945fc1 --- /dev/null +++ b/src/oop/ch04/equality/card2/ColoredCard.java @@ -0,0 +1,28 @@ +package oop.ch04.equality.card2; + +public class ColoredCard extends Card { + public final Color color; + + public ColoredCard(String key, Color color) { + super(key); + this.color = color; + } + + @Override + public String toString() { + return color + " " + super.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o instanceof ColoredCard) { + final ColoredCard that = (ColoredCard) o; + return this.color == that.color && + super.equals(that); + } + if (o instanceof Card) + return o.equals(this); + return false; + } +} diff --git a/src/oop/ch04/equality/card2/Example.java b/src/oop/ch04/equality/card2/Example.java new file mode 100644 index 0000000..96cd3d9 --- /dev/null +++ b/src/oop/ch04/equality/card2/Example.java @@ -0,0 +1,15 @@ +package oop.ch04.equality.card2; + +public class Example { + public static void main(String[] args) { + Card k1 = new Card("foo"); + Card c1 = new ColoredCard("foo", Color.green); + Card c2 = new ColoredCard("foo", Color.red); + + System.out.println(c1.equals(k1)); + System.out.println(k1.equals(c1)); + System.out.println(c2.equals(k1)); + System.out.println(k1.equals(c2)); + System.out.println(c1.equals(c2)); + } +} diff --git a/src/oop/ch04/equality/card3/Card.java b/src/oop/ch04/equality/card3/Card.java new file mode 100644 index 0000000..d5ece1d --- /dev/null +++ b/src/oop/ch04/equality/card3/Card.java @@ -0,0 +1,89 @@ +package oop.ch04.equality.card3; + +/** + * Represents any card with a name and a unique serial number. + * + * @author Mark Minas + */ +public class Card { + /** + * The name of this card. + */ + private final String name; + + /** + * Counts the number of instantiations of this class. + */ + private static int counter = 0; + + /** + * The unique serial number of this card. + */ + private final int number; + + /** + * Creates a new card with the specified name. + * + * @param name the name of this card + */ + public Card(String name) { + if (name == null) + throw new NullPointerException("name is null"); + this.name = name; + this.number = ++counter; + } + + /** + * Creates a new card for a student with the specified number. + * + * @param num the student's number + */ + public Card(int num) { + this("MatrNr. " + num); + } + + /** + * Returns the name of this card. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Returns the serial number of this card. + * + * @return the serial number + */ + public int getNumber() { + return number; + } + + /** + * Returns the number of instantiations of this class. + * + * @return the number of instantiations. + */ + public static int getCounter() { + return counter; + } + + /** + * Returns a string representation of this card. + */ + @Override + public String toString() { + return "Card " + name + " (no " + number + ")"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o instanceof Card) { + final Card that = (Card) o; + return this.name.equals(that.name) && this.getClass() == that.getClass(); + } + return false; + } +} diff --git a/src/oop/ch04/equality/card3/Color.java b/src/oop/ch04/equality/card3/Color.java new file mode 100644 index 0000000..290fd9c --- /dev/null +++ b/src/oop/ch04/equality/card3/Color.java @@ -0,0 +1,5 @@ +package oop.ch04.equality.card3; + +public enum Color { + red, green, blue +} diff --git a/src/oop/ch04/equality/card3/ColoredCard.java b/src/oop/ch04/equality/card3/ColoredCard.java new file mode 100644 index 0000000..ed0cb66 --- /dev/null +++ b/src/oop/ch04/equality/card3/ColoredCard.java @@ -0,0 +1,25 @@ +package oop.ch04.equality.card3; + +public class ColoredCard extends Card { + public final Color color; + + public ColoredCard(String key, Color color) { + super(key); + this.color = color; + } + + @Override + public String toString() { + return color + " " + super.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o instanceof ColoredCard) { + final ColoredCard that = (ColoredCard) o; + return this.color == that.color && super.equals(that); + } + return false; + } +} diff --git a/src/oop/ch04/equality/card3/Example.java b/src/oop/ch04/equality/card3/Example.java new file mode 100644 index 0000000..4df9e3b --- /dev/null +++ b/src/oop/ch04/equality/card3/Example.java @@ -0,0 +1,15 @@ +package oop.ch04.equality.card3; + +public class Example { + public static void main(String[] args) { + Card k1 = new Card("foo"); + Card c1 = new ColoredCard("foo", Color.green); + Card c2 = new ColoredCard("foo", Color.red); + + System.out.println(c1.equals(k1)); + System.out.println(k1.equals(c1)); + System.out.println(c2.equals(k1)); + System.out.println(k1.equals(c2)); + System.out.println(c1.equals(c2)); + } +} diff --git a/src/oop/ch04/equality/card4/Card.java b/src/oop/ch04/equality/card4/Card.java new file mode 100644 index 0000000..a1dd8bc --- /dev/null +++ b/src/oop/ch04/equality/card4/Card.java @@ -0,0 +1,93 @@ +package oop.ch04.equality.card4; + +/** + * Represents any card with a name and a unique serial number. + * + * @author Mark Minas + */ +public class Card { + /** + * The name of this card. + */ + private final String name; + + /** + * Counts the number of instantiations of this class. + */ + private static int counter = 0; + + /** + * The unique serial number of this card. + */ + private final int number; + + /** + * Creates a new card with the specified name. + * + * @param name the name of this card + */ + public Card(String name) { + if (name == null) + throw new NullPointerException("name is null"); + this.name = name; + this.number = ++counter; + } + + /** + * Creates a new card for a student with the specified number. + * + * @param num the student's number + */ + public Card(int num) { + this("MatrNr. " + num); + } + + /** + * Returns the name of this card. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Returns the serial number of this card. + * + * @return the serial number + */ + public int getNumber() { + return number; + } + + /** + * Returns the number of instantiations of this class. + * + * @return the number of instantiations. + */ + public static int getCounter() { + return counter; + } + + /** + * Returns a string representation of this card. + */ + @Override + public String toString() { + return "Card " + name + " (no " + number + ")"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o instanceof Card) { + final Card that = (Card) o; + return that.canEqual(this) && this.name.equals(that.name); + } + return false; + } + + public boolean canEqual(Object other) { + return other instanceof Card; + } +} diff --git a/src/oop/ch04/equality/card4/Color.java b/src/oop/ch04/equality/card4/Color.java new file mode 100644 index 0000000..ea06dea --- /dev/null +++ b/src/oop/ch04/equality/card4/Color.java @@ -0,0 +1,5 @@ +package oop.ch04.equality.card4; + +public enum Color { + red, green, blue +} diff --git a/src/oop/ch04/equality/card4/ColoredCard.java b/src/oop/ch04/equality/card4/ColoredCard.java new file mode 100644 index 0000000..f5a1df8 --- /dev/null +++ b/src/oop/ch04/equality/card4/ColoredCard.java @@ -0,0 +1,32 @@ +package oop.ch04.equality.card4; + +public class ColoredCard extends Card { + public final Color color; + + public ColoredCard(String key, Color color) { + super(key); + this.color = color; + } + + @Override + public String toString() { + return color + " " + super.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o instanceof ColoredCard) { + final ColoredCard that = (ColoredCard) o; + return that.canEqual(this) && + this.color == that.color && + super.equals(that); + } + return false; + } + + @Override + public boolean canEqual(Object other) { + return other instanceof ColoredCard; + } +} diff --git a/src/oop/ch04/equality/card4/Example.java b/src/oop/ch04/equality/card4/Example.java new file mode 100644 index 0000000..1dce1d6 --- /dev/null +++ b/src/oop/ch04/equality/card4/Example.java @@ -0,0 +1,29 @@ +package oop.ch04.equality.card4; + +import java.util.List; + +import static oop.ch04.equality.card4.Color.green; +import static oop.ch04.equality.card4.Color.red; + +public class Example { + public static void main(String[] args) { + final Card k1 = new Card("foo"); + final Card k2 = new Card("foo"); + final Card k3 = new Card("gnat"); + final Card c1 = new ColoredCard("foo", green); + final Card c2 = new ColoredCard("foo", red); + final Card c3 = new ColoredCard("foo", red); + final Card c4 = new ColoredCard("gnat", red); + + List cards = List.of(k1, k2, k3, c1, c2, c3, c4); + + for (Card x1 : cards) { + System.out.println(x1); + for (Card x2 : cards) + if (x1.equals(x2)) + System.out.println(" equal to " + x2); + else + System.out.println(" NOT equal to " + x2); + } + } +} diff --git a/src/oop/ch04/equality/rational1/Example.java b/src/oop/ch04/equality/rational1/Example.java new file mode 100644 index 0000000..8ed0920 --- /dev/null +++ b/src/oop/ch04/equality/rational1/Example.java @@ -0,0 +1,23 @@ +package oop.ch04.equality.rational1; + +import java.util.HashSet; +import java.util.Set; + +public class Example { + public static void main(String[] args) { + Rational r1 = new Rational(1, 2); + Rational r2 = new Rational(2, 4); + System.out.println(r1 == r2); + System.out.println(r1.equals(r2)); + + Set s1 = new HashSet<>(); + s1.add(new Rational(1, 2)); + s1.add(new Rational(1, 2)); + System.out.println(s1); + + Set s2 = new HashSet<>(); + s2.add(new Rational(1, 2)); + s2.add(new Rational(1, 3)); + System.out.println(s2.contains(new Rational(1, 3))); + } +} diff --git a/src/oop/ch04/equality/rational1/Rational.java b/src/oop/ch04/equality/rational1/Rational.java new file mode 100644 index 0000000..353e05e --- /dev/null +++ b/src/oop/ch04/equality/rational1/Rational.java @@ -0,0 +1,117 @@ +package oop.ch04.equality.rational1; + +public class Rational { + private final int num; + private final int denom; + + public Rational(int num, int denom) { + int gcd = gcDivider(Math.abs(num), Math.abs(denom)); + if (denom < 0) { + this.num = -num / gcd; + this.denom = -denom / gcd; + } + else { + this.num = num / gcd; + this.denom = denom / gcd; + } + } + + public Rational(int num) { + this(num, 1); + } + + private int gcDivider(int x, int y) { + return x == 0 ? y : gcDivider(y % x, x); + } + + public int getNum() { + return num; + } + + public int getDenom() { + return denom; + } + + public Rational add(Rational r) { + return new Rational(num * r.denom + denom * r.num, denom * r.denom); + } + + public Rational add(int i) { + return this.add(new Rational(i)); + } + + public Rational sub(Rational r) { + return new Rational(num * r.denom - denom * r.num, denom * r.denom); + } + + public Rational sub(int i) { + return this.sub(new Rational(i)); + } + + public Rational mult(Rational r) { + return new Rational(num * r.num, denom * r.denom); + } + + public Rational mult(int i) { + return this.mult(new Rational(i)); + } + + public Rational div(Rational r) { + return new Rational(num * r.denom, denom * r.num); + } + + public Rational div(int i) { + return this.div(new Rational(i)); + } + + public boolean lessThan(Rational r) { + return (this.sub(r).num < 0); + } + + public boolean lessThan(int i) { + return (this.sub(i).num < 0); + } + + public boolean greaterThan(Rational r) { + return (this.sub(r).num > 0); + } + + public boolean greaterThan(int i) { + return (this.sub(i).num > 0); + } + + public boolean lessThanOrEqual(Rational r) { + return (this.sub(r).num <= 0); + } + + public boolean lessThanOrEqual(int i) { + return (this.sub(i).num <= 0); + } + + public boolean greaterThanOrEqual(Rational r) { + return (this.sub(r).num <= 0); + } + + public boolean greaterThanOrEqual(int i) { + return (this.sub(i).num <= 0); + } + + @Override + public boolean equals(Object o) { + if (o == this) return true; + if (o instanceof Rational) { + final Rational that = (Rational) o; + return this.denom == that.denom && this.num == that.num; + } + return false; + } + + public boolean equals(int i) { + return this.equals(new Rational(i)); + } + + @Override + public String toString() { + return denom == 1 ? "" + num : num + "/" + denom; + } +} diff --git a/src/oop/ch04/equality/rational2/Example.java b/src/oop/ch04/equality/rational2/Example.java new file mode 100644 index 0000000..e51bffd --- /dev/null +++ b/src/oop/ch04/equality/rational2/Example.java @@ -0,0 +1,23 @@ +package oop.ch04.equality.rational2; + +import java.util.HashSet; +import java.util.Set; + +public class Example { + public static void main(String[] args) { + Rational r1 = new Rational(1, 2); + Rational r2 = new Rational(2, 4); + System.out.println(r1 == r2); + System.out.println(r1.equals(r2)); + + Set s1 = new HashSet<>(); + s1.add(new Rational(1, 2)); + s1.add(new Rational(1, 2)); + System.out.println(s1); + + Set s2 = new HashSet<>(); + s2.add(new Rational(1, 2)); + s2.add(new Rational(1, 3)); + System.out.println(s2.contains(new Rational(1, 3))); + } +} diff --git a/src/oop/ch04/equality/rational2/Rational.java b/src/oop/ch04/equality/rational2/Rational.java new file mode 100644 index 0000000..ad9d381 --- /dev/null +++ b/src/oop/ch04/equality/rational2/Rational.java @@ -0,0 +1,122 @@ +package oop.ch04.equality.rational2; + +public class Rational { + private final int num; + private final int denom; + + public Rational(int num, int denom) { + int gcd = gcDivider(Math.abs(num), Math.abs(denom)); + if (denom < 0) { + this.num = -num / gcd; + this.denom = -denom / gcd; + } + else { + this.num = num / gcd; + this.denom = denom / gcd; + } + } + + public Rational(int num) { + this(num, 1); + } + + private int gcDivider(int x, int y) { + return x == 0 ? y : gcDivider(y % x, x); + } + + public int getNum() { + return num; + } + + public int getDenom() { + return denom; + } + + public Rational add(Rational r) { + return new Rational(num * r.denom + denom * r.num, denom * r.denom); + } + + public Rational add(int i) { + return this.add(new Rational(i)); + } + + public Rational sub(Rational r) { + return new Rational(num * r.denom - denom * r.num, denom * r.denom); + } + + public Rational sub(int i) { + return this.sub(new Rational(i)); + } + + public Rational mult(Rational r) { + return new Rational(num * r.num, denom * r.denom); + } + + public Rational mult(int i) { + return this.mult(new Rational(i)); + } + + public Rational div(Rational r) { + return new Rational(num * r.denom, denom * r.num); + } + + public Rational div(int i) { + return this.div(new Rational(i)); + } + + public boolean lessThan(Rational r) { + return (this.sub(r).num < 0); + } + + public boolean lessThan(int i) { + return (this.sub(i).num < 0); + } + + public boolean greaterThan(Rational r) { + return (this.sub(r).num > 0); + } + + public boolean greaterThan(int i) { + return (this.sub(i).num > 0); + } + + public boolean lessThanOrEqual(Rational r) { + return (this.sub(r).num <= 0); + } + + public boolean lessThanOrEqual(int i) { + return (this.sub(i).num <= 0); + } + + public boolean greaterThanOrEqual(Rational r) { + return (this.sub(r).num <= 0); + } + + public boolean greaterThanOrEqual(int i) { + return (this.sub(i).num <= 0); + } + + @Override + public boolean equals(Object o) { + if (o == this) return true; + if (o instanceof Rational) { + final Rational that = (Rational) o; + return this.denom == that.denom && this.num == that.num; + } + return false; + } + + @Override + public int hashCode() { + return num + denom; + } + + public boolean equals(int i) { + return this.equals(new Rational(i)); + } + + @Override + public String toString() { + return denom == 1 ? "" + num : num + "/" + denom; + } +} diff --git a/src/oop/ch05/generic/example/AutoContainer.java b/src/oop/ch05/generic/example/AutoContainer.java new file mode 100644 index 0000000..90b4c34 --- /dev/null +++ b/src/oop/ch05/generic/example/AutoContainer.java @@ -0,0 +1,22 @@ +package oop.ch05.generic.example; + +import oop.ch03.vehicles.Auto; + +public class AutoContainer { + private final double maxAchsLast; + private Auto contained; + + public AutoContainer(double maxAchsLast) { + this.maxAchsLast = maxAchsLast; + } + + public Auto getContained() { + return contained; + } + + public void setContained(Auto auto) { + if (auto.getAchslast() > maxAchsLast) + throw new IllegalArgumentException("Too heavy"); + this.contained = auto; + } +} diff --git a/src/oop/ch05/generic/example/Example.java b/src/oop/ch05/generic/example/Example.java new file mode 100644 index 0000000..bccba73 --- /dev/null +++ b/src/oop/ch05/generic/example/Example.java @@ -0,0 +1,54 @@ +package oop.ch05.generic.example; + +import oop.ch03.vehicles.Amphibienfahrzeug; +import oop.ch03.vehicles.AmphibienfahrzeugImpl; +import oop.ch03.vehicles.Auto; +import oop.ch03.vehicles.AutoImpl; + +public class Example { + public static void main(String[] args) { + plainTest(); + genericTest(); + } + + public static void plainTest() { + final Amphibienfahrzeug alligator = new AmphibienfahrzeugImpl(750, 8000); + final Auto golf = new AutoImpl(500); + + final AutoContainer c = new AutoContainer(1000); + + c.setContained(alligator); + System.out.println("Tiefgang: " + getTiefgang(c)); + + c.setContained(golf); + System.out.println("Tiefgang: " + getTiefgang(c)); + } + + public static void genericTest() { + final Amphibienfahrzeug alligator = new AmphibienfahrzeugImpl(750, 8000); + final Auto golf = new AutoImpl(500); + + final GenericContainer c1 = new GenericContainer<>(1000); + + c1.setContained(alligator); + System.out.println("Tiefgang: " + getTiefgang(c1)); + + // incompatible types: oop.ch04.vehicles.Auto cannot be converted to oop.ch04.vehicles.Amphibienfahrzeug + // c1.setContained(golf); + System.out.println("Tiefgang: " + getTiefgang(c1)); + + final GenericContainer c2 = new GenericContainer<>(1000); + c2.setContained(golf); + // no suitable method found for getTiefgang(oop.ch05.generic.example.GenericContainer) + // System.out.println("Tiefgang: " + getTiefgang(c2)); + } + + public static double getTiefgang(AutoContainer container) { + final Amphibienfahrzeug contained = (Amphibienfahrzeug) container.getContained(); + return contained.getTiefgang(); + } + + public static double getTiefgang(GenericContainer container) { + return container.getContained().getTiefgang(); + } +} diff --git a/src/oop/ch05/generic/example/GenericContainer.java b/src/oop/ch05/generic/example/GenericContainer.java new file mode 100644 index 0000000..9790991 --- /dev/null +++ b/src/oop/ch05/generic/example/GenericContainer.java @@ -0,0 +1,22 @@ +package oop.ch05.generic.example; + +import oop.ch03.vehicles.Auto; + +public class GenericContainer { + private final double maxAchsLast; + private A contained; + + public GenericContainer(double maxAchsLast) { + this.maxAchsLast = maxAchsLast; + } + + public A getContained() { + return contained; + } + + public void setContained(A auto) { + if (auto.getAchslast() > maxAchsLast) + throw new IllegalArgumentException("Too heavy"); + this.contained = auto; + } +} diff --git a/src/oop/ch05/generic/mensa/AccountCard.java b/src/oop/ch05/generic/mensa/AccountCard.java new file mode 100644 index 0000000..07e7968 --- /dev/null +++ b/src/oop/ch05/generic/mensa/AccountCard.java @@ -0,0 +1,34 @@ +package oop.ch05.generic.mensa; + +import oop.ch05.generic.secured.AuthorizationException; +import oop.ch05.generic.secured.SecuredContent; +import oop.ch05.generic.secured.SecurityClient; + +public class AccountCard extends MensaCard { + private final SecuredContent account; + + public AccountCard(String key, String account, int password) { + super(key, Color.white); + this.account = new SecuredContent<>(password, account); + } + + public String getAccount() { + return account.getContent(); + } + + public void setAccount(SecurityClient client, String account) throws AuthorizationException { + if (account == null || account.trim().length() == 0) + throw new IllegalArgumentException("Invalid account " + account); + this.account.setContent(client, account); + } + + @Override + public String toString() { + return super.toString() + " for account " + account.getContent(); + } + + @Override + public void pass(CashPoint cashPoint) { + cashPoint.charge(this); + } +} diff --git a/src/oop/ch05/generic/mensa/CashCard.java b/src/oop/ch05/generic/mensa/CashCard.java new file mode 100644 index 0000000..ec5b130 --- /dev/null +++ b/src/oop/ch05/generic/mensa/CashCard.java @@ -0,0 +1,43 @@ +package oop.ch05.generic.mensa; + +import oop.ch05.generic.secured.AuthorizationException; +import oop.ch05.generic.secured.SecuredContent; + +public class CashCard extends MensaCard { + private final SecuredContent balance; + + public CashCard(String key, Color color, int password) { + super(key, color); + balance = new SecuredContent<>(password, 0); + if (color != Color.blue && color != Color.green) + throw new IllegalArgumentException("Invalid CashCard color " + color); + } + + public int getBalance() { + return balance.getContent(); + } + + void deposit(VendingMachine client, int cents) + throws AuthorizationException { + if (cents <= 0) + throw new IllegalArgumentException("Non-positive deposit"); + final int newBalance = getBalance() + cents; + balance.setContent(client, newBalance); + } + + void charge(CashPoint client, int cents) throws AuthorizationException { + if (cents < 0) + throw new IllegalArgumentException("Negative charge"); + balance.setContent(client, getBalance() - cents); + } + + @Override + public String toString() { + return super.toString() + " with " + balance.getContent() + " cents"; + } + + @Override + public void pass(CashPoint cashPoint) throws AuthorizationException, RejectedException { + cashPoint.charge(this); + } +} diff --git a/src/oop/ch05/generic/mensa/CashPoint.java b/src/oop/ch05/generic/mensa/CashPoint.java new file mode 100644 index 0000000..7d77448 --- /dev/null +++ b/src/oop/ch05/generic/mensa/CashPoint.java @@ -0,0 +1,64 @@ +package oop.ch05.generic.mensa; + +import oop.ch05.generic.secured.AuthorizationException; +import oop.ch05.generic.secured.SecurityClient; + +public class CashPoint implements SecurityClient { + private final int password; + public final String name; + private int counter; + private int cents; + + public CashPoint(String name, int password) { + this.name = name; + this.password = password; + this.counter = 0; + this.cents = 0; + } + + @Override + public int challengeResponse(int challenge) { + return challenge ^ password; + } + + @Override + public String toString() { + return "Cash point " + name + " (" + getCounter() + " meals, " + getCents() + " cents charged)"; + } + + public int getCounter() { + return counter; + } + + public int getCents() { + return cents; + } + + private int getPrice(Color color) { + return switch (color) { + case green -> 267; + case blue -> 357; + case white -> 495; + default -> 0; + }; + } + + void count(MensaCard card) { + counter++; + } + + void charge(CashCard cashCard) throws AuthorizationException, RejectedException { + final int price = getPrice(cashCard.color); + if (cashCard.getBalance() < price) + throw new RejectedException("insufficient payment"); + cashCard.charge(this, price); + count(cashCard); + cents += price; + } + + void charge(AccountCard accountCard) { + final int price = getPrice(accountCard.color); + System.out.println("Charging " + price + " cents on account " + accountCard.getAccount()); + cents += price; + } +} diff --git a/src/oop/ch05/generic/mensa/Color.java b/src/oop/ch05/generic/mensa/Color.java new file mode 100644 index 0000000..51060be --- /dev/null +++ b/src/oop/ch05/generic/mensa/Color.java @@ -0,0 +1,5 @@ +package oop.ch05.generic.mensa; + +public enum Color { + green, red, blue, white, gray +} diff --git a/src/oop/ch05/generic/mensa/CountCard.java b/src/oop/ch05/generic/mensa/CountCard.java new file mode 100644 index 0000000..80d4107 --- /dev/null +++ b/src/oop/ch05/generic/mensa/CountCard.java @@ -0,0 +1,15 @@ +package oop.ch05.generic.mensa; + +public class CountCard extends MensaCard { + + public CountCard(String key, Color color) { + super(key, color); + if (color != Color.red && color != Color.gray) + throw new IllegalArgumentException("Invalid CountCard color " + color); + } + + @Override + public void pass(CashPoint cashPoint) { + cashPoint.count(this); + } +} diff --git a/src/oop/ch05/generic/mensa/MensaCard.java b/src/oop/ch05/generic/mensa/MensaCard.java new file mode 100644 index 0000000..f8c97ac --- /dev/null +++ b/src/oop/ch05/generic/mensa/MensaCard.java @@ -0,0 +1,20 @@ +package oop.ch05.generic.mensa; + +import oop.ch02.cards.Card; +import oop.ch05.generic.secured.AuthorizationException; + +public abstract class MensaCard extends Card { + public final Color color; + + protected MensaCard(String name, Color color) { + super(name); + this.color = color; + } + + @Override + public String toString() { + return color + " card " + getNumber() + " (" + getName() + ")"; + } + + public abstract void pass(CashPoint cashPoint) throws RejectedException, AuthorizationException; +} \ No newline at end of file diff --git a/src/oop/ch05/generic/mensa/MensaExample.java b/src/oop/ch05/generic/mensa/MensaExample.java new file mode 100644 index 0000000..99efb0b --- /dev/null +++ b/src/oop/ch05/generic/mensa/MensaExample.java @@ -0,0 +1,68 @@ +package oop.ch05.generic.mensa; + +import oop.ch05.generic.secured.AuthorizationException; + +public class MensaExample { + public static void main(String[] args) { + VendingMachine vm1 = new VendingMachine("left", 4711); + VendingMachine vm2 = new VendingMachine("right", 4711); + VendingMachine tumVM = new VendingMachine("TUM Mensa", 3141); + CashPoint unibwMensa = new CashPoint("UniBw Mensa", 4711); + + AccountCard conf = new AccountCard("conference", "33-1298", 42); + MensaCard frankSmith = new CountCard("Frank Smith", Color.gray); + CashCard hansMueller = new CashCard("Hans Müller", Color.green, 4711); + CashCard peterSchmidt = new CashCard("Peter Schmidt", Color.green, 4711); + CashCard thomasMayer = new CashCard("Thomas Mayer", Color.blue, 4711); + + deposit(vm1, hansMueller, 10); + deposit(vm1, peterSchmidt, 5); + deposit(vm2, thomasMayer, 2); + deposit(tumVM, hansMueller, 10); + + System.out.println(vm1); + System.out.println(vm2); + System.out.println(tumVM); + System.out.println(hansMueller); + System.out.println(peterSchmidt); + System.out.println(thomasMayer); + System.out.println(); + + pass(hansMueller, unibwMensa); + System.out.println(hansMueller); + System.out.println(unibwMensa); + + pass(frankSmith, unibwMensa); + pass(conf, unibwMensa); + pass(thomasMayer, unibwMensa); + pass(hansMueller, unibwMensa); + pass(hansMueller, unibwMensa); + pass(hansMueller, unibwMensa); + + System.out.println(unibwMensa); + System.out.println(hansMueller); + System.out.println(peterSchmidt); + System.out.println(thomasMayer); + } + + private static void pass(MensaCard mensaCard, CashPoint cashPoint) { + try { + mensaCard.pass(cashPoint); + } + catch (RejectedException e) { + System.out.println("rejected: " + e.getMessage()); + } + catch (AuthorizationException e) { + System.out.println("authrozation failed: " + e.getMessage()); + } + } + + private static void deposit(VendingMachine vm, CashCard cashCard, int euros) { + try { + vm.deposit(cashCard, euros); + } + catch (AuthorizationException e) { + System.out.println("authorization failed: " + e.getMessage()); + } + } +} diff --git a/src/oop/ch05/generic/mensa/RejectedException.java b/src/oop/ch05/generic/mensa/RejectedException.java new file mode 100644 index 0000000..214f97d --- /dev/null +++ b/src/oop/ch05/generic/mensa/RejectedException.java @@ -0,0 +1,7 @@ +package oop.ch05.generic.mensa; + +public class RejectedException extends Exception { + public RejectedException(String message) { + super(message); + } +} diff --git a/src/oop/ch05/generic/mensa/VendingMachine.java b/src/oop/ch05/generic/mensa/VendingMachine.java new file mode 100644 index 0000000..64326b0 --- /dev/null +++ b/src/oop/ch05/generic/mensa/VendingMachine.java @@ -0,0 +1,37 @@ +package oop.ch05.generic.mensa; + +import oop.ch05.generic.secured.AuthorizationException; +import oop.ch05.generic.secured.SecurityClient; + +public class VendingMachine implements SecurityClient { + private final int password; + public final String name; + private int euros; + + public VendingMachine(String name, int password) { + this.name = name; + this.password = password; + this.euros = 0; + } + + @Override + public int challengeResponse(int challenge) { + return challenge ^ password; + } + + @Override + public String toString() { + return "Vending machine " + name + " (contains EUR " + euros + ")"; + } + + public int getEuros() { + return euros; + } + + public void deposit(CashCard card, int euros) throws AuthorizationException { + if (euros <= 0) + throw new IllegalArgumentException("Non-positive deposit"); + card.deposit(this, euros * 100); + this.euros += euros; + } +} diff --git a/src/oop/ch05/generic/secured/AuthorizationException.java b/src/oop/ch05/generic/secured/AuthorizationException.java new file mode 100644 index 0000000..95aa652 --- /dev/null +++ b/src/oop/ch05/generic/secured/AuthorizationException.java @@ -0,0 +1,20 @@ +package oop.ch05.generic.secured; + +/** + * This class represents exceptions that are thrown whenever an authorization + * fails. + * + * @author Mark Minas + */ +public class AuthorizationException extends Exception { + /** + * Constructs a new authorization exception with the specified detail message + * and cause. + * + * @param message the detail message (which is saved for later retrieval by the + * {@link #getMessage()} method). + */ + public AuthorizationException(String message) { + super(message); + } +} diff --git a/src/oop/ch05/generic/secured/SecuredContent.java b/src/oop/ch05/generic/secured/SecuredContent.java new file mode 100644 index 0000000..c5ea118 --- /dev/null +++ b/src/oop/ch05/generic/secured/SecuredContent.java @@ -0,0 +1,80 @@ +package oop.ch05.generic.secured; + +import java.util.Random; + +/** + * Represents containers for some content that is secured against modifications + * by a challenge-response approach. The content may be read at any time, but + * only authorized clients are allowed to modify the contents. + * + * @param the type of the actual secured content + * @author Mark Minas + */ +public class SecuredContent { + /** + * The actual, secured content + */ + private E content; + /** + * A random number generator used for generating challenges. + */ + private final Random random = new Random(); + /** + * The password used for encryption. + */ + private final int password; + + /** + * Creates a new container containing the specified contents. + * + * @param password this password is used for computing the expected response for a + * challenge. + * @param content the contained content + */ + public SecuredContent(int password, E content) { + this.password = password; + this.content = content; + } + + /** + * Returns the contained contents. There is no authorization necessary for + * reading the contents. + */ + public E getContent() { + return content; + } + + /** + * Sets the new contained contents. Only authorized clients are allowed to do + * so. + * + * @param client The accessing client. Authorization is checked prior to really + * modifying he contained content. + * @param content The new contained contents + * @throws AuthorizationException if the specified client cannot authorize himself + */ + public void setContent(SecurityClient client, E content) + throws AuthorizationException { + final int challenge = nextChallenge(); + if (client.challengeResponse(challenge) != requiredResponse(challenge)) + throw new AuthorizationException(client + + " is not authorized to access contents."); + this.content = content; + } + + /** + * Computes the next random challenge. + */ + private int nextChallenge() { + return random.nextInt(); + } + + /** + * Returns the expected response for the specified challenge. + * + * @param challenge an arbitrary integer used as a challenge + */ + private int requiredResponse(int challenge) { + return challenge ^ password; + } +} diff --git a/src/oop/ch05/generic/secured/SecurityClient.java b/src/oop/ch05/generic/secured/SecurityClient.java new file mode 100644 index 0000000..777ee67 --- /dev/null +++ b/src/oop/ch05/generic/secured/SecurityClient.java @@ -0,0 +1,18 @@ +package oop.ch05.generic.secured; + +/** + * This interface must be implemented by any client that is going to be + * authorized by a challenge-response approach. + * + * @author Mark Minas + */ +public interface SecurityClient { + /** + * Returns the response for the specified challenge. Authorization succeeds + * if this response is the same as the one expected by the server. + * + * @param challenge the integer number for which the correct response has to be + * computed. + */ + int challengeResponse(int challenge); +} diff --git a/src/oop/ch05/mensa/AccountCard.java b/src/oop/ch05/mensa/AccountCard.java new file mode 100644 index 0000000..b74f3a4 --- /dev/null +++ b/src/oop/ch05/mensa/AccountCard.java @@ -0,0 +1,34 @@ +package oop.ch05.mensa; + +import oop.ch05.secured.AuthorizationException; +import oop.ch05.secured.SecuredContent; +import oop.ch05.secured.SecurityClient; + +public class AccountCard extends MensaCard { + private final SecuredContent account; + + public AccountCard(String key, String account, int password) { + super(key, Color.white); + this.account = new SecuredContent(password, account); + } + + public String getAccount() { + return (String) account.getContent(); + } + + public void setAccount(SecurityClient client, String account) throws AuthorizationException { + if (account == null || account.trim().length() == 0) + throw new IllegalArgumentException("Invalid account " + account); + this.account.setContent(client, account); + } + + @Override + public String toString() { + return super.toString() + " for account " + account.getContent(); + } + + @Override + public void pass(CashPoint cashPoint) { + cashPoint.charge(this); + } +} diff --git a/src/oop/ch05/mensa/CashCard.java b/src/oop/ch05/mensa/CashCard.java new file mode 100644 index 0000000..810f6d0 --- /dev/null +++ b/src/oop/ch05/mensa/CashCard.java @@ -0,0 +1,43 @@ +package oop.ch05.mensa; + +import oop.ch05.secured.AuthorizationException; +import oop.ch05.secured.SecuredContent; + +public class CashCard extends MensaCard { + private final SecuredContent balance; + + public CashCard(String key, Color color, int password) { + super(key, color); + balance = new SecuredContent(password, 0); + if (color != Color.blue && color != Color.green) + throw new IllegalArgumentException("Invalid CashCard color " + color); + } + + public int getBalance() { + return (Integer) balance.getContent(); + } + + void deposit(VendingMachine client, int cents) + throws AuthorizationException { + if (cents <= 0) + throw new IllegalArgumentException("Non-positive deposit"); + final int newBalance = getBalance() + cents; + balance.setContent(client, newBalance); + } + + void charge(CashPoint client, int cents) throws AuthorizationException { + if (cents < 0) + throw new IllegalArgumentException("Negative charge"); + balance.setContent(client, getBalance() - cents); + } + + @Override + public String toString() { + return super.toString() + " with " + balance.getContent() + " cents"; + } + + @Override + public void pass(CashPoint cashPoint) throws AuthorizationException, RejectedException { + cashPoint.charge(this); + } +} diff --git a/src/oop/ch05/mensa/CashPoint.java b/src/oop/ch05/mensa/CashPoint.java new file mode 100644 index 0000000..832899b --- /dev/null +++ b/src/oop/ch05/mensa/CashPoint.java @@ -0,0 +1,64 @@ +package oop.ch05.mensa; + +import oop.ch05.secured.AuthorizationException; +import oop.ch05.secured.SecurityClient; + +public class CashPoint implements SecurityClient { + private final int password; + public final String name; + private int counter; + private int cents; + + public CashPoint(String name, int password) { + this.name = name; + this.password = password; + this.counter = 0; + this.cents = 0; + } + + @Override + public int challengeResponse(int challenge) { + return challenge ^ password; + } + + @Override + public String toString() { + return "Cash point " + name + " (" + getCounter() + " meals, " + getCents() + " cents charged)"; + } + + public int getCounter() { + return counter; + } + + public int getCents() { + return cents; + } + + private int getPrice(Color color) { + return switch (color) { + case green -> 267; + case blue -> 357; + case white -> 495; + default -> 0; + }; + } + + void count(MensaCard card) { + counter++; + } + + void charge(CashCard cashCard) throws AuthorizationException, RejectedException { + final int price = getPrice(cashCard.color); + if (cashCard.getBalance() < price) + throw new RejectedException("insufficient payment"); + cashCard.charge(this, price); + count(cashCard); + cents += price; + } + + void charge(AccountCard accountCard) { + final int price = getPrice(accountCard.color); + System.out.println("Charging " + price + " cents on account " + accountCard.getAccount()); + cents += price; + } +} diff --git a/src/oop/ch05/mensa/Color.java b/src/oop/ch05/mensa/Color.java new file mode 100644 index 0000000..13945c7 --- /dev/null +++ b/src/oop/ch05/mensa/Color.java @@ -0,0 +1,5 @@ +package oop.ch05.mensa; + +public enum Color { + green, red, blue, white, gray +} diff --git a/src/oop/ch05/mensa/CountCard.java b/src/oop/ch05/mensa/CountCard.java new file mode 100644 index 0000000..f0c32d3 --- /dev/null +++ b/src/oop/ch05/mensa/CountCard.java @@ -0,0 +1,15 @@ +package oop.ch05.mensa; + +public class CountCard extends MensaCard { + + public CountCard(String key, Color color) { + super(key, color); + if (color != Color.red && color != Color.gray) + throw new IllegalArgumentException("Invalid CountCard color " + color); + } + + @Override + public void pass(CashPoint cashPoint) { + cashPoint.count(this); + } +} diff --git a/src/oop/ch05/mensa/MensaCard.java b/src/oop/ch05/mensa/MensaCard.java new file mode 100644 index 0000000..cf0be76 --- /dev/null +++ b/src/oop/ch05/mensa/MensaCard.java @@ -0,0 +1,20 @@ +package oop.ch05.mensa; + +import oop.ch02.cards.Card; +import oop.ch05.secured.AuthorizationException; + +public abstract class MensaCard extends Card { + public final Color color; + + protected MensaCard(String name, Color color) { + super(name); + this.color = color; + } + + @Override + public String toString() { + return color + " card " + getNumber() + " (" + getName() + ")"; + } + + public abstract void pass(CashPoint cashPoint) throws RejectedException, AuthorizationException; +} \ No newline at end of file diff --git a/src/oop/ch05/mensa/MensaExample.java b/src/oop/ch05/mensa/MensaExample.java new file mode 100644 index 0000000..478c549 --- /dev/null +++ b/src/oop/ch05/mensa/MensaExample.java @@ -0,0 +1,68 @@ +package oop.ch05.mensa; + +import oop.ch05.secured.AuthorizationException; + +public class MensaExample { + public static void main(String[] args) { + VendingMachine vm1 = new VendingMachine("left", 4711); + VendingMachine vm2 = new VendingMachine("right", 4711); + VendingMachine tumVM = new VendingMachine("TUM Mensa", 3141); + CashPoint unibwMensa = new CashPoint("UniBw Mensa", 4711); + + AccountCard conf = new AccountCard("conference", "33-1298", 42); + MensaCard frankSmith = new CountCard("Frank Smith", Color.gray); + CashCard hansMueller = new CashCard("Hans Müller", Color.green, 4711); + CashCard peterSchmidt = new CashCard("Peter Schmidt", Color.green, 4711); + CashCard thomasMayer = new CashCard("Thomas Mayer", Color.blue, 4711); + + deposit(vm1, hansMueller, 10); + deposit(vm1, peterSchmidt, 5); + deposit(vm2, thomasMayer, 2); + deposit(tumVM, hansMueller, 10); + + System.out.println(vm1); + System.out.println(vm2); + System.out.println(tumVM); + System.out.println(hansMueller); + System.out.println(peterSchmidt); + System.out.println(thomasMayer); + System.out.println(); + + pass(hansMueller, unibwMensa); + System.out.println(hansMueller); + System.out.println(unibwMensa); + + pass(frankSmith, unibwMensa); + pass(conf, unibwMensa); + pass(thomasMayer, unibwMensa); + pass(hansMueller, unibwMensa); + pass(hansMueller, unibwMensa); + pass(hansMueller, unibwMensa); + + System.out.println(unibwMensa); + System.out.println(hansMueller); + System.out.println(peterSchmidt); + System.out.println(thomasMayer); + } + + private static void pass(MensaCard mensaCard, CashPoint cashPoint) { + try { + mensaCard.pass(cashPoint); + } + catch (RejectedException e) { + System.out.println("rejected: " + e.getMessage()); + } + catch (AuthorizationException e) { + System.out.println("authrozation failed: " + e.getMessage()); + } + } + + private static void deposit(VendingMachine vm, CashCard cashCard, int euros) { + try { + vm.deposit(cashCard, euros); + } + catch (AuthorizationException e) { + System.out.println("authorization failed: " + e.getMessage()); + } + } +} diff --git a/src/oop/ch05/mensa/RejectedException.java b/src/oop/ch05/mensa/RejectedException.java new file mode 100644 index 0000000..c51c48b --- /dev/null +++ b/src/oop/ch05/mensa/RejectedException.java @@ -0,0 +1,7 @@ +package oop.ch05.mensa; + +public class RejectedException extends Exception { + public RejectedException(String message) { + super(message); + } +} diff --git a/src/oop/ch05/mensa/VendingMachine.java b/src/oop/ch05/mensa/VendingMachine.java new file mode 100644 index 0000000..b2e80ec --- /dev/null +++ b/src/oop/ch05/mensa/VendingMachine.java @@ -0,0 +1,37 @@ +package oop.ch05.mensa; + +import oop.ch05.secured.AuthorizationException; +import oop.ch05.secured.SecurityClient; + +public class VendingMachine implements SecurityClient { + private final int password; + public final String name; + private int euros; + + public VendingMachine(String name, int password) { + this.name = name; + this.password = password; + this.euros = 0; + } + + @Override + public int challengeResponse(int challenge) { + return challenge ^ password; + } + + @Override + public String toString() { + return "Vending machine " + name + " (contains EUR " + euros + ")"; + } + + public int getEuros() { + return euros; + } + + public void deposit(CashCard card, int euros) throws AuthorizationException { + if (euros <= 0) + throw new IllegalArgumentException("Non-positive deposit"); + card.deposit(this, euros * 100); + this.euros += euros; + } +} diff --git a/src/oop/ch05/secured/AuthorizationException.java b/src/oop/ch05/secured/AuthorizationException.java new file mode 100644 index 0000000..325c201 --- /dev/null +++ b/src/oop/ch05/secured/AuthorizationException.java @@ -0,0 +1,20 @@ +package oop.ch05.secured; + +/** + * This class represents exceptions that are thrown whenever an authorization + * fails. + * + * @author Mark Minas + */ +public class AuthorizationException extends Exception { + /** + * Constructs a new authorization exception with the specified detail message + * and cause. + * + * @param message the detail message (which is saved for later retrieval by the + * {@link #getMessage()} method). + */ + public AuthorizationException(String message) { + super(message); + } +} diff --git a/src/oop/ch05/secured/SecuredContent.java b/src/oop/ch05/secured/SecuredContent.java new file mode 100644 index 0000000..1426aaf --- /dev/null +++ b/src/oop/ch05/secured/SecuredContent.java @@ -0,0 +1,79 @@ +package oop.ch05.secured; + +import java.util.Random; + +/** + * Represents containers for some content that is secured against modifications + * by a challenge-response approach. The content may be read at any time, but + * only authorized clients are allowed to modify the contents. + * + * @author Mark Minas + */ +public class SecuredContent { + /** + * The actual, secured content + */ + private Object content; + /** + * A random number generator used for generating challenges. + */ + private final Random random = new Random(); + /** + * The password used for encryption. + */ + private final int password; + + /** + * Creates a new container containing the specified contents. + * + * @param password this password is used for computing the expected response for a + * challenge. + * @param content the contained content + */ + public SecuredContent(int password, Object content) { + this.password = password; + this.content = content; + } + + /** + * Returns the contained contents. There is no authorization necessary for + * reading the contents. + */ + public Object getContent() { + return content; + } + + /** + * Sets the new contained contents. Only authorized clients are allowed to do + * so. + * + * @param client The accessing client. Authorization is checked prior to really + * modifying he contained content. + * @param content The new contained contents + * @throws AuthorizationException if the specified client cannot authorize himself + */ + public void setContent(SecurityClient client, Object content) + throws AuthorizationException { + final int challenge = nextChallenge(); + if (client.challengeResponse(challenge) != requiredResponse(challenge)) + throw new AuthorizationException(client + + " is not authorized to access contents."); + this.content = content; + } + + /** + * Computes the next random challenge. + */ + private int nextChallenge() { + return random.nextInt(); + } + + /** + * Returns the expected response for the specified challenge. + * + * @param challenge an arbitrary integer used as a challenge + */ + private int requiredResponse(int challenge) { + return challenge ^ password; + } +} diff --git a/src/oop/ch05/secured/SecurityClient.java b/src/oop/ch05/secured/SecurityClient.java new file mode 100644 index 0000000..760bfd9 --- /dev/null +++ b/src/oop/ch05/secured/SecurityClient.java @@ -0,0 +1,18 @@ +package oop.ch05.secured; + +/** + * This interface must be implemented by any client that is going to be + * authorized by a challenge-response approach. + * + * @author Mark Minas + */ +public interface SecurityClient { + /** + * Returns the response for the specified challenge. Authorization succeeds + * if this response is the same as the one expected by the server. + * + * @param challenge the integer number for which the correct response has to be + * computed. + */ + int challengeResponse(int challenge); +} diff --git a/src/oop/ch06/calc/AdHocCalculator.java b/src/oop/ch06/calc/AdHocCalculator.java new file mode 100644 index 0000000..3bf913b --- /dev/null +++ b/src/oop/ch06/calc/AdHocCalculator.java @@ -0,0 +1,113 @@ +package oop.ch06.calc; + +import oop.ch06.observer.ObserverSupport; + +public class AdHocCalculator extends ObserverSupport { + private double value; + private double opnd1; + private BinaryOp lastOp; + private double factor; + private boolean startedNumTyping; + private boolean hasSecondOpnd; + + public double getValue() {return value;} + + private void setValue(double n) { + value = n; + notifyObservers(); + } + + public void digit(int d) { + if (!Double.isNaN(value)) { + if (!startedNumTyping) { + startedNumTyping = true; + setValue(d); + factor = 1.; + } + else if (factor < 1.) { + setValue(value + factor * d); + factor *= 0.1; + } + else + setValue(10. * value + d); + if (lastOp != null) + hasSecondOpnd = true; + } + } + + public void dot() { + if (!Double.isNaN(value)) { + if (!startedNumTyping) { + startedNumTyping = true; + setValue(0); + factor = 0.1; + } + else if (factor > 0.1) + factor = 0.1; + if (lastOp != null) + hasSecondOpnd = true; + } + } + + public void unOp(UnaryOp op) { + try { + if (!Double.isNaN(value)) { + startedNumTyping = false; + setValue(op.eval(value)); + if (lastOp != null) + hasSecondOpnd = true; + } + } + catch (CalculatorError ex) { + setValue(Double.NaN); + } + } + + public void binOp(BinaryOp op) { + try { + if (!Double.isNaN(value)) { + startedNumTyping = false; + if (lastOp == null) { + opnd1 = value; + hasSecondOpnd = false; + } + else if (hasSecondOpnd) { + setValue(lastOp.eval(opnd1, value)); + opnd1 = value; + } + lastOp = op; + } + } + catch (CalculatorError ex) { + setValue(Double.NaN); + } + } + + public void eval() { + try { + if (!Double.isNaN(value) && lastOp != null) { + startedNumTyping = false; + setValue(lastOp.eval(opnd1, value)); + lastOp = null; + } + } + catch (CalculatorError ex) { + setValue(Double.NaN); + } + } + + public void clear() { + if (!Double.isNaN(value)) { + setValue(0); + startedNumTyping = false; + hasSecondOpnd = false; + } + } + + public void allClear() { + setValue(0); + startedNumTyping = false; + hasSecondOpnd = false; + lastOp = null; + } +} diff --git a/src/oop/ch06/calc/BinaryOp.java b/src/oop/ch06/calc/BinaryOp.java new file mode 100644 index 0000000..878cd9a --- /dev/null +++ b/src/oop/ch06/calc/BinaryOp.java @@ -0,0 +1,9 @@ +package oop.ch06.calc; + +public abstract class BinaryOp extends Op { + protected BinaryOp(String name) { + super(name); + } + + public abstract double eval(double opnd1, double opnd2); +} diff --git a/src/oop/ch06/calc/CalculatorError.java b/src/oop/ch06/calc/CalculatorError.java new file mode 100644 index 0000000..b541234 --- /dev/null +++ b/src/oop/ch06/calc/CalculatorError.java @@ -0,0 +1,7 @@ +package oop.ch06.calc; + +public class CalculatorError extends RuntimeException { + public CalculatorError(String message) { + super(message); + } +} diff --git a/src/oop/ch06/calc/Example.java b/src/oop/ch06/calc/Example.java new file mode 100644 index 0000000..7eda091 --- /dev/null +++ b/src/oop/ch06/calc/Example.java @@ -0,0 +1,27 @@ +package oop.ch06.calc; + +class Example { + public static void main(String[] args) { + final AdHocCalculator calc = new AdHocCalculator(); + calc.digit(2); + calc.digit(4); + calc.dot(); + calc.digit(5); + System.out.println(calc.getValue()); + calc.binOp(Ops.PLUS); + calc.digit(3); + calc.clear(); + calc.binOp(Ops.MULT); + calc.digit(1); + calc.digit(2); + System.out.println(calc.getValue()); + calc.eval(); + System.out.println(calc.getValue()); + calc.unOp(Ops.CHANGE_SIGN); + System.out.println(calc.getValue()); + calc.unOp(Ops.SQRT); + System.out.println(calc.getValue()); + calc.allClear(); + System.out.println(calc.getValue()); + } +} diff --git a/src/oop/ch06/calc/Op.java b/src/oop/ch06/calc/Op.java new file mode 100644 index 0000000..3c9a283 --- /dev/null +++ b/src/oop/ch06/calc/Op.java @@ -0,0 +1,22 @@ +package oop.ch06.calc; + +abstract class Op { + private final String name; + + protected Op(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + + protected double check(double v) { + if (Double.isNaN(v)) + throw new CalculatorError("value is not a number"); + if (Double.isInfinite(v)) + throw new CalculatorError("infinite value"); + return v; + } +} diff --git a/src/oop/ch06/calc/Ops.java b/src/oop/ch06/calc/Ops.java new file mode 100644 index 0000000..15a1d98 --- /dev/null +++ b/src/oop/ch06/calc/Ops.java @@ -0,0 +1,47 @@ +package oop.ch06.calc; + +public class Ops { + private Ops() { /* do not instantiate */ } + + public static final BinaryOp PLUS = new BinaryOp("+") { + public double eval(double opnd1, double opnd2) { + return check(opnd1 + opnd2); + } + }; + + public static final BinaryOp MULT = new BinaryOp("*") { + public double eval(double opnd1, double opnd2) { + return check(opnd1 * opnd2); + } + }; + + public static final BinaryOp MINUS = new BinaryOp("-") { + public double eval(double opnd1, double opnd2) { + return check(opnd1 - opnd2); + } + }; + + public static final BinaryOp DIV = new BinaryOp("/") { + public double eval(double opnd1, double opnd2) { + return check(opnd1 / opnd2); + } + }; + + public static final UnaryOp CHANGE_SIGN = new UnaryOp("+/-") { + public double eval(double opnd) { + return check(-opnd); + } + }; + + public static final UnaryOp SQRT = new UnaryOp("sqrt") { + public double eval(double opnd) { + return check(Math.sqrt(opnd)); + } + }; + + public static final UnaryOp EXP = new UnaryOp("exp") { + public double eval(double opnd) { + return check(Math.exp(opnd)); + } + }; +} diff --git a/src/oop/ch06/calc/UnaryOp.java b/src/oop/ch06/calc/UnaryOp.java new file mode 100644 index 0000000..a3c79ec --- /dev/null +++ b/src/oop/ch06/calc/UnaryOp.java @@ -0,0 +1,9 @@ +package oop.ch06.calc; + +public abstract class UnaryOp extends Op { + protected UnaryOp(String name) { + super(name); + } + + public abstract double eval(double opnd); +} diff --git a/src/oop/ch06/observer/Observer.java b/src/oop/ch06/observer/Observer.java new file mode 100644 index 0000000..112dcca --- /dev/null +++ b/src/oop/ch06/observer/Observer.java @@ -0,0 +1,5 @@ +package oop.ch06.observer; + +public interface Observer { + void update(); +} diff --git a/src/oop/ch06/observer/ObserverSupport.java b/src/oop/ch06/observer/ObserverSupport.java new file mode 100644 index 0000000..8d9df4f --- /dev/null +++ b/src/oop/ch06/observer/ObserverSupport.java @@ -0,0 +1,17 @@ +package oop.ch06.observer; + +import java.util.ArrayList; +import java.util.List; + +public class ObserverSupport { + private final List observers = new ArrayList<>(); + + public void notifyObservers() { + for (Observer o : observers) + o.update(); + } + + public void addObserver(Observer o) { + observers.add(o); + } +} diff --git a/src/oop/ch07/auto/generics/A.java b/src/oop/ch07/auto/generics/A.java new file mode 100644 index 0000000..6dbac1c --- /dev/null +++ b/src/oop/ch07/auto/generics/A.java @@ -0,0 +1,40 @@ +package oop.ch07.auto.generics; + +class A extends State { + private final Upper upper = new Upper(this); + private final Lower lower = new Lower(this); + + A(Automaton parent) { + super(parent); + } + + @Override + void entry() { + upper.entry(); + lower.entry(); + } + + @Override + void a() { + upper.a(); + lower.a(); + } + + @Override + void b() { + upper.b(); + lower.b(); + } + + @Override + void c() { + upper.c(); + lower.c(); + } + + @Override + void d() { + System.out.println("A->F"); + parent.gotoState(new F(parent)); + } +} diff --git a/src/oop/ch07/auto/generics/Automaton.java b/src/oop/ch07/auto/generics/Automaton.java new file mode 100644 index 0000000..19d61de --- /dev/null +++ b/src/oop/ch07/auto/generics/Automaton.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.generics; + +class Automaton extends StateMachine { + Automaton() { + super(null); + entry(); + } + + @Override + A initialState() { + return new A(this); + } +} diff --git a/src/oop/ch07/auto/generics/B.java b/src/oop/ch07/auto/generics/B.java new file mode 100644 index 0000000..4e47be8 --- /dev/null +++ b/src/oop/ch07/auto/generics/B.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.generics; + +class B extends State { + B(Upper parent) { + super(parent); + } + + @Override + void a() { + System.out.println("B->C"); + parent.gotoState(new C(parent)); + } +} diff --git a/src/oop/ch07/auto/generics/C.java b/src/oop/ch07/auto/generics/C.java new file mode 100644 index 0000000..71b320a --- /dev/null +++ b/src/oop/ch07/auto/generics/C.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.generics; + +class C extends State { + C(Upper parent) { + super(parent); + } + + @Override + void b() { + System.out.println("C->B"); + parent.gotoState(new B(parent)); + } +} diff --git a/src/oop/ch07/auto/generics/D.java b/src/oop/ch07/auto/generics/D.java new file mode 100644 index 0000000..11c69ca --- /dev/null +++ b/src/oop/ch07/auto/generics/D.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.generics; + +class D extends State { + D(Lower parent) { + super(parent); + } + + @Override + void a() { + System.out.println("D->E"); + parent.gotoState(new E(parent)); + } +} diff --git a/src/oop/ch07/auto/generics/Demo.java b/src/oop/ch07/auto/generics/Demo.java new file mode 100644 index 0000000..0e40f74 --- /dev/null +++ b/src/oop/ch07/auto/generics/Demo.java @@ -0,0 +1,25 @@ +package oop.ch07.auto.generics; + +public class Demo { + public static void main(String[] args) { + final Automaton auto = new Automaton(); + System.out.println("a:"); + auto.a(); + System.out.println("---------\nb:"); + auto.b(); + System.out.println("---------\nc:"); + auto.c(); + System.out.println("---------\nd:"); + auto.d(); + System.out.println("---------\nc:"); + auto.c(); + System.out.println("---------\nd:"); + auto.d(); + System.out.println("---------\nc:"); + auto.c(); + System.out.println("---------\na:"); + auto.a(); + System.out.println("---------\nb:"); + auto.b(); + } +} diff --git a/src/oop/ch07/auto/generics/E.java b/src/oop/ch07/auto/generics/E.java new file mode 100644 index 0000000..68771cd --- /dev/null +++ b/src/oop/ch07/auto/generics/E.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.generics; + +class E extends State { + E(Lower parent) { + super(parent); + } + + @Override + void c() { + System.out.println("E->D"); + parent.gotoState(new D(parent)); + } +} diff --git a/src/oop/ch07/auto/generics/F.java b/src/oop/ch07/auto/generics/F.java new file mode 100644 index 0000000..03fd2f5 --- /dev/null +++ b/src/oop/ch07/auto/generics/F.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.generics; + +class F extends State { + F(Automaton parent) { + super(parent); + } + + @Override + void d() { + System.out.println("F->A"); + parent.gotoState(new A(parent)); + } +} diff --git a/src/oop/ch07/auto/generics/Lower.java b/src/oop/ch07/auto/generics/Lower.java new file mode 100644 index 0000000..784616d --- /dev/null +++ b/src/oop/ch07/auto/generics/Lower.java @@ -0,0 +1,18 @@ +package oop.ch07.auto.generics; + +class Lower extends StateMachine { + Lower(A parent) { + super(parent); + } + + @Override + D initialState() { + return new D(this); + } + + @Override + void b() { + System.out.println("A->E"); + gotoState(new E(this)); + } +} diff --git a/src/oop/ch07/auto/generics/State.java b/src/oop/ch07/auto/generics/State.java new file mode 100644 index 0000000..e3948e8 --- /dev/null +++ b/src/oop/ch07/auto/generics/State.java @@ -0,0 +1,47 @@ +package oop.ch07.auto.generics; + +import java.lang.System.Logger; + +/** + * An abstract class representing a state in a state machine. + * + * @param

the type of the containing state. + */ +abstract class State

> { + /** + * The logger for logging messages. + */ + static final Logger LOGGER = System.getLogger(State.class.getName()); + + /** + * The parent state containing this state. + */ + final P parent; + + /** + * Constructs a state with the given parent. + * + * @param parent The state containing this state. + */ + State(P parent) { + this.parent = parent; + } + + /** + * Performs entry actions when entering this state. + */ + void entry() {} + + void a() { /* do nothing */} + + void b() { /* do nothing */} + + void c() { /* do nothing */} + + void d() { /* do nothing */} + + @Override + public String toString() { + return getClass().getSimpleName(); + } +} diff --git a/src/oop/ch07/auto/generics/StateMachine.java b/src/oop/ch07/auto/generics/StateMachine.java new file mode 100644 index 0000000..7caffa2 --- /dev/null +++ b/src/oop/ch07/auto/generics/StateMachine.java @@ -0,0 +1,88 @@ +package oop.ch07.auto.generics; + +import java.lang.System.Logger.Level; + +/** + * An abstract class representing a state machine. It maintains the current state and provides methods to transition + * between states. + * + * @param the type of the concrete state machine. + * @param

the type of the containing state. + */ +abstract class StateMachine, P extends State> extends State

{ + /** + * The current state of the state machine. + */ + private State state; + + /** + * Constructs a state machine with the given parent. + * + * @param parent The parent state machine. + */ + StateMachine(P parent) { + super(parent); + } + + /** + * Gets the initial state of the state machine. + */ + abstract State initialState(); + + /** + * Transitions the state machine to the specified state. + * + * @param newState The state to transition to. + */ + void gotoState(State newState) { + LOGGER.log(Level.DEBUG, "{0}: {1} --> {2}", this, state, newState); + enter(newState); + } + + /** + * Performs the entry action of the state machine. + */ + @Override + void entry() { + final State newState = initialState(); + LOGGER.log(Level.DEBUG, "{0}: initial state={1}", this, newState); + enter(newState); + } + + /** + * Enters a new state. + * + * @param newState The new state to enter. + */ + private void enter(State newState) { + if (newState.parent != this) + throw new IllegalArgumentException("Wrong state: " + newState + " belongs to " + newState.parent + " instead of " + this); + state = newState; + state.entry(); + } + + @Override + void a() { + state.a(); + } + + @Override + void b() { + state.b(); + } + + @Override + void c() { + state.c(); + } + + @Override + void d() { + state.d(); + } + + @Override + public String toString() { + return super.toString() + "(in " + state + ")"; + } +} diff --git a/src/oop/ch07/auto/generics/Upper.java b/src/oop/ch07/auto/generics/Upper.java new file mode 100644 index 0000000..1a23c3c --- /dev/null +++ b/src/oop/ch07/auto/generics/Upper.java @@ -0,0 +1,12 @@ +package oop.ch07.auto.generics; + +class Upper extends StateMachine { + Upper(A parent) { + super(parent); + } + + @Override + B initialState() { + return new B(this); + } +} diff --git a/src/oop/ch07/auto/simple/A.java b/src/oop/ch07/auto/simple/A.java new file mode 100644 index 0000000..3fed093 --- /dev/null +++ b/src/oop/ch07/auto/simple/A.java @@ -0,0 +1,40 @@ +package oop.ch07.auto.simple; + +class A extends State { + private final Upper upper = new Upper(this); + private final Lower lower = new Lower(this); + + A(State parent) { + super(parent); + } + + @Override + void entry() { + upper.entry(); + lower.entry(); + } + + @Override + void a() { + upper.a(); + lower.a(); + } + + @Override + void b() { + upper.b(); + lower.b(); + } + + @Override + void c() { + upper.c(); + lower.c(); + } + + @Override + void d() { + System.out.println("A->F"); + parent.gotoState(new F(parent)); + } +} diff --git a/src/oop/ch07/auto/simple/Automaton.java b/src/oop/ch07/auto/simple/Automaton.java new file mode 100644 index 0000000..bb46c94 --- /dev/null +++ b/src/oop/ch07/auto/simple/Automaton.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.simple; + +class Automaton extends StateMachine { + Automaton() { + super(null); + entry(); + } + + @Override + A initialState() { + return new A(this); + } +} diff --git a/src/oop/ch07/auto/simple/B.java b/src/oop/ch07/auto/simple/B.java new file mode 100644 index 0000000..f00bf01 --- /dev/null +++ b/src/oop/ch07/auto/simple/B.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.simple; + +class B extends State { + B(State parent) { + super(parent); + } + + @Override + void a() { + System.out.println("B->C"); + parent.gotoState(new C(parent)); + } +} diff --git a/src/oop/ch07/auto/simple/C.java b/src/oop/ch07/auto/simple/C.java new file mode 100644 index 0000000..c222e18 --- /dev/null +++ b/src/oop/ch07/auto/simple/C.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.simple; + +class C extends State { + C(State parent) { + super(parent); + } + + @Override + void b() { + System.out.println("C->B"); + parent.gotoState(new B(parent)); + } +} diff --git a/src/oop/ch07/auto/simple/D.java b/src/oop/ch07/auto/simple/D.java new file mode 100644 index 0000000..eec583f --- /dev/null +++ b/src/oop/ch07/auto/simple/D.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.simple; + +class D extends State { + D(State parent) { + super(parent); + } + + @Override + void a() { + System.out.println("D->E"); + parent.gotoState(new E(parent)); + } +} diff --git a/src/oop/ch07/auto/simple/Demo.java b/src/oop/ch07/auto/simple/Demo.java new file mode 100644 index 0000000..a019ed1 --- /dev/null +++ b/src/oop/ch07/auto/simple/Demo.java @@ -0,0 +1,25 @@ +package oop.ch07.auto.simple; + +public class Demo { + public static void main(String[] args) { + final Automaton auto = new Automaton(); + System.out.println("a:"); + auto.a(); + System.out.println("---------\nb:"); + auto.b(); + System.out.println("---------\nc:"); + auto.c(); + System.out.println("---------\nd:"); + auto.d(); + System.out.println("---------\nc:"); + auto.c(); + System.out.println("---------\nd:"); + auto.d(); + System.out.println("---------\nc:"); + auto.c(); + System.out.println("---------\na:"); + auto.a(); + System.out.println("---------\nb:"); + auto.b(); + } +} diff --git a/src/oop/ch07/auto/simple/E.java b/src/oop/ch07/auto/simple/E.java new file mode 100644 index 0000000..e2809af --- /dev/null +++ b/src/oop/ch07/auto/simple/E.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.simple; + +class E extends State { + E(State parent) { + super(parent); + } + + @Override + void c() { + System.out.println("E->D"); + parent.gotoState(new D(parent)); + } +} diff --git a/src/oop/ch07/auto/simple/F.java b/src/oop/ch07/auto/simple/F.java new file mode 100644 index 0000000..17ca5a3 --- /dev/null +++ b/src/oop/ch07/auto/simple/F.java @@ -0,0 +1,13 @@ +package oop.ch07.auto.simple; + +class F extends State { + F(State parent) { + super(parent); + } + + @Override + void d() { + System.out.println("F->A"); + parent.gotoState(new A(parent)); + } +} diff --git a/src/oop/ch07/auto/simple/Lower.java b/src/oop/ch07/auto/simple/Lower.java new file mode 100644 index 0000000..e34795e --- /dev/null +++ b/src/oop/ch07/auto/simple/Lower.java @@ -0,0 +1,18 @@ +package oop.ch07.auto.simple; + +class Lower extends StateMachine { + Lower(State parent) { + super(parent); + } + + @Override + D initialState() { + return new D(this); + } + + @Override + void b() { + System.out.println("A->E"); + gotoState(new E(this)); + } +} diff --git a/src/oop/ch07/auto/simple/State.java b/src/oop/ch07/auto/simple/State.java new file mode 100644 index 0000000..d1ad84a --- /dev/null +++ b/src/oop/ch07/auto/simple/State.java @@ -0,0 +1,49 @@ +package oop.ch07.auto.simple; + +import java.lang.System.Logger; + +/** + * An abstract class representing a state in a state machine. + */ +abstract class State { + /** + * The logger for logging messages. + */ + static final Logger LOGGER = System.getLogger(State.class.getName()); + + /** + * The parent state containing this state. + */ + final State parent; + + /** + * Constructs a state with the given parent. + * + * @param parent The state containing this state. + */ + State(State parent) { + this.parent = parent; + } + + void gotoState(State newState) { + throw new IllegalStateException("not in a statemachine"); + } + + /** + * Performs entry actions when entering this state. + */ + void entry() { /* do nothing */} + + void a() { /* do nothing */} + + void b() { /* do nothing */} + + void c() { /* do nothing */} + + void d() { /* do nothing */} + + @Override + public String toString() { + return getClass().getSimpleName(); + } +} diff --git a/src/oop/ch07/auto/simple/StateMachine.java b/src/oop/ch07/auto/simple/StateMachine.java new file mode 100644 index 0000000..2d4f700 --- /dev/null +++ b/src/oop/ch07/auto/simple/StateMachine.java @@ -0,0 +1,86 @@ +package oop.ch07.auto.simple; + +import java.lang.System.Logger.Level; + +/** + * An abstract class representing a state machine. It maintains the current state and provides methods to transition + * between states. + */ +abstract class StateMachine extends State { + /** + * The current state of the state machine. + */ + private State state; + + /** + * Constructs a state machine with the given parent. + * + * @param parent The parent state machine. + */ + StateMachine(State parent) { + super(parent); + } + + /** + * Gets the initial state of the state machine. + */ + abstract State initialState(); + + /** + * Transitions the state machine to the specified state. + * + * @param newState The state to transition to. + */ + @Override + void gotoState(State newState) { + LOGGER.log(Level.DEBUG, "{0}: {1} --> {2}", this, state, newState); + enter(newState); + } + + /** + * Performs the entry action of the state machine. + */ + @Override + void entry() { + final State newState = initialState(); + LOGGER.log(Level.DEBUG, "{0}: initial state={1}", this, newState); + enter(newState); + } + + /** + * Enters a new state. + * + * @param newState The new state to enter. + */ + private void enter(State newState) { + if (newState.parent != this) + throw new IllegalArgumentException("Wrong state: " + newState + " belongs to " + newState.parent + " instead of " + this); + state = newState; + state.entry(); + } + + @Override + void a() { + state.a(); + } + + @Override + void b() { + state.b(); + } + + @Override + void c() { + state.c(); + } + + @Override + void d() { + state.d(); + } + + @Override + public String toString() { + return super.toString() + "(in " + state + ")"; + } +} diff --git a/src/oop/ch07/auto/simple/Upper.java b/src/oop/ch07/auto/simple/Upper.java new file mode 100644 index 0000000..a1726cd --- /dev/null +++ b/src/oop/ch07/auto/simple/Upper.java @@ -0,0 +1,12 @@ +package oop.ch07.auto.simple; + +class Upper extends StateMachine { + Upper(State parent) { + super(parent); + } + + @Override + B initialState() { + return new B(this); + } +} diff --git a/src/oop/ch07/calc/AfterDot.java b/src/oop/ch07/calc/AfterDot.java new file mode 100644 index 0000000..e1d76bc --- /dev/null +++ b/src/oop/ch07/calc/AfterDot.java @@ -0,0 +1,12 @@ +package oop.ch07.calc; + +class AfterDot extends State { + AfterDot(Lower parent) {super(parent, "after_dot");} + + @Override + void digit(int d) { + final Calculator c = getCalculator(); + c.setValue(c.getValue() + d * c.getFactor()); + c.setFactor(0.1 * c.getFactor()); + } +} diff --git a/src/oop/ch07/calc/Automaton.java b/src/oop/ch07/calc/Automaton.java new file mode 100644 index 0000000..a7d7141 --- /dev/null +++ b/src/oop/ch07/calc/Automaton.java @@ -0,0 +1,55 @@ +package oop.ch07.calc; + +import oop.ch06.calc.BinaryOp; +import oop.ch06.calc.CalculatorError; +import oop.ch06.calc.UnaryOp; + +class Automaton extends StateMachine { + private final Calculator calculator; + + Automaton(Calculator calculator) { + super(null, "Automaton"); + this.calculator = calculator; + entry(); + } + + @Override + Calculator getCalculator() { + return calculator; + } + + @Override + Working initialState() { + return new Working(this); + } + + @Override + void unOp(UnaryOp op) { + try { + super.unOp(op); + } + catch (CalculatorError ex) { + error(); + } + } + + @Override + void binOp(BinaryOp op) { + try { + super.binOp(op); + } + catch (CalculatorError ex) { + error(); + } + } + + @Override + void eval() { + try { + super.eval(); + } + catch (CalculatorError ex) { + error(); + } + } +} diff --git a/src/oop/ch07/calc/BeforeDot.java b/src/oop/ch07/calc/BeforeDot.java new file mode 100644 index 0000000..02fa3d2 --- /dev/null +++ b/src/oop/ch07/calc/BeforeDot.java @@ -0,0 +1,19 @@ +package oop.ch07.calc; + +class BeforeDot extends State { + BeforeDot(Lower parent) { + super(parent, "before_dot"); + } + + @Override + void digit(int d) { + final Calculator c = getCalculator(); + c.setValue(10.0 * c.getValue() + d); + } + + @Override + void dot() { + getCalculator().setFactor(0.1); + parent.gotoState(new AfterDot(parent)); + } +} diff --git a/src/oop/ch07/calc/BinOp.java b/src/oop/ch07/calc/BinOp.java new file mode 100644 index 0000000..d1c0e81 --- /dev/null +++ b/src/oop/ch07/calc/BinOp.java @@ -0,0 +1,28 @@ +package oop.ch07.calc; + +import oop.ch06.calc.UnaryOp; + +class BinOp extends StateMachine { + BinOp(Upper parent) { + super(parent, "bin_op"); + } + + @Override + State initialState() { + return new HasFirst(this); + } + + @Override + void unOp(UnaryOp op) { + final Calculator c = getCalculator(); + c.setValue(op.eval(c.getValue())); + gotoState(new HasSecond(this)); + } + + @Override + void eval() { + final Calculator c = getCalculator(); + c.setValue(c.getLastOp().eval(c.getOpnd1(), c.getValue())); + parent.gotoState(new NoOp(parent)); + } +} diff --git a/src/oop/ch07/calc/Calculator.java b/src/oop/ch07/calc/Calculator.java new file mode 100644 index 0000000..714f985 --- /dev/null +++ b/src/oop/ch07/calc/Calculator.java @@ -0,0 +1,96 @@ +package oop.ch07.calc; + +import oop.ch06.calc.BinaryOp; +import oop.ch06.calc.CalculatorError; +import oop.ch06.calc.UnaryOp; +import oop.ch06.observer.Observer; +import oop.ch06.observer.ObserverSupport; + +public class Calculator { + private double value; + private double opnd1; + private BinaryOp lastOp; + private double factor; + private final ObserverSupport observerSupport = new ObserverSupport(); + private final Automaton auto = new Automaton(this); + + public double getValue() { + return value; + } + + void setValue(double n) { + value = n; + observerSupport.notifyObservers(); + } + + double getOpnd1() { + return opnd1; + } + + void setOpnd1(double opnd1) { + this.opnd1 = opnd1; + } + + BinaryOp getLastOp() { + return lastOp; + } + + void setLastOp(BinaryOp lastOp) { + this.lastOp = lastOp; + } + + double getFactor() { + return factor; + } + + void setFactor(double factor) { + this.factor = factor; + } + + public void addObserver(Observer o) { + observerSupport.addObserver(o); + } + + public void unOp(UnaryOp op) { + try { + auto.unOp(op); + } + catch (CalculatorError ex) { + auto.error(); + } + } + + public void binOp(BinaryOp op) { + try { + auto.binOp(op); + } + catch (CalculatorError ex) { + auto.error(); + } + } + + public void eval() { + try { + auto.eval(); + } + catch (CalculatorError ex) { + auto.error(); + } + } + + public void digit(int d) { + auto.digit(d); + } + + public void dot() { + auto.dot(); + } + + public void clear() { + auto.clear(); + } + + public void allClear() { + auto.allClear(); + } +} diff --git a/src/oop/ch07/calc/Error.java b/src/oop/ch07/calc/Error.java new file mode 100644 index 0000000..4399d3c --- /dev/null +++ b/src/oop/ch07/calc/Error.java @@ -0,0 +1,12 @@ +package oop.ch07.calc; + +class Error extends State { + Error(Automaton parent) { + super(parent, "error"); + } + + @Override + void allClear() { + parent.gotoState(new Working(parent)); + } +} diff --git a/src/oop/ch07/calc/Example.java b/src/oop/ch07/calc/Example.java new file mode 100644 index 0000000..c9aacf6 --- /dev/null +++ b/src/oop/ch07/calc/Example.java @@ -0,0 +1,29 @@ +package oop.ch07.calc; + +import oop.ch06.calc.Ops; + +class Example { + public static void main(String[] args) { + final Calculator calc = new Calculator(); + calc.digit(2); + calc.digit(4); + calc.dot(); + calc.digit(5); + System.out.println(calc.getValue()); + calc.binOp(Ops.PLUS); + calc.digit(3); + calc.clear(); + calc.binOp(Ops.MULT); + calc.digit(1); + calc.digit(2); + System.out.println(calc.getValue()); + calc.eval(); + System.out.println(calc.getValue()); + calc.unOp(Ops.CHANGE_SIGN); + System.out.println(calc.getValue()); + calc.unOp(Ops.SQRT); + System.out.println(calc.getValue()); + calc.allClear(); + System.out.println(calc.getValue()); + } +} diff --git a/src/oop/ch07/calc/HasFirst.java b/src/oop/ch07/calc/HasFirst.java new file mode 100644 index 0000000..ede36f5 --- /dev/null +++ b/src/oop/ch07/calc/HasFirst.java @@ -0,0 +1,24 @@ +package oop.ch07.calc; + +import oop.ch06.calc.BinaryOp; + +class HasFirst extends State { + HasFirst(BinOp parent) { + super(parent, "has_first"); + } + + @Override + void digit(int d) { + parent.gotoState(new HasSecond(parent)); + } + + @Override + void dot() { + parent.gotoState(new HasSecond(parent)); + } + + @Override + void binOp(BinaryOp op) { + getCalculator().setLastOp(op); + } +} diff --git a/src/oop/ch07/calc/HasSecond.java b/src/oop/ch07/calc/HasSecond.java new file mode 100644 index 0000000..40158ef --- /dev/null +++ b/src/oop/ch07/calc/HasSecond.java @@ -0,0 +1,23 @@ +package oop.ch07.calc; + +import oop.ch06.calc.BinaryOp; + +class HasSecond extends State { + HasSecond(BinOp parent) { + super(parent, "has_second"); + } + + @Override + void binOp(BinaryOp op) { + final Calculator c = getCalculator(); + c.setValue(c.getLastOp().eval(c.getOpnd1(), c.getValue())); + c.setOpnd1(c.getValue()); + c.setLastOp(op); + parent.gotoState(new HasFirst(parent)); + } + + @Override + void clear() { + parent.gotoState(new HasFirst(parent)); + } +} diff --git a/src/oop/ch07/calc/Lower.java b/src/oop/ch07/calc/Lower.java new file mode 100644 index 0000000..04c46b9 --- /dev/null +++ b/src/oop/ch07/calc/Lower.java @@ -0,0 +1,36 @@ +package oop.ch07.calc; + +import oop.ch06.calc.BinaryOp; +import oop.ch06.calc.UnaryOp; + +class Lower extends StateMachine { + Lower(Working parent) { + super(parent, "lower"); + } + + @Override + Unchanged initialState() { + return new Unchanged(this); + } + + @Override + void unOp(UnaryOp op) { + gotoState(new Unchanged(this)); + } + + @Override + void binOp(BinaryOp op) { + gotoState(new Unchanged(this)); + } + + @Override + void eval() { + gotoState(new Unchanged(this)); + } + + @Override + void clear() { + getCalculator().setValue(0.0); + gotoState(new Unchanged(this)); + } +} diff --git a/src/oop/ch07/calc/NoOp.java b/src/oop/ch07/calc/NoOp.java new file mode 100644 index 0000000..1e0fba1 --- /dev/null +++ b/src/oop/ch07/calc/NoOp.java @@ -0,0 +1,24 @@ +package oop.ch07.calc; + +import oop.ch06.calc.BinaryOp; +import oop.ch06.calc.UnaryOp; + +class NoOp extends State { + NoOp(Upper parent) { + super(parent, "no_op"); + } + + @Override + void unOp(UnaryOp op) { + final Calculator c = getCalculator(); + c.setValue(op.eval(c.getValue())); + } + + @Override + void binOp(BinaryOp op) { + final Calculator c = getCalculator(); + c.setLastOp(op); + c.setOpnd1(c.getValue()); + parent.gotoState(new BinOp(parent)); + } +} diff --git a/src/oop/ch07/calc/State.java b/src/oop/ch07/calc/State.java new file mode 100644 index 0000000..1122da9 --- /dev/null +++ b/src/oop/ch07/calc/State.java @@ -0,0 +1,114 @@ +package oop.ch07.calc; + +import oop.ch06.calc.BinaryOp; +import oop.ch06.calc.UnaryOp; + +import java.lang.System.Logger; + +/** + * An abstract class representing a state in a calculator state machine. + * This class provides basic functionalities that all states in the calculator state machine should implement. + * + * @param

the type of the containing state. + */ +abstract class State

> { + /** + * The logger for logging messages. + */ + static final Logger LOGGER = System.getLogger(State.class.getName()); + + /** + * The name of the state. + */ + final String name; + + /** + * The parent state containing this state. + */ + final P parent; + + /** + * Constructs a state with the given parent. + * + * @param parent The state containing this state. + */ + State(P parent) { + this(parent, null); + } + + /** + * Constructs a state with the given parent and name. + * + * @param parent The state containing this state. + * @param name The name of the state. + */ + State(P parent, String name) { + this.parent = parent; + this.name = name; + } + + /** + * Performs entry actions when entering this state. + */ + void entry() {} + + /** + * Handles the input of a digit. + * + * @param d The digit to be handled. + */ + void digit(int d) {} + + /** + * Handles the input of a dot. + */ + void dot() {} + + /** + * Handles the application of a unary operation. + * + * @param op The unary operation to be applied. + */ + void unOp(UnaryOp op) {} + + /** + * Handles the application of a binary operation. + * + * @param op The binary operation to be applied. + */ + void binOp(BinaryOp op) {} + + /** + * Evaluates the current expression. + */ + void eval() {} + + /** + * Clears the current input. + */ + void clear() {} + + /** + * Clears all stored values and resets the calculator. + */ + void allClear() {} + + /** + * Handles error conditions. + */ + void error() {} + + /** + * Gets the calculator associated with this state. + * + * @return The calculator object. + */ + Calculator getCalculator() { + return parent.getCalculator(); + } + + @Override + public String toString() { + return name == null ? getClass().getName() : name; + } +} diff --git a/src/oop/ch07/calc/StateMachine.java b/src/oop/ch07/calc/StateMachine.java new file mode 100644 index 0000000..a5d311e --- /dev/null +++ b/src/oop/ch07/calc/StateMachine.java @@ -0,0 +1,122 @@ +package oop.ch07.calc; + +import oop.ch06.calc.BinaryOp; +import oop.ch06.calc.UnaryOp; + +import java.lang.System.Logger.Level; + +/** + * An abstract class representing a state machine in a calculator system. + * This class extends the CompositeState class and defines the basic behavior of a state machine. + * It maintains the current state and provides methods to transition between states and handle state changes. + * + * @param the type of the concrete state machine. + * @param

the type of the containing state. + */ +abstract class StateMachine, P extends State> extends State

{ + /** + * The current state of the state machine. + */ + private State state; + + /** + * Constructs a state machine with the given parent. + * + * @param parent The parent state machine. + */ + StateMachine(P parent) { + super(parent); + } + + /** + * Constructs a state machine with the given parent and name. + * + * @param parent The parent state machine. + * @param name The name of the state machine. + */ + StateMachine(P parent, String name) { + super(parent, name); + } + + /** + * Gets the initial state of the state machine. + */ + abstract State initialState(); + + /** + * Transitions the state machine to the specified state. + * + * @param newState The state to transition to. + */ + void gotoState(State newState) { + LOGGER.log(Level.DEBUG, "{0}: {1} --> {2}", this, state, newState); + enter(newState); + } + + /** + * Performs the entry action of the state machine. + */ + @Override + void entry() { + final State newState = initialState(); + LOGGER.log(Level.DEBUG, "{0}: initial state={1}", this, newState); + enter(newState); + } + + /** + * Enters a new state. + * + * @param newState The new state to enter. + */ + private void enter(State newState) { + if (newState.parent != this) + throw new IllegalArgumentException("Wrong state: " + newState + " belongs to " + newState.parent + " instead of " + this); + state = newState; + state.entry(); + } + + @Override + void digit(int d) { + state.digit(d); + } + + @Override + void dot() { + state.dot(); + } + + @Override + void unOp(UnaryOp op) { + state.unOp(op); + } + + @Override + void binOp(BinaryOp op) { + state.binOp(op); + } + + @Override + void eval() { + state.eval(); + } + + @Override + void clear() { + state.clear(); + } + + @Override + void allClear() { + state.allClear(); + } + + @Override + void error() { + state.error(); + } + + @Override + public String toString() { + return super.toString() + "(in " + state + ")"; + } +} diff --git a/src/oop/ch07/calc/Unchanged.java b/src/oop/ch07/calc/Unchanged.java new file mode 100644 index 0000000..001bad1 --- /dev/null +++ b/src/oop/ch07/calc/Unchanged.java @@ -0,0 +1,21 @@ +package oop.ch07.calc; + +class Unchanged extends State { + Unchanged(Lower parent) { + super(parent, "unchanged"); + } + + @Override + void digit(int d) { + getCalculator().setValue(d); + parent.gotoState(new BeforeDot(parent)); + } + + @Override + void dot() { + final Calculator c = getCalculator(); + c.setValue(0.0); + c.setFactor(0.1); + parent.gotoState(new AfterDot(parent)); + } +} diff --git a/src/oop/ch07/calc/Upper.java b/src/oop/ch07/calc/Upper.java new file mode 100644 index 0000000..27dbf01 --- /dev/null +++ b/src/oop/ch07/calc/Upper.java @@ -0,0 +1,12 @@ +package oop.ch07.calc; + +class Upper extends StateMachine { + Upper(Working parent) { + super(parent, "upper"); + } + + @Override + NoOp initialState() { + return new NoOp(this); + } +} diff --git a/src/oop/ch07/calc/Working.java b/src/oop/ch07/calc/Working.java new file mode 100644 index 0000000..107bde2 --- /dev/null +++ b/src/oop/ch07/calc/Working.java @@ -0,0 +1,69 @@ +package oop.ch07.calc; + +import oop.ch06.calc.BinaryOp; +import oop.ch06.calc.UnaryOp; + +class Working extends State { + private final Upper upper; + private final Lower lower; + + Working(Automaton parent) { + super(parent, "working"); + upper = new Upper(this); + lower = new Lower(this); + } + + @Override + void entry() { + getCalculator().setValue(0.0); + upper.entry(); + lower.entry(); + } + + @Override + void digit(int d) { + upper.digit(d); + lower.digit(d); + } + + @Override + void dot() { + upper.dot(); + lower.dot(); + } + + @Override + void unOp(UnaryOp op) { + upper.unOp(op); + lower.unOp(op); + } + + @Override + void binOp(BinaryOp op) { + upper.binOp(op); + lower.binOp(op); + } + + @Override + void eval() { + upper.eval(); + lower.eval(); + } + + @Override + void clear() { + upper.clear(); + lower.clear(); + } + + @Override + void allClear() { + parent.gotoState(new Working(parent)); + } + + @Override + void error() { + getCalculator().setValue(Double.NaN); + parent.gotoState(new Error(parent)); + } +} diff --git a/src/oop/ch07/clock0/Clock.java b/src/oop/ch07/clock0/Clock.java new file mode 100644 index 0000000..06bed35 --- /dev/null +++ b/src/oop/ch07/clock0/Clock.java @@ -0,0 +1,41 @@ +package oop.ch07.clock0; + +public class Clock { + private State state = State.Normal; + private int time = 0; + + public int getTime() { + return time; + } + + public void tick() { + switch (state) { + case Normal: + time += 1; + break; + case Setting: + break; + } + } + + public void set() { + switch (state) { + case Normal: + break; + case Setting: + time += 60; + break; + } + } + + public void mode() { + switch (state) { + case Normal: + state = State.Setting; + break; + case Setting: + state = State.Normal; + break; + } + } +} \ No newline at end of file diff --git a/src/oop/ch07/clock0/Example.java b/src/oop/ch07/clock0/Example.java new file mode 100644 index 0000000..7b5768b --- /dev/null +++ b/src/oop/ch07/clock0/Example.java @@ -0,0 +1,33 @@ +package oop.ch07.clock0; + +public class Example { + public static void main(String[] args) { + final Clock clock = new Clock(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.mode(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.mode(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + } +} diff --git a/src/oop/ch07/clock0/State.java b/src/oop/ch07/clock0/State.java new file mode 100644 index 0000000..5cfa69d --- /dev/null +++ b/src/oop/ch07/clock0/State.java @@ -0,0 +1,5 @@ +package oop.ch07.clock0; + +enum State { + Normal, Setting +} diff --git a/src/oop/ch07/clock1/Clock.java b/src/oop/ch07/clock1/Clock.java new file mode 100644 index 0000000..0d77ce2 --- /dev/null +++ b/src/oop/ch07/clock1/Clock.java @@ -0,0 +1,23 @@ +package oop.ch07.clock1; + +public class Clock { + private State state = new Normal(this); + private int t = 0; + + void setState(State s) { state = s; } + + public int getTime() { + return t; + } + + void setTime(int t) { + this.t = t; + } + + public void tick() {state.tick();} + + public void set() {state.set();} + + public void mode() {state.mode();} +} + diff --git a/src/oop/ch07/clock1/Example.java b/src/oop/ch07/clock1/Example.java new file mode 100644 index 0000000..b259660 --- /dev/null +++ b/src/oop/ch07/clock1/Example.java @@ -0,0 +1,33 @@ +package oop.ch07.clock1; + +public class Example { + public static void main(String[] args) { + final Clock clock = new Clock(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.mode(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.mode(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + } +} diff --git a/src/oop/ch07/clock1/Normal.java b/src/oop/ch07/clock1/Normal.java new file mode 100644 index 0000000..bb324f5 --- /dev/null +++ b/src/oop/ch07/clock1/Normal.java @@ -0,0 +1,13 @@ +package oop.ch07.clock1; + +class Normal extends State { + Normal(Clock clock) { + super(clock); + } + + public void tick() {clock.setTime(clock.getTime() + 1);} + + public void set() {} + + public void mode() {clock.setState(new Setting(clock));} +} diff --git a/src/oop/ch07/clock1/Setting.java b/src/oop/ch07/clock1/Setting.java new file mode 100644 index 0000000..ccaf884 --- /dev/null +++ b/src/oop/ch07/clock1/Setting.java @@ -0,0 +1,13 @@ +package oop.ch07.clock1; + +class Setting extends State { + Setting(Clock clock) { + super(clock); + } + + public void tick() {} + + public void set() {clock.setTime(clock.getTime() + 60);} + + public void mode() {clock.setState(new Normal(clock));} +} diff --git a/src/oop/ch07/clock1/State.java b/src/oop/ch07/clock1/State.java new file mode 100644 index 0000000..fc8e7b2 --- /dev/null +++ b/src/oop/ch07/clock1/State.java @@ -0,0 +1,15 @@ +package oop.ch07.clock1; + +abstract class State { + final Clock clock; + + State(Clock clock) { + this.clock = clock; + } + + abstract void tick(); + + abstract void set(); + + abstract void mode(); +} diff --git a/src/oop/ch07/clock2/Clock.java b/src/oop/ch07/clock2/Clock.java new file mode 100644 index 0000000..d7f7f9b --- /dev/null +++ b/src/oop/ch07/clock2/Clock.java @@ -0,0 +1,25 @@ +package oop.ch07.clock2; + +public class Clock { + final State normal = new Normal(this); + final State setting = new Setting(this); + private State state = normal; + private int t = 0; + + void setState(State s) { state = s; } + + public int getTime() { + return t; + } + + void setTime(int t) { + this.t = t; + } + + public void tick() { state.tick(); } + + public void set() { state.set(); } + + public void mode() { state.mode(); } +} + diff --git a/src/oop/ch07/clock2/Example.java b/src/oop/ch07/clock2/Example.java new file mode 100644 index 0000000..fa2e216 --- /dev/null +++ b/src/oop/ch07/clock2/Example.java @@ -0,0 +1,33 @@ +package oop.ch07.clock2; + +public class Example { + public static void main(String[] args) { + final Clock clock = new Clock(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.mode(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.mode(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + } +} diff --git a/src/oop/ch07/clock2/Normal.java b/src/oop/ch07/clock2/Normal.java new file mode 100644 index 0000000..50ffc9a --- /dev/null +++ b/src/oop/ch07/clock2/Normal.java @@ -0,0 +1,13 @@ +package oop.ch07.clock2; + +class Normal extends State { + Normal(Clock clock) { + super(clock); + } + + public void tick() { clock.setTime(clock.getTime() + 1); } + + public void set() {} + + public void mode() { clock.setState(clock.setting); } +} diff --git a/src/oop/ch07/clock2/Setting.java b/src/oop/ch07/clock2/Setting.java new file mode 100644 index 0000000..516ba7c --- /dev/null +++ b/src/oop/ch07/clock2/Setting.java @@ -0,0 +1,13 @@ +package oop.ch07.clock2; + +class Setting extends State { + Setting(Clock clock) { + super(clock); + } + + public void tick() {} + + public void set() { clock.setTime(clock.getTime() + 60); } + + public void mode() { clock.setState(clock.normal); } +} diff --git a/src/oop/ch07/clock2/State.java b/src/oop/ch07/clock2/State.java new file mode 100644 index 0000000..4abe17d --- /dev/null +++ b/src/oop/ch07/clock2/State.java @@ -0,0 +1,15 @@ +package oop.ch07.clock2; + +abstract class State { + final Clock clock; + + State(Clock clock) { + this.clock = clock; + } + + abstract void tick(); + + abstract void set(); + + abstract void mode(); +} diff --git a/src/oop/ch07/clock3/Clock.java b/src/oop/ch07/clock3/Clock.java new file mode 100644 index 0000000..3c0ab86 --- /dev/null +++ b/src/oop/ch07/clock3/Clock.java @@ -0,0 +1,51 @@ +package oop.ch07.clock3; + +public class Clock { + private abstract class State { + abstract void tick(); + + abstract void set(); + + abstract void mode(); + } + + private final State normal = new State() { + @Override + void tick() { setTime(getTime() + 1); } + + @Override + void set() {} + + @Override + void mode() { state = setting; } + }; + + private final State setting = new State() { + @Override + void tick() {} + + @Override + void set() { setTime(getTime() + 60); } + + @Override + void mode() { state = normal; } + }; + + private State state = normal; + private int t = 0; + + public int getTime() { + return t; + } + + private void setTime(int t) { + this.t = t; + } + + public void tick() { state.tick(); } + + public void set() { state.set(); } + + public void mode() { state.mode(); } +} + diff --git a/src/oop/ch07/clock3/Example.java b/src/oop/ch07/clock3/Example.java new file mode 100644 index 0000000..293d9f7 --- /dev/null +++ b/src/oop/ch07/clock3/Example.java @@ -0,0 +1,33 @@ +package oop.ch07.clock3; + +public class Example { + public static void main(String[] args) { + final Clock clock = new Clock(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.mode(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + clock.mode(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + clock.tick(); + clock.set(); + System.out.println(clock.getTime()); + } +} diff --git a/src/oop/ch07/expr1/BinExpr.java b/src/oop/ch07/expr1/BinExpr.java new file mode 100644 index 0000000..274ddf4 --- /dev/null +++ b/src/oop/ch07/expr1/BinExpr.java @@ -0,0 +1,16 @@ +package oop.ch07.expr1; + +public abstract class BinExpr implements Expr { + public final Expr op1; + public final Expr op2; + private final char op; + + protected BinExpr(Expr op1, char op, Expr op2) { + this.op1 = op1; + this.op2 = op2; + this.op = op; + } + + @Override + public String toString() {return "(" + op1 + op + op2 + ")";} +} diff --git a/src/oop/ch07/expr1/Const.java b/src/oop/ch07/expr1/Const.java new file mode 100644 index 0000000..3fa3b0a --- /dev/null +++ b/src/oop/ch07/expr1/Const.java @@ -0,0 +1,15 @@ +package oop.ch07.expr1; + +public class Const implements Expr { + public final int value; + + public Const(int v) { + this.value = v; + } + + @Override + public int eval() { return value; } + + @Override + public String toString() { return String.valueOf(value); } +} diff --git a/src/oop/ch07/expr1/Example.java b/src/oop/ch07/expr1/Example.java new file mode 100644 index 0000000..2164186 --- /dev/null +++ b/src/oop/ch07/expr1/Example.java @@ -0,0 +1,8 @@ +package oop.ch07.expr1; + +public class Example { + public static void main(String[] args) { + Expr e = new Plus(new Neg(new Minus(new Const(1), new Const(2))), new Const(12)); + System.out.println(e + " = " + e.eval()); + } +} diff --git a/src/oop/ch07/expr1/Expr.java b/src/oop/ch07/expr1/Expr.java new file mode 100644 index 0000000..f347f9a --- /dev/null +++ b/src/oop/ch07/expr1/Expr.java @@ -0,0 +1,6 @@ +package oop.ch07.expr1; + +public interface Expr { + int eval(); +} + diff --git a/src/oop/ch07/expr1/Minus.java b/src/oop/ch07/expr1/Minus.java new file mode 100644 index 0000000..8d8f568 --- /dev/null +++ b/src/oop/ch07/expr1/Minus.java @@ -0,0 +1,10 @@ +package oop.ch07.expr1; + +public class Minus extends BinExpr { + public Minus(Expr op1, Expr op2) { + super(op1, '-', op2); + } + + @Override + public int eval() { return op1.eval() - op2.eval(); } +} diff --git a/src/oop/ch07/expr1/Mult.java b/src/oop/ch07/expr1/Mult.java new file mode 100644 index 0000000..d1936a3 --- /dev/null +++ b/src/oop/ch07/expr1/Mult.java @@ -0,0 +1,10 @@ +package oop.ch07.expr1; + +public class Mult extends BinExpr { + public Mult(Expr op1, Expr op2) { + super(op1, '*', op2); + } + + @Override + public int eval() { return op1.eval() * op2.eval(); } +} diff --git a/src/oop/ch07/expr1/Neg.java b/src/oop/ch07/expr1/Neg.java new file mode 100644 index 0000000..bf9567a --- /dev/null +++ b/src/oop/ch07/expr1/Neg.java @@ -0,0 +1,15 @@ +package oop.ch07.expr1; + +public class Neg implements Expr { + public final Expr op; + + public Neg(Expr op) { + this.op = op; + } + + @Override + public int eval() {return -op.eval();} + + @Override + public String toString() { return "(-" + op + ")"; } +} diff --git a/src/oop/ch07/expr1/Plus.java b/src/oop/ch07/expr1/Plus.java new file mode 100644 index 0000000..f553b8f --- /dev/null +++ b/src/oop/ch07/expr1/Plus.java @@ -0,0 +1,10 @@ +package oop.ch07.expr1; + +public class Plus extends BinExpr { + public Plus(Expr op1, Expr op2) { + super(op1, '+', op2); + } + + @Override + public int eval() { return op1.eval() + op2.eval(); } +} diff --git a/src/oop/ch07/expr2/BinExpr.java b/src/oop/ch07/expr2/BinExpr.java new file mode 100644 index 0000000..d0dfad5 --- /dev/null +++ b/src/oop/ch07/expr2/BinExpr.java @@ -0,0 +1,16 @@ +package oop.ch07.expr2; + +public abstract class BinExpr implements Expr { + public final Expr op1; + public final Expr op2; + private final char op; + + protected BinExpr(Expr op1, char op, Expr op2) { + this.op1 = op1; + this.op2 = op2; + this.op = op; + } + + @Override + public String toString() {return "(" + op1 + op + op2 + ")";} +} diff --git a/src/oop/ch07/expr2/Const.java b/src/oop/ch07/expr2/Const.java new file mode 100644 index 0000000..ba0b56d --- /dev/null +++ b/src/oop/ch07/expr2/Const.java @@ -0,0 +1,15 @@ +package oop.ch07.expr2; + +public class Const implements Expr { + public final int value; + + public Const(int v) { + this.value = v; + } + + @Override + public T accept(Visitor visitor) {return visitor.visit(this);} + + @Override + public String toString() {return String.valueOf(value);} +} diff --git a/src/oop/ch07/expr2/EvalVisitor.java b/src/oop/ch07/expr2/EvalVisitor.java new file mode 100644 index 0000000..83f4e3b --- /dev/null +++ b/src/oop/ch07/expr2/EvalVisitor.java @@ -0,0 +1,23 @@ +package oop.ch07.expr2; + +public class EvalVisitor implements Visitor { + public Integer visit(Const e) { + return e.value; + } + + public Integer visit(Plus e) { + return e.op1.accept(this) + e.op2.accept(this); + } + + public Integer visit(Minus e) { + return e.op1.accept(this) - e.op2.accept(this); + } + + public Integer visit(Mult e) { + return e.op1.accept(this) * e.op2.accept(this); + } + + public Integer visit(Neg e) { + return -e.op.accept(this); + } +} diff --git a/src/oop/ch07/expr2/Example.java b/src/oop/ch07/expr2/Example.java new file mode 100644 index 0000000..b65b297 --- /dev/null +++ b/src/oop/ch07/expr2/Example.java @@ -0,0 +1,9 @@ +package oop.ch07.expr2; + +public class Example { + public static void main(String[] args) { + Expr e = new Plus(new Neg(new Minus(new Const(1), new Const(2))), new Const(12)); + System.out.println(e + " = " + e.accept(new EvalVisitor())); + System.out.println(e + " = " + e.accept(new LukasiewiczVisitor())); + } +} diff --git a/src/oop/ch07/expr2/Expr.java b/src/oop/ch07/expr2/Expr.java new file mode 100644 index 0000000..92c68e8 --- /dev/null +++ b/src/oop/ch07/expr2/Expr.java @@ -0,0 +1,6 @@ +package oop.ch07.expr2; + +public interface Expr { + T accept(Visitor visitor); +} + diff --git a/src/oop/ch07/expr2/LukasiewiczVisitor.java b/src/oop/ch07/expr2/LukasiewiczVisitor.java new file mode 100644 index 0000000..c9a1bbf --- /dev/null +++ b/src/oop/ch07/expr2/LukasiewiczVisitor.java @@ -0,0 +1,28 @@ +package oop.ch07.expr2; + +public class LukasiewiczVisitor implements Visitor { + @Override + public String visit(Const e) { + return String.valueOf(e.value); + } + + @Override + public String visit(Plus e) { + return "+ " + e.op1.accept(this) + " " + e.op2.accept(this); + } + + @Override + public String visit(Minus e) { + return "- " + e.op1.accept(this) + " " + e.op2.accept(this); + } + + @Override + public String visit(Mult e) { + return "* " + e.op1.accept(this) + " " + e.op2.accept(this); + } + + @Override + public String visit(Neg e) { + return "~ " + e.op.accept(this); + } +} diff --git a/src/oop/ch07/expr2/Minus.java b/src/oop/ch07/expr2/Minus.java new file mode 100644 index 0000000..f4d9bae --- /dev/null +++ b/src/oop/ch07/expr2/Minus.java @@ -0,0 +1,10 @@ +package oop.ch07.expr2; + +public class Minus extends BinExpr { + public Minus(Expr op1, Expr op2) { + super(op1, '-', op2); + } + + @Override + public T accept(Visitor visitor) {return visitor.visit(this);} +} diff --git a/src/oop/ch07/expr2/Mult.java b/src/oop/ch07/expr2/Mult.java new file mode 100644 index 0000000..c6ae24a --- /dev/null +++ b/src/oop/ch07/expr2/Mult.java @@ -0,0 +1,10 @@ +package oop.ch07.expr2; + +public class Mult extends BinExpr { + public Mult(Expr op1, Expr op2) { + super(op1, '*', op2); + } + + @Override + public T accept(Visitor visitor) { return visitor.visit(this); } +} diff --git a/src/oop/ch07/expr2/Neg.java b/src/oop/ch07/expr2/Neg.java new file mode 100644 index 0000000..400752f --- /dev/null +++ b/src/oop/ch07/expr2/Neg.java @@ -0,0 +1,15 @@ +package oop.ch07.expr2; + +public class Neg implements Expr { + public final Expr op; + + public Neg(Expr op) { + this.op = op; + } + + @Override + public T accept(Visitor visitor) { return visitor.visit(this); } + + @Override + public String toString() { return "(-" + op + ")"; } +} diff --git a/src/oop/ch07/expr2/Plus.java b/src/oop/ch07/expr2/Plus.java new file mode 100644 index 0000000..aec3e9f --- /dev/null +++ b/src/oop/ch07/expr2/Plus.java @@ -0,0 +1,8 @@ +package oop.ch07.expr2; + +public class Plus extends BinExpr { + public Plus(Expr op1, Expr op2) { super(op1, '+', op2); } + + @Override + public T accept(Visitor visitor) { return visitor.visit(this); } +} diff --git a/src/oop/ch07/expr2/Visitor.java b/src/oop/ch07/expr2/Visitor.java new file mode 100644 index 0000000..49d01a8 --- /dev/null +++ b/src/oop/ch07/expr2/Visitor.java @@ -0,0 +1,13 @@ +package oop.ch07.expr2; + +public interface Visitor { + T visit(Const e); + + T visit(Plus e); + + T visit(Minus e); + + T visit(Mult e); + + T visit(Neg e); +} diff --git a/src/oop/ch07/trace/ConsoleTrace.java b/src/oop/ch07/trace/ConsoleTrace.java new file mode 100644 index 0000000..88d2aca --- /dev/null +++ b/src/oop/ch07/trace/ConsoleTrace.java @@ -0,0 +1,19 @@ +package oop.ch07.trace; + +public class ConsoleTrace extends Trace { + @Override + public void debug(int level, String message) { + if (level >= getDebugLevel()) + System.out.println("DEBUG: " + message); + } + + @Override + public void error(String message) { + System.out.println("ERROR: " + message); + } + + @Override + public void close() { + // nothing to do here + } +} diff --git a/src/oop/ch07/trace/FileTrace.java b/src/oop/ch07/trace/FileTrace.java new file mode 100644 index 0000000..0e0685a --- /dev/null +++ b/src/oop/ch07/trace/FileTrace.java @@ -0,0 +1,28 @@ +package oop.ch07.trace; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; + +public class FileTrace extends Trace { + private final PrintWriter pw; + + public FileTrace(String path) throws IOException { + pw = new PrintWriter(new FileWriter(path), true); + } + + @Override + public void debug(int level, String message) { + if (level >= getDebugLevel()) pw.println("DEBUG: " + message); + } + + @Override + public void error(String message) { + pw.println("ERROR: " + message); + } + + @Override + public void close() { + pw.close(); + } +} diff --git a/src/oop/ch07/trace/Trace.java b/src/oop/ch07/trace/Trace.java new file mode 100644 index 0000000..5888ad1 --- /dev/null +++ b/src/oop/ch07/trace/Trace.java @@ -0,0 +1,28 @@ +package oop.ch07.trace; + +import java.io.IOException; + +public abstract class Trace { + private int debugLevel = 0; + + public void setDebugLevel(int debugLevel) { + this.debugLevel = debugLevel; + } + + public int getDebugLevel() {return debugLevel;} + + public abstract void debug(int level, String message); + + public abstract void error(String message); + + public abstract void close(); + + public static Trace intoFile(String path) { + try { return new FileTrace(path); } + catch (IOException ex) { + final Trace trace = new ConsoleTrace(); + trace.error(ex.getMessage() + " - falling back to system trace."); + return trace; + } + } +} diff --git a/src/oop/ch07/tree/Example.java b/src/oop/ch07/tree/Example.java new file mode 100644 index 0000000..a9bfcdd --- /dev/null +++ b/src/oop/ch07/tree/Example.java @@ -0,0 +1,40 @@ +package oop.ch07.tree; + +public class Example { + public static void main(String[] args) { + final Tree t = + new Tree<>(42, + new Tree<>(17, + new Tree<>(5), + null), + new Tree<>(81, + new Tree<>(51), + new Tree<>(97))); + System.out.println("t = " + t); + for (int e : t) System.out.println(e); + + final Tree t1 = + new Tree<>("foo", + new Tree<>("baz", + new Tree<>("abc"), + null), + new Tree<>("google", + new Tree<>("gnat"), + new Tree<>("hex"))); + + System.out.println("t1 = " + t1); + for (String e : t1) System.out.println(e); + + final Tree t2 = new Tree<>("1", new Tree<>("2", new Tree<>("3"), null), null); + System.out.println("t2 = " + t2); + for (String e : t2) System.out.println(e); + + final Tree t3 = new Tree<>("4", null, new Tree<>("5", null, new Tree<>("6"))); + System.out.println("t3 = " + t3); + for (String e : t3) System.out.println(e); + + final Tree t4 = new Tree<>("7", t2, t3); + System.out.println("t4 = " + t4); + for (String e : t4) System.out.println(e); + } +} diff --git a/src/oop/ch07/tree/Example2.java b/src/oop/ch07/tree/Example2.java new file mode 100644 index 0000000..7137dc1 --- /dev/null +++ b/src/oop/ch07/tree/Example2.java @@ -0,0 +1,15 @@ +package oop.ch07.tree; + +import java.util.Iterator; +import java.util.List; + +public class Example2 { + public static void main(String[] args) { + final Iterator it = + new IterablesIterator<>(List.of(List.of(1, 2, 3), + List.of(4, 5, 6), + List.of(7, 8, 9))); + while (it.hasNext()) + System.out.println(it.next()); + } +} diff --git a/src/oop/ch07/tree/IterablesIterator.java b/src/oop/ch07/tree/IterablesIterator.java new file mode 100644 index 0000000..435dcf7 --- /dev/null +++ b/src/oop/ch07/tree/IterablesIterator.java @@ -0,0 +1,32 @@ +package oop.ch07.tree; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +public class IterablesIterator implements Iterator { + private final Iterator> iterablesIt; + private Iterator currentIt; + + public IterablesIterator(Iterable> iterables) { + iterablesIt = iterables.iterator(); + } + + @Override + public boolean hasNext() { + if (currentIt != null && currentIt.hasNext()) + return true; + while (iterablesIt.hasNext()) { + currentIt = iterablesIt.next().iterator(); + if (currentIt.hasNext()) + return true; + } + return false; + } + + @Override + public E next() { + if (hasNext()) + return currentIt.next(); + throw new NoSuchElementException(); + } +} diff --git a/src/oop/ch07/tree/Tree.java b/src/oop/ch07/tree/Tree.java new file mode 100644 index 0000000..3532230 --- /dev/null +++ b/src/oop/ch07/tree/Tree.java @@ -0,0 +1,33 @@ +package oop.ch07.tree; + +import java.util.Iterator; +import java.util.List; + +import static java.util.Collections.emptyList; +import static java.util.Collections.singletonList; + +public class Tree implements Iterable { + public final E elem; + public final Tree left; + public final Tree right; + + public Tree(E elem) {this(elem, null, null);} + + public Tree(E elem, Tree left, Tree right) { + this.elem = elem; + this.left = left; + this.right = right; + } + + @Override + public String toString() { + return String.format("%s(%s, %s)", elem, left, right); + } + + @Override + public Iterator iterator() { + return new IterablesIterator<>(List.of(left == null ? emptyList() : left, + singletonList(elem), + right == null ? emptyList() : right)); + } +} diff --git a/src/oop/ch08/gui/calc/CalcApp.java b/src/oop/ch08/gui/calc/CalcApp.java new file mode 100644 index 0000000..816d6e8 --- /dev/null +++ b/src/oop/ch08/gui/calc/CalcApp.java @@ -0,0 +1,21 @@ +package oop.ch08.gui.calc; + +import oop.ch07.calc.Calculator; + +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import java.awt.Container; + +public class CalcApp { + public static void main(String[] args) { + showFrame(new CalcGUI(new Calculator()), "Calculator"); + } + + private static void showFrame(Container pane, String title) { + final JFrame frame = new JFrame(title); + frame.setContentPane(pane); + frame.pack(); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } +} diff --git a/src/oop/ch08/gui/calc/CalcGUI.java b/src/oop/ch08/gui/calc/CalcGUI.java new file mode 100644 index 0000000..3033aa4 --- /dev/null +++ b/src/oop/ch08/gui/calc/CalcGUI.java @@ -0,0 +1,77 @@ +package oop.ch08.gui.calc; + +import oop.ch06.calc.Ops; +import oop.ch06.observer.Observer; +import oop.ch07.calc.Calculator; + +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.SwingConstants; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionListener; + +class CalcGUI extends JPanel implements Observer { + private static final int COLUMNS = 4; + private final Calculator calc; + private final JTextField display = new JTextField(); + private int count; + + CalcGUI(Calculator calc) { + this.calc = calc; + calc.addObserver(this); + setLayout(new GridBagLayout()); + addDisplay(); + addButton("±", e -> calc.unOp(Ops.CHANGE_SIGN)); + addButton("√", e -> calc.unOp(Ops.SQRT)); + addButton("C", e -> calc.clear()); + addButton("AC", e -> calc.allClear()); + addButton("7", e -> calc.digit(7)); + addButton("8", e -> calc.digit(8)); + addButton("9", e -> calc.digit(9)); + addButton("+", e -> calc.binOp(Ops.PLUS)); + addButton("4", e -> calc.digit(4)); + addButton("5", e -> calc.digit(5)); + addButton("6", e -> calc.digit(6)); + addButton("-", e -> calc.binOp(Ops.MINUS)); + addButton("1", e -> calc.digit(1)); + addButton("2", e -> calc.digit(2)); + addButton("3", e -> calc.digit(3)); + addButton("*", e -> calc.binOp(Ops.MULT)); + addButton("0", e -> calc.digit(0)); + addButton(".", e -> calc.dot()); + addButton("=", e -> calc.eval()); + addButton("/", e -> calc.binOp(Ops.DIV)); + update(); + } + + private void addDisplay() { + display.setEditable(false); + display.setHorizontalAlignment(SwingConstants.TRAILING); + add(display, makeConstraint(COLUMNS)); + } + + private void addButton(String label, ActionListener listener) { + final JButton button = new JButton(label); + button.addActionListener(listener); + add(button, makeConstraint(1)); + } + + private GridBagConstraints makeConstraint(int span) { + final GridBagConstraints c = new GridBagConstraints(); + c.gridx = count % COLUMNS; + c.gridy = count / COLUMNS; + c.gridwidth = span; + c.fill = GridBagConstraints.BOTH; + c.weightx = 0.5; + c.weighty = 0.5; + count += span; + return c; + } + + @Override + public void update() { + display.setText(String.valueOf(calc.getValue())); + } +} diff --git a/src/oop/ch08/gui/mvc/model/CounterModel.java b/src/oop/ch08/gui/mvc/model/CounterModel.java new file mode 100644 index 0000000..efc4f01 --- /dev/null +++ b/src/oop/ch08/gui/mvc/model/CounterModel.java @@ -0,0 +1,22 @@ +package oop.ch08.gui.mvc.model; + +import oop.ch06.observer.Observer; +import oop.ch06.observer.ObserverSupport; + +public class CounterModel { + private final ObserverSupport observerSupport = new ObserverSupport(); + private int counter = 0; + + public void addObserver(Observer observer) { + observerSupport.addObserver(observer); + } + + public int getCounter() { + return counter; + } + + public void increment() { + counter++; + observerSupport.notifyObservers(); + } +} diff --git a/src/oop/ch08/gui/mvc/v1/CounterApp.java b/src/oop/ch08/gui/mvc/v1/CounterApp.java new file mode 100644 index 0000000..5af64af --- /dev/null +++ b/src/oop/ch08/gui/mvc/v1/CounterApp.java @@ -0,0 +1,24 @@ +package oop.ch08.gui.mvc.v1; + +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import java.awt.Container; + +public class CounterApp { + public static void main(String[] args) { + final CounterModel model = new CounterModel(); + final CounterView view = new CounterView(model); + final CounterController controller = new CounterController(model); + view.addMouseListener(controller); + + showFrame(view, "Counter"); + } + + private static void showFrame(Container pane, String title) { + final JFrame frame = new JFrame(title); + frame.setContentPane(pane); + frame.pack(); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } +} diff --git a/src/oop/ch08/gui/mvc/v1/CounterController.java b/src/oop/ch08/gui/mvc/v1/CounterController.java new file mode 100644 index 0000000..0521476 --- /dev/null +++ b/src/oop/ch08/gui/mvc/v1/CounterController.java @@ -0,0 +1,18 @@ +package oop.ch08.gui.mvc.v1; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +class CounterController extends MouseAdapter { + private final CounterModel model; + + CounterController(CounterModel model) { + this.model = model; + } + + @Override + public void mouseClicked(MouseEvent e) { + if (10 <= e.getX() && e.getX() <= 110 && 10 <= e.getY() && e.getY() <= 40) + model.increment(); + } +} diff --git a/src/oop/ch08/gui/mvc/v1/CounterModel.java b/src/oop/ch08/gui/mvc/v1/CounterModel.java new file mode 100644 index 0000000..a47a9c9 --- /dev/null +++ b/src/oop/ch08/gui/mvc/v1/CounterModel.java @@ -0,0 +1,21 @@ +package oop.ch08.gui.mvc.v1; + +public class CounterModel { + private CounterView view; + private int counter = 0; + + void setView(CounterView view) { + if (this.view != null && this.view != view) + throw new RuntimeException("Trying to reset view"); + this.view = view; + } + + public int getCounter() { + return counter; + } + + public void increment() { + counter++; + view.update(); + } +} diff --git a/src/oop/ch08/gui/mvc/v1/CounterView.java b/src/oop/ch08/gui/mvc/v1/CounterView.java new file mode 100644 index 0000000..44f9442 --- /dev/null +++ b/src/oop/ch08/gui/mvc/v1/CounterView.java @@ -0,0 +1,29 @@ +package oop.ch08.gui.mvc.v1; + +import javax.swing.JPanel; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; + +class CounterView extends JPanel { + private final CounterModel model; + + CounterView(CounterModel model) { + this.model = model; + model.setView(this); + setPreferredSize(new Dimension(200, 100)); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + g.setColor(Color.LIGHT_GRAY); + g.fillRect(10, 10, 100, 30); + g.setColor(Color.BLACK); + g.drawString("Push me! (" + model.getCounter() + ")", 15, 30); + } + + public void update() { + repaint(); + } +} diff --git a/src/oop/ch08/gui/mvc/v2/CounterApp.java b/src/oop/ch08/gui/mvc/v2/CounterApp.java new file mode 100644 index 0000000..68f4ada --- /dev/null +++ b/src/oop/ch08/gui/mvc/v2/CounterApp.java @@ -0,0 +1,24 @@ +package oop.ch08.gui.mvc.v2; + +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import java.awt.Container; + +public class CounterApp { + public static void main(String[] args) { + final CounterModel model = new CounterModel(); + final CounterView view = new CounterView(model); + final CounterController controller = new CounterController(model); + view.addMouseListener(controller); + + showFrame(view, "Counter"); + } + + private static void showFrame(Container pane, String title) { + final JFrame frame = new JFrame(title); + frame.setContentPane(pane); + frame.pack(); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } +} diff --git a/src/oop/ch08/gui/mvc/v2/CounterController.java b/src/oop/ch08/gui/mvc/v2/CounterController.java new file mode 100644 index 0000000..08df41b --- /dev/null +++ b/src/oop/ch08/gui/mvc/v2/CounterController.java @@ -0,0 +1,18 @@ +package oop.ch08.gui.mvc.v2; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +class CounterController extends MouseAdapter { + private final CounterModel model; + + CounterController(CounterModel model) { + this.model = model; + } + + @Override + public void mouseClicked(MouseEvent e) { + if (10 <= e.getX() && e.getX() <= 110 && 10 <= e.getY() && e.getY() <= 40) + model.increment(); + } +} diff --git a/src/oop/ch08/gui/mvc/v2/CounterModel.java b/src/oop/ch08/gui/mvc/v2/CounterModel.java new file mode 100644 index 0000000..56586de --- /dev/null +++ b/src/oop/ch08/gui/mvc/v2/CounterModel.java @@ -0,0 +1,23 @@ +package oop.ch08.gui.mvc.v2; + +import oop.ch06.observer.Observer; + +public class CounterModel { + private Observer observer; + private int counter = 0; + + void setObserver(Observer observer) { + if (this.observer != null && this.observer != observer) + throw new RuntimeException("Trying to reset observer"); + this.observer = observer; + } + + public int getCounter() { + return counter; + } + + public void increment() { + counter++; + observer.update(); + } +} diff --git a/src/oop/ch08/gui/mvc/v2/CounterView.java b/src/oop/ch08/gui/mvc/v2/CounterView.java new file mode 100644 index 0000000..ce549cb --- /dev/null +++ b/src/oop/ch08/gui/mvc/v2/CounterView.java @@ -0,0 +1,32 @@ +package oop.ch08.gui.mvc.v2; + +import oop.ch06.observer.Observer; + +import javax.swing.JPanel; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; + +class CounterView extends JPanel implements Observer { + private final CounterModel model; + + CounterView(CounterModel model) { + this.model = model; + model.setObserver(this); + setPreferredSize(new Dimension(200, 100)); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + g.setColor(Color.LIGHT_GRAY); + g.fillRect(10, 10, 100, 30); + g.setColor(Color.BLACK); + g.drawString("Push me! (" + model.getCounter() + ")", 15, 30); + } + + @Override + public void update() { + repaint(); + } +} diff --git a/src/oop/ch08/gui/mvc/v3/CounterApp.java b/src/oop/ch08/gui/mvc/v3/CounterApp.java new file mode 100644 index 0000000..892a216 --- /dev/null +++ b/src/oop/ch08/gui/mvc/v3/CounterApp.java @@ -0,0 +1,26 @@ +package oop.ch08.gui.mvc.v3; + +import oop.ch08.gui.mvc.model.CounterModel; + +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import java.awt.Container; + +public class CounterApp { + public static void main(String[] args) { + final CounterModel model = new CounterModel(); + final CounterView view = new CounterView(model); + final CounterController controller = new CounterController(model); + view.addMouseListener(controller); + + showFrame(view, "Counter"); + } + + private static void showFrame(Container pane, String title) { + final JFrame frame = new JFrame(title); + frame.setContentPane(pane); + frame.pack(); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } +} diff --git a/src/oop/ch08/gui/mvc/v3/CounterController.java b/src/oop/ch08/gui/mvc/v3/CounterController.java new file mode 100644 index 0000000..4242551 --- /dev/null +++ b/src/oop/ch08/gui/mvc/v3/CounterController.java @@ -0,0 +1,20 @@ +package oop.ch08.gui.mvc.v3; + +import oop.ch08.gui.mvc.model.CounterModel; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +class CounterController extends MouseAdapter { + private final CounterModel model; + + CounterController(CounterModel model) { + this.model = model; + } + + @Override + public void mouseClicked(MouseEvent e) { + if (10 <= e.getX() && e.getX() <= 110 && 10 <= e.getY() && e.getY() <= 40) + model.increment(); + } +} diff --git a/src/oop/ch08/gui/mvc/v3/CounterView.java b/src/oop/ch08/gui/mvc/v3/CounterView.java new file mode 100644 index 0000000..3946abe --- /dev/null +++ b/src/oop/ch08/gui/mvc/v3/CounterView.java @@ -0,0 +1,33 @@ +package oop.ch08.gui.mvc.v3; + +import oop.ch06.observer.Observer; +import oop.ch08.gui.mvc.model.CounterModel; + +import javax.swing.JPanel; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; + +class CounterView extends JPanel implements Observer { + private final CounterModel model; + + CounterView(CounterModel model) { + this.model = model; + model.addObserver(this); + setPreferredSize(new Dimension(200, 100)); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + g.setColor(Color.LIGHT_GRAY); + g.fillRect(10, 10, 100, 30); + g.setColor(Color.BLACK); + g.drawString("Push me! (" + model.getCounter() + ")", 15, 30); + } + + @Override + public void update() { + repaint(); + } +} diff --git a/src/oop/ch08/gui/mvc/v4/CounterApp.java b/src/oop/ch08/gui/mvc/v4/CounterApp.java new file mode 100644 index 0000000..1e45b93 --- /dev/null +++ b/src/oop/ch08/gui/mvc/v4/CounterApp.java @@ -0,0 +1,21 @@ +package oop.ch08.gui.mvc.v4; + +import oop.ch08.gui.mvc.model.CounterModel; + +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import java.awt.Container; + +public class CounterApp { + public static void main(String[] args) { + showFrame(new CounterGUI(new CounterModel()), "Counter"); + } + + private static void showFrame(Container pane, String title) { + final JFrame frame = new JFrame(title); + frame.setContentPane(pane); + frame.pack(); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } +} diff --git a/src/oop/ch08/gui/mvc/v4/CounterController.java b/src/oop/ch08/gui/mvc/v4/CounterController.java new file mode 100644 index 0000000..2015f7f --- /dev/null +++ b/src/oop/ch08/gui/mvc/v4/CounterController.java @@ -0,0 +1,19 @@ +package oop.ch08.gui.mvc.v4; + +import oop.ch08.gui.mvc.model.CounterModel; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +class CounterController implements ActionListener { + private final CounterModel model; + + CounterController(CounterModel model) { + this.model = model; + } + + @Override + public void actionPerformed(ActionEvent e) { + model.increment(); + } +} diff --git a/src/oop/ch08/gui/mvc/v4/CounterGUI.java b/src/oop/ch08/gui/mvc/v4/CounterGUI.java new file mode 100644 index 0000000..caedbc7 --- /dev/null +++ b/src/oop/ch08/gui/mvc/v4/CounterGUI.java @@ -0,0 +1,25 @@ +package oop.ch08.gui.mvc.v4; + +import oop.ch06.observer.Observer; +import oop.ch08.gui.mvc.model.CounterModel; + +import javax.swing.JButton; +import javax.swing.JPanel; + +class CounterGUI extends JPanel implements Observer { + private final CounterModel model; + private final JButton button = new JButton("Push me!"); + + CounterGUI(CounterModel model) { + this.model = model; + model.addObserver(this); + button.addActionListener(new CounterController(model)); + add(button); + update(); + } + + @Override + public void update() { + button.setText("Push me! (" + model.getCounter() + ")"); + } +} diff --git a/src/oop/ch08/gui/mvc/v5/CounterApp.java b/src/oop/ch08/gui/mvc/v5/CounterApp.java new file mode 100644 index 0000000..5cb8a16 --- /dev/null +++ b/src/oop/ch08/gui/mvc/v5/CounterApp.java @@ -0,0 +1,21 @@ +package oop.ch08.gui.mvc.v5; + +import oop.ch08.gui.mvc.model.CounterModel; + +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import java.awt.Container; + +public class CounterApp { + public static void main(String[] args) { + showFrame(new CounterGUI(new CounterModel()), "Counter"); + } + + private static void showFrame(Container pane, String title) { + final JFrame frame = new JFrame(title); + frame.setContentPane(pane); + frame.pack(); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } +} diff --git a/src/oop/ch08/gui/mvc/v5/CounterGUI.java b/src/oop/ch08/gui/mvc/v5/CounterGUI.java new file mode 100644 index 0000000..90525e9 --- /dev/null +++ b/src/oop/ch08/gui/mvc/v5/CounterGUI.java @@ -0,0 +1,32 @@ +package oop.ch08.gui.mvc.v5; + +import oop.ch06.observer.Observer; +import oop.ch08.gui.mvc.model.CounterModel; + +import javax.swing.JButton; +import javax.swing.JPanel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +class CounterGUI extends JPanel implements Observer { + private final CounterModel model; + private final JButton button = new JButton("Push me!"); + + CounterGUI(CounterModel model) { + this.model = model; + model.addObserver(this); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + model.increment(); + } + }); + add(button); + update(); + } + + @Override + public void update() { + button.setText("Push me! (" + model.getCounter() + ")"); + } +} diff --git a/src/oop/ch08/gui/mvc/v6/CounterApp.java b/src/oop/ch08/gui/mvc/v6/CounterApp.java new file mode 100644 index 0000000..398df5c --- /dev/null +++ b/src/oop/ch08/gui/mvc/v6/CounterApp.java @@ -0,0 +1,21 @@ +package oop.ch08.gui.mvc.v6; + +import oop.ch08.gui.mvc.model.CounterModel; + +import javax.swing.JFrame; +import javax.swing.WindowConstants; +import java.awt.Container; + +public class CounterApp { + public static void main(String[] args) { + showFrame(new CounterGUI(new CounterModel()), "Counter"); + } + + private static void showFrame(Container pane, String title) { + final JFrame frame = new JFrame(title); + frame.setContentPane(pane); + frame.pack(); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } +} diff --git a/src/oop/ch08/gui/mvc/v6/CounterGUI.java b/src/oop/ch08/gui/mvc/v6/CounterGUI.java new file mode 100644 index 0000000..ac4f931 --- /dev/null +++ b/src/oop/ch08/gui/mvc/v6/CounterGUI.java @@ -0,0 +1,25 @@ +package oop.ch08.gui.mvc.v6; + +import oop.ch06.observer.Observer; +import oop.ch08.gui.mvc.model.CounterModel; + +import javax.swing.JButton; +import javax.swing.JPanel; + +class CounterGUI extends JPanel implements Observer { + private final CounterModel model; + private final JButton button = new JButton("Push me!"); + + CounterGUI(CounterModel model) { + this.model = model; + model.addObserver(this); + button.addActionListener(e -> model.increment()); + add(button); + update(); + } + + @Override + public void update() { + button.setText("Push me! (" + model.getCounter() + ")"); + } +} diff --git a/src/oop/ch08/gui/simple/HelloWorld.java b/src/oop/ch08/gui/simple/HelloWorld.java new file mode 100644 index 0000000..cddf627 --- /dev/null +++ b/src/oop/ch08/gui/simple/HelloWorld.java @@ -0,0 +1,37 @@ +package oop.ch08.gui.simple; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.WindowConstants; +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Graphics; + +public class HelloWorld extends JPanel { + public static void main(String[] args) { + final HelloWorld pane = new HelloWorld(); + showFrame(pane, "Hello World"); + } + + private static void showFrame(Container pane, String title) { + final JFrame frame = new JFrame(title); + frame.setContentPane(pane); + frame.pack(); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } + + private HelloWorld() { + setPreferredSize(new Dimension(200, 200)); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + g.setColor(Color.LIGHT_GRAY); + g.fillRect(10, 10, 90, 30); + g.setColor(Color.BLACK); + g.drawString("Hello World", 15, 30); + } +} diff --git a/src/oop/ch09/testing/Example.java b/src/oop/ch09/testing/Example.java new file mode 100644 index 0000000..555876b --- /dev/null +++ b/src/oop/ch09/testing/Example.java @@ -0,0 +1,46 @@ +package oop.ch09.testing; + +public class Example { + /** + * Counts zeroes in an array. + * + * @param x array to count zeroes in + * @return number of occurrences of 0 in x + * @throws NullPointerException if x is null + */ + public static int numZero(int[] x) { + int count = 0; + for (int i = 1; i < x.length; i++) + if (x[i] == 0) + count++; + return count; + } + + public static int numZero2(int[] x) { + int count = 0; + int i = 1; + while (i < x.length) { + if (x[i] == 0) + count++; + i++; + } + return count; + } + + public static void main(String[] args) { + int g = 5 / 0; + check(2, 7, 0); + check(0, 7, 2); + } + + private static void check(int... x) { + System.out.print("zeroes in ["); + boolean first = true; + for (int v : x) { + if (!first) System.out.print(", "); + first = false; + System.out.print(v); + } + System.out.println("]: " + numZero2(x)); + } +} diff --git a/src/uebung03/polynomial/POLNYOMIAL.java b/src/uebung03/polynomial/POLNYOMIAL.java new file mode 100644 index 0000000..e5cddb5 --- /dev/null +++ b/src/uebung03/polynomial/POLNYOMIAL.java @@ -0,0 +1,30 @@ +package uebung03.polynomial; + +public class POLNYOMIAL { + private int[] koeff; + private static int degree = 0; + + // Kontruktor für den die Koeffizienten übergeben werden + public POLNYOMIAL(int[] koeff){ + koeff = this.koeff; + degree = getDegree(koeff); + } + + //Konstruktor für den immer gilt p(x) = x + public POLNYOMIAL(){ + koeff = new int[1]; + degree = getDegree(koeff); + } + + private int getDegree(int[] koeff) { + int result = 0; + for(int i = 0; i < koeff.length; i++ ){ + if (koeff[i] != 0) { + result = i; + } + } + return result; + } + + +} diff --git a/src/uebung04/ByeGame.java b/src/uebung04/ByeGame.java new file mode 100644 index 0000000..8e3d079 --- /dev/null +++ b/src/uebung04/ByeGame.java @@ -0,0 +1,5 @@ +package uebung04; + +public class ByeGame extends Game{ + +} diff --git a/src/uebung04/Game.java b/src/uebung04/Game.java new file mode 100644 index 0000000..6754036 --- /dev/null +++ b/src/uebung04/Game.java @@ -0,0 +1,34 @@ +package uebung04; + +import java.util.List; + +public abstract class Game { + + protected static int counter = 0; + protected final int id; + protected String player1; + protected String player2; + protected String winner; + + public Game(){ + id = counter; + counter++; + } + + public int getId() {return id;} + + public String getWinner(){return winner;} + + public void setWinner(int player){ + if (player == 1) { + winner = player1; + } else if(player == 2){ + winner = player2; + } + } + + public abstract String getPlayer1(); + public abstract String getPlayer2(); + + public abstract List getAllPlayers(); +} diff --git a/src/uebung04/OrdinaryGame.java b/src/uebung04/OrdinaryGame.java new file mode 100644 index 0000000..f7d6b3e --- /dev/null +++ b/src/uebung04/OrdinaryGame.java @@ -0,0 +1,5 @@ +package uebung04; + +public class OrdinaryGame extends Game{ + +} diff --git a/src/uebung04/SeededGame.java b/src/uebung04/SeededGame.java new file mode 100644 index 0000000..89852d4 --- /dev/null +++ b/src/uebung04/SeededGame.java @@ -0,0 +1,5 @@ +package uebung04; + +public class SeededGame extends Game{ + +} diff --git a/test/oop/ch03/chess/ChessTest.java b/test/oop/ch03/chess/ChessTest.java new file mode 100644 index 0000000..4b46c23 --- /dev/null +++ b/test/oop/ch03/chess/ChessTest.java @@ -0,0 +1,168 @@ +package oop.ch03.chess; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import static org.junit.Assert.assertEquals; + +public class ChessTest { + // Das Zeilenende wird auf Windows-Systemen anders codiert als auf Nicht-Windows-Systemen. + // Die folgende Zeile ermittelt die aktuelle Codierung. + // EOL = "End of Line" + private static final String LS = System.lineSeparator(); + private static final String HE = " 1 2 3 4 5 6 7 8" + LS; + private static final String LI = " +---+---+---+---+---+---+---+---+" + LS; + private static final String EMP = " | | | | | | | | |" + LS; + private static final String WK1 = " | n | | | | | | | |" + LS; + private static final String WQ3 = " | | | q | | | | | |" + LS; + private static final String CO1 = " | | | n | | N | Q | | |" + LS; + private static final String INIT_BOARD = board(EMP, EMP, EMP, EMP, EMP, EMP, EMP, EMP); + private static final String WK61_BOARD = board(EMP, EMP, EMP, EMP, EMP, WK1, EMP, EMP); + private static final String APP1_BOARD = board(EMP, EMP, EMP, EMP, WQ3, CO1, EMP, EMP); + private static final String CHECK_TEXT1 = "white queen at (4, 2)" + LS + + " cannot capture black queen at (8, 6)" + LS + + " cannot capture white knight at (6, 4)" + LS + + "black queen at (8, 6)" + LS + + " cannot capture white queen at (4, 2)" + LS + + " can capture white knight at (6, 4)" + LS + + "white knight at (6, 4)" + LS + + " cannot capture white queen at (4, 2)" + LS + + " cannot capture black queen at (8, 6)" + LS; + private static final String CHECK_TEXT2 = "white knight at (6, 3)" + LS + + " cannot capture black knight at (6, 5)" + LS + + " cannot capture black queen at (6, 6)" + LS + + " cannot capture white queen at (5, 3)" + LS + + "black knight at (6, 5)" + LS + + " cannot capture white knight at (6, 3)" + LS + + " cannot capture black queen at (6, 6)" + LS + + " can capture white queen at (5, 3)" + LS + + "black queen at (6, 6)" + LS + + " cannot capture white knight at (6, 3)" + LS + + " cannot capture black knight at (6, 5)" + LS + + " cannot capture white queen at (5, 3)" + LS + + "white queen at (5, 3)" + LS + + " cannot capture white knight at (6, 3)" + LS + + " cannot capture black knight at (6, 5)" + LS + + " cannot capture black queen at (6, 6)" + LS; + + private static String board(String... s) { + if (s.length != 8) + throw new IllegalArgumentException("Expected 8, but got " + s.length + " arguments"); + StringBuilder sb = new StringBuilder(); + sb.append(HE).append(LI); + for (int i = 1; i <= 8; i++) + sb.append(i).append(s[i - 1]).append(LI); + return sb.toString(); + } + + private Board board; + + private final ByteArrayOutputStream printed = new ByteArrayOutputStream(); + private final PrintStream printStream = new PrintStream(printed, true); + + @Before + public void setup() { + board = new Board(); + printed.reset(); + System.setOut(printStream); + } + + @After + public void tearDown() { + printStream.close(); + } + + @Test + public void testEmpty() { + board.printBoard(); + assertEquals(INIT_BOARD, printed.toString()); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidPos1() { + new Knight(Color.white, board, 0, 4); + } + + @Test(expected = IllegalArgumentException.class) + public void testInvalidPos2() { + new Queen(Color.white, board, 0, 4); + } + + @Test + public void testWhiteknight() { + final Piece knight = new Knight(Color.white, board, 6, 1); + checkPieces(1); + assertEquals(knight, board.pieceAt(6, 1)); + board.printBoard(); + assertEquals(WK61_BOARD, printed.toString()); + } + + @Test + public void test3Pieces() { + final Piece queen1 = new Queen(Color.white, board, 4, 2); + final Piece queen2 = new Queen(Color.black, board, 8, 6); + final Piece knight = new Knight(Color.white, board, 6, 4); + Assert.assertFalse(queen1.canCapture(queen2)); + Assert.assertFalse(queen1.canCapture(knight)); + Assert.assertFalse(queen2.canCapture(queen1)); + Assert.assertTrue(queen2.canCapture(knight)); + Assert.assertFalse(knight.canCapture(queen1)); + Assert.assertFalse(knight.canCapture(queen2)); + checkPieces(3); + assertEquals(queen1, board.pieceAt(4, 2)); + assertEquals(queen2, board.pieceAt(8, 6)); + assertEquals(knight, board.pieceAt(6, 4)); + board.check(); + assertEquals(CHECK_TEXT1, printed.toString()); + } + + @Test + public void test4Pieces() { + final Piece knight1 = new Knight(Color.white, board, 6, 3); + final Piece knight2 = new Knight(Color.black, board, 6, 5); + final Piece queen1 = new Queen(Color.black, board, 6, 6); + final Piece queen2 = new Queen(Color.white, board, 5, 3); + checkPieces(4); + assertEquals(knight1, board.pieceAt(6, 3)); + assertEquals(knight2, board.pieceAt(6, 5)); + assertEquals(queen1, board.pieceAt(6, 6)); + assertEquals(queen2, board.pieceAt(5, 3)); + board.printBoard(); + assertEquals(APP1_BOARD, printed.toString()); + Assert.assertFalse(knight1.canCapture(knight2)); + Assert.assertFalse(knight1.canCapture(queen1)); + Assert.assertFalse(knight1.canCapture(queen2)); + Assert.assertFalse(knight2.canCapture(knight1)); + Assert.assertFalse(knight2.canCapture(queen1)); + Assert.assertTrue(knight2.canCapture(queen2)); + Assert.assertFalse(queen1.canCapture(knight1)); + Assert.assertFalse(queen1.canCapture(knight2)); + Assert.assertFalse(queen1.canCapture(queen2)); + Assert.assertFalse(queen2.canCapture(knight1)); + Assert.assertFalse(queen2.canCapture(knight2)); + Assert.assertFalse(queen2.canCapture(queen1)); + printed.reset(); + board.check(); + assertEquals(CHECK_TEXT2, printed.toString()); + } + + private void checkPieces(int expectedNumPieces) { + int numPieces = 0; + for (int row = 1; row < 9; row++) + for (int col = 1; col < 9; col++) + if (board.pieceAt(row, col) != null) + numPieces++; + assertEquals(expectedNumPieces, numPieces); + } + + @Test + public void testRunWithErrors() { + final Piece rook = new Rook(Color.white, board, 1, 1); + assertEquals(rook, board.pieceAt(1, 1)); + } +} \ No newline at end of file diff --git a/test/oop/ch08/gui/mvc/TestModel.java b/test/oop/ch08/gui/mvc/TestModel.java new file mode 100644 index 0000000..2275ed6 --- /dev/null +++ b/test/oop/ch08/gui/mvc/TestModel.java @@ -0,0 +1,24 @@ +package oop.ch08.gui.mvc; + +import oop.ch08.gui.mvc.model.CounterModel; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class TestModel { + @Test + public void testInitWithZero() { + final CounterModel model = new CounterModel(); + assertEquals(0, model.getCounter()); + } + + @Test + public void testInc() { + final CounterModel model = new CounterModel(); + int counter = model.getCounter(); + model.increment(); + assertEquals(++counter, model.getCounter()); + model.increment(); + assertEquals(++counter, model.getCounter()); + } +} diff --git a/test/oop/ch09/calc/test/AdHocCalculatorEdgePairTest.java b/test/oop/ch09/calc/test/AdHocCalculatorEdgePairTest.java new file mode 100644 index 0000000..df6d4ff --- /dev/null +++ b/test/oop/ch09/calc/test/AdHocCalculatorEdgePairTest.java @@ -0,0 +1,2040 @@ +package oop.ch09.calc.test; + +import oop.ch06.calc.AdHocCalculator; +import oop.ch06.calc.Ops; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class AdHocCalculatorEdgePairTest { + private AdHocCalculator calc; + + @Before + public void setup() { + calc = new AdHocCalculator(); + calc.digit(6); + calc.binOp(Ops.MULT); + calc.digit(7); + calc.eval(); + } + + @Test + public void test0() { + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(45.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(45.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-45.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(-45.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(-51.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(-51.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(-51.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(-102.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(5.0345753587649823E-45, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-5.0345753587649823E-45, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(0.3, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(-1.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-5.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(148.4131591025766, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(0.03368973499542734, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.03368973499542734, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(0.1835476368560144, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test1() { + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(0.6, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1096.6331584284585, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(-1093.6331584284585, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1196033.485214206, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test2() { + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test3() { + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + } + + @Test + public void test4() { + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + } + + @Test + public void test5() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-9.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(51.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(51.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(51.0, calc.getValue(), 1e-10); + } + + @Test + public void test6() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + } + + @Test + public void test7() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test8() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test9() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test10() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(35.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + } + + @Test + public void test11() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + } + + @Test + public void test12() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(93.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(2.451245542920086E40, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test13() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test14() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test15() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test16() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(84.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(84.0, calc.getValue(), 1e-10); + } + + @Test + public void test17() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1764.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(1764.0, calc.getValue(), 1e-10); + } + + @Test + public void test18() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test19() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test20() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test21() { + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(20.085536923187668, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test22() { + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test23() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(-6.0, calc.getValue(), 1e-10); + } + + @Test + public void test24() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test25() { + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(6.0, calc.getValue(), 1e-10); + } + + @Test + public void test26() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test27() { + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(7.0, calc.getValue(), 1e-10); + } + + @Test + public void test28() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(2.0, calc.getValue(), 1e-10); + } + + @Test + public void test29() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test30() { + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test31() { + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test32() { + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test33() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test34() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(69.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(69.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-69.0, calc.getValue(), 1e-10); + } + + @Test + public void test35() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(6.0, calc.getValue(), 1e-10); + } + + @Test + public void test36() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test37() { + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test38() { + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(2.3, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(2.3, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(2.3, calc.getValue(), 1e-10); + } + + @Test + public void test39() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test40() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test41() { + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + } + + @Test + public void test42() { + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test43() { + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test44() { + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test45() { + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test46() { + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(12.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(12.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(3.4641016151377544, calc.getValue(), 1e-10); + } + + @Test + public void test47() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test48() { + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test49() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(8103.083927575384, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test50() { + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.digit(8); + assertEquals(78.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(8.831760866327848, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test51() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test52() { + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(72.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test53() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(64.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test54() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(421.0, calc.getValue(), 1e-10); + } + + @Test + public void test62() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test63() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test64() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test65() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test66() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(-0.0, calc.getValue(), 1e-10); + } + + @Test + public void test67() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test68() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + } + + @Test + public void test69() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test70() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test71() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(0.3, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(0.33, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test72() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test73() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test74() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test75() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(0.7, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(0.7, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test76() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test77() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test78() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(0.9, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(2.45960311115695, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test79() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test80() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test81() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test82() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test83() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test84() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test85() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-4.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(0.01831563888873418, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(4.7, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(109.94717245212352, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test86() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(652.4540390039687, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test87() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.5457298950218306, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test88() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.5457298950218306, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(12.752532700090239, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(29.24746729990976, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test89() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test90() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(35.51925930159214, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test91() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test92() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(0.3, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + } + + @Test + public void test93() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-1.73927494152050099E18, calc.getValue(), 1e-10); + } + + @Test + public void test94() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.5457298950218306, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertTrue(Double.isNaN(calc.getValue())); + calc.digit(6); + assertTrue(Double.isNaN(calc.getValue())); + } + + @Test + public void test95() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + } + + @Test + public void test96() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test97() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(-1764.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test98() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + } + + @Test + public void test99() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(2.4147993510032952E-17, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(2.4147993510032952E-17, calc.getValue(), 1e-10); + } + + @Test + public void test100() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test101() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(48.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.1347969605334383E21, calc.getValue(), 1e-10); + } + + @Test + public void test102() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test103() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(51.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(515.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(-473.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(-473.0, calc.getValue(), 1e-10); + } + + @Test + public void test104() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(272.19110933313016, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test105() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test106() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(84.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test107() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(7.304954754386104E19, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test108() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test109() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test110() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(168.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test111() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + } + + @Test + public void test112() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(44.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test113() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test114() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test115() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(252.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(2.7682763318657856E109, calc.getValue(), 1e-10); + } + + @Test + public void test116() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test117() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test118() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test119() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(252.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + } + + @Test + public void test120() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test121() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(43.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(43.0, calc.getValue(), 1e-10); + } + + @Test + public void test122() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test123() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test124() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(36.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test125() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test126() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test127() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(41.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.4031242374328485, calc.getValue(), 1e-10); + } + + @Test + public void test128() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(54.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + } + + @Test + public void test129() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(126.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test130() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.8284271247461903, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(44.82842712474619, calc.getValue(), 1e-10); + } + + @Test + public void test131() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(33.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test132() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-6.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test133() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(2980.9579870417283, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test134() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertTrue(Double.isNaN(calc.getValue())); + } + + @Test + public void test135() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + } + + @Test + public void test136() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + } + + @Test + public void test137() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(27.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(27.0, calc.getValue(), 1e-10); + } + + @Test + public void test138() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(31.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(73.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test139() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(43.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-43.0, calc.getValue(), 1e-10); + } + + @Test + public void test140() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(20.085536923187668, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test141() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(75.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test142() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test143() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test144() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test145() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test146() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test147() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertTrue(Double.isNaN(calc.getValue())); + calc.binOp(Ops.MINUS); + assertTrue(Double.isNaN(calc.getValue())); + } + + @Test + public void test148() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test149() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test150() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(0.6, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test151() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test152() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test153() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + } + + @Test + public void test154() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-1.0, calc.getValue(), 1e-10); + } + + @Test + public void test155() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(0.4, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(41.6, calc.getValue(), 1e-10); + } + + @Test + public void test156() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + } + + @Test + public void test157() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test158() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + } + + @Test + public void test159() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + } + + @Test + public void test160() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(0.9, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(0.97, calc.getValue(), 1e-10); + } +} diff --git a/test/oop/ch09/calc/test/AdHocCalculatorEdgeTest.java b/test/oop/ch09/calc/test/AdHocCalculatorEdgeTest.java new file mode 100644 index 0000000..3d7efc8 --- /dev/null +++ b/test/oop/ch09/calc/test/AdHocCalculatorEdgeTest.java @@ -0,0 +1,280 @@ +package oop.ch09.calc.test; + +import oop.ch06.calc.AdHocCalculator; +import oop.ch06.calc.Ops; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class AdHocCalculatorEdgeTest { + private AdHocCalculator calc; + + @Before + public void setup() { + calc = new AdHocCalculator(); + calc.digit(6); + calc.binOp(Ops.MULT); + calc.digit(7); + calc.eval(); + } + + @Test + public void test0() { + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(62.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(62.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test1() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.5457298950218306, calc.getValue(), 1e-10); + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(5.25, calc.getValue(), 1e-10); + } + + @Test + public void test2() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test3() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test4() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test5() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test6() { + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test7() { + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test8() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(9.0, calc.getValue(), 1e-10); + } + + @Test + public void test9() { + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-5.0, calc.getValue(), 1e-10); + } + + @Test + public void test11() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test12() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(0.2, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.2214027581601699, calc.getValue(), 1e-10); + } + + @Test + public void test13() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test14() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test15() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(-1.73927494152050099E18, calc.getValue(), 1e-10); + } + + @Test + public void test16() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(-1.73927494152050099E18, calc.getValue(), 1e-10); + } + + @Test + public void test17() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test18() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertTrue(Double.isNaN(calc.getValue())); + } + + @Test + public void test19() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(25.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-25.0, calc.getValue(), 1e-10); + } + + @Test + public void test20() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(51.0, calc.getValue(), 1e-10); + } + + @Test + public void test21() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.6457513110645907, calc.getValue(), 1e-10); + } + + @Test + public void test22() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test23() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(0.3, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test24() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + } +} diff --git a/test/oop/ch09/calc/test/CalculatorEdgePairTest.java b/test/oop/ch09/calc/test/CalculatorEdgePairTest.java new file mode 100644 index 0000000..f3254d6 --- /dev/null +++ b/test/oop/ch09/calc/test/CalculatorEdgePairTest.java @@ -0,0 +1,2040 @@ +package oop.ch09.calc.test; + +import oop.ch06.calc.Ops; +import oop.ch07.calc.Calculator; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class CalculatorEdgePairTest { + private Calculator calc; + + @Before + public void setup() { + calc = new Calculator(); + calc.digit(6); + calc.binOp(Ops.MULT); + calc.digit(7); + calc.eval(); + } + + @Test + public void test0() { + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(45.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(45.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-45.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(-45.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(-51.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(-51.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(-51.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(-102.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(5.0345753587649823E-45, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-5.0345753587649823E-45, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(0.3, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(-1.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-5.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(148.4131591025766, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(0.03368973499542734, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.03368973499542734, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(0.1835476368560144, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test1() { + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(0.6, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1096.6331584284585, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(-1093.6331584284585, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1196033.485214206, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test2() { + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test3() { + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + } + + @Test + public void test4() { + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + } + + @Test + public void test5() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-9.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(51.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(51.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(51.0, calc.getValue(), 1e-10); + } + + @Test + public void test6() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + } + + @Test + public void test7() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test8() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test9() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test10() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(35.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + } + + @Test + public void test11() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + } + + @Test + public void test12() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(93.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(2.451245542920086E40, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test13() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test14() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test15() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test16() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(84.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(84.0, calc.getValue(), 1e-10); + } + + @Test + public void test17() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1764.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(1764.0, calc.getValue(), 1e-10); + } + + @Test + public void test18() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test19() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test20() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test21() { + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(20.085536923187668, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test22() { + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test23() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(-6.0, calc.getValue(), 1e-10); + } + + @Test + public void test24() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test25() { + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(6.0, calc.getValue(), 1e-10); + } + + @Test + public void test26() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test27() { + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(7.0, calc.getValue(), 1e-10); + } + + @Test + public void test28() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(2.0, calc.getValue(), 1e-10); + } + + @Test + public void test29() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test30() { + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test31() { + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test32() { + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test33() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test34() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(69.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(69.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-69.0, calc.getValue(), 1e-10); + } + + @Test + public void test35() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(6.0, calc.getValue(), 1e-10); + } + + @Test + public void test36() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test37() { + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test38() { + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(2.3, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(2.3, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(2.3, calc.getValue(), 1e-10); + } + + @Test + public void test39() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test40() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test41() { + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + } + + @Test + public void test42() { + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test43() { + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test44() { + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test45() { + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test46() { + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(12.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(12.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(3.4641016151377544, calc.getValue(), 1e-10); + } + + @Test + public void test47() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test48() { + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test49() { + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(8103.083927575384, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test50() { + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.digit(8); + assertEquals(78.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(8.831760866327848, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test51() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test52() { + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(72.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test53() { + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(64.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test54() { + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(421.0, calc.getValue(), 1e-10); + } + + @Test + public void test62() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test63() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test64() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test65() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test66() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(-0.0, calc.getValue(), 1e-10); + } + + @Test + public void test67() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test68() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + } + + @Test + public void test69() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test70() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test71() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(0.3, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(0.33, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test72() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test73() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test74() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test75() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(0.7, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(0.7, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test76() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test77() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test78() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(0.9, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(2.45960311115695, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test79() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test80() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test81() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test82() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test83() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test84() { + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test85() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-4.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(0.01831563888873418, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(4.7, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(109.94717245212352, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test86() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(652.4540390039687, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test87() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.5457298950218306, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test88() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.5457298950218306, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(12.752532700090239, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(29.24746729990976, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test89() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test90() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(35.51925930159214, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test91() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test92() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(0.3, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + } + + @Test + public void test93() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-1.73927494152050099E18, calc.getValue(), 1e-10); + } + + @Test + public void test94() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.5457298950218306, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertTrue(Double.isNaN(calc.getValue())); + calc.digit(6); + assertTrue(Double.isNaN(calc.getValue())); + } + + @Test + public void test95() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + } + + @Test + public void test96() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test97() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(-1764.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test98() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + } + + @Test + public void test99() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(2.4147993510032952E-17, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(2.4147993510032952E-17, calc.getValue(), 1e-10); + } + + @Test + public void test100() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test101() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(48.48074069840786, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.1347969605334383E21, calc.getValue(), 1e-10); + } + + @Test + public void test102() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test103() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(51.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(515.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(-473.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(-473.0, calc.getValue(), 1e-10); + } + + @Test + public void test104() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(272.19110933313016, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test105() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test106() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(84.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test107() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(7.304954754386104E19, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test108() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test109() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test110() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.48074069840786, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(168.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test111() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + } + + @Test + public void test112() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.73927494152050099E18, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(44.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test113() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test114() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MINUS); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test115() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(252.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(2.7682763318657856E109, calc.getValue(), 1e-10); + } + + @Test + public void test116() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test117() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test118() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test119() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(252.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + } + + @Test + public void test120() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test121() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(43.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(43.0, calc.getValue(), 1e-10); + } + + @Test + public void test122() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test123() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test124() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(36.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test125() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test126() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test127() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(41.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(6.4031242374328485, calc.getValue(), 1e-10); + } + + @Test + public void test128() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(5.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(54.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + } + + @Test + public void test129() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(126.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test130() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(2.8284271247461903, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(44.82842712474619, calc.getValue(), 1e-10); + } + + @Test + public void test131() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(9.0, calc.getValue(), 1e-10); + calc.binOp(Ops.DIV); + assertEquals(33.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test132() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-6.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test133() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(8); + assertEquals(8.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(2980.9579870417283, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + } + + @Test + public void test134() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertTrue(Double.isNaN(calc.getValue())); + } + + @Test + public void test135() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + } + + @Test + public void test136() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(4); + assertEquals(4.0, calc.getValue(), 1e-10); + } + + @Test + public void test137() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(2); + assertEquals(2.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(27.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(27.0, calc.getValue(), 1e-10); + } + + @Test + public void test138() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(31.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(73.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test139() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(1); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(43.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-43.0, calc.getValue(), 1e-10); + } + + @Test + public void test140() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(20.085536923187668, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test141() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + calc.digit(5); + assertEquals(75.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test142() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(3); + assertEquals(3.0, calc.getValue(), 1e-10); + } + + @Test + public void test143() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.PLUS); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test144() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test145() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test146() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test147() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertTrue(Double.isNaN(calc.getValue())); + calc.binOp(Ops.MINUS); + assertTrue(Double.isNaN(calc.getValue())); + } + + @Test + public void test148() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.binOp(Ops.MULT); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test149() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test150() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(6); + assertEquals(0.6, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test151() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + } + + @Test + public void test152() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test153() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.clear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + } + + @Test + public void test154() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.EXP); + assertEquals(1.0, calc.getValue(), 1e-10); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-1.0, calc.getValue(), 1e-10); + } + + @Test + public void test155() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(4); + assertEquals(0.4, calc.getValue(), 1e-10); + calc.binOp(Ops.MINUS); + assertEquals(41.6, calc.getValue(), 1e-10); + } + + @Test + public void test156() { + calc.binOp(Ops.PLUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.unOp(Ops.SQRT); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(7.0, calc.getValue(), 1e-10); + } + + @Test + public void test157() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.eval(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + } + + @Test + public void test158() { + calc.binOp(Ops.DIV); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.digit(6); + assertEquals(6.0, calc.getValue(), 1e-10); + } + + @Test + public void test159() { + calc.binOp(Ops.MINUS); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.allClear(); + assertEquals(0.0, calc.getValue(), 1e-20); + calc.unOp(Ops.CHANGE_SIGN); + assertEquals(-0.0, calc.getValue(), 1e-10); + } + + @Test + public void test160() { + calc.binOp(Ops.MULT); + assertEquals(42.0, calc.getValue(), 1e-10); + calc.dot(); + assertEquals(0.0, calc.getValue(), 1e-10); + calc.digit(9); + assertEquals(0.9, calc.getValue(), 1e-10); + calc.digit(7); + assertEquals(0.97, calc.getValue(), 1e-10); + } +} diff --git a/test/oop/ch09/testing/ExceptionTest.java b/test/oop/ch09/testing/ExceptionTest.java new file mode 100644 index 0000000..20533be --- /dev/null +++ b/test/oop/ch09/testing/ExceptionTest.java @@ -0,0 +1,34 @@ +package oop.ch09.testing; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class ExceptionTest { + @Test + public void testDivZero1() { + int zero = 0; + int result = 4 / zero; + assertTrue(true); + } + + @Test + public void testDivZero2() { + int zero = 0; + try { + int result = 4 / zero; + fail("ArithmeticException kam nicht"); + } + catch (ArithmeticException ex) { + assertEquals("/ by zero", ex.getMessage()); + } + } + + @Test(expected = ArithmeticException.class) + public void testDivZero2b() { + int zero = 0; + int result = 4 / zero; + } +} diff --git a/test/uebung/uebung04/tournament/TournamentTest.java b/test/uebung/uebung04/tournament/TournamentTest.java new file mode 100644 index 0000000..5dbff2d --- /dev/null +++ b/test/uebung/uebung04/tournament/TournamentTest.java @@ -0,0 +1,134 @@ +package test.uebung.uebung04.tournament; + +import org.junit.Before; +import org.junit.Test; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; + +public class TournamentTest { + + private static final String BORGHOFF = "Prof. Borghoff"; + private static final String HOMMEL = "Prof. Hommel"; + private static final String KOCH = "Prof. Koch"; + private static final String MINAS = "Prof. Minas"; + private static final String BUCHENRIEDER = "Prof. Buchenrieder"; + private static final String DREO = "Prof. Dreo"; + private static final String ROSE = "Prof. Rose"; + private static final String SIEGLE = "Prof. Siegle"; + private static final String TEEGE = "Prof. Teege"; + private static final Set SET1 = Set.of(BORGHOFF, HOMMEL, KOCH, MINAS, BUCHENRIEDER, DREO, ROSE, SIEGLE, TEEGE); + private static final Set SET2 = Set.of(BORGHOFF, MINAS, SIEGLE, HOMMEL, DREO); + private static final Set SET3 = Set.of(BORGHOFF, MINAS, SIEGLE); + private static final Set SET4 = Set.of(MINAS, SIEGLE); + private static final Set SET5 = Set.of(MINAS); + + private Tournament tournament; + private Game r1s1; + private Game r1s2; + private Game r1s3; + private Game r1s4; + private Game r2s1; + private Game r2s2; + private Game r3s1; + private Game r4s1; + + @Before + public void setup() { + r1s1 = new SeededGame(HOMMEL, KOCH); + r1s2 = new SeededGame(MINAS, BUCHENRIEDER); + r1s3 = new SeededGame(DREO, ROSE); + r1s4 = new SeededGame(SIEGLE, TEEGE); + r2s1 = new ByeGame(BORGHOFF, r1s1); + r2s2 = new OrdinaryGame(r1s2, r1s3); + r3s1 = new OrdinaryGame(r2s1, r2s2); + r4s1 = new OrdinaryGame(r3s1, r1s4); + tournament = new Tournament("UniBw Sportschießen", r4s1); + } + + @Test + public void testBeforeFirstRound() { + assertEquals(SET1, asSet(tournament.getAllPlayers())); + assertEquals(SET1, asSet(tournament.getRemainingPlayers())); + } + + @Test + public void testFirstRound() { + r1s1.setWinner(HOMMEL); + r1s2.setWinner(MINAS); + r1s3.setWinner(DREO); + r1s4.setWinner(SIEGLE); + assertEquals(SET1, asSet(tournament.getAllPlayers())); + assertEquals(SET2, asSet(tournament.getRemainingPlayers())); + } + + @Test + public void testSecondRound() { + r1s1.setWinner(HOMMEL); + r1s2.setWinner(MINAS); + r1s3.setWinner(DREO); + r1s4.setWinner(SIEGLE); + r2s1.setWinner(BORGHOFF); + r2s2.setWinner(MINAS); + assertEquals(SET1, asSet(tournament.getAllPlayers())); + assertEquals(SET3, asSet(tournament.getRemainingPlayers())); + } + + @Test + public void testThirdRound() { + r1s1.setWinner(HOMMEL); + r1s2.setWinner(MINAS); + r1s3.setWinner(DREO); + r1s4.setWinner(SIEGLE); + r2s1.setWinner(BORGHOFF); + r2s2.setWinner(MINAS); + r3s1.setWinner(MINAS); + assertEquals(SET1, asSet(tournament.getAllPlayers())); + assertEquals(SET4, asSet(tournament.getRemainingPlayers())); + } + + @Test + public void testCompleteTournament() { + r1s1.setWinner(HOMMEL); + r1s2.setWinner(MINAS); + r1s3.setWinner(DREO); + r1s4.setWinner(SIEGLE); + r2s1.setWinner(BORGHOFF); + r2s2.setWinner(MINAS); + r3s1.setWinner(MINAS); + r4s1.setWinner(MINAS); + assertEquals(SET1, asSet(tournament.getAllPlayers())); + assertEquals(SET5, asSet(tournament.getRemainingPlayers())); + } + + @Test + public void testException() { + r1s1.setWinner(HOMMEL); + r1s2.setWinner(MINAS); + r1s3.setWinner(DREO); + r1s4.setWinner(SIEGLE); + r2s1.setWinner(BORGHOFF); + r2s2.setWinner(MINAS); + r3s1.setWinner(MINAS); + assertThrows(IllegalArgumentException.class, () -> r4s1.setWinner(BUCHENRIEDER)); + } + + @Test(expected = IllegalStateException.class) + public void testException2() { + r4s1.setWinner(MINAS); + } + + @Test + public void testException3() { + r1s1.setWinner(HOMMEL); + assertThrows(IllegalStateException.class, () -> r1s1.setWinner(HOMMEL)); + } + + private static Set asSet(Collection collection) { + return new HashSet<>(collection); + } +}