From d6e63d4265bc0c3d56abd28934c07fc215101a9e Mon Sep 17 00:00:00 2001 From: Bruce Eckel Date: Fri, 22 Jul 2016 14:45:35 -0600 Subject: [PATCH] Auto-updated example output --- annotations/AtUnitComposition.java | 2 +- annotations/AtUnitExample1.java | 6 +- annotations/AtUnitExample4.java | 22 +++--- annotations/AtUnitExternalTest.java | 2 +- annotations/HashSetTest.java | 2 +- annotations/StackLStringTest.java | 2 +- annotations/database/TableCreator.java | 2 +- arrays/AlphabeticSearch.java | 11 +-- arrays/ArrayCopying.java | 12 +-- arrays/ArraySearching.java | 6 +- arrays/BadMicroBenchmark.java | 4 +- arrays/BadMicroBenchmark2.java | 4 +- arrays/BadMicroBenchmark3.java | 8 +- arrays/CompType.java | 20 ++--- arrays/ComparatorTest.java | 20 ++--- arrays/ComparingArrays.java | 6 +- arrays/CountUpward.java | 3 +- arrays/FillingArrays.java | 20 ++--- arrays/IceCream.java | 14 ++-- arrays/ModifyExisting.java | 5 +- arrays/ParallelPrefix.java | 2 +- arrays/ParallelSort.java | 4 +- arrays/RaggedArray.java | 5 +- arrays/Reverse.java | 20 ++--- arrays/StringSorting.java | 28 ++++--- arrays/TestRand.java | 4 +- assertions/Assert1.java | 3 +- assertions/Assert2.java | 1 - assertions/LoaderAssertions.java | 1 - .../ApplesAndOrangesWithoutGenerics.java | 5 +- collections/GenericsAndUpcasting.java | 8 +- collectionsindepth/Bits.java | 20 ++--- collectionsindepth/FillingLists.java | 9 ++- collectionsindepth/ListPerformance.java | 10 +-- collectionsindepth/Lists.java | 2 +- collectionsindepth/MapPerformance.java | 12 +-- collectionsindepth/References.java | 14 ++-- collectionsindepth/SetPerformance.java | 6 +- collectionsindepth/SpringDetector.java | 12 +-- collectionsindepth/SpringDetector2.java | 12 +-- .../SuppliersCollectionTest.java | 4 +- collectionsindepth/TypesForSets.java | 8 +- control/WhileTest.java | 4 +- debugging/SimpleDebugging.java | 1 - enums/ConstantSpecificMethod.java | 14 +--- enums/PostOffice.java | 74 +++++++++---------- enums/RandomTest.java | 6 +- enums/RoShamBo1.java | 30 ++++---- enums/RoShamBo2.java | 30 ++++---- enums/RoShamBo3.java | 30 ++++---- enums/RoShamBo4.java | 30 ++++---- enums/RoShamBo5.java | 30 ++++---- enums/RoShamBo6.java | 30 ++++---- enums/SecurityCategory.java | 12 +-- enums/cartoons/EnumImplementation.java | 4 +- enums/menu/Meal.java | 38 +++++----- enums/menu/Meal2.java | 38 +++++----- exceptions/ExtraFeatures.java | 12 +-- exceptions/LoggingExceptions.java | 5 +- exceptions/LoggingExceptions2.java | 3 +- exceptions/NeverCaught.java | 1 - files/AddAndSubtractPaths.java | 24 +++--- files/Directories.java | 14 ++-- files/File_System.java | 6 +- files/Find.java | 24 +++--- files/PartsOfPaths.java | 5 +- files/PathAnalysis.java | 8 +- files/PathInfo.java | 14 ++-- files/ReadLineStream.java | 2 +- files/TreeWatcher.java | 2 +- generics/DynamicProxyMixin.java | 2 +- generics/Mixins.java | 4 +- generics/PrimitiveGenericTest.java | 4 +- generics/TupleList.java | 4 +- generics/TupleTest.java | 6 +- generics/TupleTest2.java | 6 +- generics/WatercolorSets.java | 30 ++++---- housekeeping/NewVarArgs.java | 2 +- housekeeping/VarArgs.java | 2 +- innerclasses/GreenhouseController.java | 18 ++++- logging/ConfigureLogging.java | 63 ++++++++++------ logging/CustomHandler.java | 5 +- logging/InfoLogging.java | 3 +- logging/InfoLogging2.java | 3 +- logging/LogToFile.java | 3 +- logging/LogToFile2.java | 3 +- logging/LoggingLevelManipulation.java | 73 +++++++++--------- logging/LoggingLevels.java | 19 +++-- logging/MultipleHandlers.java | 5 +- logging/MultipleHandlers2.java | 3 +- logging/PrintableLogRecord.java | 2 +- logging/SimpleFilter.java | 9 +-- logging/SimpleFormatterExample.java | 1 - network/WhoAmI.java | 4 +- newio/BufferToText.java | 2 +- newio/LockingMappedFiles.java | 2 +- objects/HelloDate.java | 2 +- objects/ShowProperties.java | 10 +-- onjava/Hex.java | 12 +-- onjava/atunit/ClassNameFinder.java | 68 +++++++++++++++++ patterns/PaperScissorsRock.java | 30 ++++---- patterns/doubledispatch/DoubleDispatch.java | 40 +++++----- patterns/dynatrash/DynaTrash.java | 22 +++--- patterns/recyclea/RecycleA.java | 46 ++++++------ patterns/recycleb/RecycleB.java | 2 +- patterns/recyclec/RecycleC.java | 2 +- patterns/trashvisitor/TrashVisitor.java | 2 +- patterns/visitor/BeeAndFlowers.java | 28 +++---- phase1.py | 46 ++++++++++++ polymorphism/RTTI.java | 1 - preferences/PreferencesDemo.java | 8 +- references/Compete.java | 4 +- references/PassReferences.java | 4 +- serialization/AStoreCADState.java | 20 ++--- serialization/Logon.java | 6 +- serialization/MyWorld.java | 6 +- serialization/RecoverCADState.java | 20 ++--- serialization/Worm.java | 6 +- streams/ForEach.java | 2 +- strings/Conversion.java | 4 +- strings/JGrep.java | 18 +---- strings/TestRegularExpression.java | 2 - test_output.py | 31 ++++++++ threads/AtomicityTest.java | 2 +- threads/BankTellerSimulation.java | 21 +++--- threads/CachedThreadPool.java | 16 ++-- threads/CachedThreadPool2.java | 20 ++--- threads/CachedThreadPool3.java | 10 +-- threads/CaptureUncaughtException.java | 15 ++-- threads/CarBuilder.java | 48 +++++++----- threads/CountingStream.java | 16 ++-- threads/CriticalSection.java | 3 +- threads/DeadlockingDiningPhilosophers.java | 22 +++--- threads/DelayQueueDemo.java | 18 ++--- threads/EvenSupplier.java | 7 +- threads/ExplicitCriticalSection.java | 26 +++---- threads/FixedDiningPhilosophers.java | 26 +++---- threads/GreenhouseScheduler.java | 42 +++++------ threads/HorseRace.java | 55 +++++++------- threads/MoreTasksAfterShutdown.java | 10 +-- threads/ParallelStreamPuzzle2.java | 1 + threads/ParallelStreamPuzzle3.java | 16 ++-- threads/PriorityBlockingQueueDemo.java | 34 ++++----- threads/SerialNumberChecker.java | 3 +- threads/SettingDefaultHandler.java | 1 + threads/SingleThreadExecutor.java | 8 +- threads/Summing.java | 6 +- threads/Summing2.java | 6 +- threads/Summing3.java | 4 +- threads/Summing4.java | 2 +- threads/SyncObject.java | 10 +-- threads/ToastOMatic.java | 18 ++--- threads/WorkStealingPool.java | 14 ++-- threads/restaurant2/RestaurantWithQueues.java | 36 ++++----- typeinfo/PetCount3.java | 4 +- typeinfo/PetCount4.java | 4 +- update_extracted_example_output.py | 35 +++++++++ 157 files changed, 1163 insertions(+), 968 deletions(-) create mode 100644 phase1.py create mode 100644 test_output.py create mode 100644 update_extracted_example_output.py diff --git a/annotations/AtUnitComposition.java b/annotations/AtUnitComposition.java index f3ba4672..f2be0896 100644 --- a/annotations/AtUnitComposition.java +++ b/annotations/AtUnitComposition.java @@ -21,8 +21,8 @@ public class AtUnitComposition { } /* Output: annotations.AtUnitComposition - . _methodOne . _methodTwo This is methodTwo + . _methodOne OK (2 tests) */ diff --git a/annotations/AtUnitExample1.java b/annotations/AtUnitExample1.java index dd10076d..11bdc800 100644 --- a/annotations/AtUnitExample1.java +++ b/annotations/AtUnitExample1.java @@ -28,11 +28,11 @@ public class AtUnitExample1 { /* Output: annotations.AtUnitExample1 . anotherDisappointment (failed) - . methodOneTest - . failureTest (failed) - . m3 . m2 This is methodTwo + . m3 + . failureTest (failed) + . methodOneTest (5 tests) >>> 2 FAILURES <<< diff --git a/annotations/AtUnitExample4.java b/annotations/AtUnitExample4.java index 27af8faf..aa408915 100644 --- a/annotations/AtUnitExample4.java +++ b/annotations/AtUnitExample4.java @@ -57,15 +57,19 @@ public class AtUnitExample4 { } } /* Output: -starting annotations.AtUnitExample4 - . scramble1 'All' -lAl + . words 'All' +(failed) + . scramble1 'brontosauruses' +ntsaueorosurbs +(failed) + . scramble2 'are' +are +(failed) +(3 tests) - . scramble2 'brontosauruses' -tsaeborornussu - - . words 'are' - -OK (3 tests) +>>> 3 FAILURES <<< + annotations.AtUnitExample4: words + annotations.AtUnitExample4: scramble1 + annotations.AtUnitExample4: scramble2 */ diff --git a/annotations/AtUnitExternalTest.java b/annotations/AtUnitExternalTest.java index 9d9d90f1..eb78a551 100644 --- a/annotations/AtUnitExternalTest.java +++ b/annotations/AtUnitExternalTest.java @@ -17,8 +17,8 @@ public class AtUnitExternalTest extends AtUnitExample1 { } /* Output: annotations.AtUnitExternalTest + . _methodOne . _methodTwo This is methodTwo - . _methodOne OK (2 tests) */ diff --git a/annotations/HashSetTest.java b/annotations/HashSetTest.java index 2d3285e9..f2cfd7eb 100644 --- a/annotations/HashSetTest.java +++ b/annotations/HashSetTest.java @@ -26,8 +26,8 @@ public class HashSetTest { } /* Output: annotations.HashSetTest + . _remove . initialization . _contains - . _remove OK (3 tests) */ diff --git a/annotations/StackLStringTest.java b/annotations/StackLStringTest.java index 405aa457..d4a81b54 100644 --- a/annotations/StackLStringTest.java +++ b/annotations/StackLStringTest.java @@ -31,8 +31,8 @@ public class StackLStringTest extends StackL { } /* Output: annotations.StackLStringTest - . _top . _push + . _top . _pop OK (3 tests) */ diff --git a/annotations/database/TableCreator.java b/annotations/database/TableCreator.java index 96ac8caf..6001e07f 100644 --- a/annotations/database/TableCreator.java +++ b/annotations/database/TableCreator.java @@ -99,5 +99,5 @@ CREATE TABLE MEMBER( FIRSTNAME VARCHAR(30), LASTNAME VARCHAR(50), AGE INT, - HANDLE VARCHAR(30) PRIMARY KEY); + REFERENCE VARCHAR(30) PRIMARY KEY); */ diff --git a/arrays/AlphabeticSearch.java b/arrays/AlphabeticSearch.java index 01c768c5..6b5d87ee 100644 --- a/arrays/AlphabeticSearch.java +++ b/arrays/AlphabeticSearch.java @@ -19,10 +19,11 @@ public class AlphabeticSearch { } } /* Output: -[bkIna, cQrGs, cXZJo, dLsmw, eGZMm, EqUCB, gwsqP, hKcxr, -HLGEa, HqXum, HxxHv, JMRoE, JmzMs, Mesbt, MNvqe, nyGcF, -ogoYW, OneOE, OWZnT, RFJQA, rUkZP, sgqia, slJrL, suEcU, -uTpnX, vpfFv, WHkjU, xxEAJ, YNzbr, zDyCy] +[anmkkyh, bhmupju, btpenpc, cjwzmmr, cuxszgv, eloztdv, +ewcippc, ezdeklu, fcjpthl, fqmlgsh, gmeinne, hyoubzl, +jbvlgwc, jlxpqds, ljlbynx, mvducuj, qgekgly, skddcat, +taprwxz, uybypgp, vjsszkn, vniyapk, vqqakbm, vwodhcf, +ydpulcq, ygpoalk, yskvett, zehpfmm, zofmmvm, zrxmclh] Index: 10 -HxxHv +gmeinne */ diff --git a/arrays/ArrayCopying.java b/arrays/ArrayCopying.java index 52fa0ff4..459aaa17 100644 --- a/arrays/ArrayCopying.java +++ b/arrays/ArrayCopying.java @@ -69,12 +69,12 @@ public class ArrayCopying { } } /* Output: -a1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] -a1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] -a2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] -a2 = [0, 1, 2, 3, 4, 5, 6] -a2 = [0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0] -a4 = [4, 5, 6, 7, 8, 9, 10, 11] +a1: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] +a1: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] +a2: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] +a2: [0, 1, 2, 3, 4, 5, 6] +a2: [0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0] +a4: [4, 5, 6, 7, 8, 9, 10, 11] [Sub0, Sub1, Sub2, Sub3, Sub4, Sub5, Sub6] [Sub0, Sub1, Sub2, Sub3, Sub4, Sub5, Sub6] java.lang.ArrayStoreException diff --git a/arrays/ArraySearching.java b/arrays/ArraySearching.java index 2868744b..b76bade6 100644 --- a/arrays/ArraySearching.java +++ b/arrays/ArraySearching.java @@ -26,8 +26,8 @@ public class ArraySearching { } } /* Output: -Sorted array: [125, 267, 635, 650, 1131, 1506, 1634, -2400, 2766, 3063, 3768, 3941, 4720, 4762, 4948, 5070, -5682, 5807, 6177, 6193, 6656, 7021, 8479, 8737, 9954] +Sorted array: [125, 267, 635, 650, 1131, 1506, 1634, 2400, +2766, 3063, 3768, 3941, 4720, 4762, 4948, 5070, 5682, 5807, +6177, 6193, 6656, 7021, 8479, 8737, 9954] Location of 635 is 2, a[2] is 635 */ diff --git a/arrays/BadMicroBenchmark.java b/arrays/BadMicroBenchmark.java index 765df060..99dfb05b 100644 --- a/arrays/BadMicroBenchmark.java +++ b/arrays/BadMicroBenchmark.java @@ -16,6 +16,6 @@ public class BadMicroBenchmark { } } /* Output: -setAll: 27 -parallelSetAll: 53 +setAll: 62 +parallelSetAll: 75 */ diff --git a/arrays/BadMicroBenchmark2.java b/arrays/BadMicroBenchmark2.java index b4db0700..f3b20c35 100644 --- a/arrays/BadMicroBenchmark2.java +++ b/arrays/BadMicroBenchmark2.java @@ -17,6 +17,6 @@ public class BadMicroBenchmark2 { } } /* Output: -parallelSetAll: 38 -setAll: 63 +parallelSetAll: 83 +setAll: 159 */ diff --git a/arrays/BadMicroBenchmark3.java b/arrays/BadMicroBenchmark3.java index aea7532c..2160c766 100644 --- a/arrays/BadMicroBenchmark3.java +++ b/arrays/BadMicroBenchmark3.java @@ -27,8 +27,8 @@ public class BadMicroBenchmark3 { } } /* Output: -parallelSetAll: 5150 -setAll: 649 -parallelSetAll: 277 -setAll: 246 +parallelSetAll: 4948 +setAll: 1204 +parallelSetAll: 405 +setAll: 557 */ diff --git a/arrays/CompType.java b/arrays/CompType.java index 70a1587e..ae13e85e 100644 --- a/arrays/CompType.java +++ b/arrays/CompType.java @@ -41,16 +41,16 @@ public class CompType implements Comparable { } } /* Output: -before sorting: -[[i = 58, j = 55], [i = 93, j = 61], [i = 61, j = 29] -, [i = 68, j = 0], [i = 22, j = 7], [i = 88, j = 28] -, [i = 51, j = 89], [i = 9, j = 78], [i = 98, j = 61] -, [i = 20, j = 58], [i = 16, j = 40], [i = 11, j = 22] +Before sorting: [[i = 35, j = 37], [i = 41, j = 20], [i = +77, j = 79] +, [i = 56, j = 68], [i = 48, j = 93], [i = 70, j = 7] +, [i = 0, j = 25], [i = 62, j = 34], [i = 50, j = 82] +, [i = 31, j = 67], [i = 66, j = 54], [i = 21, j = 6] ] -after sorting: -[[i = 9, j = 78], [i = 11, j = 22], [i = 16, j = 40] -, [i = 20, j = 58], [i = 22, j = 7], [i = 51, j = 89] -, [i = 58, j = 55], [i = 61, j = 29], [i = 68, j = 0] -, [i = 88, j = 28], [i = 93, j = 61], [i = 98, j = 61] +After sorting: [[i = 0, j = 25], [i = 21, j = 6], [i = 31, +j = 67] +, [i = 35, j = 37], [i = 41, j = 20], [i = 48, j = 93] +, [i = 50, j = 82], [i = 56, j = 68], [i = 62, j = 34] +, [i = 66, j = 54], [i = 70, j = 7], [i = 77, j = 79] ] */ diff --git a/arrays/ComparatorTest.java b/arrays/ComparatorTest.java index 85abb45a..07cc0a92 100644 --- a/arrays/ComparatorTest.java +++ b/arrays/ComparatorTest.java @@ -23,16 +23,16 @@ public class ComparatorTest { } } /* Output: -before sorting: -[[i = 58, j = 55], [i = 93, j = 61], [i = 61, j = 29] -, [i = 68, j = 0], [i = 22, j = 7], [i = 88, j = 28] -, [i = 51, j = 89], [i = 9, j = 78], [i = 98, j = 61] -, [i = 20, j = 58], [i = 16, j = 40], [i = 11, j = 22] +Before sorting: [[i = 35, j = 37], [i = 41, j = 20], [i = +77, j = 79] +, [i = 56, j = 68], [i = 48, j = 93], [i = 70, j = 7] +, [i = 0, j = 25], [i = 62, j = 34], [i = 50, j = 82] +, [i = 31, j = 67], [i = 66, j = 54], [i = 21, j = 6] ] -after sorting: -[[i = 68, j = 0], [i = 22, j = 7], [i = 11, j = 22] -, [i = 88, j = 28], [i = 61, j = 29], [i = 16, j = 40] -, [i = 58, j = 55], [i = 20, j = 58], [i = 93, j = 61] -, [i = 98, j = 61], [i = 9, j = 78], [i = 51, j = 89] +After sorting: [[i = 21, j = 6], [i = 70, j = 7], [i = 41, +j = 20] +, [i = 0, j = 25], [i = 62, j = 34], [i = 35, j = 37] +, [i = 66, j = 54], [i = 31, j = 67], [i = 56, j = 68] +, [i = 77, j = 79], [i = 50, j = 82], [i = 48, j = 93] ] */ diff --git a/arrays/ComparingArrays.java b/arrays/ComparingArrays.java index bbdcdfe3..0a31fb9c 100644 --- a/arrays/ComparingArrays.java +++ b/arrays/ComparingArrays.java @@ -52,9 +52,11 @@ a1 == a2: true a1 == a2: false a1w == a2w: true a1w == a2w: false -[[], [YNzbrny], [YNzbrny, GcFOWZn], [YNzbrny, GcFOWZn, TcQrGse], [YNzbrny, GcFOWZn, TcQrGse, GZMmJMR]] +[[], [btpenpc], [btpenpc, cuxszgv], [btpenpc, cuxszgv, +gmeinne], [btpenpc, cuxszgv, gmeinne, eloztdv]] deepEquals(md1, md2): true md1 == md2: false -[[], [YNzbrny], [YNzbrny, GcFOWZn], [YNzbrny, GcFOWZn, TcQrGse], [YNzbrny, #$#$#$#, TcQrGse, GZMmJMR]] +[[], [btpenpc], [btpenpc, cuxszgv], [btpenpc, cuxszgv, +gmeinne], [btpenpc, #$#$#$#, gmeinne, eloztdv]] deepEquals(md1, md2): false */ diff --git a/arrays/CountUpward.java b/arrays/CountUpward.java index 49099583..79f7afa1 100644 --- a/arrays/CountUpward.java +++ b/arrays/CountUpward.java @@ -19,5 +19,6 @@ public class CountUpward { } } /* Output: -[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] +[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, +17, 18, 19] */ diff --git a/arrays/FillingArrays.java b/arrays/FillingArrays.java index 9c27d832..6a7a247c 100644 --- a/arrays/FillingArrays.java +++ b/arrays/FillingArrays.java @@ -42,14 +42,14 @@ public class FillingArrays { } } /* Output: -a1 = [true, true, true, true, true, true] -a2 = [11, 11, 11, 11, 11, 11] -a3 = [x, x, x, x, x, x] -a4 = [17, 17, 17, 17, 17, 17] -a5 = [19, 19, 19, 19, 19, 19] -a6 = [23, 23, 23, 23, 23, 23] -a7 = [29.0, 29.0, 29.0, 29.0, 29.0, 29.0] -a8 = [47.0, 47.0, 47.0, 47.0, 47.0, 47.0] -a9 = [Hello, Hello, Hello, Hello, Hello, Hello] -a9 = [Hello, Hello, Hello, World, World, Hello] +a1: [true, true, true, true, true, true] +a2: [11, 11, 11, 11, 11, 11] +a3: [x, x, x, x, x, x] +a4: [17, 17, 17, 17, 17, 17] +a5: [19, 19, 19, 19, 19, 19] +a6: [23, 23, 23, 23, 23, 23] +a7: [29.0, 29.0, 29.0, 29.0, 29.0, 29.0] +a8: [47.0, 47.0, 47.0, 47.0, 47.0, 47.0] +a9: [Hello, Hello, Hello, Hello, Hello, Hello] +a9: [Hello, Hello, Hello, World, World, Hello] */ diff --git a/arrays/IceCream.java b/arrays/IceCream.java index 7ee32d7b..3db2a2f4 100644 --- a/arrays/IceCream.java +++ b/arrays/IceCream.java @@ -35,11 +35,11 @@ public class IceCream { } } /* Output: -[Rum Raisin, Mint Chip, Mocha Almond Fudge] -[Chocolate, Strawberry, Mocha Almond Fudge] -[Strawberry, Mint Chip, Mocha Almond Fudge] -[Rum Raisin, Vanilla Fudge Swirl, Mud Pie] -[Vanilla Fudge Swirl, Chocolate, Mocha Almond Fudge] -[Praline Cream, Strawberry, Mocha Almond Fudge] -[Mocha Almond Fudge, Strawberry, Mint Chip] +[Praline Cream, Mint Chip, Vanilla Fudge Swirl] +[Strawberry, Vanilla Fudge Swirl, Mud Pie] +[Chocolate, Strawberry, Vanilla Fudge Swirl] +[Rum Raisin, Praline Cream, Chocolate] +[Mint Chip, Rum Raisin, Mocha Almond Fudge] +[Mocha Almond Fudge, Mud Pie, Vanilla Fudge Swirl] +[Mocha Almond Fudge, Mud Pie, Mint Chip] */ diff --git a/arrays/ModifyExisting.java b/arrays/ModifyExisting.java index 3db997b1..1199c705 100644 --- a/arrays/ModifyExisting.java +++ b/arrays/ModifyExisting.java @@ -16,6 +16,7 @@ public class ModifyExisting { } } /* Output: -[0.73, 0.53, 0.16, 0.19, 0.52, 0.27, 0.26] -[0.0073, 0.0053, 0.0016, 0.0019, 0.0052, 0.0027, 0.0026] +[4.83, 2.89, 2.9, 1.97, 3.01, 0.18, 0.99] +[0.0483, 0.028900000000000002, 0.028999999999999998, +0.0197, 0.0301, 0.0018, 0.009899999999999999] */ diff --git a/arrays/ParallelPrefix.java b/arrays/ParallelPrefix.java index 987b9c51..6c5a63cd 100644 --- a/arrays/ParallelPrefix.java +++ b/arrays/ParallelPrefix.java @@ -18,5 +18,5 @@ public class ParallelPrefix { /* Output: First 20: 190 First 200: 19900 -All: 199999990000000 +All: 49999995000000 */ diff --git a/arrays/ParallelSort.java b/arrays/ParallelSort.java index 4b724c80..009b56e0 100644 --- a/arrays/ParallelSort.java +++ b/arrays/ParallelSort.java @@ -20,7 +20,7 @@ public class ParallelSort { } } /* Output: -sort(): 484 -parallelSort(): 149 +sort(): 864 +parallelSort(): 274 3 */ diff --git a/arrays/RaggedArray.java b/arrays/RaggedArray.java index 78125295..b09d99b4 100644 --- a/arrays/RaggedArray.java +++ b/arrays/RaggedArray.java @@ -21,7 +21,6 @@ public class RaggedArray { } } /* Output: -[[], [[1], [2], [3, 4, 5, 6]], [[], [7, 8], [9, 10]], -[[11, 12, 13], [14], [15, 16, 17, 18]], [[19, 20, 21], -[22, 23, 24], [25], []], [[26], [], [27]]] +[[[1], []], [[2, 3, 4, 5], [6]], [[7, 8, 9], [10, 11, 12], +[]]] */ diff --git a/arrays/Reverse.java b/arrays/Reverse.java index 729cf395..1862dd52 100644 --- a/arrays/Reverse.java +++ b/arrays/Reverse.java @@ -17,16 +17,16 @@ public class Reverse { } } /* Output: -before sorting: -[[i = 58, j = 55], [i = 93, j = 61], [i = 61, j = 29] -, [i = 68, j = 0], [i = 22, j = 7], [i = 88, j = 28] -, [i = 51, j = 89], [i = 9, j = 78], [i = 98, j = 61] -, [i = 20, j = 58], [i = 16, j = 40], [i = 11, j = 22] +Before sorting: [[i = 35, j = 37], [i = 41, j = 20], [i = +77, j = 79] +, [i = 56, j = 68], [i = 48, j = 93], [i = 70, j = 7] +, [i = 0, j = 25], [i = 62, j = 34], [i = 50, j = 82] +, [i = 31, j = 67], [i = 66, j = 54], [i = 21, j = 6] ] -after sorting: -[[i = 98, j = 61], [i = 93, j = 61], [i = 88, j = 28] -, [i = 68, j = 0], [i = 61, j = 29], [i = 58, j = 55] -, [i = 51, j = 89], [i = 22, j = 7], [i = 20, j = 58] -, [i = 16, j = 40], [i = 11, j = 22], [i = 9, j = 78] +After sorting: [[i = 77, j = 79], [i = 70, j = 7], [i = 66, +j = 54] +, [i = 62, j = 34], [i = 56, j = 68], [i = 50, j = 82] +, [i = 48, j = 93], [i = 41, j = 20], [i = 35, j = 37] +, [i = 31, j = 67], [i = 21, j = 6], [i = 0, j = 25] ] */ diff --git a/arrays/StringSorting.java b/arrays/StringSorting.java index bbdac6df..c07325a4 100644 --- a/arrays/StringSorting.java +++ b/arrays/StringSorting.java @@ -20,16 +20,20 @@ public class StringSorting { } } /* Output: -Before sort: [YNzbr, nyGcF, OWZnT, cQrGs, eGZMm, JMRoE, -suEcU, OneOE, dLsmw, HLGEa, hKcxr, EqUCB, bkIna, Mesbt, -WHkjU, rUkZP, gwsqP, zDyCy, RFJQA, HxxHv] -After sort: [EqUCB, HLGEa, HxxHv, JMRoE, Mesbt, OWZnT, -OneOE, RFJQA, WHkjU, YNzbr, bkIna, cQrGs, dLsmw, eGZMm, -gwsqP, hKcxr, nyGcF, rUkZP, suEcU, zDyCy] -Reverse sort: [zDyCy, suEcU, rUkZP, nyGcF, hKcxr, gwsqP, -eGZMm, dLsmw, cQrGs, bkIna, YNzbr, WHkjU, RFJQA, OneOE, -OWZnT, Mesbt, JMRoE, HxxHv, HLGEa, EqUCB] -Case-insensitive sort: [bkIna, cQrGs, dLsmw, eGZMm, EqUCB, -gwsqP, hKcxr, HLGEa, HxxHv, JMRoE, Mesbt, nyGcF, OneOE, -OWZnT, RFJQA, rUkZP, suEcU, WHkjU, YNzbr, zDyCy] +Before sort: [btpenpc, cuxszgv, gmeinne, eloztdv, ewcippc, +ygpoalk, ljlbynx, taprwxz, bhmupju, cjwzmmr, anmkkyh, +fcjpthl, skddcat, jbvlgwc, mvducuj, ydpulcq, zehpfmm, +zrxmclh, qgekgly, hyoubzl] +After sort: [anmkkyh, bhmupju, btpenpc, cjwzmmr, cuxszgv, +eloztdv, ewcippc, fcjpthl, gmeinne, hyoubzl, jbvlgwc, +ljlbynx, mvducuj, qgekgly, skddcat, taprwxz, ydpulcq, +ygpoalk, zehpfmm, zrxmclh] +Reverse sort: [zrxmclh, zehpfmm, ygpoalk, ydpulcq, taprwxz, +skddcat, qgekgly, mvducuj, ljlbynx, jbvlgwc, hyoubzl, +gmeinne, fcjpthl, ewcippc, eloztdv, cuxszgv, cjwzmmr, +btpenpc, bhmupju, anmkkyh] +Case-insensitive sort: [anmkkyh, bhmupju, btpenpc, cjwzmmr, +cuxszgv, eloztdv, ewcippc, fcjpthl, gmeinne, hyoubzl, +jbvlgwc, ljlbynx, mvducuj, qgekgly, skddcat, taprwxz, +ydpulcq, ygpoalk, zehpfmm, zrxmclh] */ diff --git a/arrays/TestRand.java b/arrays/TestRand.java index 68eeefe4..43e1695b 100644 --- a/arrays/TestRand.java +++ b/arrays/TestRand.java @@ -177,13 +177,13 @@ Double [4.83, 2.89, 2.9, 1.97, 3.01] [4.83, 2.89, 2.9, 1.97, 3.01, 0.18] [4.83, 2.89, 2.9, 1.97, 3.01, 0.18, 0.99] -[4.83, 2.89, 2.9, 1.97, 3.01, 0.18, 0.99] +[4.83, 2.89, 2.9, 1.97, 3.01, 0.18] [4.83, 2.89, 2.9, 1.97, 3.01, 0.18, 0.99, 8.28] String [btpenpc, cuxszgv, gmeinne, eloztdv] [btpenpc, cuxszgv, gmeinne, eloztdv, ewcippc] [btpenpc, cuxszgv, gmeinne, eloztdv, ewcippc, ygpoalk] -[btpe, npcc, uxsz, gvgm] +[btpe, npcc, uxsz, gvgm, einn, eelo] [btpe, npcc, uxsz, gvgm, einn] [btpe, npcc, uxsz, gvgm, einn, eelo] */ diff --git a/assertions/Assert1.java b/assertions/Assert1.java index 894bb19b..1822490a 100644 --- a/assertions/Assert1.java +++ b/assertions/Assert1.java @@ -15,6 +15,5 @@ public class Assert1 { /* Output: ___[ Error Output ]___ Exception in thread "main" java.lang.AssertionError - at Assert1.main(Assert1.java:8) -___[ Exception is Expected ]___ + at Assert1.main(Assert1.java:9) */ diff --git a/assertions/Assert2.java b/assertions/Assert2.java index 0549ede0..bccefc77 100644 --- a/assertions/Assert2.java +++ b/assertions/Assert2.java @@ -16,5 +16,4 @@ ___[ Error Output ]___ Exception in thread "main" java.lang.AssertionError: Here's a message saying what happened at Assert2.main(Assert2.java:8) -___[ Exception is Expected ]___ */ diff --git a/assertions/LoaderAssertions.java b/assertions/LoaderAssertions.java index 27914ed7..28b640ff 100644 --- a/assertions/LoaderAssertions.java +++ b/assertions/LoaderAssertions.java @@ -24,5 +24,4 @@ Exception in thread "main" java.lang.AssertionError: Loaded.go() at Loaded.go(LoaderAssertions.java:15) at LoaderAssertions.main(LoaderAssertions.java:9) -___[ Exception is Expected ]___ */ diff --git a/collections/ApplesAndOrangesWithoutGenerics.java b/collections/ApplesAndOrangesWithoutGenerics.java index 649dfbc4..2b16df21 100644 --- a/collections/ApplesAndOrangesWithoutGenerics.java +++ b/collections/ApplesAndOrangesWithoutGenerics.java @@ -32,7 +32,6 @@ public class ApplesAndOrangesWithoutGenerics { ___[ Error Output ]___ Exception in thread "main" java.lang.ClassCastException: Orange cannot be cast to Apple - at ApplesAndOrangesWithoutGenerics.main(Unknown -Source) -___[ Exception is Expected ]___ + at ApplesAndOrangesWithoutGenerics.main(ApplesAndOr +angesWithoutGenerics.java:23) */ diff --git a/collections/GenericsAndUpcasting.java b/collections/GenericsAndUpcasting.java index 37853d37..df42b729 100644 --- a/collections/GenericsAndUpcasting.java +++ b/collections/GenericsAndUpcasting.java @@ -21,8 +21,8 @@ public class GenericsAndUpcasting { } } /* Output: -GrannySmith@19e0bfd -Gala@139a55 -Fuji@1db9742 -Braeburn@106d69c +GrannySmith@1db9742 +Gala@106d69c +Fuji@52e922 +Braeburn@25154f */ diff --git a/collectionsindepth/Bits.java b/collectionsindepth/Bits.java index e51b836b..6e85e60e 100644 --- a/collectionsindepth/Bits.java +++ b/collectionsindepth/Bits.java @@ -60,18 +60,18 @@ public class Bits { } } /* Output: -byte value: -107 -bits: {0, 2, 4, 7} -bit pattern: 1010100100000000000000000000000000000000000000 +byte value: 118 +bits: {1, 2, 4, 5, 6} +bit pattern: 0110111000000000000000000000000000000000000000 000000000000000000 -short value: 1302 -bits: {1, 2, 4, 8, 10} -bit pattern: 0110100010100000000000000000000000000000000000 +short value: 9795 +bits: {0, 1, 6, 9, 10, 13} +bit pattern: 1100001001100100000000000000000000000000000000 000000000000000000 -int value: -2014573909 -bits: {0, 1, 3, 5, 7, 9, 11, 18, 19, 21, 22, 23, 24, 25, -26, 31} -bit pattern: 1101010101010000001101111110000100000000000000 +int value: -645079414 +bits: {1, 3, 7, 9, 10, 11, 12, 14, 15, 18, 19, 23, 24, 27, +28, 30, 31} +bit pattern: 0101000101111011001100011001101100000000000000 000000000000000000 set bit 127: {127} set bit 255: {255} diff --git a/collectionsindepth/FillingLists.java b/collectionsindepth/FillingLists.java index 37f7b1bd..b4c4640b 100644 --- a/collectionsindepth/FillingLists.java +++ b/collectionsindepth/FillingLists.java @@ -24,8 +24,9 @@ public class FillingLists { } } /* Output: -[StringAddress@19e0bfd Hello, StringAddress@19e0bfd Hello, -StringAddress@19e0bfd Hello, StringAddress@19e0bfd Hello] -[StringAddress@139a55 World!, StringAddress@139a55 World!, -StringAddress@139a55 World!, StringAddress@139a55 World!] +[StringAddress@1db9742 Hello, StringAddress@1db9742 Hello, +StringAddress@1db9742 Hello, StringAddress@1db9742 Hello] +[StringAddress@106d69c World!, StringAddress@106d69c +World!, StringAddress@106d69c World!, StringAddress@106d69c +World!] */ diff --git a/collectionsindepth/ListPerformance.java b/collectionsindepth/ListPerformance.java index 1b26773b..083352d5 100644 --- a/collectionsindepth/ListPerformance.java +++ b/collectionsindepth/ListPerformance.java @@ -195,17 +195,17 @@ public class ListPerformance { /* Output: --- Array as List --- size get set - 100 19 20 + 100 44 44 --------------------- ArrayList --------------------- size add get set iteradd insert remove - 100 31 19 21 33 158 114 + 100 80 44 48 106 0 640 --------------------- LinkedList --------------------- size add get set iteradd insert remove - 100 30 44 45 77 143 56 + 100 80 106 94 177 0 120 ----------------------- Vector ----------------------- size add get set iteradd insert remove - 100 26 32 33 64 147 67 + 100 40 62 58 114 0 120 -------------------- Queue tests -------------------- size addFirst addLast rmFirst rmLast - 100 33 71 102 135 + 100 60 120 120 100 */ diff --git a/collectionsindepth/Lists.java b/collectionsindepth/Lists.java index 6280de57..ecd55649 100644 --- a/collectionsindepth/Lists.java +++ b/collectionsindepth/Lists.java @@ -136,7 +136,7 @@ BURUNDI, CAMEROON, CAPE VERDE, CENTRAL AFRICAN REPUBLIC, CHAD, COMOROS, CONGO, DJIBOUTI, EGYPT, EQUATORIAL GUINEA, ERITREA, ETHIOPIA, GABON, THE GAMBIA, GHANA, GUINEA, BISSAU, COTE D'IVOIR (IVORY COAST), KENYA, LESOTHO] -________...________...________...________...________ +...________...________...________...________... LESOTHO [ALGERIA, ANGOLA, BENIN, BOTSWANA, BURKINA FASO, BURUNDI, CAMEROON, CAPE VERDE, CENTRAL AFRICAN REPUBLIC, CHAD, diff --git a/collectionsindepth/MapPerformance.java b/collectionsindepth/MapPerformance.java index 1e26a728..01672591 100644 --- a/collectionsindepth/MapPerformance.java +++ b/collectionsindepth/MapPerformance.java @@ -63,20 +63,20 @@ public class MapPerformance { /* Output: ---------- TreeMap ---------- size put get iterate - 100 86 47 9 + 100 228 128 25 ---------- HashMap ---------- size put get iterate - 100 25 10 12 + 100 68 26 35 ------- LinkedHashMap ------- size put get iterate - 100 27 8 6 + 100 70 35 18 ------ IdentityHashMap ------ size put get iterate - 100 51 47 13 + 100 128 126 38 -------- WeakHashMap -------- size put get iterate - 100 28 11 12 + 100 62 31 25 --------- Hashtable --------- size put get iterate - 100 31 21 13 + 100 56 30 20 */ diff --git a/collectionsindepth/References.java b/collectionsindepth/References.java index b1858d5e..37610b04 100644 --- a/collectionsindepth/References.java +++ b/collectionsindepth/References.java @@ -64,8 +64,6 @@ public class References { } } /* Output: (First and Last 10 Lines) -Just created: java.lang.ref.SoftReference@19e0bfd -Just created: java.lang.ref.SoftReference@139a55 Just created: java.lang.ref.SoftReference@1db9742 Just created: java.lang.ref.SoftReference@106d69c Just created: java.lang.ref.SoftReference@52e922 @@ -74,15 +72,17 @@ Just created: java.lang.ref.SoftReference@10dea4e Just created: java.lang.ref.SoftReference@647e05 Just created: java.lang.ref.SoftReference@1909752 Just created: java.lang.ref.SoftReference@1f96302 -________...________...________...________...________ -Just created: java.lang.ref.PhantomReference@16f6e28 -In queue: null -Just created: java.lang.ref.PhantomReference@15fbaa4 -In queue: null +Just created: java.lang.ref.SoftReference@14eac69 +Just created: java.lang.ref.SoftReference@a57993 +...________...________...________...________... Just created: java.lang.ref.PhantomReference@1ee12a7 In queue: null Just created: java.lang.ref.PhantomReference@10bedb4 In queue: null Just created: java.lang.ref.PhantomReference@103dbd3 In queue: null +Just created: java.lang.ref.PhantomReference@167cf4d +In queue: null +Just created: java.lang.ref.PhantomReference@a987ac +In queue: null */ diff --git a/collectionsindepth/SetPerformance.java b/collectionsindepth/SetPerformance.java index 20bc0e77..ab052062 100644 --- a/collectionsindepth/SetPerformance.java +++ b/collectionsindepth/SetPerformance.java @@ -60,11 +60,11 @@ public class SetPerformance { /* Output: ------------- TreeSet ------------- size add contains iterate - 100 85 51 9 + 100 200 132 24 ------------- HashSet ------------- size add contains iterate - 100 27 12 12 + 100 76 32 34 ---------- LinkedHashSet ---------- size add contains iterate - 100 28 10 7 + 100 70 25 19 */ diff --git a/collectionsindepth/SpringDetector.java b/collectionsindepth/SpringDetector.java index 7a9e259c..7a4aaa8b 100644 --- a/collectionsindepth/SpringDetector.java +++ b/collectionsindepth/SpringDetector.java @@ -28,12 +28,12 @@ public class SpringDetector { } } /* Output: -map = {Groundhog #2=Early Spring!, Groundhog #3=Early -Spring!, Groundhog #1=Six more weeks of Winter!, Groundhog -#8=Six more weeks of Winter!, Groundhog #9=Six more weeks -of Winter!, Groundhog #6=Early Spring!, Groundhog #5=Early -Spring!, Groundhog #0=Six more weeks of Winter!, Groundhog -#7=Early Spring!, Groundhog #4=Six more weeks of Winter!} +map = {Groundhog #2=Early Spring!, Groundhog #5=Early +Spring!, Groundhog #6=Early Spring!, Groundhog #4=Early +Spring!, Groundhog #9=Six more weeks of Winter!, Groundhog +#8=Six more weeks of Winter!, Groundhog #0=Early Spring!, +Groundhog #1=Early Spring!, Groundhog #3=Early Spring!, +Groundhog #7=Six more weeks of Winter!} Looking up prediction for Groundhog #3 Key not found: Groundhog #3 */ diff --git a/collectionsindepth/SpringDetector2.java b/collectionsindepth/SpringDetector2.java index 4a2081cb..830159bf 100644 --- a/collectionsindepth/SpringDetector2.java +++ b/collectionsindepth/SpringDetector2.java @@ -11,12 +11,12 @@ public class SpringDetector2 { } } /* Output: -map = {Groundhog #0=Six more weeks of Winter!, Groundhog -#1=Six more weeks of Winter!, Groundhog #2=Early Spring!, -Groundhog #3=Early Spring!, Groundhog #4=Six more weeks of -Winter!, Groundhog #5=Early Spring!, Groundhog #6=Early -Spring!, Groundhog #7=Early Spring!, Groundhog #8=Six more -weeks of Winter!, Groundhog #9=Six more weeks of Winter!} +map = {Groundhog #0=Early Spring!, Groundhog #1=Early +Spring!, Groundhog #2=Early Spring!, Groundhog #3=Early +Spring!, Groundhog #4=Early Spring!, Groundhog #5=Early +Spring!, Groundhog #6=Early Spring!, Groundhog #7=Six more +weeks of Winter!, Groundhog #8=Six more weeks of Winter!, +Groundhog #9=Six more weeks of Winter!} Looking up prediction for Groundhog #3 Early Spring! */ diff --git a/collectionsindepth/SuppliersCollectionTest.java b/collectionsindepth/SuppliersCollectionTest.java index f11c71a3..4c4d447a 100644 --- a/collectionsindepth/SuppliersCollectionTest.java +++ b/collectionsindepth/SuppliersCollectionTest.java @@ -51,8 +51,8 @@ is, no, basis, for, a, system, of, government] is, no, basis, for, a, system, of, government] [strange, women, lying, in, ponds, distributing, swords, is, no, basis, for, a, system, of, government] -[ponds, no, a, in, swords, for, is, basis, strange, -system, government, distributing, of, women, lying] +[ponds, no, a, in, swords, for, is, basis, strange, system, +government, distributing, of, women, lying] [strange, women, lying, in, ponds, distributing, swords, is, no, basis, for, a, system, of, government] [strange, women, lying, in, ponds, distributing, swords, diff --git a/collectionsindepth/TypesForSets.java b/collectionsindepth/TypesForSets.java index 99961c65..7fe2ea17 100644 --- a/collectionsindepth/TypesForSets.java +++ b/collectionsindepth/TypesForSets.java @@ -71,10 +71,10 @@ public class TypesForSets { [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] -[6, 9, 2, 0, 8, 5, 4, 8, 0, 2, 7, 8, 9, 1, 4, 5, 0, 4, 3, -1, 6, 3, 2, 7, 7, 6, 5, 3, 9, 1] -[7, 2, 8, 9, 1, 7, 4, 1, 2, 3, 0, 9, 1, 8, 3, 0, 8, 5, 6, -6, 3, 0, 2, 7, 5, 4, 6, 4, 5, 9] +[8, 6, 3, 5, 4, 2, 2, 1, 0, 3, 6, 7, 9, 1, 3, 1, 5, 0, 9, +8, 0, 9, 8, 7, 4, 6, 2, 4, 7, 5] +[2, 2, 1, 4, 6, 6, 8, 4, 9, 3, 0, 4, 8, 5, 8, 1, 7, 5, 5, +3, 1, 9, 6, 0, 7, 0, 9, 7, 2, 3] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, diff --git a/control/WhileTest.java b/control/WhileTest.java index 0ab19914..a85418d7 100644 --- a/control/WhileTest.java +++ b/control/WhileTest.java @@ -7,7 +7,7 @@ public class WhileTest { static boolean condition() { boolean result = Math.random() < 0.99; - System.out.println(result + ", "); + System.out.print(result + ", "); return result; } public static void main(String[] args) { @@ -22,7 +22,7 @@ true, Inside 'while' true, Inside 'while' true, Inside 'while' true, Inside 'while' -________...________...________...________...________ +...________...________...________...________... true, Inside 'while' true, Inside 'while' true, Inside 'while' diff --git a/debugging/SimpleDebugging.java b/debugging/SimpleDebugging.java index 74846b8d..4a78dc95 100644 --- a/debugging/SimpleDebugging.java +++ b/debugging/SimpleDebugging.java @@ -33,5 +33,4 @@ by zero at SimpleDebugging.foo2(SimpleDebugging.java:10) at SimpleDebugging.foo1(SimpleDebugging.java:6) at SimpleDebugging.main(SimpleDebugging.java:19) -___[ Exception is Expected ]___ */ diff --git a/enums/ConstantSpecificMethod.java b/enums/ConstantSpecificMethod.java index 974acf7c..c4be5a7b 100644 --- a/enums/ConstantSpecificMethod.java +++ b/enums/ConstantSpecificMethod.java @@ -32,14 +32,8 @@ public enum ConstantSpecificMethod { } } /* Output: -Dec 13, 2015 -.;..;C:\Program Files (x86)\Java\xom-1.2.10.jar;C:\Program -Files (x86)\Java\jdk1.8.0_45\lib\tools.jar;C:\Program Files -(x86)\Java\jre1.8.0_45\lib\javaws.jar;C:\Program Files -(x86)\Java\swt-4.4.2-win32-win32-x86\swt.jar;C:\Program -Files (x86)\Java\javassist.jar;C:\Users\Bruce\Documents\Git -Hub\OnJava\ExtractedExamples;C:\Program Files -(x86)\Java\junit-4.12.jar;C:\Program Files -(x86)\Java\hamcrest-core-1.3.jar; -1.8.0_66 +Jul 22, 2016 +C:\Users\Bruce\Documents\GitHub\on- +java\ExtractedExamples\\gradle\wrapper\gradle-wrapper.jar +1.8.0_77 */ diff --git a/enums/PostOffice.java b/enums/PostOffice.java index 7b1837e4..b975b904 100644 --- a/enums/PostOffice.java +++ b/enums/PostOffice.java @@ -137,54 +137,54 @@ public class PostOffice { } } /* Output: -Mail 0, General Delivery: NO2, Address Scanability: -UNSCANNABLE, Address Readability: YES3, Address Address: -OK1, Return address: OK1 -Delivering Mail 0 normally +Mail 0, General Delivery: NO3, Address Scanability: YES2, +Address Readability: YES1, Address Address: OK4, Return +address: OK5 +Delivering Mail 0 automatically ***** -Mail 1, General Delivery: NO5, Address Scanability: YES3, -Address Readability: ILLEGIBLE, Address Address: OK5, -Return address: OK1 +Mail 1, General Delivery: NO1, Address Scanability: YES1, +Address Readability: YES3, Address Address: OK6, Return +address: OK1 Delivering Mail 1 automatically ***** -Mail 2, General Delivery: YES, Address Scanability: YES3, -Address Readability: YES1, Address Address: OK1, Return +Mail 2, General Delivery: NO4, Address Scanability: YES2, +Address Readability: ILLEGIBLE, Address Address: OK5, +Return address: MISSING +Delivering Mail 2 automatically +***** +Mail 3, General Delivery: YES, Address Scanability: +UNSCANNABLE, Address Readability: YES2, Address Address: +OK6, Return address: OK1 +Using general delivery for Mail 3 +***** +Mail 4, General Delivery: YES, Address Scanability: YES4, +Address Readability: YES1, Address Address: OK6, Return address: OK5 -Using general delivery for Mail 2 +Using general delivery for Mail 4 ***** -Mail 3, General Delivery: NO4, Address Scanability: YES3, -Address Readability: YES1, Address Address: INCORRECT, -Return address: OK4 -Returning Mail 3 to sender -***** -Mail 4, General Delivery: NO4, Address Scanability: -UNSCANNABLE, Address Readability: YES1, Address Address: -INCORRECT, Return address: OK2 -Returning Mail 4 to sender -***** -Mail 5, General Delivery: NO3, Address Scanability: YES1, -Address Readability: ILLEGIBLE, Address Address: OK4, -Return address: OK2 +Mail 5, General Delivery: NO5, Address Scanability: YES3, +Address Readability: YES3, Address Address: OK1, Return +address: OK4 Delivering Mail 5 automatically ***** -Mail 6, General Delivery: YES, Address Scanability: YES4, -Address Readability: ILLEGIBLE, Address Address: OK4, -Return address: OK4 +Mail 6, General Delivery: YES, Address Scanability: +UNSCANNABLE, Address Readability: YES1, Address Address: +OK3, Return address: MISSING Using general delivery for Mail 6 ***** -Mail 7, General Delivery: YES, Address Scanability: YES3, -Address Readability: YES4, Address Address: OK2, Return +Mail 7, General Delivery: NO4, Address Scanability: YES1, +Address Readability: YES2, Address Address: OK2, Return address: MISSING -Using general delivery for Mail 7 +Delivering Mail 7 automatically ***** -Mail 8, General Delivery: NO3, Address Scanability: YES1, -Address Readability: YES3, Address Address: INCORRECT, -Return address: MISSING -Mail 8 is a dead letter +Mail 8, General Delivery: NO1, Address Scanability: YES2, +Address Readability: YES3, Address Address: OK3, Return +address: OK3 +Delivering Mail 8 automatically ***** -Mail 9, General Delivery: NO1, Address Scanability: -UNSCANNABLE, Address Readability: YES2, Address Address: -OK1, Return address: OK4 -Delivering Mail 9 normally +Mail 9, General Delivery: NO5, Address Scanability: YES1, +Address Readability: YES3, Address Address: OK2, Return +address: OK3 +Delivering Mail 9 automatically ***** */ diff --git a/enums/RandomTest.java b/enums/RandomTest.java index 70dbc443..aae5caba 100644 --- a/enums/RandomTest.java +++ b/enums/RandomTest.java @@ -15,7 +15,7 @@ public class RandomTest { } } /* Output: -STANDING FLYING RUNNING STANDING RUNNING STANDING LYING -DODGING SITTING RUNNING HOPPING HOPPING HOPPING RUNNING -STANDING LYING FALLING RUNNING FLYING LYING +JUMPING DODGING SITTING RUNNING FLYING RUNNING DODGING +STANDING DODGING FALLING FALLING SITTING DODGING LYING +JUMPING JUMPING HOPPING DODGING SITTING FALLING */ diff --git a/enums/RoShamBo1.java b/enums/RoShamBo1.java index 62899404..a4f3c435 100644 --- a/enums/RoShamBo1.java +++ b/enums/RoShamBo1.java @@ -81,24 +81,24 @@ public class RoShamBo1 { } } /* Output: +Scissors vs. Rock: LOSE +Scissors vs. Paper: WIN +Rock vs. Paper: LOSE Rock vs. Rock: DRAW -Paper vs. Rock: WIN -Paper vs. Rock: WIN -Paper vs. Rock: WIN -Scissors vs. Paper: WIN +Rock vs. Paper: LOSE +Paper vs. Scissors: LOSE +Rock vs. Paper: LOSE Scissors vs. Scissors: DRAW +Scissors vs. Rock: LOSE Scissors vs. Paper: WIN -Rock vs. Paper: LOSE +Scissors vs. Rock: LOSE +Paper vs. Scissors: LOSE +Rock vs. Rock: DRAW +Scissors vs. Scissors: DRAW Paper vs. Paper: DRAW -Rock vs. Paper: LOSE -Paper vs. Scissors: LOSE -Paper vs. Scissors: LOSE -Rock vs. Scissors: WIN -Rock vs. Paper: LOSE -Paper vs. Rock: WIN Scissors vs. Paper: WIN -Paper vs. Scissors: LOSE -Paper vs. Scissors: LOSE -Paper vs. Scissors: LOSE -Paper vs. Scissors: LOSE +Scissors vs. Rock: LOSE +Scissors vs. Paper: WIN +Rock vs. Paper: LOSE +Rock vs. Scissors: WIN */ diff --git a/enums/RoShamBo2.java b/enums/RoShamBo2.java index b5dfd9a9..7538c879 100644 --- a/enums/RoShamBo2.java +++ b/enums/RoShamBo2.java @@ -31,24 +31,24 @@ public enum RoShamBo2 implements Competitor { } } /* Output: +PAPER vs. ROCK: WIN +PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN ROCK vs. ROCK: DRAW -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN +SCISSORS vs. PAPER: WIN +ROCK vs. SCISSORS: WIN PAPER vs. PAPER: DRAW +PAPER vs. ROCK: WIN PAPER vs. SCISSORS: LOSE -ROCK vs. SCISSORS: WIN +PAPER vs. ROCK: WIN +SCISSORS vs. PAPER: WIN +ROCK vs. ROCK: DRAW +PAPER vs. PAPER: DRAW SCISSORS vs. SCISSORS: DRAW -ROCK vs. SCISSORS: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -ROCK vs. PAPER: LOSE -ROCK vs. SCISSORS: WIN -SCISSORS vs. ROCK: LOSE PAPER vs. SCISSORS: LOSE -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN +PAPER vs. ROCK: WIN +PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN +ROCK vs. PAPER: LOSE */ diff --git a/enums/RoShamBo3.java b/enums/RoShamBo3.java index 72782bea..90df039b 100644 --- a/enums/RoShamBo3.java +++ b/enums/RoShamBo3.java @@ -48,24 +48,24 @@ public enum RoShamBo3 implements Competitor { } } /* Output: +PAPER vs. ROCK: WIN +PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN ROCK vs. ROCK: DRAW -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN +SCISSORS vs. PAPER: WIN +ROCK vs. SCISSORS: WIN PAPER vs. PAPER: DRAW +PAPER vs. ROCK: WIN PAPER vs. SCISSORS: LOSE -ROCK vs. SCISSORS: WIN +PAPER vs. ROCK: WIN +SCISSORS vs. PAPER: WIN +ROCK vs. ROCK: DRAW +PAPER vs. PAPER: DRAW SCISSORS vs. SCISSORS: DRAW -ROCK vs. SCISSORS: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -ROCK vs. PAPER: LOSE -ROCK vs. SCISSORS: WIN -SCISSORS vs. ROCK: LOSE PAPER vs. SCISSORS: LOSE -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN +PAPER vs. ROCK: WIN +PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN +ROCK vs. PAPER: LOSE */ diff --git a/enums/RoShamBo4.java b/enums/RoShamBo4.java index 473ea8e9..b80a55e9 100644 --- a/enums/RoShamBo4.java +++ b/enums/RoShamBo4.java @@ -34,24 +34,24 @@ public enum RoShamBo4 implements Competitor { } } /* Output: +ROCK vs. PAPER: LOSE +ROCK vs. SCISSORS: WIN +PAPER vs. SCISSORS: LOSE PAPER vs. PAPER: DRAW -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -ROCK vs. SCISSORS: WIN +PAPER vs. SCISSORS: LOSE +SCISSORS vs. ROCK: LOSE +PAPER vs. SCISSORS: LOSE ROCK vs. ROCK: DRAW +ROCK vs. PAPER: LOSE ROCK vs. SCISSORS: WIN -PAPER vs. SCISSORS: LOSE +ROCK vs. PAPER: LOSE +SCISSORS vs. ROCK: LOSE +PAPER vs. PAPER: DRAW +ROCK vs. ROCK: DRAW SCISSORS vs. SCISSORS: DRAW -PAPER vs. SCISSORS: LOSE -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -PAPER vs. ROCK: WIN -PAPER vs. SCISSORS: LOSE -SCISSORS vs. PAPER: WIN ROCK vs. SCISSORS: WIN -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE +ROCK vs. PAPER: LOSE +ROCK vs. SCISSORS: WIN +PAPER vs. SCISSORS: LOSE +PAPER vs. ROCK: WIN */ diff --git a/enums/RoShamBo5.java b/enums/RoShamBo5.java index 4d6e7b53..78f80507 100644 --- a/enums/RoShamBo5.java +++ b/enums/RoShamBo5.java @@ -36,24 +36,24 @@ enum RoShamBo5 implements Competitor { } } /* Output: +PAPER vs. ROCK: WIN +PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN ROCK vs. ROCK: DRAW -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN +SCISSORS vs. PAPER: WIN +ROCK vs. SCISSORS: WIN PAPER vs. PAPER: DRAW +PAPER vs. ROCK: WIN PAPER vs. SCISSORS: LOSE -ROCK vs. SCISSORS: WIN +PAPER vs. ROCK: WIN +SCISSORS vs. PAPER: WIN +ROCK vs. ROCK: DRAW +PAPER vs. PAPER: DRAW SCISSORS vs. SCISSORS: DRAW -ROCK vs. SCISSORS: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -ROCK vs. PAPER: LOSE -ROCK vs. SCISSORS: WIN -SCISSORS vs. ROCK: LOSE PAPER vs. SCISSORS: LOSE -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN +PAPER vs. ROCK: WIN +PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN +ROCK vs. PAPER: LOSE */ diff --git a/enums/RoShamBo6.java b/enums/RoShamBo6.java index 90fba9e1..b59a05eb 100644 --- a/enums/RoShamBo6.java +++ b/enums/RoShamBo6.java @@ -23,24 +23,24 @@ enum RoShamBo6 implements Competitor { } } /* Output: +PAPER vs. ROCK: WIN +PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN ROCK vs. ROCK: DRAW -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -SCISSORS vs. ROCK: LOSE -PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN +SCISSORS vs. PAPER: WIN +ROCK vs. SCISSORS: WIN PAPER vs. PAPER: DRAW +PAPER vs. ROCK: WIN PAPER vs. SCISSORS: LOSE -ROCK vs. SCISSORS: WIN +PAPER vs. ROCK: WIN +SCISSORS vs. PAPER: WIN +ROCK vs. ROCK: DRAW +PAPER vs. PAPER: DRAW SCISSORS vs. SCISSORS: DRAW -ROCK vs. SCISSORS: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -ROCK vs. PAPER: LOSE -ROCK vs. SCISSORS: WIN -SCISSORS vs. ROCK: LOSE PAPER vs. SCISSORS: LOSE -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN -SCISSORS vs. PAPER: WIN +PAPER vs. ROCK: WIN +PAPER vs. SCISSORS: LOSE +ROCK vs. SCISSORS: WIN +ROCK vs. PAPER: LOSE */ diff --git a/enums/SecurityCategory.java b/enums/SecurityCategory.java index 357980d6..469af033 100644 --- a/enums/SecurityCategory.java +++ b/enums/SecurityCategory.java @@ -28,14 +28,14 @@ enum SecurityCategory { } } /* Output: +STOCK: MARGIN +STOCK: LONG +STOCK: LONG +STOCK: MARGIN BOND: MUNICIPAL BOND: MUNICIPAL -STOCK: MARGIN -STOCK: MARGIN +STOCK: LONG BOND: JUNK -STOCK: SHORT -STOCK: LONG -STOCK: LONG -BOND: MUNICIPAL +STOCK: MARGIN BOND: JUNK */ diff --git a/enums/cartoons/EnumImplementation.java b/enums/cartoons/EnumImplementation.java index 71e1bbba..5164b0d0 100644 --- a/enums/cartoons/EnumImplementation.java +++ b/enums/cartoons/EnumImplementation.java @@ -30,6 +30,6 @@ public class EnumImplementation { } } /* Output: -BOB, PUNCHY, BOB, SPANKY, NUTTY, PUNCHY, SLAPPY, NUTTY, -NUTTY, SLAPPY, +SILLY, SPANKY, PUNCHY, BOUNCY, BOB, SLAPPY, SLAPPY, BOB, +BOB, SLAPPY, */ diff --git a/enums/menu/Meal.java b/enums/menu/Meal.java index a7d6334c..7d6cb8d3 100644 --- a/enums/menu/Meal.java +++ b/enums/menu/Meal.java @@ -17,29 +17,29 @@ public class Meal { } } /* Output: +SALAD +VINDALOO +GELATO +CAPPUCCINO +--- SPRING_ROLLS -VINDALOO -FRUIT -DECAF_COFFEE ---- -SOUP -VINDALOO -FRUIT -TEA ---- -SALAD BURRITO -FRUIT -TEA +GELATO +HERB_TEA --- -SALAD -BURRITO -CREME_CARAMEL -LATTE ---- -SOUP +SPRING_ROLLS BURRITO TIRAMISU -ESPRESSO +CAPPUCCINO +--- +SPRING_ROLLS +BURRITO +BLACK_FOREST_CAKE +LATTE +--- +SALAD +PAD_THAI +GELATO +TEA --- */ diff --git a/enums/menu/Meal2.java b/enums/menu/Meal2.java index b0a7dc40..a0aaf84f 100644 --- a/enums/menu/Meal2.java +++ b/enums/menu/Meal2.java @@ -46,29 +46,29 @@ public enum Meal2 { } } /* Output: +SALAD +VINDALOO +GELATO +CAPPUCCINO +--- SPRING_ROLLS -VINDALOO -FRUIT -DECAF_COFFEE ---- -SOUP -VINDALOO -FRUIT -TEA ---- -SALAD BURRITO -FRUIT -TEA +GELATO +HERB_TEA --- -SALAD -BURRITO -CREME_CARAMEL -LATTE ---- -SOUP +SPRING_ROLLS BURRITO TIRAMISU -ESPRESSO +CAPPUCCINO +--- +SPRING_ROLLS +BURRITO +BLACK_FOREST_CAKE +LATTE +--- +SALAD +PAD_THAI +GELATO +TEA --- */ diff --git a/exceptions/ExtraFeatures.java b/exceptions/ExtraFeatures.java index 57200ce9..1dc318f0 100644 --- a/exceptions/ExtraFeatures.java +++ b/exceptions/ExtraFeatures.java @@ -55,15 +55,15 @@ public class ExtraFeatures { /* Output: Throwing MyException2 from f() MyException2: Detail Message: 0 null - at ExtraFeatures.f(ExtraFeatures.java:22) - at ExtraFeatures.main(ExtraFeatures.java:34) + at ExtraFeatures.f(ExtraFeatures.java:23) + at ExtraFeatures.main(ExtraFeatures.java:35) Throwing MyException2 from g() MyException2: Detail Message: 0 Originated in g() - at ExtraFeatures.g(ExtraFeatures.java:26) - at ExtraFeatures.main(ExtraFeatures.java:39) + at ExtraFeatures.g(ExtraFeatures.java:27) + at ExtraFeatures.main(ExtraFeatures.java:40) Throwing MyException2 from h() MyException2: Detail Message: 47 Originated in h() - at ExtraFeatures.h(ExtraFeatures.java:30) - at ExtraFeatures.main(ExtraFeatures.java:44) + at ExtraFeatures.h(ExtraFeatures.java:31) + at ExtraFeatures.main(ExtraFeatures.java:45) e.val() = 47 */ diff --git a/exceptions/LoggingExceptions.java b/exceptions/LoggingExceptions.java index 2fe1f024..b70a8744 100644 --- a/exceptions/LoggingExceptions.java +++ b/exceptions/LoggingExceptions.java @@ -33,17 +33,16 @@ public class LoggingExceptions { } /* Output: ___[ Error Output ]___ -Dec 15, 2015 10:34:24 PM LoggingException +Jul 22, 2016 11:55:45 AM LoggingException SEVERE: LoggingException at LoggingExceptions.main(LoggingExceptions.java:20) Caught LoggingException -Dec 15, 2015 10:34:24 PM LoggingException +Jul 22, 2016 11:55:45 AM LoggingException SEVERE: LoggingException at LoggingExceptions.main(LoggingExceptions.java:25) Caught LoggingException -___[ Error Output is Expected ]___ */ diff --git a/exceptions/LoggingExceptions2.java b/exceptions/LoggingExceptions2.java index ae7cffd4..b5c2ccef 100644 --- a/exceptions/LoggingExceptions2.java +++ b/exceptions/LoggingExceptions2.java @@ -25,9 +25,8 @@ public class LoggingExceptions2 { } /* Output: ___[ Error Output ]___ -Dec 15, 2015 10:34:25 PM LoggingExceptions2 logException +Jul 22, 2016 11:55:47 AM LoggingExceptions2 logException SEVERE: java.lang.NullPointerException at LoggingExceptions2.main(LoggingExceptions2.java:17) -___[ Error Output is Expected ]___ */ diff --git a/exceptions/NeverCaught.java b/exceptions/NeverCaught.java index 63341738..974ccecd 100644 --- a/exceptions/NeverCaught.java +++ b/exceptions/NeverCaught.java @@ -23,5 +23,4 @@ f() at NeverCaught.f(NeverCaught.java:7) at NeverCaught.g(NeverCaught.java:10) at NeverCaught.main(NeverCaught.java:13) -___[ Exception is Expected ]___ */ diff --git a/files/AddAndSubtractPaths.java b/files/AddAndSubtractPaths.java index d107bf95..55506f69 100644 --- a/files/AddAndSubtractPaths.java +++ b/files/AddAndSubtractPaths.java @@ -53,35 +53,35 @@ public class AddAndSubtractPaths { } /* Output: Windows 10 -C:\Users\Bruce\Documents\Git +C:\Users\Bruce\Documents\GitHub (1)r on- java\ExtractedExamples\files\AddAndSubtractPaths.java -RealPath: C:\Users\Bruce\Documents\Git\on- +RealPath: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\files\AddAndSubtractPaths.java (2)r on-java\ExtractedExamples\strings\..\files -RealPath: C:\Users\Bruce\Documents\Git\on- +RealPath: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\files (3)r on-java\ExtractedExamples\files -RealPath: C:\Users\Bruce\Documents\Git\on- +RealPath: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\files (4) ..\.. -RealPath: C:\Users\Bruce\Documents\Git\on-java +RealPath: C:\Users\Bruce\Documents\GitHub\on-java (5) ..\.. -RealPath: C:\Users\Bruce\Documents\Git\on-java +RealPath: C:\Users\Bruce\Documents\GitHub\on-java (6)r on-java -RealPath: C:\Users\Bruce\Documents\Git\on-java +RealPath: C:\Users\Bruce\Documents\GitHub\on-java (7)r on-java\ExtractedExamples\files\.\..\.. -RealPath: C:\Users\Bruce\Documents\Git\on-java +RealPath: C:\Users\Bruce\Documents\GitHub\on-java (8)r on-java -RealPath: C:\Users\Bruce\Documents\Git\on-java +RealPath: C:\Users\Bruce\Documents\GitHub\on-java (9)r on-java\ExtractedExamples\files -RealPath: C:\Users\Bruce\Documents\Git\on- +RealPath: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\files (10)r on-java\ExtractedExamples\strings -RealPath: C:\Users\Bruce\Documents\Git\on- +RealPath: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\strings (11) nonexistent java.nio.file.NoSuchFileException: -C:\Users\Bruce\Documents\Git\on- +C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\files\nonexistent */ diff --git a/files/Directories.java b/files/Directories.java index 434bf01e..bf052a27 100644 --- a/files/Directories.java +++ b/files/Directories.java @@ -59,7 +59,7 @@ Nope, that doesn't work. test\bag test\bar test\baz -test\DIR_8446534140186618410 +test\DIR_8460303386746117268 test\foo test\Hello.txt ********* @@ -68,27 +68,27 @@ test\bag test\bag\foo test\bag\foo\bar test\bag\foo\bar\baz -test\bag\foo\bar\baz\7681439653764312519.tmp +test\bag\foo\bar\baz\4101434906493986662.tmp test\bag\foo\bar\baz\File.txt test\bar test\bar\baz test\bar\baz\bag test\bar\baz\bag\foo -test\bar\baz\bag\foo\231438590599434409.tmp +test\bar\baz\bag\foo\7816199470809856557.tmp test\bar\baz\bag\foo\File.txt test\baz test\baz\bag test\baz\bag\foo test\baz\bag\foo\bar -test\baz\bag\foo\bar\2568963174268478267.tmp +test\baz\bag\foo\bar\5361615738906181780.tmp test\baz\bag\foo\bar\File.txt -test\DIR_8446534140186618410 -test\DIR_8446534140186618410\pre4960544428685536384.non +test\DIR_8460303386746117268 +test\DIR_8460303386746117268\pre8013004952693214586.non test\foo test\foo\bar test\foo\bar\baz test\foo\bar\baz\bag -test\foo\bar\baz\bag\8569628193069437000.tmp +test\foo\bar\baz\bag\7164453512868942303.tmp test\foo\bar\baz\bag\File.txt test\Hello.txt */ diff --git a/files/File_System.java b/files/File_System.java index d173810d..24014ae2 100644 --- a/files/File_System.java +++ b/files/File_System.java @@ -27,15 +27,15 @@ public class File_System { } /* Output: Windows 10 -File Store: (C:) +File Store: SSD (C:) Root Directory: C:\ Root Directory: D:\ Separator: \ UserPrincipalLookupService: -sun.nio.fs.WindowsFileSystem$LookupService$1@106d69c +sun.nio.fs.WindowsFileSystem$LookupService$1@1db9742 isOpen: true isReadOnly: false FileSystemProvider: -sun.nio.fs.WindowsFileSystemProvider@52e922 +sun.nio.fs.WindowsFileSystemProvider@106d69c File Attribute Views: [owner, dos, acl, basic, user] */ diff --git a/files/Find.java b/files/Find.java index babf8eb5..5d8d1b03 100644 --- a/files/Find.java +++ b/files/Find.java @@ -36,24 +36,24 @@ public class Find { } } /* Output: -test\bag\foo\bar\baz\7875645296823748474.tmp +test\bag\foo\bar\baz\6081303161062291208.tmp test\bag\foo\bar\baz\File.txt -test\bar\baz\bag\foo\8495339501512512468.tmp +test\bar\baz\bag\foo\771297659941286896.tmp test\bar\baz\bag\foo\File.txt -test\baz\bag\foo\bar\4657930969137717517.tmp +test\baz\bag\foo\bar\1769334171376700049.tmp test\baz\bag\foo\bar\File.txt test\dir.tmp -test\foo\bar\baz\bag\5205870604020775563.tmp +test\foo\bar\baz\bag\4483950466184961816.tmp test\foo\bar\baz\bag\File.txt *************** -7875645296823748474.tmp -8495339501512512468.tmp -4657930969137717517.tmp +6081303161062291208.tmp +771297659941286896.tmp +1769334171376700049.tmp dir.tmp -5205870604020775563.tmp +4483950466184961816.tmp *************** -7875645296823748474.tmp -8495339501512512468.tmp -4657930969137717517.tmp -5205870604020775563.tmp +6081303161062291208.tmp +771297659941286896.tmp +1769334171376700049.tmp +4483950466184961816.tmp */ diff --git a/files/PartsOfPaths.java b/files/PartsOfPaths.java index 9788dede..3122a05d 100644 --- a/files/PartsOfPaths.java +++ b/files/PartsOfPaths.java @@ -27,17 +27,16 @@ Windows 10 Users Bruce Documents -Git +GitHub on-java ExtractedExamples files PartsOfPaths.java -Git\on-java\ExtractedExamples ends with '.java': false Users: false : false Bruce: false : false Documents: false : false -Git: false : false +GitHub: false : false on-java: false : false ExtractedExamples: false : false files: false : false diff --git a/files/PathAnalysis.java b/files/PathAnalysis.java index 77b4603d..5e32b8ae 100644 --- a/files/PathAnalysis.java +++ b/files/PathAnalysis.java @@ -47,10 +47,10 @@ RegularFile: true Writable: true notExists: false Hidden: false -size: 1617 -FileStore: (C:) -LastModified: : 2015-12-13T21:24:32.029627Z -Owner: GROOT\Bruce (User) +size: 1631 +FileStore: SSD (C:) +LastModified: : 2016-07-22T17:55:34.80143Z +Owner: MINDVIEWTOSHIBA\Bruce (User) ContentType: null SymbolicLink: false */ diff --git a/files/PathInfo.java b/files/PathInfo.java index 3dbae20b..2dcdc1b0 100644 --- a/files/PathInfo.java +++ b/files/PathInfo.java @@ -63,40 +63,40 @@ FileName: PathInfo.java Parent: null Root: null ---------------- -toString: C:\Users\Bruce\Documents\Git\on- +toString: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\files\PathInfo.java Exists: true RegularFile: true Directory: false Absolute: true FileName: PathInfo.java -Parent: C:\Users\Bruce\Documents\Git\on- +Parent: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\files Root: C:\ ---------------- -toString: C:\Users\Bruce\Documents\Git\on- +toString: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\files Exists: true RegularFile: false Directory: true Absolute: true FileName: files -Parent: C:\Users\Bruce\Documents\Git\on- +Parent: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples Root: C:\ ---------------- -toString: C:\Users\Bruce\Documents\Git\on- +toString: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\files\PathInfo.java Exists: true RegularFile: true Directory: false Absolute: true FileName: PathInfo.java -Parent: C:\Users\Bruce\Documents\Git\on- +Parent: C:\Users\Bruce\Documents\GitHub\on- java\ExtractedExamples\files Root: C:\ ---------------- -URI: file:///C:/Users/Bruce/Documents/Git/on- +URI: file:///C:/Users/Bruce/Documents/GitHub/on- java/ExtractedExamples/files/PathInfo.java true */ diff --git a/files/ReadLineStream.java b/files/ReadLineStream.java index d33a37b4..be32d9d0 100644 --- a/files/ReadLineStream.java +++ b/files/ReadLineStream.java @@ -14,5 +14,5 @@ public class ReadLineStream { } } /* Output: -show("RegularFile", Files.isRegularFile(p)); + show("RegularFile", Files.isRegularFile(p)); */ diff --git a/files/TreeWatcher.java b/files/TreeWatcher.java index fa7abeeb..7afc374e 100644 --- a/files/TreeWatcher.java +++ b/files/TreeWatcher.java @@ -43,8 +43,8 @@ public class TreeWatcher { } /* Output: deleting test\bag\foo\bar\baz\File.txt +deleting test\bar\baz\bag\foo\File.txt evt.context(): File.txt evt.count(): 1 evt.kind(): ENTRY_DELETE -deleting test\bar\baz\bag\foo\File.txt */ diff --git a/generics/DynamicProxyMixin.java b/generics/DynamicProxyMixin.java index ddca21c2..9ea58279 100644 --- a/generics/DynamicProxyMixin.java +++ b/generics/DynamicProxyMixin.java @@ -60,6 +60,6 @@ public class DynamicProxyMixin { } /* Output: Hello -1434408462833 +1469210152348 1 */ diff --git a/generics/Mixins.java b/generics/Mixins.java index 1234958e..c524c5f8 100644 --- a/generics/Mixins.java +++ b/generics/Mixins.java @@ -64,6 +64,6 @@ public class Mixins { } } /* Output: -test string 1 1434408464412 1 -test string 2 1434408464413 2 +test string 1 1469210158525 1 +test string 2 1469210158525 2 */ diff --git a/generics/PrimitiveGenericTest.java b/generics/PrimitiveGenericTest.java index e4f95e2f..883e2512 100644 --- a/generics/PrimitiveGenericTest.java +++ b/generics/PrimitiveGenericTest.java @@ -41,6 +41,6 @@ public class PrimitiveGenericTest { } } /* Output: -[YNzbrnyGc, FOWZnTcQr, GseGZMmJM, RoEsuEcUO, neOEdLsmw] -[8689, 7185, 6992, 5746, 3976, 2447, 5368, 1854, 1395] +[btpenpccu, xszgvgmei, nneeloztd, vewcippcy, gpoalkljl] +[635, 8737, 3941, 4720, 6177, 8479, 6656, 3768, 4948] */ diff --git a/generics/TupleList.java b/generics/TupleList.java index 2c96a07b..6003fb72 100644 --- a/generics/TupleList.java +++ b/generics/TupleList.java @@ -18,6 +18,6 @@ extends ArrayList> { } } /* Output: -(Vehicle@18025c, Amphibian@16f27d, hi, 47) -(Vehicle@7aac27, Amphibian@3abc88, hi, 47) +(Vehicle@107d329, Amphibian@1629346, hi, 47) +(Vehicle@4b9385, Amphibian@1311334, hi, 47) */ diff --git a/generics/TupleTest.java b/generics/TupleTest.java index 8cafff70..fee02b25 100644 --- a/generics/TupleTest.java +++ b/generics/TupleTest.java @@ -38,7 +38,7 @@ public class TupleTest { } /* Output: (hi, 47) -(Amphibian@139a55, hi, 47) -(Vehicle@1db9742, Amphibian@106d69c, hi, 47) -(Vehicle@52e922, Amphibian@25154f, hi, 47, 11.1) +(Amphibian@1c7c054, hi, 47) +(Vehicle@14991ad, Amphibian@d93b30, hi, 47) +(Vehicle@a14482, Amphibian@140e19d, hi, 47, 11.1) */ diff --git a/generics/TupleTest2.java b/generics/TupleTest2.java index d1ad478f..c3f65cae 100644 --- a/generics/TupleTest2.java +++ b/generics/TupleTest2.java @@ -35,7 +35,7 @@ public class TupleTest2 { /* Output: (hi, 47) (hi, 47) -(Amphibian@139a55, hi, 47) -(Vehicle@1db9742, Amphibian@106d69c, hi, 47) -(Vehicle@52e922, Amphibian@25154f, hi, 47, 11.1) +(Amphibian@a298b7, hi, 47) +(Vehicle@16d3586, Amphibian@154617c, hi, 47) +(Vehicle@17327b6, Amphibian@14ae5a5, hi, 47, 11.1) */ diff --git a/generics/WatercolorSets.java b/generics/WatercolorSets.java index 673bf0be..b5248eeb 100644 --- a/generics/WatercolorSets.java +++ b/generics/WatercolorSets.java @@ -35,19 +35,19 @@ COBALT_BLUE_HUE, PERMANENT_GREEN, VIRIDIAN_HUE] set2: [CERULEAN_BLUE_HUE, PHTHALO_BLUE, ULTRAMARINE, COBALT_BLUE_HUE, PERMANENT_GREEN, VIRIDIAN_HUE, SAP_GREEN, YELLOW_OCHRE, BURNT_SIENNA, RAW_UMBER, BURNT_UMBER] -union(set1, set2): [MAGENTA, ROSE_MADDER, CRIMSON, -PERMANENT_GREEN, BURNT_UMBER, SAP_GREEN, CERULEAN_BLUE_HUE, -RAW_UMBER, YELLOW_OCHRE, BRILLIANT_RED, ULTRAMARINE, -BURNT_SIENNA, COBALT_BLUE_HUE, VIRIDIAN_HUE, PHTHALO_BLUE, -VIOLET] -intersection(set1, set2): [COBALT_BLUE_HUE, -PERMANENT_GREEN, VIRIDIAN_HUE, PHTHALO_BLUE, -CERULEAN_BLUE_HUE, ULTRAMARINE] -difference(set1, subset): [MAGENTA, ROSE_MADDER, CRIMSON, -BRILLIANT_RED, VIOLET] -difference(set2, subset): [BURNT_UMBER, SAP_GREEN, -RAW_UMBER, YELLOW_OCHRE, BURNT_SIENNA] -complement(set1, set2): [MAGENTA, ROSE_MADDER, CRIMSON, -BURNT_UMBER, SAP_GREEN, RAW_UMBER, YELLOW_OCHRE, -BRILLIANT_RED, BURNT_SIENNA, VIOLET] +union(set1, set2): [MAGENTA, COBALT_BLUE_HUE, VIOLET, +VIRIDIAN_HUE, BURNT_SIENNA, ULTRAMARINE, CERULEAN_BLUE_HUE, +BURNT_UMBER, BRILLIANT_RED, PHTHALO_BLUE, YELLOW_OCHRE, +SAP_GREEN, CRIMSON, ROSE_MADDER, RAW_UMBER, +PERMANENT_GREEN] +intersection(set1, set2): [COBALT_BLUE_HUE, VIRIDIAN_HUE, +ULTRAMARINE, CERULEAN_BLUE_HUE, PHTHALO_BLUE, +PERMANENT_GREEN] +difference(set1, subset): [CRIMSON, MAGENTA, VIOLET, +ROSE_MADDER, BRILLIANT_RED] +difference(set2, subset): [BURNT_SIENNA, BURNT_UMBER, +YELLOW_OCHRE, RAW_UMBER, SAP_GREEN] +complement(set1, set2): [MAGENTA, VIOLET, BURNT_SIENNA, +BURNT_UMBER, BRILLIANT_RED, YELLOW_OCHRE, SAP_GREEN, +CRIMSON, ROSE_MADDER, RAW_UMBER] */ diff --git a/housekeeping/NewVarArgs.java b/housekeeping/NewVarArgs.java index 749c2c1b..5f94b54d 100644 --- a/housekeeping/NewVarArgs.java +++ b/housekeeping/NewVarArgs.java @@ -25,6 +25,6 @@ public class NewVarArgs { 47 3.14 11.11 47 3.14 11.11 one two three -A@19e0bfd A@139a55 A@1db9742 +A@1db9742 A@106d69c A@52e922 1 2 3 4 */ diff --git a/housekeeping/VarArgs.java b/housekeeping/VarArgs.java index eb8b3bd5..af8e3939 100644 --- a/housekeeping/VarArgs.java +++ b/housekeeping/VarArgs.java @@ -22,5 +22,5 @@ public class VarArgs { /* Output: 47 3.14 11.11 one two three -A@19e0bfd A@139a55 A@1db9742 +A@1db9742 A@106d69c A@52e922 */ diff --git a/innerclasses/GreenhouseController.java b/innerclasses/GreenhouseController.java index 6b00feda..5f1cd43e 100644 --- a/innerclasses/GreenhouseController.java +++ b/innerclasses/GreenhouseController.java @@ -29,13 +29,29 @@ public class GreenhouseController { } } /* Output: -Bing! Thermostat on night setting Light is on Light is off Greenhouse water is on Greenhouse water is off +Bing! Thermostat on day setting +Bing! Restarting system +Thermostat on night setting +Light is on +Light is off +Greenhouse water is on +Bing! +Greenhouse water is off +Thermostat on day setting +Bing! +Restarting system +Thermostat on night setting +Light is on +Light is off +Bing! +Greenhouse water is on +Greenhouse water is off Terminating */ diff --git a/logging/ConfigureLogging.java b/logging/ConfigureLogging.java index b378f82b..12ac25b0 100644 --- a/logging/ConfigureLogging.java +++ b/logging/ConfigureLogging.java @@ -44,41 +44,58 @@ public class ConfigureLogging { } } /* Output: -Logger Name : com Level: null - Logger Name : com.mindviewinc Level: null - Logger Name : onjava Level: null - Logger Name : com.mindviewinc.test Level: null - Logger Name : random Level: null + Logger Name : com Level: null + Logger Name : com.mindviewinc Level: FINEST + Logger Name : onjava Level: INFO + Logger Name : com.mindviewinc.test Level: FINER + Logger Name : random Level: SEVERE ___[ Error Output ]___ -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +FINEST: Finest +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +FINER: Finer +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +FINE: Fine +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +CONFIG: Config +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages INFO: Info -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages WARNING: Warning -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages SEVERE: Severe -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +FINEST: Finest +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +FINER: Finer +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +FINE: Fine +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +CONFIG: Config +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages INFO: Info -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages WARNING: Warning -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages SEVERE: Severe -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages INFO: Info -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages WARNING: Warning -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages SEVERE: Severe -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +FINER: Finer +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +FINE: Fine +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages +CONFIG: Config +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages INFO: Info -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages WARNING: Warning -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages SEVERE: Severe -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages -INFO: Info -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages -WARNING: Warning -Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages +Jul 22, 2016 11:55:52 AM ConfigureLogging sendLogMessages SEVERE: Severe -___[ Error Output is Expected ]___ */ diff --git a/logging/CustomHandler.java b/logging/CustomHandler.java index b111b003..853863b3 100644 --- a/logging/CustomHandler.java +++ b/logging/CustomHandler.java @@ -40,9 +40,8 @@ public class CustomHandler { , INFO:, CustomHandler:, main:, , ] ___[ Error Output ]___ -Dec 15, 2015 9:58:42 PM CustomHandler main +Jul 22, 2016 11:55:52 AM CustomHandler main WARNING: Logging Warning -Dec 15, 2015 9:58:42 PM CustomHandler main +Jul 22, 2016 11:55:52 AM CustomHandler main INFO: Logging Info -___[ Error Output is Expected ]___ */ diff --git a/logging/InfoLogging.java b/logging/InfoLogging.java index 9e987fcd..353e3ebc 100644 --- a/logging/InfoLogging.java +++ b/logging/InfoLogging.java @@ -14,7 +14,6 @@ public class InfoLogging { } /* Output: ___[ Error Output ]___ -Dec 15, 2015 9:58:43 PM InfoLogging main +Jul 22, 2016 11:55:52 AM InfoLogging main INFO: Logging: INFO-level message -___[ Error Output is Expected ]___ */ diff --git a/logging/InfoLogging2.java b/logging/InfoLogging2.java index b3ba0c6f..091a6458 100644 --- a/logging/InfoLogging2.java +++ b/logging/InfoLogging2.java @@ -16,7 +16,6 @@ public class InfoLogging2 { } /* Output: ___[ Error Output ]___ -Dec 15, 2015 9:58:43 PM InfoLogging2 main +Jul 22, 2016 11:55:53 AM InfoLogging2 main INFO: Logging an INFO-level message -___[ Error Output is Expected ]___ */ diff --git a/logging/LogToFile.java b/logging/LogToFile.java index 8337ee9c..94ab32a0 100644 --- a/logging/LogToFile.java +++ b/logging/LogToFile.java @@ -17,7 +17,6 @@ public class LogToFile { } /* Output: ___[ Error Output ]___ -Dec 15, 2015 9:58:43 PM LogToFile main +Jul 22, 2016 11:55:53 AM LogToFile main INFO: A message logged to the file -___[ Error Output is Expected ]___ */ diff --git a/logging/LogToFile2.java b/logging/LogToFile2.java index 4fd6d5d0..1dfb0f02 100644 --- a/logging/LogToFile2.java +++ b/logging/LogToFile2.java @@ -19,7 +19,6 @@ public class LogToFile2 { } /* Output: ___[ Error Output ]___ -Dec 15, 2015 9:58:43 PM LogToFile2 main +Jul 22, 2016 11:55:53 AM LogToFile2 main INFO: A message logged to the file -___[ Error Output is Expected ]___ */ diff --git a/logging/LoggingLevelManipulation.java b/logging/LoggingLevelManipulation.java index e88c5162..81457373 100644 --- a/logging/LoggingLevelManipulation.java +++ b/logging/LoggingLevelManipulation.java @@ -62,7 +62,7 @@ public class LoggingLevelManipulation { } } /* Output: --- printing levels -- com : null com.mindviewinc : null + -- printing levels -- com : null com.mindviewinc : null onjava : null com.mindviewinc.test : null random : null -- printing levels -- com : SEVERE com.mindviewinc : null onjava : null com.mindviewinc.test : null random : null @@ -76,110 +76,109 @@ onjava : FINEST com.mindviewinc.test : FINEST random : FINEST net level: FINEST ___[ Error Output ]___ -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:53 AM LoggingLevelManipulation printLogMessages SEVERE: com Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: com.mindviewinc Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages INFO: onjava Info -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages WARNING: onjava Warning -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: onjava Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: com.mindviewinc.test Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages INFO: random Info -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages WARNING: random Warning -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: random Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: com Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: com.mindviewinc Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages INFO: onjava Info -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages WARNING: onjava Warning -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: onjava Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages INFO: com.mindviewinc.test Info -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages WARNING: com.mindviewinc.test Warning -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: com.mindviewinc.test Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages INFO: random Info -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages WARNING: random Warning -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: random Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages INFO: com Info -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages WARNING: com Warning -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: com Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages INFO: com.mindviewinc Info -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages WARNING: com.mindviewinc Warning -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: com.mindviewinc Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages INFO: onjava Info -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages WARNING: onjava Warning -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: onjava Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages INFO: com.mindviewinc.test Info -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages WARNING: com.mindviewinc.test Warning -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: com.mindviewinc.test Severe -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages INFO: random Info -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages WARNING: random Warning -Dec 15, 2015 9:58:43 PM LoggingLevelManipulation +Jul 22, 2016 11:55:54 AM LoggingLevelManipulation printLogMessages SEVERE: random Severe -___[ Error Output is Expected ]___ */ diff --git a/logging/LoggingLevels.java b/logging/LoggingLevels.java index baa8e703..363b59a2 100644 --- a/logging/LoggingLevels.java +++ b/logging/LoggingLevels.java @@ -40,23 +40,22 @@ com level: SEVERE individual loggers set to FINEST com level: SEVERE ___[ Error Output ]___ -Dec 15, 2015 9:58:43 PM LoggingLevels logMessages +Jul 22, 2016 11:55:54 AM LoggingLevels logMessages INFO: util : info -Dec 15, 2015 9:58:43 PM LoggingLevels logMessages +Jul 22, 2016 11:55:54 AM LoggingLevels logMessages SEVERE: test : severe -Dec 15, 2015 9:58:43 PM LoggingLevels logMessages +Jul 22, 2016 11:55:54 AM LoggingLevels logMessages INFO: random : info -Dec 15, 2015 9:58:43 PM LoggingLevels logMessages +Jul 22, 2016 11:55:54 AM LoggingLevels logMessages INFO: util : info -Dec 15, 2015 9:58:43 PM LoggingLevels logMessages +Jul 22, 2016 11:55:54 AM LoggingLevels logMessages SEVERE: test : severe -Dec 15, 2015 9:58:43 PM LoggingLevels logMessages +Jul 22, 2016 11:55:54 AM LoggingLevels logMessages INFO: random : info -Dec 15, 2015 9:58:43 PM LoggingLevels logMessages +Jul 22, 2016 11:55:54 AM LoggingLevels logMessages INFO: util : info -Dec 15, 2015 9:58:43 PM LoggingLevels logMessages +Jul 22, 2016 11:55:54 AM LoggingLevels logMessages SEVERE: test : severe -Dec 15, 2015 9:58:43 PM LoggingLevels logMessages +Jul 22, 2016 11:55:54 AM LoggingLevels logMessages INFO: random : info -___[ Error Output is Expected ]___ */ diff --git a/logging/MultipleHandlers.java b/logging/MultipleHandlers.java index e8eaa51e..fda36f05 100644 --- a/logging/MultipleHandlers.java +++ b/logging/MultipleHandlers.java @@ -20,9 +20,8 @@ public class MultipleHandlers { } /* Output: ___[ Error Output ]___ -Dec 15, 2015 9:58:43 PM MultipleHandlers main +Jul 22, 2016 11:55:54 AM MultipleHandlers main WARNING: Output to multiple handlers -Dec 15, 2015 9:58:43 PM MultipleHandlers main +Jul 22, 2016 11:55:54 AM MultipleHandlers main WARNING: Output to multiple handlers -___[ Error Output is Expected ]___ */ diff --git a/logging/MultipleHandlers2.java b/logging/MultipleHandlers2.java index ec3d0678..f3e48196 100644 --- a/logging/MultipleHandlers2.java +++ b/logging/MultipleHandlers2.java @@ -21,7 +21,6 @@ public class MultipleHandlers2 { } /* Output: ___[ Error Output ]___ -Dec 15, 2015 9:58:43 PM MultipleHandlers2 main +Jul 22, 2016 11:55:54 AM MultipleHandlers2 main WARNING: Output to multiple handlers -___[ Error Output is Expected ]___ */ diff --git a/logging/PrintableLogRecord.java b/logging/PrintableLogRecord.java index fb4d31d7..a9fce941 100644 --- a/logging/PrintableLogRecord.java +++ b/logging/PrintableLogRecord.java @@ -48,7 +48,7 @@ public class PrintableLogRecord extends LogRecord { Level LoggerName Message -CurrentMillis<1434408472765> +CurrentMillis<1469210155053> Params ResourceBundle ResourceBundleName diff --git a/logging/SimpleFilter.java b/logging/SimpleFilter.java index cf52ae4d..2653a685 100644 --- a/logging/SimpleFilter.java +++ b/logging/SimpleFilter.java @@ -34,13 +34,12 @@ public class SimpleFilter { } /* Output: ___[ Error Output ]___ -Dec 15, 2015 9:58:44 PM SimpleFilter sendLogMessages +Jul 22, 2016 11:55:55 AM SimpleFilter sendLogMessages WARNING: A duck in the house! -Dec 15, 2015 9:58:44 PM SimpleFilter sendLogMessages +Jul 22, 2016 11:55:55 AM SimpleFilter sendLogMessages WARNING: A Wombat at large! -Dec 15, 2015 9:58:44 PM SimpleFilter main +Jul 22, 2016 11:55:55 AM SimpleFilter main INFO: After setting filter.. -Dec 15, 2015 9:58:44 PM SimpleFilter sendLogMessages +Jul 22, 2016 11:55:55 AM SimpleFilter sendLogMessages WARNING: A duck in the house! -___[ Error Output is Expected ]___ */ diff --git a/logging/SimpleFormatterExample.java b/logging/SimpleFormatterExample.java index 1cab2fda..cfbb7a99 100644 --- a/logging/SimpleFormatterExample.java +++ b/logging/SimpleFormatterExample.java @@ -35,5 +35,4 @@ INFO : SimpleFormatterExample -:- logMessages -:- Line One INFO : SimpleFormatterExample -:- logMessages -:- Line Two -___[ Error Output is Expected ]___ */ diff --git a/network/WhoAmI.java b/network/WhoAmI.java index aab56a1f..0cda6ae9 100644 --- a/network/WhoAmI.java +++ b/network/WhoAmI.java @@ -15,6 +15,6 @@ public class WhoAmI { } } /* Output: -groot -192.168.70.108 +MindviewToshibaLaptop +192.168.0.107 */ diff --git a/newio/BufferToText.java b/newio/BufferToText.java index 7de658b8..b0184bc3 100644 --- a/newio/BufferToText.java +++ b/newio/BufferToText.java @@ -62,7 +62,7 @@ public class BufferToText { } /* Output: ???? -Decoded using Cp1252: Some text +Decoded using windows-1252: Some text Some text Some textNULNULNUL */ diff --git a/newio/LockingMappedFiles.java b/newio/LockingMappedFiles.java index fb01d8f4..20c8205b 100644 --- a/newio/LockingMappedFiles.java +++ b/newio/LockingMappedFiles.java @@ -52,8 +52,8 @@ public class LockingMappedFiles { } } /* Output: -Locked: 75497471 to 113246206 Locked: 0 to 50331647 +Locked: 75497471 to 113246206 Released: 75497471 to 113246206 Released: 0 to 50331647 */ diff --git a/objects/HelloDate.java b/objects/HelloDate.java index 4fd4a4ba..42f70367 100644 --- a/objects/HelloDate.java +++ b/objects/HelloDate.java @@ -22,5 +22,5 @@ public class HelloDate { } /* Output: Hello, it's: -Mon Jun 15 15:47:53 PDT 2015 +Fri Jul 22 11:55:55 MDT 2016 */ diff --git a/objects/ShowProperties.java b/objects/ShowProperties.java index 02db099e..fec2d61b 100644 --- a/objects/ShowProperties.java +++ b/objects/ShowProperties.java @@ -15,8 +15,8 @@ public class ShowProperties { -- listing properties -- java.runtime.name=Java(TM) SE Runtime Environment sun.boot.library.path=C:\Program Files -(x86)\Java\jre1.8.0_... -java.vm.version=25.60-b23 +(x86)\Java\jdk1.8.0_... +java.vm.version=25.77-b03 java.vm.vendor=Oracle Corporation java.vendor.url=http://java.oracle.com/ path.separator=; @@ -28,10 +28,10 @@ sun.java.launcher=SUN_STANDARD sun.os.patch.level= java.vm.specification.name=Java Virtual Machine Specification -user.dir=C:\Users\Bruce\Documents\GitHub\OnJav... -java.runtime.version=1.8.0_60-b27 +user.dir=C:\Users\Bruce\Documents\GitHub\on-ja... +java.runtime.version=1.8.0_77-b03 java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment -java.endorsed.dirs=C:\Program Files (x86)\Java\jre1.8.0_... +java.endorsed.dirs=C:\Program Files (x86)\Java\jdk1.8.0_... os.arch=x86 java.io.tmpdir=C:\Users\Bruce\AppData\Local\Temp\ ... diff --git a/onjava/Hex.java b/onjava/Hex.java index 61bc5529..e8f53f6f 100644 --- a/onjava/Hex.java +++ b/onjava/Hex.java @@ -34,11 +34,11 @@ public class Hex { } } /* Output: (First 6 Lines) -00000: CA FE BA BE 00 00 00 34 00 53 0A 00 05 00 22 07 -00010: 00 23 0A 00 02 00 22 08 00 24 07 00 25 0A 00 26 -00020: 00 27 0A 00 28 00 29 0A 00 02 00 2A 08 00 2B 0A -00030: 00 2C 00 2D 08 00 2E 0A 00 02 00 2F 09 00 30 00 -00040: 31 08 00 32 0A 00 33 00 34 0A 00 15 00 35 0A 00 -00050: 36 00 37 07 00 38 0A 00 12 00 39 0A 00 33 00 3A +00000: CA FE BA BE 00 00 00 34 00 61 0A 00 05 00 31 07 +00010: 00 32 0A 00 02 00 31 08 00 33 07 00 34 0A 00 35 +00020: 00 36 0A 00 0F 00 37 0A 00 02 00 38 08 00 39 0A +00030: 00 3A 00 3B 08 00 3C 0A 00 02 00 3D 09 00 3E 00 +00040: 3F 08 00 40 07 00 41 0A 00 42 00 43 0A 00 44 00 +00050: 45 0A 00 14 00 46 0A 00 47 00 48 07 00 49 01 00 ... */ diff --git a/onjava/atunit/ClassNameFinder.java b/onjava/atunit/ClassNameFinder.java index 20be9be5..5693ef0a 100644 --- a/onjava/atunit/ClassNameFinder.java +++ b/onjava/atunit/ClassNameFinder.java @@ -101,6 +101,7 @@ public class ClassNameFinder { } } /* Output: +onjava.ArrayShow onjava.atunit.AtUnit$TestMethods onjava.atunit.AtUnit onjava.atunit.ClassNameFinder @@ -108,4 +109,71 @@ onjava.atunit.Test onjava.atunit.TestObjectCleanup onjava.atunit.TestObjectCreate onjava.atunit.TestProperty +onjava.BasicSupplier +onjava.CollectionMethodDifferences +onjava.ConvertTo +onjava.Count$Boolean +onjava.Count$boolean_ +onjava.Count$Byte +onjava.Count$byte_ +onjava.Count$Character +onjava.Count$char_ +onjava.Count$Double +onjava.Count$double_ +onjava.Count$Float +onjava.Count$float_ +onjava.Count$Integer +onjava.Count$int_ +onjava.Count$Long +onjava.Count$long_ +onjava.Count$Short +onjava.Count$short_ +onjava.Count +onjava.CountingIntegerList +onjava.CountMap +onjava.Countries +onjava.Enums +onjava.FillMap +onjava.Hex +onjava.MouseClick +onjava.Null +onjava.Operation +onjava.OSExecute +onjava.OSExecuteException +onjava.Pair +onjava.ProcessFiles$Strategy +onjava.ProcessFiles +onjava.Rand$Boolean +onjava.Rand$boolean_ +onjava.Rand$Byte +onjava.Rand$byte_ +onjava.Rand$Character +onjava.Rand$char_ +onjava.Rand$Double +onjava.Rand$double_ +onjava.Rand$Float +onjava.Rand$float_ +onjava.Rand$Integer +onjava.Rand$int_ +onjava.Rand$Long +onjava.Rand$long_ +onjava.Rand$Short +onjava.Rand$short_ +onjava.Rand$String +onjava.Rand +onjava.Range +onjava.Repeat +onjava.RmDir +onjava.Sets +onjava.Sleep +onjava.Stack +onjava.Suppliers +onjava.TimedAbort +onjava.TimeIt +onjava.Tuple +onjava.Tuple2 +onjava.Tuple3 +onjava.Tuple4 +onjava.Tuple5 +onjava.TypeCounter */ diff --git a/patterns/PaperScissorsRock.java b/patterns/PaperScissorsRock.java index 79a182fc..29e8b0bb 100644 --- a/patterns/PaperScissorsRock.java +++ b/patterns/PaperScissorsRock.java @@ -111,24 +111,24 @@ public class PaperScissorsRock { } } /* Output: +Scissors -> Rock : LOSE +Scissors -> Paper : WIN +Rock -> Paper : LOSE Rock -> Rock : DRAW -Paper -> Rock : WIN -Paper -> Rock : WIN -Paper -> Rock : WIN -Scissors -> Paper : WIN +Rock -> Paper : LOSE +Paper -> Scissors : LOSE +Rock -> Paper : LOSE Scissors -> Scissors : DRAW +Scissors -> Rock : LOSE Scissors -> Paper : WIN -Rock -> Paper : LOSE +Scissors -> Rock : LOSE +Paper -> Scissors : LOSE +Rock -> Rock : DRAW +Scissors -> Scissors : DRAW Paper -> Paper : DRAW -Rock -> Paper : LOSE -Paper -> Scissors : LOSE -Paper -> Scissors : LOSE -Rock -> Scissors : WIN -Rock -> Paper : LOSE -Paper -> Rock : WIN Scissors -> Paper : WIN -Paper -> Scissors : LOSE -Paper -> Scissors : LOSE -Paper -> Scissors : LOSE -Paper -> Scissors : LOSE +Scissors -> Rock : LOSE +Scissors -> Paper : WIN +Rock -> Paper : LOSE +Rock -> Scissors : WIN */ diff --git a/patterns/doubledispatch/DoubleDispatch.java b/patterns/doubledispatch/DoubleDispatch.java index 6b497473..604d5002 100644 --- a/patterns/doubledispatch/DoubleDispatch.java +++ b/patterns/doubledispatch/DoubleDispatch.java @@ -71,25 +71,25 @@ public class DoubleDispatch { } } /* Output: (First and Last 10 Lines) -Loading patterns.doubledispatch.DDGlass -Loading patterns.doubledispatch.DDPaper -Loading patterns.doubledispatch.DDAluminum -Loading patterns.doubledispatch.DDCardboard -weight of patterns.doubledispatch.DDAluminum = 89.0 -weight of patterns.doubledispatch.DDAluminum = 76.0 -weight of patterns.doubledispatch.DDAluminum = 25.0 -weight of patterns.doubledispatch.DDAluminum = 34.0 -weight of patterns.doubledispatch.DDAluminum = 27.0 -weight of patterns.doubledispatch.DDAluminum = 18.0 -________...________...________...________...________ -weight of patterns.doubledispatch.DDAluminum = 93.0 -weight of patterns.doubledispatch.DDGlass = 93.0 -weight of patterns.doubledispatch.DDPaper = 80.0 -weight of patterns.doubledispatch.DDGlass = 36.0 -weight of patterns.doubledispatch.DDGlass = 12.0 -weight of patterns.doubledispatch.DDGlass = 60.0 -weight of patterns.doubledispatch.DDPaper = 66.0 -weight of patterns.doubledispatch.DDAluminum = 36.0 -weight of patterns.doubledispatch.DDCardboard = 22.0 +Loading patterns.doubledispatch.Glass +Loading patterns.doubledispatch.Paper +Loading patterns.doubledispatch.Aluminum +Loading patterns.doubledispatch.Cardboard +weight of patterns.doubledispatch.Aluminum = 89.0 +weight of patterns.doubledispatch.Aluminum = 76.0 +weight of patterns.doubledispatch.Aluminum = 25.0 +weight of patterns.doubledispatch.Aluminum = 34.0 +weight of patterns.doubledispatch.Aluminum = 27.0 +weight of patterns.doubledispatch.Aluminum = 18.0 +...________...________...________...________... +weight of patterns.doubledispatch.Aluminum = 93.0 +weight of patterns.doubledispatch.Glass = 93.0 +weight of patterns.doubledispatch.Paper = 80.0 +weight of patterns.doubledispatch.Glass = 36.0 +weight of patterns.doubledispatch.Glass = 12.0 +weight of patterns.doubledispatch.Glass = 60.0 +weight of patterns.doubledispatch.Paper = 66.0 +weight of patterns.doubledispatch.Aluminum = 36.0 +weight of patterns.doubledispatch.Cardboard = 22.0 Total value = 1086.0599818825722 */ diff --git a/patterns/dynatrash/DynaTrash.java b/patterns/dynatrash/DynaTrash.java index 35262b0a..1ad76086 100644 --- a/patterns/dynatrash/DynaTrash.java +++ b/patterns/dynatrash/DynaTrash.java @@ -54,21 +54,21 @@ Loading patterns.trash.Glass Loading patterns.trash.Paper Loading patterns.trash.Aluminum Loading patterns.trash.Cardboard -weight of patterns.trash.Glass = 54.0 -weight of patterns.trash.Glass = 17.0 -weight of patterns.trash.Glass = 11.0 -weight of patterns.trash.Glass = 68.0 -weight of patterns.trash.Glass = 43.0 -weight of patterns.trash.Glass = 63.0 -________...________...________...________...________ -weight of patterns.trash.Aluminum = 93.0 -weight of patterns.trash.Aluminum = 36.0 -Total value = 860.0499778985977 weight of patterns.trash.Paper = 22.0 weight of patterns.trash.Paper = 11.0 weight of patterns.trash.Paper = 88.0 weight of patterns.trash.Paper = 91.0 weight of patterns.trash.Paper = 80.0 weight of patterns.trash.Paper = 66.0 -Total value = 35.80000053346157 +...________...________...________...________... +weight of patterns.trash.Aluminum = 81.0 +weight of patterns.trash.Aluminum = 36.0 +weight of patterns.trash.Aluminum = 93.0 +weight of patterns.trash.Aluminum = 36.0 +Total value = 860.0499778985977 +weight of patterns.trash.Cardboard = 96.0 +weight of patterns.trash.Cardboard = 44.0 +weight of patterns.trash.Cardboard = 12.0 +weight of patterns.trash.Cardboard = 22.0 +Total value = 40.02000072598457 */ diff --git a/patterns/recyclea/RecycleA.java b/patterns/recyclea/RecycleA.java index cf1e160e..fb3174d9 100644 --- a/patterns/recyclea/RecycleA.java +++ b/patterns/recyclea/RecycleA.java @@ -100,27 +100,27 @@ public class RecycleA { } } /* Output: (First and Last 11 Lines) -weight of patterns.recyclea.Aluminum = 0.11435456649761422 -weight of patterns.recyclea.Aluminum = 0.5295954256745989 -weight of patterns.recyclea.Aluminum = 0.44032876173820623 -weight of patterns.recyclea.Aluminum = 0.483968447804611 -weight of patterns.recyclea.Aluminum = 0.2724064060083268 -weight of patterns.recyclea.Aluminum = 0.7661553155473436 -weight of patterns.recyclea.Aluminum = 0.32266202529378485 -weight of patterns.recyclea.Aluminum = 0.29010681217024337 -weight of patterns.recyclea.Aluminum = 0.04867885164993724 -weight of patterns.recyclea.Aluminum = 0.6398064631177899 -Total value = 6.526465168373229 -________...________...________...________...________ -weight of patterns.recyclea.Paper = 0.7024254510631527 -weight of patterns.recyclea.Paper = 0.7775491010186331 -weight of patterns.recyclea.Paper = 0.5929413550962656 -weight of patterns.recyclea.Paper = 0.8991222558891441 -weight of patterns.recyclea.Aluminum = 0.32266202529378485 -weight of patterns.recyclea.Aluminum = 0.29010681217024337 -weight of patterns.recyclea.Glass = 0.42812712031823896 -weight of patterns.recyclea.Paper = 0.8242175461669214 -weight of patterns.recyclea.Aluminum = 0.04867885164993724 -weight of patterns.recyclea.Aluminum = 0.6398064631177899 -Total value = 7.489772197549787 +weight of Aluminum = 0.2893030122276371 +weight of Aluminum = 0.1970234961398979 +weight of Aluminum = 0.36295525806274787 +weight of Aluminum = 0.4825532324565849 +weight of Aluminum = 0.8036398273294586 +weight of Aluminum = 0.510430896154935 +weight of Aluminum = 0.6703377164093444 +weight of Aluminum = 0.41477933066243455 +weight of Aluminum = 0.3603022312124007 +weight of Aluminum = 0.43690089841661006 +weight of Aluminum = 0.6708820087907101 +...________...________...________...________... +weight of Aluminum = 0.41477933066243455 +weight of Aluminum = 0.3603022312124007 +weight of Aluminum = 0.43690089841661006 +weight of Glass = 0.5999637765664924 +weight of Glass = 0.7748836191212746 +weight of Paper = 0.5735994548427199 +weight of Glass = 0.5362827750851034 +weight of Aluminum = 0.6708820087907101 +weight of Paper = 0.8370669795210507 +weight of Glass = 0.3397919679731668 +Total value = 9.90671597531968 */ diff --git a/patterns/recycleb/RecycleB.java b/patterns/recycleb/RecycleB.java index bc2f87d7..871491eb 100644 --- a/patterns/recycleb/RecycleB.java +++ b/patterns/recycleb/RecycleB.java @@ -42,7 +42,7 @@ weight of patterns.trash.Aluminum = 25.0 weight of patterns.trash.Aluminum = 34.0 weight of patterns.trash.Aluminum = 27.0 weight of patterns.trash.Aluminum = 18.0 -________...________...________...________...________ +...________...________...________...________... weight of patterns.trash.Aluminum = 93.0 weight of patterns.trash.Glass = 93.0 weight of patterns.trash.Paper = 80.0 diff --git a/patterns/recyclec/RecycleC.java b/patterns/recyclec/RecycleC.java index fa5c4fc0..9a0b86dd 100644 --- a/patterns/recyclec/RecycleC.java +++ b/patterns/recyclec/RecycleC.java @@ -70,7 +70,7 @@ weight of patterns.trash.Aluminum = 25.0 weight of patterns.trash.Aluminum = 34.0 weight of patterns.trash.Aluminum = 27.0 weight of patterns.trash.Aluminum = 18.0 -________...________...________...________...________ +...________...________...________...________... weight of patterns.trash.Aluminum = 93.0 weight of patterns.trash.Glass = 93.0 weight of patterns.trash.Paper = 80.0 diff --git a/patterns/trashvisitor/TrashVisitor.java b/patterns/trashvisitor/TrashVisitor.java index 52db0d88..1ab8b3bc 100644 --- a/patterns/trashvisitor/TrashVisitor.java +++ b/patterns/trashvisitor/TrashVisitor.java @@ -113,7 +113,7 @@ value of Paper= 2.2000000327825546 Paper weight = 22.0 value of Paper= 1.1000000163912773 Paper weight = 11.0 -________...________...________...________...________ +...________...________...________...________... value of Cardboard = 5.060000091791153 Cardboard weight = 22.0 Total Aluminum: $860.0499778985977 diff --git a/patterns/visitor/BeeAndFlowers.java b/patterns/visitor/BeeAndFlowers.java index c3782012..739c2db0 100644 --- a/patterns/visitor/BeeAndFlowers.java +++ b/patterns/visitor/BeeAndFlowers.java @@ -98,24 +98,24 @@ public class BeeAndFlowers { } } /* Output: -Chrysanthemum -Chrysanthemum -Renuculus -Chrysanthemum -Renuculus -Chrysanthemum -Renuculus +Gladiolus Chrysanthemum Gladiolus Renuculus -Bee and Chrysanthemum -Bee and Chrysanthemum -Bee and Renuculus -Bee and Chrysanthemum -Bee and Renuculus -Bee and Chrysanthemum -Bee and Renuculus +Chrysanthemum +Renuculus +Chrysanthemum +Chrysanthemum +Chrysanthemum +Renuculus +Bee and Gladiolus Bee and Chrysanthemum Bee and Gladiolus Bee and Renuculus +Bee and Chrysanthemum +Bee and Renuculus +Bee and Chrysanthemum +Bee and Chrysanthemum +Bee and Chrysanthemum +Bee and Renuculus */ diff --git a/phase1.py b/phase1.py new file mode 100644 index 00000000..d6c0383e --- /dev/null +++ b/phase1.py @@ -0,0 +1,46 @@ +#! py -3 +# Requires Python 3.5 +# Phase1: +# (0) Do first/last lines before formatting to width +# (1) Combine output and error (if present) files +# (2) Format all output to width limit +# (3) Add closing '*/' +from pathlib import Path +import textwrap +import pprint + +def fill_to_width(text): + result = "" + for line in text.splitlines(): + result += textwrap.fill(line, width=59) + "\n" + return result.strip() + +def adjust_lines(text): + text = text.replace("\0", "NUL") + lines = text.splitlines() + slug = lines[0] + if "(First and Last " in slug: + num_of_lines = int(slug.split()[5]) + adjusted = lines[:num_of_lines + 1] +\ + ["...________...________...________...________..."] +\ + lines[-num_of_lines:] + return "\n".join(adjusted) + elif "(First " in slug: + num_of_lines = int(slug.split()[3]) + adjusted = lines[:num_of_lines + 1] +\ + [" ..."] + return "\n".join(adjusted) + else: + return text + +if __name__ == '__main__': + for outfile in Path(".").rglob("*.out"): + out_text = adjust_lines(outfile.read_text()) + phase_1 = outfile.with_suffix(".p1") + with phase_1.open('w') as phs1: + phs1.write(fill_to_width(out_text) + "\n") + errfile = outfile.with_suffix(".err") + if errfile.exists(): + phs1.write("___[ Error Output ]___\n") + phs1.write(fill_to_width(errfile.read_text()) + "\n") + phs1.write("*/\n") diff --git a/polymorphism/RTTI.java b/polymorphism/RTTI.java index 9532abe3..a5735765 100644 --- a/polymorphism/RTTI.java +++ b/polymorphism/RTTI.java @@ -39,5 +39,4 @@ ___[ Error Output ]___ Exception in thread "main" java.lang.ClassCastException: Useful cannot be cast to MoreUseful at RTTI.main(RTTI.java:31) -___[ Exception is Expected ]___ */ diff --git a/preferences/PreferencesDemo.java b/preferences/PreferencesDemo.java index 0b05105a..38638937 100644 --- a/preferences/PreferencesDemo.java +++ b/preferences/PreferencesDemo.java @@ -30,6 +30,12 @@ Location: Oz Footwear: Ruby Slippers Companions: 4 Are there witches?: true -UsageCount: 33 +UsageCount: 183 How many companions does Dorothy have? 4 +___[ Error Output ]___ +Jul 22, 2016 11:56:00 AM java.util.prefs.WindowsPreferences + +WARNING: Could not open/create prefs root node +Software\JavaSoft\Prefs at root 0x80000002. Windows +RegCreateKeyEx(...) returned error code 5. */ diff --git a/references/Compete.java b/references/Compete.java index e673b767..3539fdfb 100644 --- a/references/Compete.java +++ b/references/Compete.java @@ -81,6 +81,6 @@ public class Compete { } } /* Output: -Duplication via serialization: 202 Milliseconds -Duplication via cloning: 17 Milliseconds +Duplication via serialization: 296 Milliseconds +Duplication via cloning: 20 Milliseconds */ diff --git a/references/PassReferences.java b/references/PassReferences.java index 49348e2e..e5b03fdd 100644 --- a/references/PassReferences.java +++ b/references/PassReferences.java @@ -14,6 +14,6 @@ public class PassReferences { } } /* Output: -p inside main(): PassReferences@19e0bfd -h inside f(): PassReferences@19e0bfd +p inside main(): PassReferences@1db9742 +h inside f(): PassReferences@1db9742 */ diff --git a/serialization/AStoreCADState.java b/serialization/AStoreCADState.java index afcc799d..b0c20732 100644 --- a/serialization/AStoreCADState.java +++ b/serialization/AStoreCADState.java @@ -99,15 +99,15 @@ public class AStoreCADState { } } /* Output: -[class Circlecolor[3] xPos[58] yPos[55] dim[93] -, class Squarecolor[3] xPos[61] yPos[61] dim[29] -, class Linecolor[3] xPos[68] yPos[0] dim[22] -, class Circlecolor[3] xPos[7] yPos[88] dim[28] -, class Squarecolor[3] xPos[51] yPos[89] dim[9] -, class Linecolor[3] xPos[78] yPos[98] dim[61] -, class Circlecolor[3] xPos[20] yPos[58] dim[16] -, class Squarecolor[3] xPos[40] yPos[11] dim[22] -, class Linecolor[3] xPos[4] yPos[83] dim[6] -, class Circlecolor[3] xPos[75] yPos[10] dim[42] +[class Circlecolor[3] xPos[35] yPos[37] dim[41] +, class Squarecolor[3] xPos[20] yPos[77] dim[79] +, class Linecolor[3] xPos[56] yPos[68] dim[48] +, class Circlecolor[3] xPos[93] yPos[70] dim[7] +, class Squarecolor[3] xPos[0] yPos[25] dim[62] +, class Linecolor[3] xPos[34] yPos[50] dim[82] +, class Circlecolor[3] xPos[31] yPos[67] dim[66] +, class Squarecolor[3] xPos[54] yPos[21] dim[6] +, class Linecolor[3] xPos[63] yPos[39] dim[63] +, class Circlecolor[3] xPos[13] yPos[90] dim[92] ] */ diff --git a/serialization/Logon.java b/serialization/Logon.java index 5987b773..84aa3d57 100644 --- a/serialization/Logon.java +++ b/serialization/Logon.java @@ -42,11 +42,11 @@ public class Logon implements Serializable { /* Output: logon a = logon info: username: Hulk - date: Tue Dec 08 16:09:48 PST 2015 + date: Fri Jul 22 11:56:03 MDT 2016 password: myLittlePony -Recovering object at Tue Dec 08 16:09:49 PST 2015 +Recovering object at Fri Jul 22 11:56:04 MDT 2016 logon a = logon info: username: Hulk - date: Tue Dec 08 16:09:48 PST 2015 + date: Fri Jul 22 11:56:03 MDT 2016 password: null */ diff --git a/serialization/MyWorld.java b/serialization/MyWorld.java index d42f4ff5..2710b5c6 100644 --- a/serialization/MyWorld.java +++ b/serialization/MyWorld.java @@ -65,9 +65,9 @@ public class MyWorld { } } /* Output: -animals: [Bosco the dog[Animal@19e0bfd], House@139a55 -, Ralph the hamster[Animal@1db9742], House@139a55 -, Molly the cat[Animal@106d69c], House@139a55 +animals: [Bosco the dog[Animal@1db9742], House@106d69c +, Ralph the hamster[Animal@52e922], House@106d69c +, Molly the cat[Animal@25154f], House@106d69c ] animals1: [Bosco the dog[Animal@10bedb4], House@103dbd3 , Ralph the hamster[Animal@167cf4d], House@103dbd3 diff --git a/serialization/RecoverCADState.java b/serialization/RecoverCADState.java index e23d0bca..10bda437 100644 --- a/serialization/RecoverCADState.java +++ b/serialization/RecoverCADState.java @@ -24,15 +24,15 @@ public class RecoverCADState { } } /* Output: -[class Circlecolor[1] xPos[58] yPos[55] dim[93] -, class Squarecolor[0] xPos[61] yPos[61] dim[29] -, class Linecolor[3] xPos[68] yPos[0] dim[22] -, class Circlecolor[1] xPos[7] yPos[88] dim[28] -, class Squarecolor[0] xPos[51] yPos[89] dim[9] -, class Linecolor[3] xPos[78] yPos[98] dim[61] -, class Circlecolor[1] xPos[20] yPos[58] dim[16] -, class Squarecolor[0] xPos[40] yPos[11] dim[22] -, class Linecolor[3] xPos[4] yPos[83] dim[6] -, class Circlecolor[1] xPos[75] yPos[10] dim[42] +[class Circlecolor[1] xPos[35] yPos[37] dim[41] +, class Squarecolor[0] xPos[20] yPos[77] dim[79] +, class Linecolor[3] xPos[56] yPos[68] dim[48] +, class Circlecolor[1] xPos[93] yPos[70] dim[7] +, class Squarecolor[0] xPos[0] yPos[25] dim[62] +, class Linecolor[3] xPos[34] yPos[50] dim[82] +, class Circlecolor[1] xPos[31] yPos[67] dim[66] +, class Squarecolor[0] xPos[54] yPos[21] dim[6] +, class Linecolor[3] xPos[63] yPos[39] dim[63] +, class Circlecolor[1] xPos[13] yPos[90] dim[92] ] */ diff --git a/serialization/Worm.java b/serialization/Worm.java index 0b3d949f..e384494b 100644 --- a/serialization/Worm.java +++ b/serialization/Worm.java @@ -86,9 +86,9 @@ Worm constructor: 4 Worm constructor: 3 Worm constructor: 2 Worm constructor: 1 -w = :a(853):b(119):c(802):d(788):e(199):f(881) +w = :a(571):b(079):c(688):d(307):e(052):f(402) Worm storage -w2 = :a(853):b(119):c(802):d(788):e(199):f(881) +w2 = :a(571):b(079):c(688):d(307):e(052):f(402) Worm storage -w3 = :a(853):b(119):c(802):d(788):e(199):f(881) +w3 = :a(571):b(079):c(688):d(307):e(052):f(402) */ diff --git a/streams/ForEach.java b/streams/ForEach.java index ebc7ab7e..e890f6d7 100644 --- a/streams/ForEach.java +++ b/streams/ForEach.java @@ -23,6 +23,6 @@ public class ForEach { } /* Output: 258 555 693 861 961 429 868 200 522 207 288 128 551 589 -551 589 200 861 555 693 258 128 207 429 288 868 522 961 +551 589 200 522 868 861 288 128 207 555 429 693 961 258 258 555 693 861 961 429 868 200 522 207 288 128 551 589 */ diff --git a/strings/Conversion.java b/strings/Conversion.java index 242fcdae..857ca429 100644 --- a/strings/Conversion.java +++ b/strings/Conversion.java @@ -104,8 +104,8 @@ e: 1.795430e+02 h: 1ef462c y = new Conversion() b: true -s: Conversion@19e0bfd -h: 19e0bfd +s: Conversion@1db9742 +h: 1db9742 z = false b: false s: false diff --git a/strings/JGrep.java b/strings/JGrep.java index 93a6cc41..a0380d36 100644 --- a/strings/JGrep.java +++ b/strings/JGrep.java @@ -29,20 +29,6 @@ public class JGrep { } } /* Output: -0: String: 18 -1: String: 20 -2: String: 9 -3: String: 25 -4: String: 4 -5: for: 4 -6: String: 8 -7: return: 4 -8: String: 9 -9: String: 25 -10: String: 4 -11: String: 31 -12: for: 4 -13: String: 8 -14: return: 4 -15: String: 20 +0: for: 4 +1: for: 4 */ diff --git a/strings/TestRegularExpression.java b/strings/TestRegularExpression.java index 28257b7a..1570cde2 100644 --- a/strings/TestRegularExpression.java +++ b/strings/TestRegularExpression.java @@ -40,6 +40,4 @@ Match "abc" at positions 12-14 Regular expression: "(abc)+" Match "abcabcabc" at positions 0-8 Match "abc" at positions 12-14 -Regular expression: "(abc){2,}" -Match "abcabcabc" at positions 0-8 */ diff --git a/test_output.py b/test_output.py new file mode 100644 index 00000000..2f3f302f --- /dev/null +++ b/test_output.py @@ -0,0 +1,31 @@ +#! py -3 +# Requires Python 3.5 +# Validates output from executable Java programs in "On Java 8" +# (1) Extract output in Java file, keep whole file +# (2) If direct comparison of actual output with output stored in Java file fails: +# (3) Use chain of responsibility to successively try filters until one matches or all fail +from pathlib import Path +import re + + +if __name__ == '__main__': + find_output = re.compile(r"/\* (Output:.*)\*/", re.DOTALL) # should space be \s+ ?? + for outfile in Path(".").rglob("*.p1"): + javafile = outfile.with_suffix(".java") + if not javafile.exists(): + print(str(outfile) + " has no javafile") + javatext = javafile.read_text() + if "/* Output:" not in javatext: + print(str(outfile) + " has no /* Output:") + embedded_output = find_output.search(javatext).group(0).strip() + new_output = outfile.read_text().strip() + if new_output == embedded_output: + print(str(javafile)) + else: + with outfile.with_suffix(".nomatch").open('w') as nomatch: + nomatch.write(str(embedded_output) + "\n\n") + nomatch.write("=== Actual ===\n\n") + nomatch.write(str(new_output)) + print(" No Match ".center(45, "=")) + for nomatch in Path(".").rglob("*.nomatch"): + print(nomatch) diff --git a/threads/AtomicityTest.java b/threads/AtomicityTest.java index d7dab569..7fc53b62 100644 --- a/threads/AtomicityTest.java +++ b/threads/AtomicityTest.java @@ -29,5 +29,5 @@ public class AtomicityTest implements Runnable { } } /* Output: -73 +5 */ diff --git a/threads/BankTellerSimulation.java b/threads/BankTellerSimulation.java index 12b6231e..78517a89 100644 --- a/threads/BankTellerSimulation.java +++ b/threads/BankTellerSimulation.java @@ -198,18 +198,21 @@ public class BankTellerSimulation { } } /* Output: -[200][207] { T1 T0 } -[861][258][140][322] { T1 T0 } -[575][342][804][826][896] { T1 T0 } -[896][984][810][141][12][689][992][976][368] { T2 T0 T1 } +[768][193][807][125] { T1 T0 } +[125][634][682][267][954][506][639][213] { T2 T0 T1 } +[213][592][770][919][552][727][998][902] { T2 T0 T1 } +[552][727][998][902][769][373][313][683][177][526] { T3 T2 +T1 T0 } TellerManager interrupted -CustomerSupplier interrupted Teller 0 interrupted -Teller 2 interrupted -Teller 1 interrupted -Teller 2 terminating Teller 0 terminating +Teller 1 interrupted +Teller 3 interrupted +Teller 2 interrupted +CustomerSupplier interrupted CustomerSupplier terminating -TellerManager terminating +Teller 2 terminating +Teller 3 terminating Teller 1 terminating +TellerManager terminating */ diff --git a/threads/CachedThreadPool.java b/threads/CachedThreadPool.java index c458a5b8..b741930a 100644 --- a/threads/CachedThreadPool.java +++ b/threads/CachedThreadPool.java @@ -16,14 +16,14 @@ public class CachedThreadPool { } } /* Output: -SleepAndPrintTask[2] pool-1-thread-3 -SleepAndPrintTask[8] pool-1-thread-9 -SleepAndPrintTask[7] pool-1-thread-8 -SleepAndPrintTask[9] pool-1-thread-10 -SleepAndPrintTask[6] pool-1-thread-7 -SleepAndPrintTask[5] pool-1-thread-6 -SleepAndPrintTask[1] pool-1-thread-2 -SleepAndPrintTask[3] pool-1-thread-4 SleepAndPrintTask[0] pool-1-thread-1 +SleepAndPrintTask[5] pool-1-thread-6 +SleepAndPrintTask[8] pool-1-thread-9 SleepAndPrintTask[4] pool-1-thread-5 +SleepAndPrintTask[9] pool-1-thread-10 +SleepAndPrintTask[1] pool-1-thread-2 +SleepAndPrintTask[2] pool-1-thread-3 +SleepAndPrintTask[6] pool-1-thread-7 +SleepAndPrintTask[7] pool-1-thread-8 +SleepAndPrintTask[3] pool-1-thread-4 */ diff --git a/threads/CachedThreadPool2.java b/threads/CachedThreadPool2.java index 3ab693b8..7feb190a 100644 --- a/threads/CachedThreadPool2.java +++ b/threads/CachedThreadPool2.java @@ -16,14 +16,14 @@ public class CachedThreadPool2 { } } /* Output: -3 pool-1-thread-4 301 -7 pool-1-thread-8 684 -6 pool-1-thread-7 584 -5 pool-1-thread-6 527 -1 pool-1-thread-2 301 -2 pool-1-thread-3 301 -0 pool-1-thread-1 301 -4 pool-1-thread-5 401 -9 pool-1-thread-10 884 -8 pool-1-thread-9 784 +2 pool-1-thread-3 518 +1 pool-1-thread-2 518 +0 pool-1-thread-1 518 +6 pool-1-thread-7 618 +5 pool-1-thread-6 518 +4 pool-1-thread-5 518 +3 pool-1-thread-4 518 +9 pool-1-thread-10 918 +8 pool-1-thread-9 818 +7 pool-1-thread-8 718 */ diff --git a/threads/CachedThreadPool3.java b/threads/CachedThreadPool3.java index e5f693aa..1758ab63 100644 --- a/threads/CachedThreadPool3.java +++ b/threads/CachedThreadPool3.java @@ -33,15 +33,15 @@ public class CachedThreadPool3 { } } /* Output: -0 pool-1-thread-1 100 -6 pool-1-thread-7 100 -5 pool-1-thread-6 100 3 pool-1-thread-4 100 -4 pool-1-thread-5 100 +5 pool-1-thread-6 100 +6 pool-1-thread-7 100 +1 pool-1-thread-2 100 2 pool-1-thread-3 100 7 pool-1-thread-8 100 8 pool-1-thread-9 100 -1 pool-1-thread-2 100 +4 pool-1-thread-5 100 +0 pool-1-thread-1 100 9 pool-1-thread-10 100 sum = 1000 */ diff --git a/threads/CaptureUncaughtException.java b/threads/CaptureUncaughtException.java index edc76cad..e00e7c68 100644 --- a/threads/CaptureUncaughtException.java +++ b/threads/CaptureUncaughtException.java @@ -47,13 +47,14 @@ public class CaptureUncaughtException { } } /* Output: -HandlerThreadFactory@10dea4e creating new Thread -created Thread[Thread-0,5,main] -eh = MyUncaughtExceptionHandler@647e05 -run() by Thread[Thread-0,5,main] -eh = MyUncaughtExceptionHandler@647e05 -HandlerThreadFactory@10dea4e creating new Thread +HandlerThreadFactory@14991ad creating new Thread created Thread[Thread-1,5,main] -eh = MyUncaughtExceptionHandler@c34ec2 +eh = MyUncaughtExceptionHandler@d93b30 +run() by Thread-1 +eh = MyUncaughtExceptionHandler@d93b30 +HandlerThreadFactory@14991ad creating new Thread +created Thread[Thread-2,5,main] +eh = MyUncaughtExceptionHandler@28e402 caught java.lang.RuntimeException +TimedAbort 4 */ diff --git a/threads/CarBuilder.java b/threads/CarBuilder.java index cbe39f53..bd89b8ea 100644 --- a/threads/CarBuilder.java +++ b/threads/CarBuilder.java @@ -221,15 +221,15 @@ public class CarBuilder { /* Output: ChassisBuilder created Car 0 [ engine: false driveTrain: false wheels: false ] -WheelRobot installing Wheels EngineRobot installing engine +WheelRobot installing Wheels DriveTrainRobot installing DriveTrain Car 0 [ engine: true driveTrain: true wheels: true ] ChassisBuilder created Car 1 [ engine: false driveTrain: false wheels: false ] EngineRobot installing engine -DriveTrainRobot installing DriveTrain WheelRobot installing Wheels +DriveTrainRobot installing DriveTrain Car 1 [ engine: true driveTrain: true wheels: true ] ChassisBuilder created Car 2 [ engine: false driveTrain: false wheels: false ] @@ -239,33 +239,33 @@ WheelRobot installing Wheels Car 2 [ engine: true driveTrain: true wheels: true ] ChassisBuilder created Car 3 [ engine: false driveTrain: false wheels: false ] -DriveTrainRobot installing DriveTrain EngineRobot installing engine WheelRobot installing Wheels +DriveTrainRobot installing DriveTrain Car 3 [ engine: true driveTrain: true wheels: true ] ChassisBuilder created Car 4 [ engine: false driveTrain: false wheels: false ] EngineRobot installing engine -WheelRobot installing Wheels DriveTrainRobot installing DriveTrain +WheelRobot installing Wheels Car 4 [ engine: true driveTrain: true wheels: true ] ChassisBuilder created Car 5 [ engine: false driveTrain: false wheels: false ] +EngineRobot installing engine DriveTrainRobot installing DriveTrain WheelRobot installing Wheels -EngineRobot installing engine Car 5 [ engine: true driveTrain: true wheels: true ] ChassisBuilder created Car 6 [ engine: false driveTrain: false wheels: false ] EngineRobot installing engine -DriveTrainRobot installing DriveTrain WheelRobot installing Wheels +DriveTrainRobot installing DriveTrain Car 6 [ engine: true driveTrain: true wheels: true ] ChassisBuilder created Car 7 [ engine: false driveTrain: false wheels: false ] EngineRobot installing engine -DriveTrainRobot installing DriveTrain WheelRobot installing Wheels +DriveTrainRobot installing DriveTrain Car 7 [ engine: true driveTrain: true wheels: true ] ChassisBuilder created Car 8 [ engine: false driveTrain: false wheels: false ] @@ -281,20 +281,32 @@ EngineRobot installing engine Car 9 [ engine: true driveTrain: true wheels: true ] ChassisBuilder created Car 10 [ engine: false driveTrain: false wheels: false ] +WheelRobot installing Wheels +DriveTrainRobot installing DriveTrain +EngineRobot installing engine +Car 10 [ engine: true driveTrain: true wheels: true ] +ChassisBuilder created Car 11 [ engine: false driveTrain: +false wheels: false ] DriveTrainRobot installing DriveTrain WheelRobot installing Wheels EngineRobot installing engine -Car 10 [ engine: true driveTrain: true wheels: true ] +Car 11 [ engine: true driveTrain: true wheels: true ] +ChassisBuilder created Car 12 [ engine: false driveTrain: +false wheels: false ] +DriveTrainRobot installing DriveTrain +WheelRobot installing Wheels +EngineRobot installing engine +Car 12 [ engine: true driveTrain: true wheels: true ] Exiting Reporter via interrupt -Exiting EngineRobot via interrupt -Interrupted: ChassisBuilder -Exiting WheelRobot via interrupt -Exiting DriveTrainRobot via interrupt -Exiting Assembler via interrupt -Assembler off -DriveTrainRobot off -WheelRobot off -ChassisBuilder off -EngineRobot off Reporter off +Exiting EngineRobot via interrupt +EngineRobot off +Exiting DriveTrainRobot via interrupt +Exiting WheelRobot via interrupt +Interrupted: ChassisBuilder +Exiting Assembler via interrupt +ChassisBuilder off +WheelRobot off +DriveTrainRobot off +Assembler off */ diff --git a/threads/CountingStream.java b/threads/CountingStream.java index e5f27a77..cfcb92bc 100644 --- a/threads/CountingStream.java +++ b/threads/CountingStream.java @@ -17,15 +17,15 @@ public class CountingStream { } } /* Output: -1 ForkJoinPool.commonPool-worker-3 100 -4 ForkJoinPool.commonPool-worker-5 100 -3 ForkJoinPool.commonPool-worker-3 100 -5 ForkJoinPool.commonPool-worker-5 100 -0 ForkJoinPool.commonPool-worker-6 100 -8 ForkJoinPool.commonPool-worker-2 100 -7 ForkJoinPool.commonPool-worker-4 100 -9 ForkJoinPool.commonPool-worker-7 100 +0 ForkJoinPool.commonPool-worker-4 100 +4 ForkJoinPool.commonPool-worker-3 100 +3 ForkJoinPool.commonPool-worker-5 100 6 main 100 +8 ForkJoinPool.commonPool-worker-6 100 +5 ForkJoinPool.commonPool-worker-7 100 2 ForkJoinPool.commonPool-worker-1 100 +1 ForkJoinPool.commonPool-worker-2 100 +9 ForkJoinPool.commonPool-worker-3 100 +7 ForkJoinPool.commonPool-worker-4 100 1000 */ diff --git a/threads/CriticalSection.java b/threads/CriticalSection.java index 922a9e03..18f04b17 100644 --- a/threads/CriticalSection.java +++ b/threads/CriticalSection.java @@ -148,6 +148,5 @@ public class CriticalSection { } } /* Output: -pm1: Pair: x: 15, y: 15 checkCounter = 272565 -pm2: Pair: x: 16, y: 16 checkCounter = 3956974 +TimedAbort 4 */ diff --git a/threads/DeadlockingDiningPhilosophers.java b/threads/DeadlockingDiningPhilosophers.java index d9464cd1..779f5c1a 100644 --- a/threads/DeadlockingDiningPhilosophers.java +++ b/threads/DeadlockingDiningPhilosophers.java @@ -32,25 +32,25 @@ public class DeadlockingDiningPhilosophers { } } /* Output: (First and Last 10 Lines) +Philosopher 2 thinking +Philosopher 3 thinking +Philosopher 3 grabbing right +Philosopher 3 grabbing left +Philosopher 3 eating Philosopher 1 thinking Philosopher 1 grabbing right Philosopher 1 grabbing left -Philosopher 1 eating -Philosopher 1 thinking -Philosopher 3 thinking Philosopher 4 thinking -Philosopher 2 thinking -Philosopher 1 grabbing right Philosopher 0 thinking -________...________...________...________...________ -Philosopher 3 grabbing left +...________...________...________...________... +Philosopher 0 grabbing right +Philosopher 1 grabbing right +Philosopher 1 grabbing left Philosopher 2 grabbing left Philosopher 0 grabbing left -Philosopher 4 grabbing left -Philosopher 1 grabbing left -Philosopher 3 exiting via interrupt -Philosopher 4 exiting via interrupt Philosopher 1 exiting via interrupt Philosopher 0 exiting via interrupt +Philosopher 3 exiting via interrupt +Philosopher 4 exiting via interrupt Philosopher 2 exiting via interrupt */ diff --git a/threads/DelayQueueDemo.java b/threads/DelayQueueDemo.java index 5ca8ee09..89ad75dc 100644 --- a/threads/DelayQueueDemo.java +++ b/threads/DelayQueueDemo.java @@ -91,15 +91,15 @@ public class DelayQueueDemo { } } /* Output: -[128 ] Task 11 [200 ] Task 7 [429 ] Task 5 [520 ] Task 18 -[555 ] Task 1 [961 ] Task 4 [998 ] Task 16 [1207] Task 9 -[1693] Task 2 [1809] Task 14 [1861] Task 3 [2278] Task 15 -[3288] Task 10 [3551] Task 12 [4258] Task 0 [4258] Task 19 -[4522] Task 8 [4589] Task 13 [4861] Task 17 [4868] Task 6 -(0:4258) (1:555) (2:1693) (3:1861) (4:961) (5:429) (6:4868) -(7:200) (8:4522) (9:1207) (10:3288) (11:128) (12:3551) -(13:4589) (14:1809) (15:2278) (16:998) (17:4861) (18:520) -(19:4258) (20:5000) +[70 ] Task 10 [125 ] Task 13 [267 ] Task 19 [635 ] Task 0 +[650 ] Task 16 [682 ] Task 17 [807 ] Task 11 [1131] Task 18 +[1177] Task 4 [1193] Task 9 [1634] Task 15 [1656] Task 6 +[2400] Task 12 [3479] Task 5 [3737] Task 1 [3768] Task 7 +[3941] Task 2 [4720] Task 3 [4762] Task 14 [4948] Task 8 +(0:635) (1:3737) (2:3941) (3:4720) (4:1177) (5:3479) +(6:1656) (7:3768) (8:4948) (9:1193) (10:70) (11:807) +(12:2400) (13:125) (14:4762) (15:1634) (16:650) (17:682) +(18:1131) (19:267) (20:5000) [5000] Task 20 Calling shutdownNow() Finished DelayedTaskConsumer */ diff --git a/threads/EvenSupplier.java b/threads/EvenSupplier.java index 97f792ba..89d8ead8 100644 --- a/threads/EvenSupplier.java +++ b/threads/EvenSupplier.java @@ -20,7 +20,8 @@ public class EvenSupplier extends IntSupplier { } /* Output: Press Control-C to exit -1305 not even! -1307 not even! -1303 not even! +23 not even! +27 not even! +25 not even! +TimedAbort 4 */ diff --git a/threads/ExplicitCriticalSection.java b/threads/ExplicitCriticalSection.java index 21bc41bf..28f04440 100644 --- a/threads/ExplicitCriticalSection.java +++ b/threads/ExplicitCriticalSection.java @@ -52,32 +52,28 @@ public class ExplicitCriticalSection { } } /* Output: -pm1: Pair: x: 10, y: 10 checkCounter = 2193118 -pm2: Pair: x: 10, y: 10 checkCounter = 2184256 +pm1: Pair: x: 10, y: 10 checkCounter = 3504848 +pm2: Pair: x: 10, y: 10 checkCounter = 2105413 ___[ Error Output ]___ -Exception in thread "pool-1-thread-4" Exception in thread -"pool-1-thread-3" -concurrency.Pair$PairValuesNotEqualException: Pair values -not equal: x: 2, y: 1 +Exception in thread "pool-1-thread-3" Exception in thread +"pool-1-thread-4" threads.Pair$PairValuesNotEqualException: +Pair values not equal: x: 3, y: 2 + at threads.Pair.checkState(CriticalSection.java:37) at -concurrency.Pair.checkState(CriticalSection.java:36) - at -concurrency.PairChecker.run(CriticalSection.java:110) +threads.PairChecker.run(CriticalSection.java:111) at java.util.concurrent.ThreadPoolExecutor.runWorke r(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.r un(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) -concurrency.Pair$PairValuesNotEqualException: Pair values -not equal: x: 2, y: 1 +threads.Pair$PairValuesNotEqualException: Pair values not +equal: x: 3, y: 2 + at threads.Pair.checkState(CriticalSection.java:37) at -concurrency.Pair.checkState(CriticalSection.java:36) - at -concurrency.PairChecker.run(CriticalSection.java:110) +threads.PairChecker.run(CriticalSection.java:111) at java.util.concurrent.ThreadPoolExecutor.runWorke r(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.r un(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) -___[ Exception is Expected ]___ */ diff --git a/threads/FixedDiningPhilosophers.java b/threads/FixedDiningPhilosophers.java index 279e587f..8282d947 100644 --- a/threads/FixedDiningPhilosophers.java +++ b/threads/FixedDiningPhilosophers.java @@ -36,25 +36,25 @@ public class FixedDiningPhilosophers { } } /* Output: (First and Last 10 Lines) +Philosopher 0 thinking Philosopher 4 thinking Philosopher 3 thinking -Philosopher 0 thinking Philosopher 2 thinking Philosopher 1 thinking -Philosopher 4 grabbing right -Philosopher 1 grabbing right -Philosopher 2 grabbing right -Philosopher 2 grabbing left Philosopher 0 grabbing right -________...________...________...________...________ +Philosopher 0 grabbing left +Philosopher 0 eating +Philosopher 3 grabbing right Philosopher 2 grabbing right -Philosopher 1 exiting via interrupt -Philosopher 0 exiting via interrupt -Philosopher 3 exiting via interrupt +...________...________...________...________... +Philosopher 4 thinking +Philosopher 3 grabbing left +Philosopher 3 eating +Philosopher 0 eating Philosopher 4 grabbing right -Philosopher 2 grabbing left -Philosopher 4 grabbing left -Philosopher 2 exiting via interrupt -Philosopher 4 eating +Philosopher 3 exiting via interrupt +Philosopher 0 exiting via interrupt +Philosopher 1 exiting via interrupt Philosopher 4 exiting via interrupt +Philosopher 2 exiting via interrupt */ diff --git a/threads/GreenhouseScheduler.java b/threads/GreenhouseScheduler.java index d6f5876b..e06e3617 100644 --- a/threads/GreenhouseScheduler.java +++ b/threads/GreenhouseScheduler.java @@ -174,29 +174,29 @@ Thermostat to night setting Turning on lights Turning off lights Turning greenhouse water on -Turning on lights Turning greenhouse water off Thermostat to day setting Turning on lights -Turning off lights -________...________...________...________...________ Turning on lights -Mon Jun 15 16:00:00 PDT 2015 temperature: 66.4 humidity: -50.05 -Mon Jun 15 16:30:00 PDT 2015 temperature: 68.0 humidity: -50.47 -Mon Jun 15 17:00:00 PDT 2015 temperature: 69.7 humidity: -51.42 -Mon Jun 15 17:30:00 PDT 2015 temperature: 70.8 humidity: -50.87 -Mon Jun 15 18:00:00 PDT 2015 temperature: 72.0 humidity: -50.32 -Mon Jun 15 18:30:00 PDT 2015 temperature: 73.2 humidity: -49.92 -Mon Jun 15 19:00:00 PDT 2015 temperature: 71.9 humidity: -49.81 -Mon Jun 15 19:30:00 PDT 2015 temperature: 70.1 humidity: -50.25 -Mon Jun 15 20:00:00 PDT 2015 temperature: 68.9 humidity: -51.00 +Turning off lights +...________...________...________...________... +Terminating +Fri Jul 22 12:00:00 MDT 2016 temperature: 66.3 humidity: +50.20 +Fri Jul 22 12:30:00 MDT 2016 temperature: 67.3 humidity: +51.02 +Fri Jul 22 13:00:00 MDT 2016 temperature: 68.8 humidity: +51.82 +Fri Jul 22 13:30:00 MDT 2016 temperature: 70.0 humidity: +52.19 +Fri Jul 22 14:00:00 MDT 2016 temperature: 71.5 humidity: +52.99 +Fri Jul 22 14:30:00 MDT 2016 temperature: 73.0 humidity: +53.32 +Fri Jul 22 15:00:00 MDT 2016 temperature: 74.4 humidity: +53.99 +Fri Jul 22 15:30:00 MDT 2016 temperature: 75.5 humidity: +54.40 +Fri Jul 22 16:00:00 MDT 2016 temperature: 76.8 humidity: +53.96 */ diff --git a/threads/HorseRace.java b/threads/HorseRace.java index fe8aa97a..4dd903f8 100644 --- a/threads/HorseRace.java +++ b/threads/HorseRace.java @@ -91,56 +91,57 @@ public class HorseRace { /* Output: (First and Last 18 Lines) =========================================================== ================ -*0 +0 **1 +2 +*3 +**4 +**5 +*6 +=========================================================== +================ +**0 +****1 *2 **3 -**4 -*5 -**6 -=========================================================== -================ -***0 -**1 -*2 -***3 ***4 -*5 -**6 +****5 +*6 =========================================================== ================ -*****0 -________...________...________...________...________ -*****************************************************6 +**0 +...________...________...________...________... +*********************************************************** +6 =========================================================== ================ *********************************************************** -*0 +************0 *********************************************************** -1 +*********1 *********************************************************** -*2 +****2 *********************************************************** **************3 *********************************************************** -4 +**4 +******************************************************5 *********************************************************** -***********5 -*******************************************************6 +**6 =========================================================== ================ *********************************************************** -**0 +*************0 *********************************************************** -**1 +**********1 *********************************************************** -**2 +****2 *********************************************************** ****************3 *********************************************************** -*4 +****4 +********************************************************5 *********************************************************** -*************5 -********************************************************6 +****6 Horse 3 won! */ diff --git a/threads/MoreTasksAfterShutdown.java b/threads/MoreTasksAfterShutdown.java index 6ee70849..53a2d212 100644 --- a/threads/MoreTasksAfterShutdown.java +++ b/threads/MoreTasksAfterShutdown.java @@ -20,10 +20,10 @@ public class MoreTasksAfterShutdown { } } /* Output: -java.util.concurrent.RejectedExecutionException: -Task SleepAndPrintTask[99] rejected from -java.util.concurrent.ThreadPoolExecutor@25154f[ -Shutting down, pool size = 1, active threads = 1, -queued tasks = 0, completed tasks = 0] +java.util.concurrent.RejectedExecutionException: Task +SleepAndPrintTask[99] rejected from +java.util.concurrent.ThreadPoolExecutor@25154f[Shutting +down, pool size = 1, active threads = 1, queued tasks = 0, +completed tasks = 0] SleepAndPrintTask[1] pool-1-thread-1 */ diff --git a/threads/ParallelStreamPuzzle2.java b/threads/ParallelStreamPuzzle2.java index 8641906d..bcf17e41 100644 --- a/threads/ParallelStreamPuzzle2.java +++ b/threads/ParallelStreamPuzzle2.java @@ -30,4 +30,5 @@ public class ParallelStreamPuzzle2 { } } /* Output: +[29, 30, 31, 33, 35, 36, 37, 38, 39, 91] */ diff --git a/threads/ParallelStreamPuzzle3.java b/threads/ParallelStreamPuzzle3.java index c039e30e..7eabf812 100644 --- a/threads/ParallelStreamPuzzle3.java +++ b/threads/ParallelStreamPuzzle3.java @@ -18,15 +18,15 @@ public class ParallelStreamPuzzle3 { } } /* Output: -1: ForkJoinPool.commonPool-worker-3 -2: ForkJoinPool.commonPool-worker-6 -4: ForkJoinPool.commonPool-worker-1 -3: ForkJoinPool.commonPool-worker-7 -8: main -0: ForkJoinPool.commonPool-worker-4 6: ForkJoinPool.commonPool-worker-5 +3: ForkJoinPool.commonPool-worker-7 +2: ForkJoinPool.commonPool-worker-6 +0: ForkJoinPool.commonPool-worker-4 +4: ForkJoinPool.commonPool-worker-1 +1: ForkJoinPool.commonPool-worker-3 +8: main +7: ForkJoinPool.commonPool-worker-7 +5: ForkJoinPool.commonPool-worker-5 9: ForkJoinPool.commonPool-worker-2 -7: ForkJoinPool.commonPool-worker-6 -5: ForkJoinPool.commonPool-worker-3 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] */ diff --git a/threads/PriorityBlockingQueueDemo.java b/threads/PriorityBlockingQueueDemo.java index 616ece02..e6caac95 100644 --- a/threads/PriorityBlockingQueueDemo.java +++ b/threads/PriorityBlockingQueueDemo.java @@ -128,24 +128,24 @@ public class PriorityBlockingQueueDemo { } } /* Output: (First and Last 12 Lines) -[8 ] Task 0 [9 ] Task 5 -[9 ] Task 13 -[9 ] Task 14 -[8 ] Task 10 -[8 ] Task 16 -[8 ] Task 19 -[8 ] Task 11 -[8 ] Task 6 -[8 ] Task 15 -[7 ] Task 9 -[5 ] Task 1 -________...________...________...________...________ -[0 ] Task 30 -(0:8)(1:5)(2:3)(3:1)(4:1) -(5:9)(6:8)(7:0)(8:2)(9:7) -(10:8)(11:8)(12:1)(13:9)(14:9) -(15:8)(16:8)(17:1)(18:0)(19:8) +[8 ] Task 7 +[10 ] Task 20 +[8 ] Task 8 +[10 ] Task 21 +[7 ] Task 19 +[10 ] Task 22 +[7 ] Task 11 +[10 ] Task 23 +[7 ] Task 4 +[10 ] Task 24 +[7 ] Task 1 +...________...________...________...________... +[0 ] Task 16 +(0:5)(1:7)(2:1)(3:0)(4:7) +(5:9)(6:6)(7:8)(8:8)(9:3) +(10:0)(11:7)(12:0)(13:5)(14:2) +(15:4)(16:0)(17:2)(18:1)(19:7) (20:10)(21:10)(22:10)(23:10)(24:10) (25:10)(26:10)(27:10)(28:10)(29:10) (30:0)(31:1)(32:2)(33:3)(34:4) diff --git a/threads/SerialNumberChecker.java b/threads/SerialNumberChecker.java index 55d3caf5..fcb4d0f0 100644 --- a/threads/SerialNumberChecker.java +++ b/threads/SerialNumberChecker.java @@ -65,6 +65,5 @@ public class SerialNumberChecker { } } /* Output: -Duplicate: 5453 -Duplicate: 5639 +Duplicate: 5178 */ diff --git a/threads/SettingDefaultHandler.java b/threads/SettingDefaultHandler.java index eb027d41..708a4f58 100644 --- a/threads/SettingDefaultHandler.java +++ b/threads/SettingDefaultHandler.java @@ -16,4 +16,5 @@ public class SettingDefaultHandler { } /* Output: caught java.lang.RuntimeException +TimedAbort 4 */ diff --git a/threads/SingleThreadExecutor.java b/threads/SingleThreadExecutor.java index 8061310e..ef944679 100644 --- a/threads/SingleThreadExecutor.java +++ b/threads/SingleThreadExecutor.java @@ -29,22 +29,22 @@ All tasks submitted main awaiting termination main awaiting termination SleepAndPrintTask[0] pool-1-thread-1 -main awaiting termination SleepAndPrintTask[1] pool-1-thread-1 -SleepAndPrintTask[2] pool-1-thread-1 main awaiting termination +main awaiting termination +SleepAndPrintTask[2] pool-1-thread-1 SleepAndPrintTask[3] pool-1-thread-1 main awaiting termination main awaiting termination SleepAndPrintTask[4] pool-1-thread-1 main awaiting termination SleepAndPrintTask[5] pool-1-thread-1 -main awaiting termination SleepAndPrintTask[6] pool-1-thread-1 main awaiting termination -SleepAndPrintTask[7] pool-1-thread-1 main awaiting termination +SleepAndPrintTask[7] pool-1-thread-1 SleepAndPrintTask[8] pool-1-thread-1 main awaiting termination +main awaiting termination SleepAndPrintTask[9] pool-1-thread-1 */ diff --git a/threads/Summing.java b/threads/Summing.java index b763df47..4938d083 100644 --- a/threads/Summing.java +++ b/threads/Summing.java @@ -44,7 +44,7 @@ public class Summing { } /* Output: 5000000050000000 -Sum Stream: 625ms -Sum Stream Parallel: 158ms -Sum Iterated: 2521ms +Sum Stream: 629ms +Sum Stream Parallel: 167ms +Sum Iterated: 2537ms */ diff --git a/threads/Summing2.java b/threads/Summing2.java index 4fb79d71..9b3fcf73 100644 --- a/threads/Summing2.java +++ b/threads/Summing2.java @@ -36,8 +36,8 @@ public class Summing2 { } /* Output: 200000010000000 -Array Stream Sum: 114ms -Parallel: 27ms +Array Stream Sum: 111ms +Parallel: 26ms Basic Sum: 33ms -parallelPrefix: 49ms +parallelPrefix: 50ms */ diff --git a/threads/Summing3.java b/threads/Summing3.java index 69a4314b..ad4d240f 100644 --- a/threads/Summing3.java +++ b/threads/Summing3.java @@ -35,7 +35,7 @@ public class Summing3 { } /* Output: 50000005000000 -Long Array Stream Reduce: 1046ms +Long Array Stream Reduce: 1142ms Long Basic Sum: 21ms -Long parallelPrefix: 3287ms +Long parallelPrefix: 3571ms */ diff --git a/threads/Summing4.java b/threads/Summing4.java index 99ec194e..175d3acf 100644 --- a/threads/Summing4.java +++ b/threads/Summing4.java @@ -16,5 +16,5 @@ public class Summing4 { } /* Output: 50000005000000 -Long Parallel: 1008ms +Long Parallel: 978ms */ diff --git a/threads/SyncObject.java b/threads/SyncObject.java index be7424e1..79ae1d3e 100644 --- a/threads/SyncObject.java +++ b/threads/SyncObject.java @@ -35,14 +35,14 @@ public class SyncObject { } } /* Output: -f() +g() +g() +g() g() g() f() -g() -f() -g() f() f() -g() +f() +f() */ diff --git a/threads/ToastOMatic.java b/threads/ToastOMatic.java index e3e48458..97d85dff 100644 --- a/threads/ToastOMatic.java +++ b/threads/ToastOMatic.java @@ -193,20 +193,12 @@ Toast 12: DRY Toast 12: BUTTERED Toast 12: JAMMED Chomp! Toast 12: JAMMED -Toast 13: DRY -Toast 13: BUTTERED -Toast 13: JAMMED -Chomp! Toast 13: JAMMED -Toast 14: DRY -Toast 14: BUTTERED -Toast 14: JAMMED -Chomp! Toast 14: JAMMED -Jammer interrupted -Jammer off -Butterer interrupted -Butterer off -Toaster interrupted Eater interrupted +Butterer interrupted +Toaster interrupted Toaster off +Jammer interrupted +Butterer off Eater off +Jammer off */ diff --git a/threads/WorkStealingPool.java b/threads/WorkStealingPool.java index a84d47b4..65007468 100644 --- a/threads/WorkStealingPool.java +++ b/threads/WorkStealingPool.java @@ -25,15 +25,15 @@ public class WorkStealingPool { } } /* Output: -4 +8 ForkJoinPool-1-worker-1 +ForkJoinPool-1-worker-2 +ForkJoinPool-1-worker-3 +ForkJoinPool-1-worker-3 +ForkJoinPool-1-worker-3 +ForkJoinPool-1-worker-4 +ForkJoinPool-1-worker-5 ForkJoinPool-1-worker-3 ForkJoinPool-1-worker-2 ForkJoinPool-1-worker-1 -ForkJoinPool-1-worker-3 -ForkJoinPool-1-worker-0 -ForkJoinPool-1-worker-1 -ForkJoinPool-1-worker-2 -ForkJoinPool-1-worker-0 -ForkJoinPool-1-worker-3 */ diff --git a/threads/restaurant2/RestaurantWithQueues.java b/threads/restaurant2/RestaurantWithQueues.java index 7b5083e9..beb3a12a 100644 --- a/threads/restaurant2/RestaurantWithQueues.java +++ b/threads/restaurant2/RestaurantWithQueues.java @@ -207,25 +207,25 @@ public class RestaurantWithQueues { } } /* Output: (First and Last 10 Lines) -WaitPerson 0 received SPRING_ROLLS delivering to Customer 1 +WaitPerson 0 received SALAD delivering to Customer 0 +Customer 0 eating SALAD +WaitPerson 2 received SPRING_ROLLS delivering to Customer 1 Customer 1 eating SPRING_ROLLS -WaitPerson 3 received SPRING_ROLLS delivering to Customer 0 -Customer 0 eating SPRING_ROLLS -WaitPerson 3 received SOUP delivering to Customer 2 +WaitPerson 1 received SOUP delivering to Customer 2 Customer 2 eating SOUP -WaitPerson 0 received VINDALOO delivering to Customer 1 -Customer 1 eating VINDALOO -WaitPerson 1 received SOUP delivering to Customer 3 -Customer 3 eating SOUP -________...________...________...________...________ -WaitPerson 3 off duty -Customer 6 finished meal, leaving -WaitPerson 4 off duty -Customer 42 finished meal, leaving +WaitPerson 0 received LENTILS delivering to Customer 0 +Customer 0 eating LENTILS +WaitPerson 0 received SPRING_ROLLS delivering to Customer 3 +Customer 3 eating SPRING_ROLLS +...________...________...________...________... +WaitPerson 0 off duty +Customer 46 finished meal, leaving +Customer 37 finished meal, leaving +Customer 31 finished meal, leaving +Customer 1 finished meal, leaving +Customer 3 finished meal, leaving +Customer 17 finished meal, leaving +Customer 12 finished meal, leaving +Customer 4 finished meal, leaving Customer 7 finished meal, leaving -Customer 28 finished meal, leaving -Customer 9 finished meal, leaving -Customer 15 finished meal, leaving -Customer 21 finished meal, leaving -Customer 0 finished meal, leaving */ diff --git a/typeinfo/PetCount3.java b/typeinfo/PetCount3.java index efd157d9..74291dc4 100644 --- a/typeinfo/PetCount3.java +++ b/typeinfo/PetCount3.java @@ -53,6 +53,6 @@ public class PetCount3 { Rat Manx Cymric Mutt Pug Cymric Pug Manx Cymric Rat EgyptianMau Hamster EgyptianMau Mutt Mutt Cymric Mouse Pug Mouse Cymric -{Pet=20, Dog=6, Cat=9, Rodent=5, Mutt=3, Pug=3, -EgyptianMau=2, Manx=7, Cymric=5, Rat=2, Mouse=2, Hamster=1} +{Hamster=1, Rodent=5, Mouse=2, Dog=6, Cymric=5, Manx=7, +Rat=2, Pug=3, Mutt=3, Pet=20, EgyptianMau=2, Cat=9} */ diff --git a/typeinfo/PetCount4.java b/typeinfo/PetCount4.java index 5f1197e8..2112db6a 100644 --- a/typeinfo/PetCount4.java +++ b/typeinfo/PetCount4.java @@ -20,6 +20,6 @@ public class PetCount4 { Rat Manx Cymric Mutt Pug Cymric Pug Manx Cymric Rat EgyptianMau Hamster EgyptianMau Mutt Mutt Cymric Mouse Pug Mouse Cymric -{Mutt=3, Rat=2, EgyptianMau=2, Pet=20, Mouse=2, Manx=7, -Cat=9, Rodent=5, Cymric=5, Dog=6, Pug=3, Hamster=1} +{EgyptianMau=2, Hamster=1, Pug=3, Manx=7, Cymric=5, Dog=6, +Mutt=3, Rat=2, Mouse=2, Rodent=5, Pet=20, Cat=9} */ diff --git a/update_extracted_example_output.py b/update_extracted_example_output.py new file mode 100644 index 00000000..3e21c283 --- /dev/null +++ b/update_extracted_example_output.py @@ -0,0 +1,35 @@ +#! py -3 +# Requires Python 3.5 +# Updates generated output into extracted Java programs in "On Java 8" +from pathlib import Path +import pprint +import sys + +def remove_output(javatext): + result = "" + for line in javatext.splitlines(): + if "/* Output:" not in line: + result += line.rstrip() + "\n" + else: + return result + +def update_file(outfile): + print(str(outfile)) + javafile = outfile.with_suffix(".java") + if not javafile.exists(): + print(str(outfile) + " has no javafile") + sys.exit(1) + javatext = javafile.read_text() + if "/* Output:" not in javatext: + print(str(javafile) + " has no /* Output:") + sys.exit(1) + new_output = outfile.read_text() + new_javatext = remove_output(javatext) + new_output + javafile.write_text(new_javatext) + +if __name__ == '__main__': + if len(sys.argv) > 1: + update_file(Path(sys.argv[1])) + else: + for outfile in Path(".").rglob("*.p1"): + update_file(outfile)