From 7d995056ff9fda832d4754d6f7eca088d7bb7359 Mon Sep 17 00:00:00 2001 From: NooBxGockeL Date: Sat, 26 Nov 2016 12:51:06 +0100 Subject: [PATCH] Update URM Version to 1.4.4 and regenerated all puml files --- .../etc/abstract-document.urm.puml | 42 ++-- .../etc/abstract-factory.urm.puml | 65 +++---- adapter/etc/adapter.urm.puml | 14 +- .../etc/aggregator-service.urm.puml | 32 ++-- .../etc/inventory-microservice.urm.puml | 8 +- api-gateway/etc/api-gateway-service.urm.puml | 44 ++--- .../etc/async-method-invocation.urm.puml | 15 +- bridge/etc/bridge.urm.puml | 103 +++++----- builder/etc/builder.urm.puml | 108 +++++------ .../etc/business-delegate.urm.puml | 32 ++-- caching/etc/caching.urm.puml | 106 ++++++----- callback/etc/callback.urm.puml | 23 ++- chain/etc/chain.urm.puml | 31 +-- command/etc/command.urm.puml | 56 +++--- composite/etc/composite.urm.puml | 33 ++-- dao/etc/dao.urm.puml | 66 +++---- data-mapper/etc/data-mapper.urm.puml | 12 +- decorator/etc/decorator.urm.puml | 35 ++-- delegation/etc/delegation.urm.puml | 21 +- .../etc/dependency-injection.urm.puml | 37 ++-- .../etc/double-checked-locking.urm.puml | 2 + double-dispatch/etc/double-dispatch.urm.puml | 45 +++-- .../etc/event-aggregator.urm.puml | 53 +++--- .../etc/event-asynchronous.urm.puml | 29 +-- .../etc/event-driven-architecture.urm.puml | 14 +- execute-around/etc/execute-around.urm.puml | 6 +- facade/etc/facade.urm.puml | 35 ++-- factory-kit/etc/factory-kit.urm.puml | 33 ++-- factory-method/etc/factory-method.urm.puml | 35 ++-- feature-toggle/etc/feature-toggle.urm.puml | 1 + fluentinterface/etc/fluentinterface.urm.puml | 1 + flux/etc/flux.urm.puml | 84 ++++---- flyweight/etc/flyweight.urm.puml | 50 ++--- .../etc/front-controller.urm.puml | 45 +++-- .../etc/half-sync-half-async.urm.puml | 19 +- hexagonal/etc/hexagonal.urm.puml | 179 +++++++++--------- .../etc/intercepting-filter.urm.puml | 82 ++++---- interpreter/etc/interpreter.urm.puml | 31 +-- iterator/etc/iterator.urm.puml | 31 +-- layers/etc/layers.urm.puml | 127 +++++++------ lazy-loading/etc/lazy-loading.urm.puml | 25 ++- mediator/etc/mediator.urm.puml | 67 +++---- memento/etc/memento.urm.puml | 29 +-- message-channel/etc/message-channel.urm.puml | 1 + .../etc/model-view-controller.urm.puml | 49 ++--- .../etc/model-view-presenter.urm.puml | 90 ++++----- monad/etc/monad.urm.puml | 29 +-- monostate/etc/monostate.urm.puml | 9 +- multiton/etc/multiton.urm.puml | 1 + mute-idiom/etc/mute-idiom.urm.puml | 7 +- mutex/etc/mutex.urm.puml | 8 +- naked-objects/etc/naked-objects-dom.urm.puml | 26 +-- .../etc/naked-objects-fixture.urm.puml | 5 +- .../etc/naked-objects-integtests.urm.puml | 15 +- null-object/etc/null-object.urm.puml | 15 +- object-pool/etc/object-pool.urm.puml | 27 +-- observer/etc/observer.urm.puml | 47 +++-- poison-pill/etc/poison-pill.urm.puml | 57 +++--- pom.xml | 2 +- .../etc/private-class-data.urm.puml | 32 ++-- .../etc/producer-consumer.urm.puml | 20 +- promise/etc/promise.urm.puml | 81 ++++---- property/etc/property.urm.puml | 16 +- prototype/etc/prototype.urm.puml | 81 ++++---- proxy/etc/proxy.urm.puml | 30 +-- .../etc/publish-subscribe.urm.puml | 1 + reactor/etc/reactor.urm.puml | 156 +++++++-------- .../etc/reader-writer-lock.urm.puml | 33 ++-- repository/etc/repository.urm.puml | 38 ++-- ...rce-acquisition-is-initialization.urm.puml | 3 + semaphore/etc/semaphore.urm.puml | 54 +++--- servant/etc/servant.urm.puml | 43 +++-- service-layer/etc/service-layer.urm.puml | 64 ++++--- service-locator/etc/service-locator.urm.puml | 37 ++-- singleton/etc/singleton.urm.puml | 33 ++-- specification/etc/specification.urm.puml | 75 ++++---- state/etc/state.urm.puml | 28 +-- step-builder/etc/step-builder.urm.puml | 74 ++++---- strategy/etc/strategy.urm.puml | 12 +- template-method/etc/template-method.urm.puml | 21 +- thread-pool/etc/thread-pool.urm.puml | 30 +-- tolerant-reader/etc/tolerant-reader.urm.puml | 19 +- twin/etc/twin.urm.puml | 20 +- value-object/etc/value-object.urm.puml | 9 +- visitor/etc/visitor.urm.puml | 51 ++--- 85 files changed, 1749 insertions(+), 1606 deletions(-) diff --git a/abstract-document/etc/abstract-document.urm.puml b/abstract-document/etc/abstract-document.urm.puml index fa15eb3c759d..0c6ffc5ece2e 100644 --- a/abstract-document/etc/abstract-document.urm.puml +++ b/abstract-document/etc/abstract-document.urm.puml @@ -1,33 +1,29 @@ @startuml package com.iluwatar.abstractdocument.domain { - class Part { - + Part(properties : Map) + class Car { + + Car(properties : Map) } - interface HasPrice { + interface HasModel { + PROPERTY : String {static} - + getPrice() : Optional + + getModel() : Optional } interface HasParts { + PROPERTY : String {static} + getParts() : Stream } - class Car { - + Car(properties : Map) + interface HasPrice { + + PROPERTY : String {static} + + getPrice() : Optional } interface HasType { + PROPERTY : String {static} + getType() : Optional } - interface HasModel { - + PROPERTY : String {static} - + getModel() : Optional + class Part { + + Part(properties : Map) } } package com.iluwatar.abstractdocument { - class App { - + App() - + main(args : String[]) {static} - } abstract class AbstractDocument { - properties : Map # AbstractDocument(properties : Map) @@ -36,24 +32,28 @@ package com.iluwatar.abstractdocument { + put(key : String, value : Object) + toString() : String } + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } interface Document { + children(String, Function, T>) : Stream {abstract} + get(String) : Object {abstract} + put(String, Object) {abstract} } } -AbstractDocument --+ Map -Part ..|> HasType -Part ..|> HasModel -Part ..|> HasPrice -Part --|> AbstractDocument AbstractDocument ..|> Document -HasPrice --|> Document -HasParts --|> Document Car ..|> HasModel Car ..|> HasPrice Car ..|> HasParts Car --|> AbstractDocument -HasType --|> Document HasModel --|> Document +HasParts --|> Document +HasPrice --|> Document +HasType --|> Document +Part ..|> HasType +Part ..|> HasModel +Part ..|> HasPrice +Part --|> AbstractDocument @enduml \ No newline at end of file diff --git a/abstract-factory/etc/abstract-factory.urm.puml b/abstract-factory/etc/abstract-factory.urm.puml index 9648a6a96049..7b5e1b701f3a 100644 --- a/abstract-factory/etc/abstract-factory.urm.puml +++ b/abstract-factory/etc/abstract-factory.urm.puml @@ -1,6 +1,7 @@ @startuml package com.iluwatar.abstractfactory { class App { + - LOGGER : Logger {static} - army : Army - castle : Castle - king : King @@ -17,58 +18,58 @@ package com.iluwatar.abstractfactory { - setCastle(castle : Castle) - setKing(king : King) } - class OrcKingdomFactory { - + OrcKingdomFactory() - + createArmy() : Army - + createCastle() : Castle - + createKing() : King + interface Army { + + getDescription() : String {abstract} + } + interface Castle { + + getDescription() : String {abstract} + } + class ElfArmy { + ~ DESCRIPTION : String {static} + + ElfArmy() + + getDescription() : String } class ElfCastle { ~ DESCRIPTION : String {static} + ElfCastle() + getDescription() : String } - class OrcCastle { + class ElfKing { ~ DESCRIPTION : String {static} - + OrcCastle() + + ElfKing() + getDescription() : String } + class ElfKingdomFactory { + + ElfKingdomFactory() + + createArmy() : Army + + createCastle() : Castle + + createKing() : King + } + interface King { + + getDescription() : String {abstract} + } interface KingdomFactory { + createArmy() : Army {abstract} + createCastle() : Castle {abstract} + createKing() : King {abstract} } - class ElfKing { + class OrcArmy { ~ DESCRIPTION : String {static} - + ElfKing() + + OrcArmy() + getDescription() : String } - class ElfArmy { + class OrcCastle { ~ DESCRIPTION : String {static} - + ElfArmy() + + OrcCastle() + getDescription() : String } - interface Castle { - + getDescription() : String {abstract} - } - interface Army { - + getDescription() : String {abstract} - } class OrcKing { ~ DESCRIPTION : String {static} + OrcKing() + getDescription() : String } - class OrcArmy { - ~ DESCRIPTION : String {static} - + OrcArmy() - + getDescription() : String - } - interface King { - + getDescription() : String {abstract} - } - class ElfKingdomFactory { - + ElfKingdomFactory() + class OrcKingdomFactory { + + OrcKingdomFactory() + createArmy() : Army + createCastle() : Castle + createKing() : King @@ -77,12 +78,12 @@ package com.iluwatar.abstractfactory { App --> "-castle" Castle App --> "-king" King App --> "-army" Army -OrcKingdomFactory ..|> KingdomFactory +ElfArmy ..|> Army ElfCastle ..|> Castle -OrcCastle ..|> Castle ElfKing ..|> King -ElfArmy ..|> Army -OrcKing ..|> King -OrcArmy ..|> Army ElfKingdomFactory ..|> KingdomFactory +OrcArmy ..|> Army +OrcCastle ..|> Castle +OrcKing ..|> King +OrcKingdomFactory ..|> KingdomFactory @enduml \ No newline at end of file diff --git a/adapter/etc/adapter.urm.puml b/adapter/etc/adapter.urm.puml index a7c962a3b09b..847427a449f0 100644 --- a/adapter/etc/adapter.urm.puml +++ b/adapter/etc/adapter.urm.puml @@ -1,18 +1,19 @@ @startuml package com.iluwatar.adapter { - interface BattleShip { - + fire() {abstract} - + move() {abstract} + class App { + + App() + + main(args : String[]) {static} } class BattleFishingBoat { + - LOGGER : Logger {static} - boat : FishingBoat + BattleFishingBoat() + fire() + move() } - class App { - + App() - + main(args : String[]) {static} + interface BattleShip { + + fire() {abstract} + + move() {abstract} } class Captain { - battleship : BattleShip @@ -23,6 +24,7 @@ package com.iluwatar.adapter { + setBattleship(battleship : BattleShip) } class FishingBoat { + - LOGGER : Logger {static} + FishingBoat() + fish() + sail() diff --git a/aggregator-microservices/etc/aggregator-service.urm.puml b/aggregator-microservices/etc/aggregator-service.urm.puml index 2a6600531e55..ebb782f202b5 100644 --- a/aggregator-microservices/etc/aggregator-service.urm.puml +++ b/aggregator-microservices/etc/aggregator-service.urm.puml @@ -1,16 +1,15 @@ @startuml package com.iluwatar.aggregator.microservices { - class ProductInventoryClientImpl { - + ProductInventoryClientImpl() - + getProductInventories() : int + class Aggregator { + - informationClient : ProductInformationClient + - inventoryClient : ProductInventoryClient + + Aggregator() + + getProduct() : Product } class App { + App() + main(args : String[]) {static} } - interface ProductInventoryClient { - + getProductInventories() : int {abstract} - } class Product { - productInventories : int - title : String @@ -20,22 +19,25 @@ package com.iluwatar.aggregator.microservices { + setProductInventories(productInventories : int) + setTitle(title : String) } - class Aggregator { - - informationClient : ProductInformationClient - - inventoryClient : ProductInventoryClient - + Aggregator() - + getProduct() : Product + interface ProductInformationClient { + + getProductTitle() : String {abstract} } class ProductInformationClientImpl { + - LOGGER : Logger {static} + ProductInformationClientImpl() + getProductTitle() : String } - interface ProductInformationClient { - + getProductTitle() : String {abstract} + interface ProductInventoryClient { + + getProductInventories() : int {abstract} + } + class ProductInventoryClientImpl { + - LOGGER : Logger {static} + + ProductInventoryClientImpl() + + getProductInventories() : int } } -Aggregator --> "-inventoryClient" ProductInventoryClient Aggregator --> "-informationClient" ProductInformationClient -ProductInventoryClientImpl ..|> ProductInventoryClient +Aggregator --> "-inventoryClient" ProductInventoryClient ProductInformationClientImpl ..|> ProductInformationClient +ProductInventoryClientImpl ..|> ProductInventoryClient @enduml \ No newline at end of file diff --git a/aggregator-microservices/etc/inventory-microservice.urm.puml b/aggregator-microservices/etc/inventory-microservice.urm.puml index a07a36306376..90f327e07db8 100644 --- a/aggregator-microservices/etc/inventory-microservice.urm.puml +++ b/aggregator-microservices/etc/inventory-microservice.urm.puml @@ -1,12 +1,12 @@ @startuml package com.iluwatar.inventory.microservice { - class InventoryController { - + InventoryController() - + getProductInventories() : int - } class InventoryApplication { + InventoryApplication() + main(args : String[]) {static} } + class InventoryController { + + InventoryController() + + getProductInventories() : int + } } @enduml \ No newline at end of file diff --git a/api-gateway/etc/api-gateway-service.urm.puml b/api-gateway/etc/api-gateway-service.urm.puml index 409e7ee91842..5fabc6a0fab4 100644 --- a/api-gateway/etc/api-gateway-service.urm.puml +++ b/api-gateway/etc/api-gateway-service.urm.puml @@ -1,26 +1,5 @@ @startuml package com.iluwatar.api.gateway { - class App { - + App() - + main(args : String[]) {static} - } - class PriceClientImpl { - + PriceClientImpl() - + getPrice() : String - } - class ImageClientImpl { - + ImageClientImpl() - + getImagePath() : String - } - class MobileProduct { - - price : String - + MobileProduct() - + getPrice() : String - + setPrice(price : String) - } - interface ImageClient { - + getImagePath() : String {abstract} - } class ApiGateway { - imageClient : ImageClient - priceClient : PriceClient @@ -28,6 +7,10 @@ package com.iluwatar.api.gateway { + getProductDesktop() : DesktopProduct + getProductMobile() : MobileProduct } + class App { + + App() + + main(args : String[]) {static} + } class DesktopProduct { - imagePath : String - price : String @@ -37,12 +20,29 @@ package com.iluwatar.api.gateway { + setImagePath(imagePath : String) + setPrice(price : String) } + interface ImageClient { + + getImagePath() : String {abstract} + } + class ImageClientImpl { + + ImageClientImpl() + + getImagePath() : String + } + class MobileProduct { + - price : String + + MobileProduct() + + getPrice() : String + + setPrice(price : String) + } interface PriceClient { + getPrice() : String {abstract} } + class PriceClientImpl { + + PriceClientImpl() + + getPrice() : String + } } ApiGateway --> "-imageClient" ImageClient ApiGateway --> "-priceClient" PriceClient -PriceClientImpl ..|> PriceClient ImageClientImpl ..|> ImageClient +PriceClientImpl ..|> PriceClient @enduml \ No newline at end of file diff --git a/async-method-invocation/etc/async-method-invocation.urm.puml b/async-method-invocation/etc/async-method-invocation.urm.puml index b96e843d3f7a..6f5d0b27f9d4 100644 --- a/async-method-invocation/etc/async-method-invocation.urm.puml +++ b/async-method-invocation/etc/async-method-invocation.urm.puml @@ -1,22 +1,26 @@ @startuml package com.iluwatar.async.method.invocation { class App { + - LOGGER : Logger {static} + App() - callback(name : String) : AsyncCallback {static} - lazyval(value : T, delayMillis : long) : Callable {static} - log(msg : String) {static} + main(args : String[]) {static} } - interface AsyncResult { - + await() {abstract} - + getValue() : T {abstract} - + isCompleted() : boolean {abstract} + interface AsyncCallback { + + onComplete(T, Optional) {abstract} } interface AsyncExecutor { + endProcess(AsyncResult) : T {abstract} + startProcess(Callable) : AsyncResult {abstract} + startProcess(Callable, AsyncCallback) : AsyncResult {abstract} } + interface AsyncResult { + + await() {abstract} + + getValue() : T {abstract} + + isCompleted() : boolean {abstract} + } class ThreadAsyncExecutor { - idx : AtomicInteger + ThreadAsyncExecutor() @@ -24,9 +28,6 @@ package com.iluwatar.async.method.invocation { + startProcess(task : Callable) : AsyncResult + startProcess(task : Callable, callback : AsyncCallback) : AsyncResult } - interface AsyncCallback { - + onComplete(T, Optional) {abstract} - } -class CompletableResult { ~ COMPLETED : int {static} ~ FAILED : int {static} diff --git a/bridge/etc/bridge.urm.puml b/bridge/etc/bridge.urm.puml index 84e250a06e50..82e3b14afecf 100644 --- a/bridge/etc/bridge.urm.puml +++ b/bridge/etc/bridge.urm.puml @@ -1,31 +1,48 @@ @startuml package com.iluwatar.bridge { - class FlyingMagicWeapon { - + FlyingMagicWeapon(imp : FlyingMagicWeaponImpl) - + fly() - + getImp() : FlyingMagicWeaponImpl + class App { + + App() + + main(args : String[]) {static} + } + class BlindingMagicWeapon { + + BlindingMagicWeapon(imp : BlindingMagicWeaponImpl) + + blind() + + getImp() : BlindingMagicWeaponImpl + swing() + unwield() + wield() } - class Stormbringer { - + Stormbringer() - + eatSoulImp() + abstract class BlindingMagicWeaponImpl { + + BlindingMagicWeaponImpl() + + blindImp() {abstract} + } + class Excalibur { + - LOGGER : Logger {static} + + Excalibur() + + blindImp() + swingImp() + unwieldImp() + wieldImp() } + class FlyingMagicWeapon { + + FlyingMagicWeapon(imp : FlyingMagicWeaponImpl) + + fly() + + getImp() : FlyingMagicWeaponImpl + + swing() + + unwield() + + wield() + } abstract class FlyingMagicWeaponImpl { + FlyingMagicWeaponImpl() + flyImp() {abstract} } - class SoulEatingMagicWeapon { - + SoulEatingMagicWeapon(imp : SoulEatingMagicWeaponImpl) - + eatSoul() - + getImp() : SoulEatingMagicWeaponImpl - + swing() - + unwield() - + wield() + abstract class MagicWeapon { + # imp : MagicWeaponImpl + + MagicWeapon(imp : MagicWeaponImpl) + + getImp() : MagicWeaponImpl + + swing() {abstract} + + unwield() {abstract} + + wield() {abstract} } abstract class MagicWeaponImpl { + MagicWeaponImpl() @@ -33,57 +50,43 @@ package com.iluwatar.bridge { + unwieldImp() {abstract} + wieldImp() {abstract} } - abstract class SoulEatingMagicWeaponImpl { - + SoulEatingMagicWeaponImpl() - + eatSoulImp() {abstract} - } - class Excalibur { - + Excalibur() - + blindImp() - + swingImp() - + unwieldImp() - + wieldImp() - } class Mjollnir { + - LOGGER : Logger {static} + Mjollnir() + flyImp() + swingImp() + unwieldImp() + wieldImp() } - class App { - + App() - + main(args : String[]) {static} - } - abstract class MagicWeapon { - # imp : MagicWeaponImpl - + MagicWeapon(imp : MagicWeaponImpl) - + getImp() : MagicWeaponImpl - + swing() {abstract} - + unwield() {abstract} - + wield() {abstract} - } - abstract class BlindingMagicWeaponImpl { - + BlindingMagicWeaponImpl() - + blindImp() {abstract} - } - class BlindingMagicWeapon { - + BlindingMagicWeapon(imp : BlindingMagicWeaponImpl) - + blind() - + getImp() : BlindingMagicWeaponImpl + class SoulEatingMagicWeapon { + + SoulEatingMagicWeapon(imp : SoulEatingMagicWeaponImpl) + + eatSoul() + + getImp() : SoulEatingMagicWeaponImpl + swing() + unwield() + wield() } + abstract class SoulEatingMagicWeaponImpl { + + SoulEatingMagicWeaponImpl() + + eatSoulImp() {abstract} + } + class Stormbringer { + - LOGGER : Logger {static} + + Stormbringer() + + eatSoulImp() + + swingImp() + + unwieldImp() + + wieldImp() + } } MagicWeapon --> "-imp" MagicWeaponImpl +BlindingMagicWeapon --|> MagicWeapon +BlindingMagicWeaponImpl --|> MagicWeaponImpl +Excalibur --|> BlindingMagicWeaponImpl FlyingMagicWeapon --|> MagicWeapon -Stormbringer --|> SoulEatingMagicWeaponImpl FlyingMagicWeaponImpl --|> MagicWeaponImpl +Mjollnir --|> FlyingMagicWeaponImpl SoulEatingMagicWeapon --|> MagicWeapon SoulEatingMagicWeaponImpl --|> MagicWeaponImpl -Excalibur --|> BlindingMagicWeaponImpl -Mjollnir --|> FlyingMagicWeaponImpl -BlindingMagicWeaponImpl --|> MagicWeaponImpl -BlindingMagicWeapon --|> MagicWeapon +Stormbringer --|> SoulEatingMagicWeaponImpl @enduml \ No newline at end of file diff --git a/builder/etc/builder.urm.puml b/builder/etc/builder.urm.puml index 0c98f3b4b753..631c62cc4d74 100644 --- a/builder/etc/builder.urm.puml +++ b/builder/etc/builder.urm.puml @@ -1,23 +1,41 @@ @startuml package com.iluwatar.builder { - class Builder { - - armor : Armor - - hairColor : HairColor - - hairType : HairType - - name : String - - profession : Profession - - weapon : Weapon - + Builder(profession : Profession, name : String) - + build() : Hero - + withArmor(armor : Armor) : Builder - + withHairColor(hairColor : HairColor) : Builder - + withHairType(hairType : HairType) : Builder - + withWeapon(weapon : Weapon) : Builder - } class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } + enum Armor { + + CHAIN_MAIL {static} + + CLOTHES {static} + + LEATHER {static} + + PLATE_MAIL {static} + - title : String + + toString() : String + + valueOf(name : String) : Armor {static} + + values() : Armor[] {static} + } + enum HairColor { + + BLACK {static} + + BLOND {static} + + BROWN {static} + + RED {static} + + WHITE {static} + + toString() : String + + valueOf(name : String) : HairColor {static} + + values() : HairColor[] {static} + } + enum HairType { + + BALD {static} + + CURLY {static} + + LONG_CURLY {static} + + LONG_STRAIGHT {static} + + SHORT {static} + - title : String + + toString() : String + + valueOf(name : String) : HairType {static} + + values() : HairType[] {static} + } class Hero { - armor : Armor - hairColor : HairColor @@ -34,25 +52,19 @@ package com.iluwatar.builder { + getWeapon() : Weapon + toString() : String } - enum Weapon { - + AXE {static} - + BOW {static} - + DAGGER {static} - + SWORD {static} - + WARHAMMER {static} - + toString() : String - + valueOf(name : String) : Weapon {static} - + values() : Weapon[] {static} - } - enum HairColor { - + BLACK {static} - + BLOND {static} - + BROWN {static} - + RED {static} - + WHITE {static} - + toString() : String - + valueOf(name : String) : HairColor {static} - + values() : HairColor[] {static} + class Builder { + - armor : Armor + - hairColor : HairColor + - hairType : HairType + - name : String + - profession : Profession + - weapon : Weapon + + Builder(profession : Profession, name : String) + + build() : Hero + + withArmor(armor : Armor) : Builder + + withHairColor(hairColor : HairColor) : Builder + + withHairType(hairType : HairType) : Builder + + withWeapon(weapon : Weapon) : Builder } enum Profession { + MAGE {static} @@ -63,35 +75,23 @@ package com.iluwatar.builder { + valueOf(name : String) : Profession {static} + values() : Profession[] {static} } - enum Armor { - + CHAIN_MAIL {static} - + CLOTHES {static} - + LEATHER {static} - + PLATE_MAIL {static} - - title : String - + toString() : String - + valueOf(name : String) : Armor {static} - + values() : Armor[] {static} - } - enum HairType { - + BALD {static} - + CURLY {static} - + LONG_CURLY {static} - + LONG_STRAIGHT {static} - + SHORT {static} - - title : String + enum Weapon { + + AXE {static} + + BOW {static} + + DAGGER {static} + + SWORD {static} + + WARHAMMER {static} + toString() : String - + valueOf(name : String) : HairType {static} - + values() : HairType[] {static} + + valueOf(name : String) : Weapon {static} + + values() : Weapon[] {static} } } Hero --> "-profession" Profession Builder ..+ Hero Hero --> "-armor" Armor -App --+ Hero Builder --> "-weapon" Weapon -Builder --> "-hairColor" HairColor Builder --> "-hairType" HairType +Builder --> "-hairColor" HairColor Hero --> "-hairColor" HairColor Builder --> "-profession" Profession Hero --> "-weapon" Weapon diff --git a/business-delegate/etc/business-delegate.urm.puml b/business-delegate/etc/business-delegate.urm.puml index a58136c8ce8d..e78b147e0960 100644 --- a/business-delegate/etc/business-delegate.urm.puml +++ b/business-delegate/etc/business-delegate.urm.puml @@ -1,8 +1,17 @@ @startuml package com.iluwatar.business.delegate { - class EjbService { - + EjbService() - + doProcessing() + class App { + + App() + + main(args : String[]) {static} + } + class BusinessDelegate { + - businessService : BusinessService + - lookupService : BusinessLookup + - serviceType : ServiceType + + BusinessDelegate() + + doTask() + + setLookupService(businessLookup : BusinessLookup) + + setServiceType(serviceType : ServiceType) } class BusinessLookup { - ejbService : EjbService @@ -12,10 +21,6 @@ package com.iluwatar.business.delegate { + setEjbService(ejbService : EjbService) + setJmsService(jmsService : JmsService) } - class App { - + App() - + main(args : String[]) {static} - } interface BusinessService { + doProcessing() {abstract} } @@ -24,16 +29,13 @@ package com.iluwatar.business.delegate { + Client(businessDelegate : BusinessDelegate) + doTask() } - class BusinessDelegate { - - businessService : BusinessService - - lookupService : BusinessLookup - - serviceType : ServiceType - + BusinessDelegate() - + doTask() - + setLookupService(businessLookup : BusinessLookup) - + setServiceType(serviceType : ServiceType) + class EjbService { + - LOGGER : Logger {static} + + EjbService() + + doProcessing() } class JmsService { + - LOGGER : Logger {static} + JmsService() + doProcessing() } diff --git a/caching/etc/caching.urm.puml b/caching/etc/caching.urm.puml index b8f4fb49b6b4..6ac3fd4cc136 100644 --- a/caching/etc/caching.urm.puml +++ b/caching/etc/caching.urm.puml @@ -1,56 +1,68 @@ @startuml package com.iluwatar.caching { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} + + useCacheAsideStategy() + useReadAndWriteThroughStrategy() + useReadThroughAndWriteAroundStrategy() + useReadThroughAndWriteBehindStrategy() } - ~class Node { - ~ next : Node - ~ previous : Node - ~ userAccount : UserAccount - ~ userId : String - + Node(this$0 : String, userId : UserAccount) + class AppManager { + - cachingPolicy : CachingPolicy {static} + - AppManager() + + find(userId : String) : UserAccount {static} + - findAside(userId : String) : UserAccount {static} + + initCacheCapacity(capacity : int) {static} + + initCachingPolicy(policy : CachingPolicy) {static} + + initDb(useMongoDb : boolean) {static} + + printCacheContent() : String {static} + + save(userAccount : UserAccount) {static} + - saveAside(userAccount : UserAccount) {static} } class CacheStore { + - LOGGER : Logger {static} ~ cache : LruCache {static} - CacheStore() + clearCache() {static} + flushCache() {static} + + get(userId : String) : UserAccount {static} + initCapacity(capacity : int) {static} + + invalidate(userId : String) {static} + print() : String {static} + readThrough(userId : String) : UserAccount {static} + readThroughWithWriteBackPolicy(userId : String) : UserAccount {static} + + set(userId : String, userAccount : UserAccount) {static} + writeAround(userAccount : UserAccount) {static} + writeBehind(userAccount : UserAccount) {static} + writeThrough(userAccount : UserAccount) {static} } - class AppManager { - - cachingPolicy : CachingPolicy {static} - - AppManager() - + find(userId : String) : UserAccount {static} - + initCacheCapacity(capacity : int) {static} - + initCachingPolicy(policy : CachingPolicy) {static} - + initDb(useMongoDb : boolean) {static} - + printCacheContent() : String {static} - + save(userAccount : UserAccount) {static} + enum CachingPolicy { + + AROUND {static} + + ASIDE {static} + + BEHIND {static} + + THROUGH {static} + - policy : String + + getPolicy() : String + + valueOf(name : String) : CachingPolicy {static} + + values() : CachingPolicy[] {static} } - class UserAccount { - - additionalInfo : String - - userId : String - - userName : String - + UserAccount(userId : String, userName : String, additionalInfo : String) - + getAdditionalInfo() : String - + getUserId() : String - + getUserName() : String - + setAdditionalInfo(additionalInfo : String) - + setUserId(userId : String) - + setUserName(userName : String) - + toString() : String + class DbManager { + - db : MongoDatabase {static} + - mongoClient : MongoClient {static} + - useMongoDB : boolean {static} + - virtualDB : Map {static} + - DbManager() + + connect() {static} + + createVirtualDb() {static} + + readFromDb(userId : String) : UserAccount {static} + + updateDb(userAccount : UserAccount) {static} + + upsertDb(userAccount : UserAccount) {static} + + writeToDb(userAccount : UserAccount) {static} } class LruCache { + - LOGGER : Logger {static} ~ cache : Map ~ capacity : int ~ end : Node @@ -68,31 +80,29 @@ package com.iluwatar.caching { + setCapacity(newCapacity : int) + setHead(node : Node) } - class DbManager { - - db : MongoDatabase {static} - - mongoClient : MongoClient {static} - - useMongoDB : boolean {static} - - virtualDB : Map {static} - - DbManager() - + connect() {static} - + createVirtualDb() {static} - + readFromDb(userId : String) : UserAccount {static} - + updateDb(userAccount : UserAccount) {static} - + upsertDb(userAccount : UserAccount) {static} - + writeToDb(userAccount : UserAccount) {static} + ~class Node { + ~ next : Node + ~ previous : Node + ~ userAccount : UserAccount + ~ userId : String + + Node(this$0 : String, userId : UserAccount) } - enum CachingPolicy { - + AROUND {static} - + BEHIND {static} - + THROUGH {static} - - policy : String - + getPolicy() : String - + valueOf(name : String) : CachingPolicy {static} - + values() : CachingPolicy[] {static} + class UserAccount { + - additionalInfo : String + - userId : String + - userName : String + + UserAccount(userId : String, userName : String, additionalInfo : String) + + getAdditionalInfo() : String + + getUserId() : String + + getUserName() : String + + setAdditionalInfo(additionalInfo : String) + + setUserId(userId : String) + + setUserName(userName : String) + + toString() : String } } -Node --+ LruCache LruCache --> "-head" Node +Node --+ LruCache Node --> "-previous" Node AppManager --> "-cachingPolicy" CachingPolicy Node --> "-userAccount" UserAccount diff --git a/callback/etc/callback.urm.puml b/callback/etc/callback.urm.puml index b9e1ca694e44..02545e80f841 100644 --- a/callback/etc/callback.urm.puml +++ b/callback/etc/callback.urm.puml @@ -1,24 +1,27 @@ @startuml package com.iluwatar.callback { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } interface Callback { + call() {abstract} } - abstract class Task { - + Task() - + execute() {abstract} - + executeWith(callback : Callback) - } - class App { - + App() + class LambdasApp { + - LOGGER : Logger {static} + + LambdasApp() + main(args : String[]) {static} } class SimpleTask { + - LOGGER : Logger {static} + SimpleTask() + execute() } - class LambdasApp { - + LambdasApp() - + main(args : String[]) {static} + abstract class Task { + + Task() + + execute() {abstract} + + executeWith(callback : Callback) } } SimpleTask --|> Task diff --git a/chain/etc/chain.urm.puml b/chain/etc/chain.urm.puml index 21365765d0e3..3add4037da4d 100644 --- a/chain/etc/chain.urm.puml +++ b/chain/etc/chain.urm.puml @@ -1,9 +1,8 @@ @startuml package com.iluwatar.chain { - class OrcSoldier { - + OrcSoldier(handler : RequestHandler) - + handleRequest(req : Request) - + toString() : String + class App { + + App() + + main(args : String[]) {static} } class OrcCommander { + OrcCommander(handler : RequestHandler) @@ -16,6 +15,16 @@ package com.iluwatar.chain { - buildChain() + makeRequest(req : Request) } + class OrcOfficer { + + OrcOfficer(handler : RequestHandler) + + handleRequest(req : Request) + + toString() : String + } + class OrcSoldier { + + OrcSoldier(handler : RequestHandler) + + handleRequest(req : Request) + + toString() : String + } class Request { - handled : boolean - requestDescription : String @@ -27,22 +36,14 @@ package com.iluwatar.chain { + markHandled() + toString() : String } - class App { - + App() - + main(args : String[]) {static} - } abstract class RequestHandler { + - LOGGER : Logger {static} - next : RequestHandler + RequestHandler(next : RequestHandler) + handleRequest(req : Request) # printHandling(req : Request) + toString() : String {abstract} } - class OrcOfficer { - + OrcOfficer(handler : RequestHandler) - + handleRequest(req : Request) - + toString() : String - } enum RequestType { + COLLECT_TAX {static} + DEFEND_CASTLE {static} @@ -52,9 +53,9 @@ package com.iluwatar.chain { } } RequestHandler --> "-next" RequestHandler -Request --> "-requestType" RequestType OrcKing --> "-chain" RequestHandler -OrcSoldier --|> RequestHandler +Request --> "-requestType" RequestType OrcCommander --|> RequestHandler OrcOfficer --|> RequestHandler +OrcSoldier --|> RequestHandler @enduml \ No newline at end of file diff --git a/command/etc/command.urm.puml b/command/etc/command.urm.puml index 27bff7330605..9bdbce64d383 100644 --- a/command/etc/command.urm.puml +++ b/command/etc/command.urm.puml @@ -1,13 +1,5 @@ @startuml package com.iluwatar.command { - class InvisibilitySpell { - - target : Target - + InvisibilitySpell() - + execute(target : Target) - + redo() - + toString() : String - + undo() - } class App { + App() + main(args : String[]) {static} @@ -23,25 +15,13 @@ package com.iluwatar.command { + Goblin() + toString() : String } - abstract class Target { - - size : Size - - visibility : Visibility - + Target() - + getSize() : Size - + getVisibility() : Visibility - + printStatus() - + setSize(size : Size) - + setVisibility(visibility : Visibility) - + toString() : String {abstract} - } - class Wizard { - - redoStack : Deque - - undoStack : Deque - + Wizard() - + castSpell(command : Command, target : Target) - + redoLastSpell() + class InvisibilitySpell { + - target : Target + + InvisibilitySpell() + + execute(target : Target) + + redo() + toString() : String - + undoLastSpell() + + undo() } class ShrinkSpell { - oldSize : Size @@ -62,6 +42,18 @@ package com.iluwatar.command { + valueOf(name : String) : Size {static} + values() : Size[] {static} } + abstract class Target { + - LOGGER : Logger {static} + - size : Size + - visibility : Visibility + + Target() + + getSize() : Size + + getVisibility() : Visibility + + printStatus() + + setSize(size : Size) + + setVisibility(visibility : Visibility) + + toString() : String {abstract} + } enum Visibility { + INVISIBLE {static} + UNDEFINED {static} @@ -71,6 +63,16 @@ package com.iluwatar.command { + valueOf(name : String) : Visibility {static} + values() : Visibility[] {static} } + class Wizard { + - LOGGER : Logger {static} + - redoStack : Deque + - undoStack : Deque + + Wizard() + + castSpell(command : Command, target : Target) + + redoLastSpell() + + toString() : String + + undoLastSpell() + } } Target --> "-size" Size Wizard --> "-undoStack" Command @@ -78,7 +80,7 @@ ShrinkSpell --> "-oldSize" Size InvisibilitySpell --> "-target" Target ShrinkSpell --> "-target" Target Target --> "-visibility" Visibility -InvisibilitySpell --|> Command Goblin --|> Target +InvisibilitySpell --|> Command ShrinkSpell --|> Command @enduml \ No newline at end of file diff --git a/composite/etc/composite.urm.puml b/composite/etc/composite.urm.puml index 82e9b65eb059..82f2cab0d1f0 100644 --- a/composite/etc/composite.urm.puml +++ b/composite/etc/composite.urm.puml @@ -1,30 +1,16 @@ @startuml package com.iluwatar.composite { - class Word { - + Word(letters : List) - # printThisAfter() - # printThisBefore() - } class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } - class Messenger { - + Messenger() - ~ messageFromElves() : LetterComposite - ~ messageFromOrcs() : LetterComposite - } class Letter { - c : char + Letter(c : char) # printThisAfter() # printThisBefore() } - class Sentence { - + Sentence(words : List) - # printThisAfter() - # printThisBefore() - } abstract class LetterComposite { - children : List + LetterComposite() @@ -34,9 +20,24 @@ package com.iluwatar.composite { # printThisAfter() {abstract} # printThisBefore() {abstract} } + class Messenger { + + Messenger() + ~ messageFromElves() : LetterComposite + ~ messageFromOrcs() : LetterComposite + } + class Sentence { + + Sentence(words : List) + # printThisAfter() + # printThisBefore() + } + class Word { + + Word(letters : List) + # printThisAfter() + # printThisBefore() + } } LetterComposite --> "-children" LetterComposite -Word --|> LetterComposite Letter --|> LetterComposite Sentence --|> LetterComposite +Word --|> LetterComposite @enduml \ No newline at end of file diff --git a/dao/etc/dao.urm.puml b/dao/etc/dao.urm.puml index 90a9c9725f78..2b3f7fca6b7f 100644 --- a/dao/etc/dao.urm.puml +++ b/dao/etc/dao.urm.puml @@ -1,25 +1,5 @@ @startuml package com.iluwatar.dao { - class InMemoryCustomerDao { - - idToCustomer : Map - + InMemoryCustomerDao() - + add(customer : Customer) : boolean - + delete(customer : Customer) : boolean - + getAll() : Stream - + getById(id : int) : Optional - + update(customer : Customer) : boolean - } - interface CustomerSchemaSql { - + CREATE_SCHEMA_SQL : String {static} - + DELETE_SCHEMA_SQL : String {static} - } - interface CustomerDao { - + add(Customer) : boolean {abstract} - + delete(Customer) : boolean {abstract} - + getAll() : Stream {abstract} - + getById(int) : Optional {abstract} - + update(Customer) : boolean {abstract} - } class App { - DB_URL : String {static} - log : Logger {static} @@ -32,18 +12,6 @@ package com.iluwatar.dao { + main(args : String[]) {static} - performOperationsUsing(customerDao : CustomerDao) {static} } - class DbCustomerDao { - - dataSource : DataSource - + DbCustomerDao(dataSource : DataSource) - + add(customer : Customer) : boolean - - createCustomer(resultSet : ResultSet) : Customer - + delete(customer : Customer) : boolean - + getAll() : Stream - + getById(id : int) : Optional - - getConnection() : Connection - - mutedClose(connection : Connection) - + update(customer : Customer) : boolean - } class Customer { - firstName : String - id : int @@ -59,7 +27,39 @@ package com.iluwatar.dao { + setLastName(lastName : String) + toString() : String } + interface CustomerDao { + + add(Customer) : boolean {abstract} + + delete(Customer) : boolean {abstract} + + getAll() : Stream {abstract} + + getById(int) : Optional {abstract} + + update(Customer) : boolean {abstract} + } + interface CustomerSchemaSql { + + CREATE_SCHEMA_SQL : String {static} + + DELETE_SCHEMA_SQL : String {static} + } + class DbCustomerDao { + - dataSource : DataSource + + DbCustomerDao(dataSource : DataSource) + + add(customer : Customer) : boolean + - createCustomer(resultSet : ResultSet) : Customer + + delete(customer : Customer) : boolean + + getAll() : Stream + + getById(id : int) : Optional + - getConnection() : Connection + - mutedClose(connection : Connection) + + update(customer : Customer) : boolean + } + class InMemoryCustomerDao { + - idToCustomer : Map + + InMemoryCustomerDao() + + add(customer : Customer) : boolean + + delete(customer : Customer) : boolean + + getAll() : Stream + + getById(id : int) : Optional + + update(customer : Customer) : boolean + } } -InMemoryCustomerDao ..|> CustomerDao DbCustomerDao ..|> CustomerDao +InMemoryCustomerDao ..|> CustomerDao @enduml \ No newline at end of file diff --git a/data-mapper/etc/data-mapper.urm.puml b/data-mapper/etc/data-mapper.urm.puml index a16df0020089..041cbb07b331 100644 --- a/data-mapper/etc/data-mapper.urm.puml +++ b/data-mapper/etc/data-mapper.urm.puml @@ -1,11 +1,5 @@ @startuml package com.iluwatar.datamapper { - interface StudentDataMapper { - + delete(Student) {abstract} - + find(int) : Optional {abstract} - + insert(Student) {abstract} - + update(Student) {abstract} - } class App { - log : Logger {static} - App() @@ -27,6 +21,12 @@ package com.iluwatar.datamapper { + setStudentId(studentId : int) + toString() : String } + interface StudentDataMapper { + + delete(Student) {abstract} + + find(int) : Optional {abstract} + + insert(Student) {abstract} + + update(Student) {abstract} + } class StudentDataMapperImpl { - students : List + StudentDataMapperImpl() diff --git a/decorator/etc/decorator.urm.puml b/decorator/etc/decorator.urm.puml index 4862ddfeb47f..be878bd914c9 100644 --- a/decorator/etc/decorator.urm.puml +++ b/decorator/etc/decorator.urm.puml @@ -1,29 +1,38 @@ @startuml package com.iluwatar.decorator { - interface Hostile { - + attack() {abstract} - + fleeBattle() {abstract} - + getAttackPower() : int {abstract} - } class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } - class Troll { - + Troll() + class ClubbedTroll { + - LOGGER : Logger {static} + + ClubbedTroll(decorated : Troll) + + attack() + + getAttackPower() : int + } + class SimpleTroll { + - LOGGER : Logger {static} + + SimpleTroll() + attack() + fleeBattle() + getAttackPower() : int } - class SmartHostile { - - decorated : Hostile - + SmartHostile(decorated : Hostile) + interface Troll { + + attack() {abstract} + + fleeBattle() {abstract} + + getAttackPower() : int {abstract} + } + class TrollDecorator { + - decorated : Troll + + TrollDecorator(decorated : Troll) + attack() + fleeBattle() + getAttackPower() : int } } -SmartHostile --> "-decorated" Hostile -Troll ..|> Hostile -SmartHostile ..|> Hostile +TrollDecorator --> "-decorated" Troll +ClubbedTroll --|> TrollDecorator +SimpleTroll ..|> Troll +TrollDecorator ..|> Troll @enduml \ No newline at end of file diff --git a/delegation/etc/delegation.urm.puml b/delegation/etc/delegation.urm.puml index 378587019bb6..419cf350bd30 100644 --- a/delegation/etc/delegation.urm.puml +++ b/delegation/etc/delegation.urm.puml @@ -1,15 +1,18 @@ @startuml package com.iluwatar.delegation.simple.printers { - class HpPrinter { - + HpPrinter() + class CanonPrinter { + - LOGGER : Logger {static} + + CanonPrinter() + print(message : String) } class EpsonPrinter { + - LOGGER : Logger {static} + EpsonPrinter() + print(message : String) } - class CanonPrinter { - + CanonPrinter() + class HpPrinter { + - LOGGER : Logger {static} + + HpPrinter() + print(message : String) } } @@ -19,18 +22,18 @@ package com.iluwatar.delegation.simple { + App() + main(args : String[]) {static} } + interface Printer { + + print(String) {abstract} + } class PrinterController { - printer : Printer + PrinterController(printer : Printer) + print(message : String) } - interface Printer { - + print(String) {abstract} - } } PrinterController --> "-printer" Printer -HpPrinter ..|> Printer PrinterController ..|> Printer -EpsonPrinter ..|> Printer CanonPrinter ..|> Printer +EpsonPrinter ..|> Printer +HpPrinter ..|> Printer @enduml \ No newline at end of file diff --git a/dependency-injection/etc/dependency-injection.urm.puml b/dependency-injection/etc/dependency-injection.urm.puml index bf4d105998fa..80f15fce32a5 100644 --- a/dependency-injection/etc/dependency-injection.urm.puml +++ b/dependency-injection/etc/dependency-injection.urm.puml @@ -5,44 +5,45 @@ package com.iluwatar.dependency.injection { + AdvancedWizard(tobacco : Tobacco) + smoke() } - interface Wizard { - + smoke() {abstract} - } - class RivendellTobacco { - + RivendellTobacco() + class App { + + App() + + main(args : String[]) {static} } - class SimpleWizard { - - tobacco : OldTobyTobacco - + SimpleWizard() + class GuiceWizard { + - tobacco : Tobacco + + GuiceWizard(tobacco : Tobacco) + smoke() } class OldTobyTobacco { + OldTobyTobacco() } + class RivendellTobacco { + + RivendellTobacco() + } class SecondBreakfastTobacco { + SecondBreakfastTobacco() } - class App { - + App() - + main(args : String[]) {static} + class SimpleWizard { + - tobacco : OldTobyTobacco + + SimpleWizard() + + smoke() } abstract class Tobacco { + - LOGGER : Logger {static} + Tobacco() + smoke(wizard : Wizard) } - class GuiceWizard { - - tobacco : Tobacco - + GuiceWizard(tobacco : Tobacco) - + smoke() + interface Wizard { + + smoke() {abstract} } } SimpleWizard --> "-tobacco" OldTobyTobacco AdvancedWizard --> "-tobacco" Tobacco GuiceWizard --> "-tobacco" Tobacco AdvancedWizard ..|> Wizard -RivendellTobacco --|> Tobacco -SimpleWizard ..|> Wizard +GuiceWizard ..|> Wizard OldTobyTobacco --|> Tobacco +RivendellTobacco --|> Tobacco SecondBreakfastTobacco --|> Tobacco -GuiceWizard ..|> Wizard +SimpleWizard ..|> Wizard @enduml \ No newline at end of file diff --git a/double-checked-locking/etc/double-checked-locking.urm.puml b/double-checked-locking/etc/double-checked-locking.urm.puml index 6feb989019cc..242519fce77c 100644 --- a/double-checked-locking/etc/double-checked-locking.urm.puml +++ b/double-checked-locking/etc/double-checked-locking.urm.puml @@ -1,10 +1,12 @@ @startuml package com.iluwatar.doublechecked.locking { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } class Inventory { + - LOGGER : Logger {static} - inventorySize : int - items : List - lock : Lock diff --git a/double-dispatch/etc/double-dispatch.urm.puml b/double-dispatch/etc/double-dispatch.urm.puml index 78d361326fe3..447cf3081e7f 100644 --- a/double-dispatch/etc/double-dispatch.urm.puml +++ b/double-dispatch/etc/double-dispatch.urm.puml @@ -1,5 +1,14 @@ @startuml package com.iluwatar.doubledispatch { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } + class FlamingAsteroid { + + FlamingAsteroid(left : int, top : int, right : int, bottom : int) + + collision(gameObject : GameObject) + } abstract class GameObject { - damaged : boolean - onFire : boolean @@ -15,23 +24,8 @@ package com.iluwatar.doubledispatch { + setOnFire(onFire : boolean) + toString() : String } - class SpaceStationIss { - + SpaceStationIss(left : int, top : int, right : int, bottom : int) - + collision(gameObject : GameObject) - } - class FlamingAsteroid { - + FlamingAsteroid(left : int, top : int, right : int, bottom : int) - + collision(gameObject : GameObject) - } - class SpaceStationMir { - + SpaceStationMir(left : int, top : int, right : int, bottom : int) - + collision(gameObject : GameObject) - + collisionResolve(asteroid : FlamingAsteroid) - + collisionResolve(iss : SpaceStationIss) - + collisionResolve(meteoroid : Meteoroid) - + collisionResolve(mir : SpaceStationMir) - } class Meteoroid { + - LOGGER : Logger {static} + Meteoroid(left : int, top : int, right : int, bottom : int) + collision(gameObject : GameObject) + collisionResolve(asteroid : FlamingAsteroid) @@ -52,14 +46,23 @@ package com.iluwatar.doubledispatch { ~ intersectsWith(r : Rectangle) : boolean + toString() : String } - class App { - + App() - + main(args : String[]) {static} + class SpaceStationIss { + + SpaceStationIss(left : int, top : int, right : int, bottom : int) + + collision(gameObject : GameObject) + } + class SpaceStationMir { + - LOGGER : Logger {static} + + SpaceStationMir(left : int, top : int, right : int, bottom : int) + + collision(gameObject : GameObject) + + collisionResolve(asteroid : FlamingAsteroid) + + collisionResolve(iss : SpaceStationIss) + + collisionResolve(meteoroid : Meteoroid) + + collisionResolve(mir : SpaceStationMir) } } +FlamingAsteroid --|> Meteoroid GameObject --|> Rectangle +Meteoroid --|> GameObject SpaceStationIss --|> SpaceStationMir -FlamingAsteroid --|> Meteoroid SpaceStationMir --|> GameObject -Meteoroid --|> GameObject @enduml \ No newline at end of file diff --git a/event-aggregator/etc/event-aggregator.urm.puml b/event-aggregator/etc/event-aggregator.urm.puml index 3ccfea536fd4..341d7d65e02c 100644 --- a/event-aggregator/etc/event-aggregator.urm.puml +++ b/event-aggregator/etc/event-aggregator.urm.puml @@ -1,9 +1,17 @@ @startuml package com.iluwatar.event.aggregator { - class LordVarys { - + LordVarys() - + LordVarys(obs : EventObserver) - + timePasses(day : Weekday) + class App { + + App() + + main(args : String[]) {static} + } + enum Event { + + STARK_SIGHTED {static} + + TRAITOR_DETECTED {static} + + WARSHIPS_APPROACHING {static} + - description : String + + toString() : String + + valueOf(name : String) : Event {static} + + values() : Event[] {static} } abstract class EventEmitter { - observers : List @@ -13,22 +21,28 @@ package com.iluwatar.event.aggregator { + registerObserver(obs : EventObserver) + timePasses(Weekday) {abstract} } + interface EventObserver { + + onEvent(Event) {abstract} + } class KingJoffrey { + - LOGGER : Logger {static} + KingJoffrey() + onEvent(e : Event) } + class KingsHand { + + KingsHand() + + KingsHand(obs : EventObserver) + + onEvent(e : Event) + + timePasses(day : Weekday) + } class LordBaelish { + LordBaelish() + LordBaelish(obs : EventObserver) + timePasses(day : Weekday) } - interface EventObserver { - + onEvent(Event) {abstract} - } - class KingsHand { - + KingsHand() - + KingsHand(obs : EventObserver) - + onEvent(e : Event) + class LordVarys { + + LordVarys() + + LordVarys(obs : EventObserver) + timePasses(day : Weekday) } class Scout { @@ -36,10 +50,6 @@ package com.iluwatar.event.aggregator { + Scout(obs : EventObserver) + timePasses(day : Weekday) } - class App { - + App() - + main(args : String[]) {static} - } enum Weekday { + FRIDAY {static} + MONDAY {static} @@ -53,21 +63,12 @@ package com.iluwatar.event.aggregator { + valueOf(name : String) : Weekday {static} + values() : Weekday[] {static} } - enum Event { - + STARK_SIGHTED {static} - + TRAITOR_DETECTED {static} - + WARSHIPS_APPROACHING {static} - - description : String - + toString() : String - + valueOf(name : String) : Event {static} - + values() : Event[] {static} - } } EventEmitter --> "-observers" EventObserver -LordVarys --|> EventEmitter KingJoffrey ..|> EventObserver -LordBaelish --|> EventEmitter KingsHand ..|> EventObserver KingsHand --|> EventEmitter +LordBaelish --|> EventEmitter +LordVarys --|> EventEmitter Scout --|> EventEmitter @enduml \ No newline at end of file diff --git a/event-asynchronous/etc/event-asynchronous.urm.puml b/event-asynchronous/etc/event-asynchronous.urm.puml index c5b183187c24..0d683d27d77f 100644 --- a/event-asynchronous/etc/event-asynchronous.urm.puml +++ b/event-asynchronous/etc/event-asynchronous.urm.puml @@ -1,6 +1,18 @@ @startuml package com.iluwatar.event.asynchronous { + class App { + - LOGGER : Logger {static} + + PROP_FILE_NAME : String {static} + ~ interactiveMode : boolean + + App() + + main(args : String[]) {static} + + quickRun() + + run() + + runInteractiveMode() + + setUp() + } class Event { + - LOGGER : Logger {static} - eventId : int - eventListener : ThreadCompleteListener - eventTime : int @@ -17,9 +29,6 @@ package com.iluwatar.event.asynchronous { + status() + stop() } - interface ThreadCompleteListener { - + completedEventHandler(int) {abstract} - } class EventManager { + MAX_EVENT_TIME : int {static} + MAX_ID : int {static} @@ -42,24 +51,16 @@ package com.iluwatar.event.asynchronous { + status(eventId : int) + statusOfAllEvents() } - class App { - + PROP_FILE_NAME : String {static} - ~ interactiveMode : boolean - + App() - + main(args : String[]) {static} - + quickRun() - + run() - + runInteractiveMode() - + setUp() - } interface IEvent { + start() {abstract} + status() {abstract} + stop() {abstract} } + interface ThreadCompleteListener { + + completedEventHandler(int) {abstract} + } } Event --> "-eventListener" ThreadCompleteListener -EventManager --+ Map Event ..|> IEvent EventManager ..|> ThreadCompleteListener @enduml \ No newline at end of file diff --git a/event-driven-architecture/etc/event-driven-architecture.urm.puml b/event-driven-architecture/etc/event-driven-architecture.urm.puml index 8314913a6114..6b67f0a0e569 100644 --- a/event-driven-architecture/etc/event-driven-architecture.urm.puml +++ b/event-driven-architecture/etc/event-driven-architecture.urm.puml @@ -1,10 +1,12 @@ @startuml package com.iluwatar.eda.handler { class UserCreatedEventHandler { + - LOGGER : Logger {static} + UserCreatedEventHandler() + onEvent(event : UserCreatedEvent) } class UserUpdatedEventHandler { + - LOGGER : Logger {static} + UserUpdatedEventHandler() + onEvent(event : UserUpdatedEvent) } @@ -26,8 +28,8 @@ package com.iluwatar.eda.event { } } package com.iluwatar.eda.framework { - interface Handler { - + onEvent(E extends Event) {abstract} + interface Event { + + getType() : Class {abstract} } class EventDispatcher { - handlers : Map, Handler> @@ -35,8 +37,8 @@ package com.iluwatar.eda.framework { + dispatch(event : E extends Event) + registerHandler(eventType : Class, handler : Handler) } - interface Event { - + getType() : Class {abstract} + interface Handler { + + onEvent(E extends Event) {abstract} } } package com.iluwatar.eda.model { @@ -52,11 +54,11 @@ package com.iluwatar.eda { + main(args : String[]) {static} } } -UserUpdatedEvent --> "-user" User UserCreatedEvent --> "-user" User +UserUpdatedEvent --> "-user" User AbstractEvent ..|> Event UserCreatedEvent --|> AbstractEvent -UserCreatedEventHandler ..|> Handler UserUpdatedEvent --|> AbstractEvent +UserCreatedEventHandler ..|> Handler UserUpdatedEventHandler ..|> Handler @enduml \ No newline at end of file diff --git a/execute-around/etc/execute-around.urm.puml b/execute-around/etc/execute-around.urm.puml index 4fdc4bffb7d2..fd01a5fe1fe9 100644 --- a/execute-around/etc/execute-around.urm.puml +++ b/execute-around/etc/execute-around.urm.puml @@ -1,8 +1,5 @@ @startuml package com.iluwatar.execute.around { - class SimpleFileWriter { - + SimpleFileWriter(filename : String, action : FileWriterAction) - } class App { + App() + main(args : String[]) {static} @@ -10,5 +7,8 @@ package com.iluwatar.execute.around { interface FileWriterAction { + writeFile(FileWriter) {abstract} } + class SimpleFileWriter { + + SimpleFileWriter(filename : String, action : FileWriterAction) + } } @enduml \ No newline at end of file diff --git a/facade/etc/facade.urm.puml b/facade/etc/facade.urm.puml index 8c53cb728b26..477f9eee7e47 100644 --- a/facade/etc/facade.urm.puml +++ b/facade/etc/facade.urm.puml @@ -1,6 +1,17 @@ @startuml package com.iluwatar.facade { + class App { + + App() + + main(args : String[]) {static} + } + class DwarvenCartOperator { + - LOGGER : Logger {static} + + DwarvenCartOperator() + + name() : String + + work() + } class DwarvenGoldDigger { + - LOGGER : Logger {static} + DwarvenGoldDigger() + name() : String + work() @@ -13,12 +24,8 @@ package com.iluwatar.facade { - makeActions(workers : Collection, actions : Action[]) {static} + startNewDay() } - class DwarvenTunnelDigger { - + DwarvenTunnelDigger() - + name() : String - + work() - } abstract class DwarvenMineWorker { + - LOGGER : Logger {static} + DwarvenMineWorker() - action(action : Action) + action(actions : Action[]) @@ -29,15 +36,6 @@ package com.iluwatar.facade { + wakeUp() + work() {abstract} } - class App { - + App() - + main(args : String[]) {static} - } - class DwarvenCartOperator { - + DwarvenCartOperator() - + name() : String - + work() - } ~enum Action { + GO_HOME {static} + GO_TO_MINE {static} @@ -47,11 +45,16 @@ package com.iluwatar.facade { + valueOf(name : String) : Action {static} + values() : Action[] {static} } + class DwarvenTunnelDigger { + - LOGGER : Logger {static} + + DwarvenTunnelDigger() + + name() : String + + work() + } } -DwarvenGoldmineFacade --+ DwarvenMineWorker DwarvenGoldmineFacade --> "-workers" DwarvenMineWorker Action ..+ DwarvenMineWorker +DwarvenCartOperator --|> DwarvenMineWorker DwarvenGoldDigger --|> DwarvenMineWorker DwarvenTunnelDigger --|> DwarvenMineWorker -DwarvenCartOperator --|> DwarvenMineWorker @enduml \ No newline at end of file diff --git a/factory-kit/etc/factory-kit.urm.puml b/factory-kit/etc/factory-kit.urm.puml index fdee9a01c57f..23cf658f467e 100644 --- a/factory-kit/etc/factory-kit.urm.puml +++ b/factory-kit/etc/factory-kit.urm.puml @@ -1,27 +1,14 @@ @startuml package com.iluwatar.factorykit { - class Spear { - + Spear() - + toString() : String - } class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } - interface Weapon { - } - interface WeaponFactory { - + create(WeaponType) : Weapon {abstract} - + factory(consumer : Consumer) : WeaponFactory {static} - } class Axe { + Axe() + toString() : String } - class Sword { - + Sword() - + toString() : String - } class Bow { + Bow() + toString() : String @@ -29,6 +16,20 @@ package com.iluwatar.factorykit { interface Builder { + add(WeaponType, Supplier) {abstract} } + class Spear { + + Spear() + + toString() : String + } + class Sword { + + Sword() + + toString() : String + } + interface Weapon { + } + interface WeaponFactory { + + create(WeaponType) : Weapon {abstract} + + factory(consumer : Consumer) : WeaponFactory {static} + } enum WeaponType { + AXE {static} + BOW {static} @@ -38,8 +39,8 @@ package com.iluwatar.factorykit { + values() : WeaponType[] {static} } } -Spear ..|> Weapon Axe ..|> Weapon -Sword ..|> Weapon Bow ..|> Weapon +Spear ..|> Weapon +Sword ..|> Weapon @enduml \ No newline at end of file diff --git a/factory-method/etc/factory-method.urm.puml b/factory-method/etc/factory-method.urm.puml index d61984a85047..73a05e178661 100644 --- a/factory-method/etc/factory-method.urm.puml +++ b/factory-method/etc/factory-method.urm.puml @@ -1,34 +1,35 @@ @startuml package com.iluwatar.factory.method { - class OrcBlacksmith { - + OrcBlacksmith() - + manufactureWeapon(weaponType : WeaponType) : Weapon + class App { + - LOGGER : Logger {static} + - blacksmith : Blacksmith + + App(blacksmith : Blacksmith) + + main(args : String[]) {static} + - manufactureWeapons() + } + interface Blacksmith { + + manufactureWeapon(WeaponType) : Weapon {abstract} } class ElfBlacksmith { + ElfBlacksmith() + manufactureWeapon(weaponType : WeaponType) : Weapon } - class OrcWeapon { + class ElfWeapon { - weaponType : WeaponType - + OrcWeapon(weaponType : WeaponType) + + ElfWeapon(weaponType : WeaponType) + getWeaponType() : WeaponType + toString() : String } - interface Blacksmith { - + manufactureWeapon(WeaponType) : Weapon {abstract} + class OrcBlacksmith { + + OrcBlacksmith() + + manufactureWeapon(weaponType : WeaponType) : Weapon } - class ElfWeapon { + class OrcWeapon { - weaponType : WeaponType - + ElfWeapon(weaponType : WeaponType) + + OrcWeapon(weaponType : WeaponType) + getWeaponType() : WeaponType + toString() : String } - class App { - - blacksmith : Blacksmith - + App(blacksmith : Blacksmith) - + main(args : String[]) {static} - - manufactureWeapons() - } interface Weapon { + getWeaponType() : WeaponType {abstract} } @@ -46,8 +47,8 @@ package com.iluwatar.factory.method { ElfWeapon --> "-weaponType" WeaponType OrcWeapon --> "-weaponType" WeaponType App --> "-blacksmith" Blacksmith -OrcBlacksmith ..|> Blacksmith ElfBlacksmith ..|> Blacksmith -OrcWeapon ..|> Weapon ElfWeapon ..|> Weapon +OrcBlacksmith ..|> Blacksmith +OrcWeapon ..|> Weapon @enduml \ No newline at end of file diff --git a/feature-toggle/etc/feature-toggle.urm.puml b/feature-toggle/etc/feature-toggle.urm.puml index 6c935f3e64e5..0febb26319d1 100644 --- a/feature-toggle/etc/feature-toggle.urm.puml +++ b/feature-toggle/etc/feature-toggle.urm.puml @@ -37,6 +37,7 @@ package com.iluwatar.featuretoggle.pattern.propertiesversion { } package com.iluwatar.featuretoggle { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } diff --git a/fluentinterface/etc/fluentinterface.urm.puml b/fluentinterface/etc/fluentinterface.urm.puml index 0283e20b594c..ef71a0f4bace 100644 --- a/fluentinterface/etc/fluentinterface.urm.puml +++ b/fluentinterface/etc/fluentinterface.urm.puml @@ -21,6 +21,7 @@ package com.iluwatar.fluentinterface.fluentiterable.simple { } package com.iluwatar.fluentinterface.app { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} - negatives() : Predicate {static} diff --git a/flux/etc/flux.urm.puml b/flux/etc/flux.urm.puml index a4e0b0622eca..40637d624de3 100644 --- a/flux/etc/flux.urm.puml +++ b/flux/etc/flux.urm.puml @@ -1,34 +1,26 @@ @startuml package com.iluwatar.flux.view { - interface View { - + render() {abstract} - + storeChanged(Store) {abstract} + class ContentView { + - LOGGER : Logger {static} + - content : Content + + ContentView() + + render() + + storeChanged(store : Store) } class MenuView { + - LOGGER : Logger {static} - selected : MenuItem + MenuView() + itemClicked(item : MenuItem) + render() + storeChanged(store : Store) } - class ContentView { - - content : Content - + ContentView() - + render() - + storeChanged(store : Store) + interface View { + + render() {abstract} + + storeChanged(Store) {abstract} } } package com.iluwatar.flux.action { - class MenuAction { - - menuItem : MenuItem - + MenuAction(menuItem : MenuItem) - + getMenuItem() : MenuItem - } - class ContentAction { - - content : Content - + ContentAction(content : Content) - + getContent() : Content - } abstract class Action { - type : ActionType + Action(type : ActionType) @@ -40,22 +32,32 @@ package com.iluwatar.flux.action { + valueOf(name : String) : ActionType {static} + values() : ActionType[] {static} } - enum MenuItem { + enum Content { + COMPANY {static} - + HOME {static} + PRODUCTS {static} - title : String + toString() : String - + valueOf(name : String) : MenuItem {static} - + values() : MenuItem[] {static} + + valueOf(name : String) : Content {static} + + values() : Content[] {static} } - enum Content { + class ContentAction { + - content : Content + + ContentAction(content : Content) + + getContent() : Content + } + class MenuAction { + - menuItem : MenuItem + + MenuAction(menuItem : MenuItem) + + getMenuItem() : MenuItem + } + enum MenuItem { + COMPANY {static} + + HOME {static} + PRODUCTS {static} - title : String + toString() : String - + valueOf(name : String) : Content {static} - + values() : Content[] {static} + + valueOf(name : String) : MenuItem {static} + + values() : MenuItem[] {static} } } package com.iluwatar.flux.app { @@ -64,17 +66,6 @@ package com.iluwatar.flux.app { + main(args : String[]) {static} } } -package com.iluwatar.flux.dispatcher { - class Dispatcher { - - instance : Dispatcher {static} - - stores : List - - Dispatcher() - - dispatchAction(action : Action) - + getInstance() : Dispatcher {static} - + menuItemSelected(menuItem : MenuItem) - + registerStore(store : Store) - } -} package com.iluwatar.flux.store { class ContentStore { - content : Content @@ -96,20 +87,31 @@ package com.iluwatar.flux.store { + registerView(view : View) } } +package com.iluwatar.flux.dispatcher { + class Dispatcher { + - instance : Dispatcher {static} + - stores : List + - Dispatcher() + - dispatchAction(action : Action) + + getInstance() : Dispatcher {static} + + menuItemSelected(menuItem : MenuItem) + + registerStore(store : Store) + } +} MenuAction --> "-menuItem" MenuItem -Action --> "-type" ActionType MenuStore --> "-selected" MenuItem +Action --> "-type" ActionType Dispatcher --> "-instance" Dispatcher ContentView --> "-content" Content Dispatcher --> "-stores" Store MenuView --> "-selected" MenuItem Store --> "-views" View -ContentAction --> "-content" Content ContentStore --> "-content" Content -ContentStore --|> Store +ContentAction --> "-content" Content +ContentAction --|> Action MenuAction --|> Action +ContentStore --|> Store MenuStore --|> Store -ContentAction --|> Action -MenuView ..|> View ContentView ..|> View +MenuView ..|> View @enduml \ No newline at end of file diff --git a/flyweight/etc/flyweight.urm.puml b/flyweight/etc/flyweight.urm.puml index 3f2203712e15..648c223af594 100644 --- a/flyweight/etc/flyweight.urm.puml +++ b/flyweight/etc/flyweight.urm.puml @@ -1,19 +1,7 @@ @startuml package com.iluwatar.flyweight { - class PotionFactory { - - potions : Map - + PotionFactory() - ~ createPotion(type : PotionType) : Potion - } - class HealingPotion { - + HealingPotion() - + drink() - } - class InvisibilityPotion { - + InvisibilityPotion() - + drink() - } class AlchemistShop { + - LOGGER : Logger {static} - bottomShelf : List - topShelf : List + AlchemistShop() @@ -26,21 +14,34 @@ package com.iluwatar.flyweight { + App() + main(args : String[]) {static} } - interface Potion { - + drink() {abstract} + class HealingPotion { + - LOGGER : Logger {static} + + HealingPotion() + + drink() } - class PoisonPotion { - + PoisonPotion() + class HolyWaterPotion { + - LOGGER : Logger {static} + + HolyWaterPotion() + drink() } - class StrengthPotion { - + StrengthPotion() + class InvisibilityPotion { + - LOGGER : Logger {static} + + InvisibilityPotion() + drink() } - class HolyWaterPotion { - + HolyWaterPotion() + class PoisonPotion { + - LOGGER : Logger {static} + + PoisonPotion() + drink() } + interface Potion { + + drink() {abstract} + } + class PotionFactory { + - potions : Map + + PotionFactory() + ~ createPotion(type : PotionType) : Potion + } enum PotionType { + HEALING {static} + HOLY_WATER {static} @@ -50,11 +51,16 @@ package com.iluwatar.flyweight { + valueOf(name : String) : PotionType {static} + values() : PotionType[] {static} } + class StrengthPotion { + - LOGGER : Logger {static} + + StrengthPotion() + + drink() + } } AlchemistShop --> "-topShelf" Potion HealingPotion ..|> Potion +HolyWaterPotion ..|> Potion InvisibilityPotion ..|> Potion PoisonPotion ..|> Potion StrengthPotion ..|> Potion -HolyWaterPotion ..|> Potion @enduml \ No newline at end of file diff --git a/front-controller/etc/front-controller.urm.puml b/front-controller/etc/front-controller.urm.puml index 8fb9be184488..246e7657c4c5 100644 --- a/front-controller/etc/front-controller.urm.puml +++ b/front-controller/etc/front-controller.urm.puml @@ -1,23 +1,34 @@ @startuml package com.iluwatar.front.controller { + class App { + + App() + + main(args : String[]) {static} + } + class ArcherCommand { + + ArcherCommand() + + process() + } class ArcherView { + - LOGGER : Logger {static} + ArcherView() + display() } - interface View { - + display() {abstract} + class CatapultCommand { + + CatapultCommand() + + process() } class CatapultView { + - LOGGER : Logger {static} + CatapultView() + display() } - class ArcherCommand { - + ArcherCommand() - + process() + interface Command { + + process() {abstract} } - class App { - + App() - + main(args : String[]) {static} + class ErrorView { + - LOGGER : Logger {static} + + ErrorView() + + display() } class FrontController { + FrontController() @@ -29,22 +40,14 @@ package com.iluwatar.front.controller { + UnknownCommand() + process() } - class ErrorView { - + ErrorView() - + display() - } - class CatapultCommand { - + CatapultCommand() - + process() - } - interface Command { - + process() {abstract} + interface View { + + display() {abstract} } } +ArcherCommand ..|> Command ArcherView ..|> View +CatapultCommand ..|> Command CatapultView ..|> View -ArcherCommand ..|> Command -UnknownCommand ..|> Command ErrorView ..|> View -CatapultCommand ..|> Command +UnknownCommand ..|> Command @enduml \ No newline at end of file diff --git a/half-sync-half-async/etc/half-sync-half-async.urm.puml b/half-sync-half-async/etc/half-sync-half-async.urm.puml index 88f49eb4da50..1dd9c1d83432 100644 --- a/half-sync-half-async/etc/half-sync-half-async.urm.puml +++ b/half-sync-half-async/etc/half-sync-half-async.urm.puml @@ -1,9 +1,10 @@ @startuml package com.iluwatar.halfsynchalfasync { - class AsynchronousService { - - service : ExecutorService - + AsynchronousService(workQueue : BlockingQueue) - + execute(task : AsyncTask) + class App { + - LOGGER : Logger {static} + + App() + - ap(i : long) : long {static} + + main(args : String[]) {static} } ~class ArithmeticSumTask { - n : long @@ -13,17 +14,17 @@ package com.iluwatar.halfsynchalfasync { + onPostCall(result : Long) + onPreCall() } - class App { - + App() - - ap(i : long) : long {static} - + main(args : String[]) {static} - } interface AsyncTask { + call() : O {abstract} + onError(Throwable) {abstract} + onPostCall(O) {abstract} + onPreCall() {abstract} } + class AsynchronousService { + - service : ExecutorService + + AsynchronousService(workQueue : BlockingQueue) + + execute(task : AsyncTask) + } } ArithmeticSumTask ..+ App ArithmeticSumTask ..|> AsyncTask diff --git a/hexagonal/etc/hexagonal.urm.puml b/hexagonal/etc/hexagonal.urm.puml index a2f5d04691ec..f6dd970c0908 100644 --- a/hexagonal/etc/hexagonal.urm.puml +++ b/hexagonal/etc/hexagonal.urm.puml @@ -9,6 +9,7 @@ package com.iluwatar.hexagonal.sampledata { } package com.iluwatar.hexagonal.service { class ConsoleLottery { + - LOGGER : Logger {static} + ConsoleLottery() + main(args : String[]) {static} - printMainMenu() {static} @@ -24,16 +25,6 @@ package com.iluwatar.hexagonal.mongo { } } package com.iluwatar.hexagonal.domain { - class LotteryTicketId { - - id : int - - numAllocated : int {static} - + LotteryTicketId() - + LotteryTicketId(id : int) - + equals(o : Object) : boolean - + getId() : int - + hashCode() : int - + toString() : String - } class LotteryAdministration { - notifications : LotteryEventLog - repository : LotteryTicketRepository @@ -43,6 +34,14 @@ package com.iluwatar.hexagonal.domain { + performLottery() : LotteryNumbers + resetLottery() } + class LotteryConstants { + + PLAYER_MAX_SALDO : int {static} + + PRIZE_AMOUNT : int {static} + + SERVICE_BANK_ACCOUNT : String {static} + + SERVICE_BANK_ACCOUNT_SALDO : int {static} + + TICKET_PRIZE : int {static} + - LotteryConstants() + } class LotteryNumbers { + MAX_NUMBER : int {static} + MIN_NUMBER : int {static} @@ -59,6 +58,11 @@ package com.iluwatar.hexagonal.domain { + hashCode() : int + toString() : String } + -class RandomNumberGenerator { + - randomIterator : OfInt + + RandomNumberGenerator(min : int, max : int) + + nextInt() : int + } class LotteryService { - notifications : LotteryEventLog - repository : LotteryTicketRepository @@ -67,21 +71,17 @@ package com.iluwatar.hexagonal.domain { + checkTicketForPrize(id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult + submitTicket(ticket : LotteryTicket) : Optional } - -class RandomNumberGenerator { - - randomIterator : OfInt - + RandomNumberGenerator(min : int, max : int) - + nextInt() : int - } - class PlayerDetails { - - bankAccountNumber : String - - emailAddress : String - - phoneNumber : String - + PlayerDetails(email : String, bankAccount : String, phone : String) + class LotteryTicket { + - id : LotteryTicketId + - lotteryNumbers : LotteryNumbers + - playerDetails : PlayerDetails + + LotteryTicket(id : LotteryTicketId, details : PlayerDetails, numbers : LotteryNumbers) + equals(obj : Object) : boolean - + getBankAccount() : String - + getEmail() : String - + getPhoneNumber() : String + + getId() : LotteryTicketId + + getNumbers() : LotteryNumbers + + getPlayerDetails() : PlayerDetails + hashCode() : int + + setId(id : LotteryTicketId) + toString() : String } class LotteryTicketCheckResult { @@ -94,44 +94,47 @@ package com.iluwatar.hexagonal.domain { + getResult() : CheckResult + hashCode() : int } - class LotteryConstants { - + PLAYER_MAX_SALDO : int {static} - + PRIZE_AMOUNT : int {static} - + SERVICE_BANK_ACCOUNT : String {static} - + SERVICE_BANK_ACCOUNT_SALDO : int {static} - + TICKET_PRIZE : int {static} - - LotteryConstants() + enum CheckResult { + + NO_PRIZE {static} + + TICKET_NOT_SUBMITTED {static} + + WIN_PRIZE {static} + + valueOf(name : String) : CheckResult {static} + + values() : CheckResult[] {static} } - class LotteryTicket { - - id : LotteryTicketId - - lotteryNumbers : LotteryNumbers - - playerDetails : PlayerDetails - + LotteryTicket(id : LotteryTicketId, details : PlayerDetails, numbers : LotteryNumbers) - + equals(obj : Object) : boolean - + getId() : LotteryTicketId - + getNumbers() : LotteryNumbers - + getPlayerDetails() : PlayerDetails + class LotteryTicketId { + - id : int + - numAllocated : int {static} + + LotteryTicketId() + + LotteryTicketId(id : int) + + equals(o : Object) : boolean + + getId() : int + hashCode() : int - + setId(id : LotteryTicketId) + toString() : String } class LotteryUtils { - LotteryUtils() + checkTicketForPrize(repository : LotteryTicketRepository, id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult {static} } - enum CheckResult { - + NO_PRIZE {static} - + TICKET_NOT_SUBMITTED {static} - + WIN_PRIZE {static} - + valueOf(name : String) : CheckResult {static} - + values() : CheckResult[] {static} + class PlayerDetails { + - bankAccountNumber : String + - emailAddress : String + - phoneNumber : String + + PlayerDetails(email : String, bankAccount : String, phone : String) + + equals(obj : Object) : boolean + + getBankAccount() : String + + getEmail() : String + + getPhoneNumber() : String + + hashCode() : int + + toString() : String } } package com.iluwatar.hexagonal.banking { - interface WireTransfers { - + getFunds(String) : int {abstract} - + setFunds(String, int) {abstract} - + transferFunds(int, String, String) : boolean {abstract} + class InMemoryBank { + - accounts : Map {static} + + InMemoryBank() + + getFunds(bankAccount : String) : int + + setFunds(bankAccount : String, amount : int) + + transferFunds(amount : int, sourceBackAccount : String, destinationBankAccount : String) : boolean } class MongoBank { - DEFAULT_ACCOUNTS_COLLECTION : String {static} @@ -150,15 +153,27 @@ package com.iluwatar.hexagonal.banking { + setFunds(bankAccount : String, amount : int) + transferFunds(amount : int, sourceBackAccount : String, destinationBankAccount : String) : boolean } - class InMemoryBank { - - accounts : Map {static} - + InMemoryBank() - + getFunds(bankAccount : String) : int - + setFunds(bankAccount : String, amount : int) - + transferFunds(amount : int, sourceBackAccount : String, destinationBankAccount : String) : boolean + interface WireTransfers { + + getFunds(String) : int {abstract} + + setFunds(String, int) {abstract} + + transferFunds(int, String, String) : boolean {abstract} } } package com.iluwatar.hexagonal.database { + class InMemoryTicketRepository { + - tickets : Map {static} + + InMemoryTicketRepository() + + deleteAll() + + findAll() : Map + + findById(id : LotteryTicketId) : Optional + + save(ticket : LotteryTicket) : Optional + } + interface LotteryTicketRepository { + + deleteAll() {abstract} + + findAll() : Map {abstract} + + findById(LotteryTicketId) : Optional {abstract} + + save(LotteryTicket) : Optional {abstract} + } class MongoTicketRepository { - DEFAULT_COUNTERS_COLLECTION : String {static} - DEFAULT_DB : String {static} @@ -183,20 +198,6 @@ package com.iluwatar.hexagonal.database { - initCounters() + save(ticket : LotteryTicket) : Optional } - class InMemoryTicketRepository { - - tickets : Map {static} - + InMemoryTicketRepository() - + deleteAll() - + findAll() : Map - + findById(id : LotteryTicketId) : Optional - + save(ticket : LotteryTicket) : Optional - } - interface LotteryTicketRepository { - + deleteAll() {abstract} - + findAll() : Map {abstract} - + findById(LotteryTicketId) : Optional {abstract} - + save(LotteryTicket) : Optional {abstract} - } } package com.iluwatar.hexagonal { class App { @@ -206,6 +207,7 @@ package com.iluwatar.hexagonal { } package com.iluwatar.hexagonal.administration { class ConsoleAdministration { + - LOGGER : Logger {static} + ConsoleAdministration() + main(args : String[]) {static} - printMainMenu() {static} @@ -220,14 +222,6 @@ package com.iluwatar.hexagonal.eventlog { + ticketSubmitted(PlayerDetails) {abstract} + ticketWon(PlayerDetails, int) {abstract} } - class StdOutEventLog { - + StdOutEventLog() - + prizeError(details : PlayerDetails, prizeAmount : int) - + ticketDidNotWin(details : PlayerDetails) - + ticketSubmitError(details : PlayerDetails) - + ticketSubmitted(details : PlayerDetails) - + ticketWon(details : PlayerDetails, prizeAmount : int) - } class MongoEventLog { - DEFAULT_DB : String {static} - DEFAULT_EVENTS_COLLECTION : String {static} @@ -248,29 +242,34 @@ package com.iluwatar.hexagonal.eventlog { + ticketSubmitted(details : PlayerDetails) + ticketWon(details : PlayerDetails, prizeAmount : int) } + class StdOutEventLog { + - LOGGER : Logger {static} + + StdOutEventLog() + + prizeError(details : PlayerDetails, prizeAmount : int) + + ticketDidNotWin(details : PlayerDetails) + + ticketSubmitError(details : PlayerDetails) + + ticketSubmitted(details : PlayerDetails) + + ticketWon(details : PlayerDetails, prizeAmount : int) + } } -LotteryAdministration --+ LotteryTicketCheckResult -LotteryTicket --> "-playerDetails" PlayerDetails -MongoEventLog --> "-stdOutEventLog" StdOutEventLog -LotteryService --> "-wireTransfers" WireTransfers -LotteryAdministration --> "-notifications" LotteryEventLog -RandomNumberGenerator ..+ PrimitiveIterator LotteryAdministration --> "-wireTransfers" WireTransfers LotteryTicket --> "-id" LotteryTicketId +LotteryTicket --> "-playerDetails" PlayerDetails LotteryService --> "-notifications" LotteryEventLog LotteryAdministration --> "-repository" LotteryTicketRepository LotteryTicket --> "-lotteryNumbers" LotteryNumbers +MongoEventLog --> "-stdOutEventLog" StdOutEventLog +LotteryService --> "-wireTransfers" WireTransfers SampleData --> "-PLAYERS" PlayerDetails -ConsoleLottery --+ LotteryTicketCheckResult +LotteryAdministration --> "-notifications" LotteryEventLog RandomNumberGenerator ..+ LotteryNumbers LotteryService --> "-repository" LotteryTicketRepository -LotteryUtils --+ LotteryTicketCheckResult -LotteryTicketCheckResult --> "-checkResult" CheckResult CheckResult ..+ LotteryTicketCheckResult -MongoTicketRepository ..|> LotteryTicketRepository -MongoBank ..|> WireTransfers +LotteryTicketCheckResult --> "-checkResult" CheckResult InMemoryBank ..|> WireTransfers -StdOutEventLog ..|> LotteryEventLog +MongoBank ..|> WireTransfers InMemoryTicketRepository ..|> LotteryTicketRepository +MongoTicketRepository ..|> LotteryTicketRepository MongoEventLog ..|> LotteryEventLog +StdOutEventLog ..|> LotteryEventLog @enduml \ No newline at end of file diff --git a/intercepting-filter/etc/intercepting-filter.urm.puml b/intercepting-filter/etc/intercepting-filter.urm.puml index e3616c3abf64..2b090cfff258 100644 --- a/intercepting-filter/etc/intercepting-filter.urm.puml +++ b/intercepting-filter/etc/intercepting-filter.urm.puml @@ -1,8 +1,13 @@ @startuml package com.iluwatar.intercepting.filter { - class DepositFilter { - + DepositFilter() + abstract class AbstractFilter { + - next : Filter + + AbstractFilter() + + AbstractFilter(next : Filter) + execute(order : Order) : String + + getLast() : Filter + + getNext() : Filter + + setNext(filter : Filter) } class AddressFilter { + AddressFilter() @@ -12,14 +17,35 @@ package com.iluwatar.intercepting.filter { + App() + main(args : String[]) {static} } - abstract class AbstractFilter { - - next : Filter - + AbstractFilter() - + AbstractFilter(next : Filter) + class ContactFilter { + + ContactFilter() + + execute(order : Order) : String + } + class DepositFilter { + + DepositFilter() + + execute(order : Order) : String + } + interface Filter { + + execute(Order) : String {abstract} + + getLast() : Filter {abstract} + + getNext() : Filter {abstract} + + setNext(Filter) {abstract} + } + class FilterChain { + - chain : Filter + + FilterChain() + + addFilter(filter : Filter) + + execute(order : Order) : String + } + class FilterManager { + - filterChain : FilterChain + + FilterManager() + + addFilter(filter : Filter) + + filterRequest(order : Order) : String + } + class NameFilter { + + NameFilter() + execute(order : Order) : String - + getLast() : Filter - + getNext() : Filter - + setNext(filter : Filter) } class Order { - address : String @@ -40,49 +66,23 @@ package com.iluwatar.intercepting.filter { + setName(name : String) + setOrder(order : String) } - class FilterManager { - - filterChain : FilterChain - + FilterManager() - + addFilter(filter : Filter) - + filterRequest(order : Order) : String - } - class NameFilter { - + NameFilter() - + execute(order : Order) : String - } - class ContactFilter { - + ContactFilter() + class OrderFilter { + + OrderFilter() + execute(order : Order) : String } - interface Filter { - + execute(Order) : String {abstract} - + getLast() : Filter {abstract} - + getNext() : Filter {abstract} - + setNext(Filter) {abstract} - } ~class DListener { ~ DListener() + actionPerformed(e : ActionEvent) } - class OrderFilter { - + OrderFilter() - + execute(order : Order) : String - } - class FilterChain { - - chain : Filter - + FilterChain() - + addFilter(filter : Filter) - + execute(order : Order) : String - } } AbstractFilter --> "-next" Filter DListener --+ Target -FilterChain --> "-chain" Filter FilterManager --> "-filterChain" FilterChain -DepositFilter --|> AbstractFilter -AddressFilter --|> AbstractFilter +FilterChain --> "-chain" Filter AbstractFilter ..|> Filter -NameFilter --|> AbstractFilter +AddressFilter --|> AbstractFilter ContactFilter --|> AbstractFilter +DepositFilter --|> AbstractFilter +NameFilter --|> AbstractFilter OrderFilter --|> AbstractFilter @enduml \ No newline at end of file diff --git a/interpreter/etc/interpreter.urm.puml b/interpreter/etc/interpreter.urm.puml index dc0d83bf2fb1..e79ad1989588 100644 --- a/interpreter/etc/interpreter.urm.puml +++ b/interpreter/etc/interpreter.urm.puml @@ -1,20 +1,7 @@ @startuml package com.iluwatar.interpreter { - class NumberExpression { - - number : int - + NumberExpression(number : int) - + NumberExpression(s : String) - + interpret() : int - + toString() : String - } - class MinusExpression { - - leftExpression : Expression - - rightExpression : Expression - + MinusExpression(leftExpression : Expression, rightExpression : Expression) - + interpret() : int - + toString() : String - } class App { + - LOGGER : Logger {static} + App() + getOperatorInstance(s : String, left : Expression, right : Expression) : Expression {static} + isOperator(s : String) : boolean {static} @@ -25,6 +12,13 @@ package com.iluwatar.interpreter { + interpret() : int {abstract} + toString() : String {abstract} } + class MinusExpression { + - leftExpression : Expression + - rightExpression : Expression + + MinusExpression(leftExpression : Expression, rightExpression : Expression) + + interpret() : int + + toString() : String + } class MultiplyExpression { - leftExpression : Expression - rightExpression : Expression @@ -32,6 +26,13 @@ package com.iluwatar.interpreter { + interpret() : int + toString() : String } + class NumberExpression { + - number : int + + NumberExpression(number : int) + + NumberExpression(s : String) + + interpret() : int + + toString() : String + } class PlusExpression { - leftExpression : Expression - rightExpression : Expression @@ -43,8 +44,8 @@ package com.iluwatar.interpreter { MultiplyExpression --> "-leftExpression" Expression MinusExpression --> "-leftExpression" Expression PlusExpression --> "-leftExpression" Expression -NumberExpression --|> Expression MinusExpression --|> Expression MultiplyExpression --|> Expression +NumberExpression --|> Expression PlusExpression --|> Expression @enduml \ No newline at end of file diff --git a/iterator/etc/iterator.urm.puml b/iterator/etc/iterator.urm.puml index 032cd4c165b4..881b9a6d47df 100644 --- a/iterator/etc/iterator.urm.puml +++ b/iterator/etc/iterator.urm.puml @@ -1,6 +1,7 @@ @startuml package com.iluwatar.iterator { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } @@ -12,21 +13,6 @@ package com.iluwatar.iterator { + setType(type : ItemType) + toString() : String } - class TreasureChestItemIterator { - - chest : TreasureChest - - idx : int - - type : ItemType - + TreasureChestItemIterator(chest : TreasureChest, type : ItemType) - - findNextIdx() : int - + hasNext() : boolean - + next() : Item - } - class TreasureChest { - - items : List - + TreasureChest() - + getItems() : List - ~ iterator(itemType : ItemType) : ItemIterator - } interface ItemIterator { + hasNext() : boolean {abstract} + next() : Item {abstract} @@ -39,6 +25,21 @@ package com.iluwatar.iterator { + valueOf(name : String) : ItemType {static} + values() : ItemType[] {static} } + class TreasureChest { + - items : List + + TreasureChest() + + getItems() : List + ~ iterator(itemType : ItemType) : ItemIterator + } + class TreasureChestItemIterator { + - chest : TreasureChest + - idx : int + - type : ItemType + + TreasureChestItemIterator(chest : TreasureChest, type : ItemType) + - findNextIdx() : int + + hasNext() : boolean + + next() : Item + } } Item --> "-type" ItemType TreasureChest --> "-items" Item diff --git a/layers/etc/layers.urm.puml b/layers/etc/layers.urm.puml index 2ec6e142eabd..e597c7546ec4 100644 --- a/layers/etc/layers.urm.puml +++ b/layers/etc/layers.urm.puml @@ -1,14 +1,54 @@ @startuml package com.iluwatar.layers { - interface View { - + render() {abstract} + class App { + - cakeBakingService : CakeBakingService {static} + + App() + - initializeData(cakeBakingService : CakeBakingService) {static} + + main(args : String[]) {static} } - class CakeToppingInfo { - + calories : int + class Cake { + - id : Long + - layers : Set + - topping : CakeTopping + + Cake() + + addLayer(layer : CakeLayer) + + getId() : Long + + getLayers() : Set + + getTopping() : CakeTopping + + setId(id : Long) + + setLayers(layers : Set) + + setTopping(topping : CakeTopping) + + toString() : String + } + interface CakeBakingService { + + bakeNewCake(CakeInfo) {abstract} + + getAllCakes() : List {abstract} + + getAvailableLayers() : List {abstract} + + getAvailableToppings() : List {abstract} + + saveNewLayer(CakeLayerInfo) {abstract} + + saveNewTopping(CakeToppingInfo) {abstract} + } + class CakeBakingServiceImpl { + - context : AbstractApplicationContext + + CakeBakingServiceImpl() + + bakeNewCake(cakeInfo : CakeInfo) + + getAllCakes() : List + - getAvailableLayerEntities() : List + + getAvailableLayers() : List + - getAvailableToppingEntities() : List + + getAvailableToppings() : List + + saveNewLayer(layerInfo : CakeLayerInfo) + + saveNewTopping(toppingInfo : CakeToppingInfo) + } + interface CakeDao { + } + class CakeInfo { + + cakeLayerInfos : List + + cakeToppingInfo : CakeToppingInfo + id : Optional - + name : String - + CakeToppingInfo(id : Long, name : String, calories : int) - + CakeToppingInfo(name : String, calories : int) + + CakeInfo(cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List) + + CakeInfo(id : Long, cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List) + + calculateTotalCalories() : int + toString() : String } class CakeLayer { @@ -28,6 +68,8 @@ package com.iluwatar.layers { + setName(name : String) + toString() : String } + interface CakeLayerDao { + } class CakeLayerInfo { + calories : int + id : Optional @@ -36,23 +78,6 @@ package com.iluwatar.layers { + CakeLayerInfo(name : String, calories : int) + toString() : String } - class CakeViewImpl { - - cakeBakingService : CakeBakingService - + CakeViewImpl(cakeBakingService : CakeBakingService) - + render() - } - class CakeBakingServiceImpl { - - context : AbstractApplicationContext - + CakeBakingServiceImpl() - + bakeNewCake(cakeInfo : CakeInfo) - + getAllCakes() : List - - getAvailableLayerEntities() : List - + getAvailableLayers() : List - - getAvailableToppingEntities() : List - + getAvailableToppings() : List - + saveNewLayer(layerInfo : CakeLayerInfo) - + saveNewTopping(toppingInfo : CakeToppingInfo) - } class CakeTopping { - cake : Cake - calories : int @@ -70,49 +95,25 @@ package com.iluwatar.layers { + setName(name : String) + toString() : String } - class Cake { - - id : Long - - layers : Set - - topping : CakeTopping - + Cake() - + addLayer(layer : CakeLayer) - + getId() : Long - + getLayers() : Set - + getTopping() : CakeTopping - + setId(id : Long) - + setLayers(layers : Set) - + setTopping(topping : CakeTopping) - + toString() : String - } interface CakeToppingDao { } - interface CakeBakingService { - + bakeNewCake(CakeInfo) {abstract} - + getAllCakes() : List {abstract} - + getAvailableLayers() : List {abstract} - + getAvailableToppings() : List {abstract} - + saveNewLayer(CakeLayerInfo) {abstract} - + saveNewTopping(CakeToppingInfo) {abstract} - } - class App { - - cakeBakingService : CakeBakingService {static} - + App() - - initializeData(cakeBakingService : CakeBakingService) {static} - + main(args : String[]) {static} - } - interface CakeDao { - } - interface CakeLayerDao { - } - class CakeInfo { - + cakeLayerInfos : List - + cakeToppingInfo : CakeToppingInfo + class CakeToppingInfo { + + calories : int + id : Optional - + CakeInfo(cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List) - + CakeInfo(id : Long, cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List) - + calculateTotalCalories() : int + + name : String + + CakeToppingInfo(id : Long, name : String, calories : int) + + CakeToppingInfo(name : String, calories : int) + toString() : String } + class CakeViewImpl { + - LOGGER : Logger {static} + - cakeBakingService : CakeBakingService + + CakeViewImpl(cakeBakingService : CakeBakingService) + + render() + } + interface View { + + render() {abstract} + } } CakeViewImpl --> "-cakeBakingService" CakeBakingService CakeInfo --> "-cakeToppingInfo" CakeToppingInfo @@ -120,6 +121,6 @@ CakeInfo --> "-cakeLayerInfos" CakeLayerInfo App --> "-cakeBakingService" CakeBakingService CakeLayer --> "-cake" Cake Cake --> "-topping" CakeTopping -CakeViewImpl ..|> View CakeBakingServiceImpl ..|> CakeBakingService +CakeViewImpl ..|> View @enduml \ No newline at end of file diff --git a/lazy-loading/etc/lazy-loading.urm.puml b/lazy-loading/etc/lazy-loading.urm.puml index 80192160a425..e982cb0d34ab 100644 --- a/lazy-loading/etc/lazy-loading.urm.puml +++ b/lazy-loading/etc/lazy-loading.urm.puml @@ -1,33 +1,38 @@ @startuml package com.iluwatar.lazy.loading { - ~class HeavyFactory { - - heavyInstance : Heavy - ~ HeavyFactory() - + get() : Heavy - } class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } - class HolderThreadSafe { - - heavy : Heavy - + HolderThreadSafe() - + getHeavy() : Heavy - } class Heavy { + - LOGGER : Logger {static} + Heavy() } class HolderNaive { + - LOGGER : Logger {static} - heavy : Heavy + HolderNaive() + getHeavy() : Heavy } + class HolderThreadSafe { + - LOGGER : Logger {static} + - heavy : Heavy + + HolderThreadSafe() + + getHeavy() : Heavy + } class Java8Holder { + - LOGGER : Logger {static} - heavy : Supplier + Java8Holder() - createAndCacheHeavy() : Heavy + getHeavy() : Heavy } + ~class HeavyFactory { + - heavyInstance : Heavy + ~ HeavyFactory() + + get() : Heavy + } } HolderNaive --> "-heavy" Heavy HolderThreadSafe --> "-heavy" Heavy diff --git a/mediator/etc/mediator.urm.puml b/mediator/etc/mediator.urm.puml index 330e024abb1b..04e75d2b8841 100644 --- a/mediator/etc/mediator.urm.puml +++ b/mediator/etc/mediator.urm.puml @@ -1,37 +1,47 @@ @startuml package com.iluwatar.mediator { - interface Party { - + act(PartyMember, Action) {abstract} - + addMember(PartyMember) {abstract} + enum Action { + + ENEMY {static} + + GOLD {static} + + HUNT {static} + + NONE {static} + + TALE {static} + - description : String + - title : String + + getDescription() : String + + toString() : String + + valueOf(name : String) : Action {static} + + values() : Action[] {static} } - interface PartyMember { - + act(Action) {abstract} - + joinedParty(Party) {abstract} - + partyAction(Action) {abstract} + class App { + + App() + + main(args : String[]) {static} } - class Rogue { - + Rogue() + class Hobbit { + + Hobbit() + toString() : String } class Hunter { + Hunter() + toString() : String } + interface Party { + + act(PartyMember, Action) {abstract} + + addMember(PartyMember) {abstract} + } class PartyImpl { - members : List + PartyImpl() + act(actor : PartyMember, action : Action) + addMember(member : PartyMember) } - class Hobbit { - + Hobbit() - + toString() : String - } - class Wizard { - + Wizard() - + toString() : String + interface PartyMember { + + act(Action) {abstract} + + joinedParty(Party) {abstract} + + partyAction(Action) {abstract} } abstract class PartyMemberBase { + - LOGGER : Logger {static} # party : Party + PartyMemberBase() + act(action : Action) @@ -39,30 +49,21 @@ package com.iluwatar.mediator { + partyAction(action : Action) + toString() : String {abstract} } - class App { - + App() - + main(args : String[]) {static} + class Rogue { + + Rogue() + + toString() : String } - enum Action { - + ENEMY {static} - + GOLD {static} - + HUNT {static} - + NONE {static} - + TALE {static} - - description : String - - title : String - + getDescription() : String + class Wizard { + + Wizard() + toString() : String - + valueOf(name : String) : Action {static} - + values() : Action[] {static} } } PartyImpl --> "-members" PartyMember PartyMemberBase --> "-party" Party -Rogue --|> PartyMemberBase +Hobbit --|> PartyMemberBase Hunter --|> PartyMemberBase PartyImpl ..|> Party -Hobbit --|> PartyMemberBase -Wizard --|> PartyMemberBase PartyMemberBase ..|> PartyMember +Rogue --|> PartyMemberBase +Wizard --|> PartyMemberBase @enduml \ No newline at end of file diff --git a/memento/etc/memento.urm.puml b/memento/etc/memento.urm.puml index 316d4047ddbd..319227ad242c 100644 --- a/memento/etc/memento.urm.puml +++ b/memento/etc/memento.urm.puml @@ -1,23 +1,10 @@ @startuml package com.iluwatar.memento { - -class StarMementoInternal { - - ageYears : int - - massTons : int - - type : StarType - - StarMementoInternal() - + getAgeYears() : int - + getMassTons() : int - + getType() : StarType - + setAgeYears(ageYears : int) - + setMassTons(massTons : int) - + setType(type : StarType) - } class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } - interface StarMemento { - } class Star { - ageYears : int - massTons : int @@ -28,6 +15,20 @@ package com.iluwatar.memento { + timePasses() + toString() : String } + -class StarMementoInternal { + - ageYears : int + - massTons : int + - type : StarType + - StarMementoInternal() + + getAgeYears() : int + + getMassTons() : int + + getType() : StarType + + setAgeYears(ageYears : int) + + setMassTons(massTons : int) + + setType(type : StarType) + } + interface StarMemento { + } enum StarType { + DEAD {static} + RED_GIANT {static} diff --git a/message-channel/etc/message-channel.urm.puml b/message-channel/etc/message-channel.urm.puml index 9e2b24032f1e..852f190b46d0 100644 --- a/message-channel/etc/message-channel.urm.puml +++ b/message-channel/etc/message-channel.urm.puml @@ -1,6 +1,7 @@ @startuml package com.iluwatar.message.channel { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } diff --git a/model-view-controller/etc/model-view-controller.urm.puml b/model-view-controller/etc/model-view-controller.urm.puml index ad979fe0e066..92ec1e949d83 100644 --- a/model-view-controller/etc/model-view-controller.urm.puml +++ b/model-view-controller/etc/model-view-controller.urm.puml @@ -1,17 +1,17 @@ @startuml package com.iluwatar.model.view.controller { - class GiantModel { - - fatigue : Fatigue - - health : Health - - nourishment : Nourishment - ~ GiantModel(health : Health, fatigue : Fatigue, nourishment : Nourishment) - + getFatigue() : Fatigue - + getHealth() : Health - + getNourishment() : Nourishment - + setFatigue(fatigue : Fatigue) - + setHealth(health : Health) - + setNourishment(nourishment : Nourishment) + class App { + + App() + + main(args : String[]) {static} + } + enum Fatigue { + + ALERT {static} + + SLEEPING {static} + + TIRED {static} + - title : String + toString() : String + + valueOf(name : String) : Fatigue {static} + + values() : Fatigue[] {static} } class GiantController { - giant : GiantModel @@ -25,14 +25,24 @@ package com.iluwatar.model.view.controller { + setNourishment(nourishment : Nourishment) + updateView() } + class GiantModel { + - fatigue : Fatigue + - health : Health + - nourishment : Nourishment + ~ GiantModel(health : Health, fatigue : Fatigue, nourishment : Nourishment) + + getFatigue() : Fatigue + + getHealth() : Health + + getNourishment() : Nourishment + + setFatigue(fatigue : Fatigue) + + setHealth(health : Health) + + setNourishment(nourishment : Nourishment) + + toString() : String + } class GiantView { + - LOGGER : Logger {static} + GiantView() + displayGiant(giant : GiantModel) } - class App { - + App() - + main(args : String[]) {static} - } enum Health { + DEAD {static} + HEALTHY {static} @@ -51,15 +61,6 @@ package com.iluwatar.model.view.controller { + valueOf(name : String) : Nourishment {static} + values() : Nourishment[] {static} } - enum Fatigue { - + ALERT {static} - + SLEEPING {static} - + TIRED {static} - - title : String - + toString() : String - + valueOf(name : String) : Fatigue {static} - + values() : Fatigue[] {static} - } } GiantModel --> "-nourishment" Nourishment GiantController --> "-giant" GiantModel diff --git a/model-view-presenter/etc/model-view-presenter.urm.puml b/model-view-presenter/etc/model-view-presenter.urm.puml index 0cec653e44c1..188b3fb4de2d 100644 --- a/model-view-presenter/etc/model-view-presenter.urm.puml +++ b/model-view-presenter/etc/model-view-presenter.urm.puml @@ -1,34 +1,8 @@ @startuml package com.iluwatar.model.view.presenter { - interface FileSelectorView { - + close() {abstract} - + displayData(String) {abstract} - + getFileName() : String {abstract} - + getPresenter() : FileSelectorPresenter {abstract} - + isOpened() : boolean {abstract} - + open() {abstract} - + setFileName(String) {abstract} - + setPresenter(FileSelectorPresenter) {abstract} - + showMessage(String) {abstract} - } - class FileSelectorStub { - - dataDisplayed : boolean - - name : String - - numOfMessageSent : int - - opened : boolean - - presenter : FileSelectorPresenter - + FileSelectorStub() - + close() - + dataDisplayed() : boolean - + displayData(data : String) - + getFileName() : String - + getMessagesSent() : int - + getPresenter() : FileSelectorPresenter - + isOpened() : boolean - + open() - + setFileName(name : String) - + setPresenter(presenter : FileSelectorPresenter) - + showMessage(message : String) + class App { + + App() + + main(args : String[]) {static} } class FileLoader { - fileName : String @@ -40,20 +14,6 @@ package com.iluwatar.model.view.presenter { + loadData() : String + setFileName(fileName : String) } - class FileSelectorPresenter { - - loader : FileLoader - - view : FileSelectorView - + FileSelectorPresenter(view : FileSelectorView) - + cancelled() - + confirmed() - + fileNameChanged() - + setLoader(loader : FileLoader) - + start() - } - class App { - + App() - + main(args : String[]) {static} - } class FileSelectorJFrame { - area : JTextArea - cancel : JButton @@ -77,11 +37,51 @@ package com.iluwatar.model.view.presenter { + setPresenter(presenter : FileSelectorPresenter) + showMessage(message : String) } + class FileSelectorPresenter { + - loader : FileLoader + - view : FileSelectorView + + FileSelectorPresenter(view : FileSelectorView) + + cancelled() + + confirmed() + + fileNameChanged() + + setLoader(loader : FileLoader) + + start() + } + class FileSelectorStub { + - dataDisplayed : boolean + - name : String + - numOfMessageSent : int + - opened : boolean + - presenter : FileSelectorPresenter + + FileSelectorStub() + + close() + + dataDisplayed() : boolean + + displayData(data : String) + + getFileName() : String + + getMessagesSent() : int + + getPresenter() : FileSelectorPresenter + + isOpened() : boolean + + open() + + setFileName(name : String) + + setPresenter(presenter : FileSelectorPresenter) + + showMessage(message : String) + } + interface FileSelectorView { + + close() {abstract} + + displayData(String) {abstract} + + getFileName() : String {abstract} + + getPresenter() : FileSelectorPresenter {abstract} + + isOpened() : boolean {abstract} + + open() {abstract} + + setFileName(String) {abstract} + + setPresenter(FileSelectorPresenter) {abstract} + + showMessage(String) {abstract} + } } -FileSelectorJFrame --> "-presenter" FileSelectorPresenter FileSelectorStub --> "-presenter" FileSelectorPresenter +FileSelectorJFrame --> "-presenter" FileSelectorPresenter FileSelectorPresenter --> "-loader" FileLoader FileSelectorPresenter --> "-view" FileSelectorView -FileSelectorStub ..|> FileSelectorView FileSelectorJFrame ..|> FileSelectorView +FileSelectorStub ..|> FileSelectorView @enduml \ No newline at end of file diff --git a/monad/etc/monad.urm.puml b/monad/etc/monad.urm.puml index 6fe037064dcd..c9dcc8db664f 100644 --- a/monad/etc/monad.urm.puml +++ b/monad/etc/monad.urm.puml @@ -1,18 +1,16 @@ @startuml package com.iluwatar.monad { - class Validator { - - exceptions : List - - t : T - - Validator(t : T) - + get() : T - + of(t : T) : Validator {static} - + validate(projection : Function, validation : Predicate, message : String) : Validator - + validate(validation : Predicate, message : String) : Validator - } class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } + enum Sex { + + FEMALE {static} + + MALE {static} + + valueOf(name : String) : Sex {static} + + values() : Sex[] {static} + } class User { - age : int - email : String @@ -24,11 +22,14 @@ package com.iluwatar.monad { + getName() : String + getSex() : Sex } - enum Sex { - + FEMALE {static} - + MALE {static} - + valueOf(name : String) : Sex {static} - + values() : Sex[] {static} + class Validator { + - exceptions : List + - t : T + - Validator(t : T) + + get() : T + + of(t : T) : Validator {static} + + validate(projection : Function, validation : Predicate, message : String) : Validator + + validate(validation : Predicate, message : String) : Validator } } User --> "-sex" Sex diff --git a/monostate/etc/monostate.urm.puml b/monostate/etc/monostate.urm.puml index 6574bcad1f0e..b7797d5e4954 100644 --- a/monostate/etc/monostate.urm.puml +++ b/monostate/etc/monostate.urm.puml @@ -4,10 +4,6 @@ package com.iluwatar.monostate { + App() + main(args : String[]) {static} } - class Request { - + value : String - + Request(value : String) - } class LoadBalancer { - id : int {static} - lastServedId : int {static} @@ -18,7 +14,12 @@ package com.iluwatar.monostate { + getNoOfServers() : int + serverRequest(request : Request) } + class Request { + + value : String + + Request(value : String) + } class Server { + - LOGGER : Logger {static} + host : String + id : int + port : int diff --git a/multiton/etc/multiton.urm.puml b/multiton/etc/multiton.urm.puml index c582a6379ce0..63a74b1f1f74 100644 --- a/multiton/etc/multiton.urm.puml +++ b/multiton/etc/multiton.urm.puml @@ -1,6 +1,7 @@ @startuml package com.iluwatar.multiton { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } diff --git a/mute-idiom/etc/mute-idiom.urm.puml b/mute-idiom/etc/mute-idiom.urm.puml index c992773f52c1..32d036bc8144 100644 --- a/mute-idiom/etc/mute-idiom.urm.puml +++ b/mute-idiom/etc/mute-idiom.urm.puml @@ -1,9 +1,7 @@ @startuml package com.iluwatar.mute { - interface CheckedRunnable { - + run() {abstract} - } class App { + - LOGGER : Logger {static} + App() - acquireResource() : Resource {static} - closeResource(resource : Resource) {static} @@ -12,6 +10,9 @@ package com.iluwatar.mute { - useOfMute() {static} - utilizeResource(resource : Resource) {static} } + interface CheckedRunnable { + + run() {abstract} + } class Mute { - Mute() + loggedMute(runnable : CheckedRunnable) {static} diff --git a/mutex/etc/mutex.urm.puml b/mutex/etc/mutex.urm.puml index 68b96d66816a..08cf43b90795 100644 --- a/mutex/etc/mutex.urm.puml +++ b/mutex/etc/mutex.urm.puml @@ -1,5 +1,9 @@ @startuml package com.iluwatar.mutex { + class App { + + App() + + main(args : String[]) {static} + } class Jar { - beans : int - lock : Lock @@ -17,10 +21,6 @@ package com.iluwatar.mutex { + getOwner() : Object + release() } - class App { - + App() - + main(args : String[]) {static} - } } Jar --> "-lock" Lock Mutex ..|> Lock diff --git a/naked-objects/etc/naked-objects-dom.urm.puml b/naked-objects/etc/naked-objects-dom.urm.puml index 6662a560a683..4623640991e2 100644 --- a/naked-objects/etc/naked-objects-dom.urm.puml +++ b/naked-objects/etc/naked-objects-dom.urm.puml @@ -1,26 +1,18 @@ @startuml package domainapp.dom.app.homepage { + class HomePageService { + ~ container : DomainObjectContainer + + HomePageService() + + homePage() : HomePageViewModel + } class HomePageViewModel { ~ simpleObjects : SimpleObjects + HomePageViewModel() + getObjects() : List + title() : String } - class HomePageService { - ~ container : DomainObjectContainer - + HomePageService() - + homePage() : HomePageViewModel - } } package domainapp.dom.modules.simple { - class SimpleObjects { - ~ container : DomainObjectContainer - + SimpleObjects() - + create(name : String) : SimpleObject - + findByName(name : String) : List - + listAll() : List - + title() : TranslatableString - } class SimpleObject { - container : DomainObjectContainer - name : String @@ -34,6 +26,14 @@ package domainapp.dom.modules.simple { + updateName(name : String) : SimpleObject + validateUpdateName(name : String) : TranslatableString } + class SimpleObjects { + ~ container : DomainObjectContainer + + SimpleObjects() + + create(name : String) : SimpleObject + + findByName(name : String) : List + + listAll() : List + + title() : TranslatableString + } } HomePageViewModel --> "-simpleObjects" SimpleObjects @enduml \ No newline at end of file diff --git a/naked-objects/etc/naked-objects-fixture.urm.puml b/naked-objects/etc/naked-objects-fixture.urm.puml index 21e38d7102ac..04b3b1350cd7 100644 --- a/naked-objects/etc/naked-objects-fixture.urm.puml +++ b/naked-objects/etc/naked-objects-fixture.urm.puml @@ -86,7 +86,8 @@ package domainapp.fixture { + getSpecification() : FixtureScriptsSpecification } } -DomainAppFixturesProvider --+ FixtureScripts -DomainAppFixturesProvider --+ FixtureScriptsSpecification +Builder ..+ FixtureScriptsSpecification +DropDownPolicy ..+ FixtureScriptsSpecification +MultipleExecutionStrategy ..+ FixtureScripts HomePageViewModel --> "-simpleObjects" SimpleObjects @enduml \ No newline at end of file diff --git a/naked-objects/etc/naked-objects-integtests.urm.puml b/naked-objects/etc/naked-objects-integtests.urm.puml index 65c44410ae92..04b3b1350cd7 100644 --- a/naked-objects/etc/naked-objects-integtests.urm.puml +++ b/naked-objects/etc/naked-objects-integtests.urm.puml @@ -1,16 +1,16 @@ @startuml package domainapp.dom.app.homepage { + class HomePageService { + ~ container : DomainObjectContainer + + HomePageService() + + homePage() : HomePageViewModel + } class HomePageViewModel { ~ simpleObjects : SimpleObjects + HomePageViewModel() + getObjects() : List + title() : String } - class HomePageService { - ~ container : DomainObjectContainer - + HomePageService() - + homePage() : HomePageViewModel - } } package domainapp.dom.modules.simple { class SimpleObject { @@ -86,7 +86,8 @@ package domainapp.fixture { + getSpecification() : FixtureScriptsSpecification } } -DomainAppFixturesProvider --+ FixtureScripts -DomainAppFixturesProvider --+ FixtureScriptsSpecification +Builder ..+ FixtureScriptsSpecification +DropDownPolicy ..+ FixtureScriptsSpecification +MultipleExecutionStrategy ..+ FixtureScripts HomePageViewModel --> "-simpleObjects" SimpleObjects @enduml \ No newline at end of file diff --git a/null-object/etc/null-object.urm.puml b/null-object/etc/null-object.urm.puml index bd4f8446ea5c..a937a2b178e2 100644 --- a/null-object/etc/null-object.urm.puml +++ b/null-object/etc/null-object.urm.puml @@ -4,7 +4,15 @@ package com.iluwatar.nullobject { + App() + main(args : String[]) {static} } + interface Node { + + getLeft() : Node {abstract} + + getName() : String {abstract} + + getRight() : Node {abstract} + + getTreeSize() : int {abstract} + + walk() {abstract} + } class NodeImpl { + - LOGGER : Logger {static} - left : Node - name : String - right : Node @@ -15,13 +23,6 @@ package com.iluwatar.nullobject { + getTreeSize() : int + walk() } - interface Node { - + getLeft() : Node {abstract} - + getName() : String {abstract} - + getRight() : Node {abstract} - + getTreeSize() : int {abstract} - + walk() {abstract} - } class NullNode { - instance : NullNode {static} - NullNode() diff --git a/object-pool/etc/object-pool.urm.puml b/object-pool/etc/object-pool.urm.puml index caf0b6d7e90f..21ef76e0d99c 100644 --- a/object-pool/etc/object-pool.urm.puml +++ b/object-pool/etc/object-pool.urm.puml @@ -1,15 +1,9 @@ @startuml package com.iluwatar.object.pool { - class OliphauntPool { - + OliphauntPool() - # create() : Oliphaunt - } - class Oliphaunt { - - counter : int {static} - - id : int - + Oliphaunt() - + getId() : int - + toString() : String + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} } abstract class ObjectPool { - available : HashSet @@ -20,9 +14,16 @@ package com.iluwatar.object.pool { # create() : T {abstract} + toString() : String } - class App { - + App() - + main(args : String[]) {static} + class Oliphaunt { + - counter : int {static} + - id : int + + Oliphaunt() + + getId() : int + + toString() : String + } + class OliphauntPool { + + OliphauntPool() + # create() : Oliphaunt } } OliphauntPool --|> ObjectPool diff --git a/observer/etc/observer.urm.puml b/observer/etc/observer.urm.puml index e9a8f7b9b18a..bea9aab533d3 100644 --- a/observer/etc/observer.urm.puml +++ b/observer/etc/observer.urm.puml @@ -1,17 +1,22 @@ @startuml package com.iluwatar.observer { - class Orcs { - + Orcs() - + update(currentWeather : WeatherType) - } - interface WeatherObserver { - + update(WeatherType) {abstract} - } class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } + class Hobbits { + - LOGGER : Logger {static} + + Hobbits() + + update(currentWeather : WeatherType) + } + class Orcs { + - LOGGER : Logger {static} + + Orcs() + + update(currentWeather : WeatherType) + } class Weather { + - LOGGER : Logger {static} - currentWeather : WeatherType - observers : List + Weather() @@ -20,9 +25,8 @@ package com.iluwatar.observer { + removeObserver(obs : WeatherObserver) + timePasses() } - class Hobbits { - + Hobbits() - + update(currentWeather : WeatherType) + interface WeatherObserver { + + update(WeatherType) {abstract} } enum WeatherType { + COLD {static} @@ -35,13 +39,18 @@ package com.iluwatar.observer { } } package com.iluwatar.observer.generic { + class GHobbits { + - LOGGER : Logger {static} + + GHobbits() + + update(weather : GWeather, weatherType : WeatherType) + } class GOrcs { + - LOGGER : Logger {static} + GOrcs() + update(weather : GWeather, weatherType : WeatherType) } - interface Race { - } class GWeather { + - LOGGER : Logger {static} - currentWeather : WeatherType + GWeather() + timePasses() @@ -53,21 +62,19 @@ package com.iluwatar.observer.generic { + notifyObservers(argument : A) + removeObserver(observer : O extends Observer) } - class GHobbits { - + GHobbits() - + update(weather : GWeather, weatherType : WeatherType) - } interface Observer, O extends Observer, A> { + update(S extends Observable, A) {abstract} } + interface Race { + } } Weather --> "-currentWeather" WeatherType GWeather --> "-currentWeather" WeatherType Weather --> "-observers" WeatherObserver -GOrcs ..|> Race +Hobbits ..|> WeatherObserver Orcs ..|> WeatherObserver -Race --|> Observer -GWeather --|> Observable GHobbits ..|> Race -Hobbits ..|> WeatherObserver +GOrcs ..|> Race +GWeather --|> Observable +Race --|> Observer @enduml \ No newline at end of file diff --git a/poison-pill/etc/poison-pill.urm.puml b/poison-pill/etc/poison-pill.urm.puml index f05c40692226..923449e10b4a 100644 --- a/poison-pill/etc/poison-pill.urm.puml +++ b/poison-pill/etc/poison-pill.urm.puml @@ -1,7 +1,15 @@ @startuml package com.iluwatar.poison.pill { - interface MqPublishPoint { - + put(Message) {abstract} + class App { + + App() + + main(args : String[]) {static} + } + class Consumer { + - LOGGER : Logger {static} + - name : String + - queue : MqSubscribePoint + + Consumer(name : String, queue : MqSubscribePoint) + + consume() } interface Message { + POISON_PILL : Message {static} @@ -11,13 +19,22 @@ package com.iluwatar.poison.pill { + getHeaders() : Map {abstract} + setBody(String) {abstract} } - class App { - + App() - + main(args : String[]) {static} + enum Headers { + + DATE {static} + + SENDER {static} + + valueOf(name : String) : Headers {static} + + values() : Headers[] {static} } interface MessageQueue { } + interface MqPublishPoint { + + put(Message) {abstract} + } + interface MqSubscribePoint { + + take() : Message {abstract} + } class Producer { + - LOGGER : Logger {static} - isStopped : boolean - name : String - queue : MqPublishPoint @@ -25,21 +42,6 @@ package com.iluwatar.poison.pill { + send(body : String) + stop() } - class Consumer { - - name : String - - queue : MqSubscribePoint - + Consumer(name : String, queue : MqSubscribePoint) - + consume() - } - class SimpleMessageQueue { - - queue : BlockingQueue - + SimpleMessageQueue(bound : int) - + put(msg : Message) - + take() : Message - } - interface MqSubscribePoint { - + take() : Message {abstract} - } class SimpleMessage { - body : String - headers : Map @@ -50,23 +52,20 @@ package com.iluwatar.poison.pill { + getHeaders() : Map + setBody(body : String) } - enum Headers { - + DATE {static} - + SENDER {static} - + valueOf(name : String) : Headers {static} - + values() : Headers[] {static} + class SimpleMessageQueue { + - queue : BlockingQueue + + SimpleMessageQueue(bound : int) + + put(msg : Message) + + take() : Message } } SimpleMessageQueue --> "-queue" Message Headers ..+ Message Consumer --> "-queue" MqSubscribePoint Producer --> "-queue" MqPublishPoint -SimpleMessage --+ Message -Producer --+ Message Message --> "-POISON_PILL" Message -Consumer --+ Message MessageQueue --|> MqPublishPoint MessageQueue --|> MqSubscribePoint -SimpleMessageQueue ..|> MessageQueue SimpleMessage ..|> Message +SimpleMessageQueue ..|> MessageQueue @enduml \ No newline at end of file diff --git a/pom.xml b/pom.xml index adb95bef2477..8df4791a99d6 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ 4.12.1 4.5.2 2.22 - 1.4.1 + 1.4.4 4.0 3.3.0 1.7.21 diff --git a/private-class-data/etc/private-class-data.urm.puml b/private-class-data/etc/private-class-data.urm.puml index ad35c0bddeb9..990b53342521 100644 --- a/private-class-data/etc/private-class-data.urm.puml +++ b/private-class-data/etc/private-class-data.urm.puml @@ -1,21 +1,17 @@ @startuml package com.iluwatar.privateclassdata { - class StewData { - - numCarrots : int - - numMeat : int - - numPeppers : int - - numPotatoes : int - + StewData(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int) - + getNumCarrots() : int - + getNumMeat() : int - + getNumPeppers() : int - + getNumPotatoes() : int - } class App { + App() + main(args : String[]) {static} } + class ImmutableStew { + - LOGGER : Logger {static} + - data : StewData + + ImmutableStew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int) + + mix() + } class Stew { + - LOGGER : Logger {static} - numCarrots : int - numMeat : int - numPeppers : int @@ -24,10 +20,16 @@ package com.iluwatar.privateclassdata { + mix() + taste() } - class ImmutableStew { - - data : StewData - + ImmutableStew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int) - + mix() + class StewData { + - numCarrots : int + - numMeat : int + - numPeppers : int + - numPotatoes : int + + StewData(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int) + + getNumCarrots() : int + + getNumMeat() : int + + getNumPeppers() : int + + getNumPotatoes() : int } } ImmutableStew --> "-data" StewData diff --git a/producer-consumer/etc/producer-consumer.urm.puml b/producer-consumer/etc/producer-consumer.urm.puml index 8b793d75b847..05539a55ea42 100644 --- a/producer-consumer/etc/producer-consumer.urm.puml +++ b/producer-consumer/etc/producer-consumer.urm.puml @@ -1,6 +1,12 @@ @startuml package com.iluwatar.producer.consumer { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } class Consumer { + - LOGGER : Logger {static} - name : String - queue : ItemQueue + Consumer(name : String, queue : ItemQueue) @@ -13,9 +19,11 @@ package com.iluwatar.producer.consumer { + getId() : int + getProducer() : String } - class App { - + App() - + main(args : String[]) {static} + class ItemQueue { + - queue : BlockingQueue + + ItemQueue() + + put(item : Item) + + take() : Item } class Producer { - itemId : int @@ -24,12 +32,6 @@ package com.iluwatar.producer.consumer { + Producer(name : String, queue : ItemQueue) + produce() } - class ItemQueue { - - queue : BlockingQueue - + ItemQueue() - + put(item : Item) - + take() : Item - } } Consumer --> "-queue" ItemQueue Producer --> "-queue" ItemQueue diff --git a/promise/etc/promise.urm.puml b/promise/etc/promise.urm.puml index cd6e732529fc..9c6d09cde947 100644 --- a/promise/etc/promise.urm.puml +++ b/promise/etc/promise.urm.puml @@ -1,44 +1,8 @@ @startuml package com.iluwatar.promise { - ~class PromiseSupport { - - COMPLETED : int {static} - - FAILED : int {static} - - RUNNING : int {static} - - exception : Exception - - lock : Object - - state : int - - value : T - ~ PromiseSupport() - + cancel(mayInterruptIfRunning : boolean) : boolean - ~ fulfill(value : T) - ~ fulfillExceptionally(exception : Exception) - + get() : T - + get(timeout : long, unit : TimeUnit) : T - + isCancelled() : boolean - + isDone() : boolean - } - -class ConsumeAction { - - action : Consumer - - dest : Promise - - src : Promise - - ConsumeAction(src : Promise, dest : Promise, action : Consumer) - + run() - } - class Promise { - - exceptionHandler : Consumer - - fulfillmentAction : Runnable - + Promise() - + fulfill(value : T) - + fulfillExceptionally(exception : Exception) - + fulfillInAsync(task : Callable, executor : Executor) : Promise - - handleException(exception : Exception) - + onError(exceptionHandler : Consumer) : Promise - - postFulfillment() - + thenAccept(action : Consumer) : Promise - + thenApply(func : Function) : Promise - } class App { - DEFAULT_URL : String {static} + - LOGGER : Logger {static} - executor : ExecutorService - stopLatch : CountDownLatch - App() @@ -53,6 +17,26 @@ package com.iluwatar.promise { - stop() - taskCompleted() } + class Promise { + - exceptionHandler : Consumer + - fulfillmentAction : Runnable + + Promise() + + fulfill(value : T) + + fulfillExceptionally(exception : Exception) + + fulfillInAsync(task : Callable, executor : Executor) : Promise + - handleException(exception : Exception) + + onError(exceptionHandler : Consumer) : Promise + - postFulfillment() + + thenAccept(action : Consumer) : Promise + + thenApply(func : Function) : Promise + } + -class ConsumeAction { + - action : Consumer + - dest : Promise + - src : Promise + - ConsumeAction(src : Promise, dest : Promise, action : Consumer) + + run() + } -class TransformAction { - dest : Promise - func : Function @@ -60,7 +44,25 @@ package com.iluwatar.promise { - TransformAction(src : Promise, dest : Promise, func : Function) + run() } + ~class PromiseSupport { + - COMPLETED : int {static} + - FAILED : int {static} + - RUNNING : int {static} + - exception : Exception + - lock : Object + - state : int + - value : T + ~ PromiseSupport() + + cancel(mayInterruptIfRunning : boolean) : boolean + ~ fulfill(value : T) + ~ fulfillExceptionally(exception : Exception) + + get() : T + + get(timeout : long, unit : TimeUnit) : T + + isCancelled() : boolean + + isDone() : boolean + } class Utility { + - LOGGER : Logger {static} + Utility() + characterFrequency(fileLocation : String) : Map {static} + countLines(fileLocation : String) : Integer {static} @@ -68,10 +70,9 @@ package com.iluwatar.promise { + lowestFrequencyChar(charFrequency : Map) : Character {static} } } -TransformAction --+ Promise TransformAction --> "-src" Promise -ConsumeAction --+ Promise +TransformAction --+ Promise ConsumeAction --> "-src" Promise -Utility --+ Map +ConsumeAction --+ Promise Promise --|> PromiseSupport @enduml \ No newline at end of file diff --git a/property/etc/property.urm.puml b/property/etc/property.urm.puml index 6ff0e5c52ed6..f281cd87319f 100644 --- a/property/etc/property.urm.puml +++ b/property/etc/property.urm.puml @@ -1,15 +1,10 @@ @startuml package com.iluwatar.property { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } - interface Prototype { - + get(Stats) : Integer {abstract} - + has(Stats) : boolean {abstract} - + remove(Stats) {abstract} - + set(Stats, Integer) {abstract} - } class Character { - name : String - properties : Map @@ -33,6 +28,12 @@ package com.iluwatar.property { + valueOf(name : String) : Type {static} + values() : Type[] {static} } + interface Prototype { + + get(Stats) : Integer {abstract} + + has(Stats) : boolean {abstract} + + remove(Stats) {abstract} + + set(Stats, Integer) {abstract} + } enum Stats { + AGILITY {static} + ARMOR {static} @@ -46,9 +47,8 @@ package com.iluwatar.property { + values() : Stats[] {static} } } -App --+ Character Character --> "-prototype" Prototype -Character --> "-type" Type Type ..+ Character +Character --> "-type" Type Character ..|> Prototype @enduml \ No newline at end of file diff --git a/prototype/etc/prototype.urm.puml b/prototype/etc/prototype.urm.puml index 7ab26dd1b3e4..801679fb7f18 100644 --- a/prototype/etc/prototype.urm.puml +++ b/prototype/etc/prototype.urm.puml @@ -1,40 +1,50 @@ @startuml package com.iluwatar.prototype { - class OrcWarlord { - + OrcWarlord() - + clone() : Warlord - + toString() : String - } - class OrcBeast { - + OrcBeast() - + clone() : Beast - + toString() : String + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} } abstract class Beast { + Beast() + clone() : Beast {abstract} } + class ElfBeast { + + ElfBeast() + + clone() : Beast + + toString() : String + } class ElfMage { + ElfMage() + clone() : Mage + toString() : String } - abstract class Mage { - + Mage() - + clone() : Mage {abstract} - } - abstract class Prototype { - + Prototype() - + clone() : Object {abstract} + class ElfWarlord { + + ElfWarlord() + + clone() : Warlord + + toString() : String } interface HeroFactory { + createBeast() : Beast {abstract} + createMage() : Mage {abstract} + createWarlord() : Warlord {abstract} } - class ElfWarlord { - + ElfWarlord() - + clone() : Warlord + class HeroFactoryImpl { + - beast : Beast + - mage : Mage + - warlord : Warlord + + HeroFactoryImpl(mage : Mage, warlord : Warlord, beast : Beast) + + createBeast() : Beast + + createMage() : Mage + + createWarlord() : Warlord + } + abstract class Mage { + + Mage() + + clone() : Mage {abstract} + } + class OrcBeast { + + OrcBeast() + + clone() : Beast + toString() : String } class OrcMage { @@ -42,40 +52,31 @@ package com.iluwatar.prototype { + clone() : Mage + toString() : String } - class ElfBeast { - + ElfBeast() - + clone() : Beast + class OrcWarlord { + + OrcWarlord() + + clone() : Warlord + toString() : String } + abstract class Prototype { + + Prototype() + + clone() : Object {abstract} + } abstract class Warlord { + Warlord() + clone() : Warlord {abstract} } - class HeroFactoryImpl { - - beast : Beast - - mage : Mage - - warlord : Warlord - + HeroFactoryImpl(mage : Mage, warlord : Warlord, beast : Beast) - + createBeast() : Beast - + createMage() : Mage - + createWarlord() : Warlord - } - class App { - + App() - + main(args : String[]) {static} - } } HeroFactoryImpl --> "-beast" Beast HeroFactoryImpl --> "-warlord" Warlord HeroFactoryImpl --> "-mage" Mage -OrcWarlord --|> Warlord -OrcBeast --|> Beast Beast --|> Prototype +ElfBeast --|> Beast ElfMage --|> Mage -Mage --|> Prototype ElfWarlord --|> Warlord +HeroFactoryImpl ..|> HeroFactory +Mage --|> Prototype +OrcBeast --|> Beast OrcMage --|> Mage -ElfBeast --|> Beast +OrcWarlord --|> Warlord Warlord --|> Prototype -HeroFactoryImpl ..|> HeroFactory @enduml \ No newline at end of file diff --git a/proxy/etc/proxy.urm.puml b/proxy/etc/proxy.urm.puml index 1dc58087c7c3..ffe0fa446074 100644 --- a/proxy/etc/proxy.urm.puml +++ b/proxy/etc/proxy.urm.puml @@ -1,24 +1,32 @@ @startuml package com.iluwatar.proxy { - class WizardTowerProxy { - - NUM_WIZARDS_ALLOWED : int {static} - - numWizards : int - + WizardTowerProxy() - + enter(wizard : Wizard) - } - class WizardTower { - + WizardTower() - + enter(wizard : Wizard) - } class App { + App() + main(args : String[]) {static} } + class IvoryTower { + - LOGGER : Logger {static} + + IvoryTower() + + enter(wizard : Wizard) + } class Wizard { - name : String + Wizard(name : String) + toString() : String } + interface WizardTower { + + enter(Wizard) {abstract} + } + class WizardTowerProxy { + - LOGGER : Logger {static} + - NUM_WIZARDS_ALLOWED : int {static} + - numWizards : int + - tower : WizardTower + + WizardTowerProxy(tower : WizardTower) + + enter(wizard : Wizard) + } } -WizardTowerProxy --|> WizardTower +WizardTowerProxy --> "-tower" WizardTower +IvoryTower ..|> WizardTower +WizardTowerProxy ..|> WizardTower @enduml \ No newline at end of file diff --git a/publish-subscribe/etc/publish-subscribe.urm.puml b/publish-subscribe/etc/publish-subscribe.urm.puml index 1272f1f6db29..2e511c92dbb9 100644 --- a/publish-subscribe/etc/publish-subscribe.urm.puml +++ b/publish-subscribe/etc/publish-subscribe.urm.puml @@ -1,6 +1,7 @@ @startuml package com.iluwatar.publish.subscribe { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } diff --git a/reactor/etc/reactor.urm.puml b/reactor/etc/reactor.urm.puml index ecf2f40f72f4..cc56eae7a1c8 100644 --- a/reactor/etc/reactor.urm.puml +++ b/reactor/etc/reactor.urm.puml @@ -1,46 +1,4 @@ @startuml -package com.iluwatar.reactor.app { - class App { - - channels : List - - dispatcher : Dispatcher - - reactor : NioReactor - + App(dispatcher : Dispatcher) - + main(args : String[]) {static} - + start() - + stop() - - tcpChannel(port : int, handler : ChannelHandler) : AbstractNioChannel - - udpChannel(port : int, handler : ChannelHandler) : AbstractNioChannel - } - class LoggingHandler { - - ACK : byte[] {static} - + LoggingHandler() - - doLogging(data : ByteBuffer) {static} - + handleChannelRead(channel : AbstractNioChannel, readObject : Object, key : SelectionKey) - - sendReply(channel : AbstractNioChannel, incomingPacket : DatagramPacket, key : SelectionKey) {static} - - sendReply(channel : AbstractNioChannel, key : SelectionKey) {static} - } - ~class TcpLoggingClient { - - clientName : String - - serverPort : int - + TcpLoggingClient(clientName : String, serverPort : int) - + run() - - sendLogRequests(writer : PrintWriter, inputStream : InputStream) - } - ~class UdpLoggingClient { - - clientName : String - - remoteAddress : InetSocketAddress - + UdpLoggingClient(clientName : String, port : int) - + run() - } - class AppClient { - - service : ExecutorService - + AppClient() - - artificialDelayOf(millis : long) {static} - + main(args : String[]) {static} - + start() - + stop() - } -} package com.iluwatar.reactor.framework { abstract class AbstractNioChannel { - channel : SelectableChannel @@ -58,17 +16,15 @@ package com.iluwatar.reactor.framework { ~ setReactor(reactor : NioReactor) + write(data : Object, key : SelectionKey) } - ~class ChangeKeyOpsCommand { - - interestedOps : int - - key : SelectionKey - + ChangeKeyOpsCommand(this$0 : SelectionKey, key : int) - + run() - + toString() : String - } interface ChannelHandler { + handleChannelRead(AbstractNioChannel, Object, SelectionKey) {abstract} } + interface Dispatcher { + + onChannelReadEvent(AbstractNioChannel, Object, SelectionKey) {abstract} + + stop() {abstract} + } class NioDatagramChannel { + - LOGGER : Logger {static} - port : int + NioDatagramChannel(port : int, handler : ChannelHandler) + bind() @@ -78,30 +34,6 @@ package com.iluwatar.reactor.framework { + read(key : SelectionKey) : DatagramPacket + write(data : Object, key : SelectionKey) } - class ThreadPoolDispatcher { - - executorService : ExecutorService - + ThreadPoolDispatcher(poolSize : int) - + onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey) - + stop() - } - class NioServerSocketChannel { - - port : int - + NioServerSocketChannel(port : int, handler : ChannelHandler) - + bind() - # doWrite(pendingWrite : Object, key : SelectionKey) - + getInterestedOps() : int - + getJavaChannel() : ServerSocketChannel - + read(key : SelectionKey) : ByteBuffer - } - class SameThreadDispatcher { - + SameThreadDispatcher() - + onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey) - + stop() - } - interface Dispatcher { - + onChannelReadEvent(AbstractNioChannel, Object, SelectionKey) {abstract} - + stop() {abstract} - } class DatagramPacket { - data : ByteBuffer - receiver : SocketAddress @@ -114,6 +46,7 @@ package com.iluwatar.reactor.framework { + setSender(sender : SocketAddress) } class NioReactor { + - LOGGER : Logger {static} - dispatcher : Dispatcher - pendingCommands : Queue - reactorMain : ExecutorService @@ -131,6 +64,78 @@ package com.iluwatar.reactor.framework { + start() + stop() } + ~class ChangeKeyOpsCommand { + - interestedOps : int + - key : SelectionKey + + ChangeKeyOpsCommand(this$0 : SelectionKey, key : int) + + run() + + toString() : String + } + class NioServerSocketChannel { + - LOGGER : Logger {static} + - port : int + + NioServerSocketChannel(port : int, handler : ChannelHandler) + + bind() + # doWrite(pendingWrite : Object, key : SelectionKey) + + getInterestedOps() : int + + getJavaChannel() : ServerSocketChannel + + read(key : SelectionKey) : ByteBuffer + } + class SameThreadDispatcher { + + SameThreadDispatcher() + + onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey) + + stop() + } + class ThreadPoolDispatcher { + - executorService : ExecutorService + + ThreadPoolDispatcher(poolSize : int) + + onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey) + + stop() + } +} +package com.iluwatar.reactor.app { + class App { + - channels : List + - dispatcher : Dispatcher + - reactor : NioReactor + + App(dispatcher : Dispatcher) + + main(args : String[]) {static} + + start() + + stop() + - tcpChannel(port : int, handler : ChannelHandler) : AbstractNioChannel + - udpChannel(port : int, handler : ChannelHandler) : AbstractNioChannel + } + class AppClient { + - LOGGER : Logger {static} + - service : ExecutorService + + AppClient() + - artificialDelayOf(millis : long) {static} + + main(args : String[]) {static} + + start() + + stop() + } + ~class TcpLoggingClient { + - clientName : String + - serverPort : int + + TcpLoggingClient(clientName : String, serverPort : int) + + run() + - sendLogRequests(writer : PrintWriter, inputStream : InputStream) + } + ~class UdpLoggingClient { + - clientName : String + - remoteAddress : InetSocketAddress + + UdpLoggingClient(clientName : String, port : int) + + run() + } + class LoggingHandler { + - ACK : byte[] {static} + - LOGGER : Logger {static} + + LoggingHandler() + - doLogging(data : ByteBuffer) {static} + + handleChannelRead(channel : AbstractNioChannel, readObject : Object, key : SelectionKey) + - sendReply(channel : AbstractNioChannel, incomingPacket : DatagramPacket, key : SelectionKey) {static} + - sendReply(channel : AbstractNioChannel, key : SelectionKey) {static} + } } AbstractNioChannel --> "-handler" ChannelHandler UdpLoggingClient ..+ AppClient @@ -140,12 +145,11 @@ NioReactor --> "-dispatcher" Dispatcher App --> "-reactor" NioReactor App --> "-channels" AbstractNioChannel DatagramPacket ..+ NioDatagramChannel -LoggingHandler --+ NioDatagramChannel App --> "-dispatcher" Dispatcher ChangeKeyOpsCommand --+ NioReactor -NioDatagramChannel --|> AbstractNioChannel LoggingHandler ..|> ChannelHandler -ThreadPoolDispatcher ..|> Dispatcher +NioDatagramChannel --|> AbstractNioChannel NioServerSocketChannel --|> AbstractNioChannel SameThreadDispatcher ..|> Dispatcher +ThreadPoolDispatcher ..|> Dispatcher @enduml \ No newline at end of file diff --git a/reader-writer-lock/etc/reader-writer-lock.urm.puml b/reader-writer-lock/etc/reader-writer-lock.urm.puml index 1760cf3e46d0..c0302cd6de5a 100644 --- a/reader-writer-lock/etc/reader-writer-lock.urm.puml +++ b/reader-writer-lock/etc/reader-writer-lock.urm.puml @@ -1,5 +1,18 @@ @startuml package com.iluwatar.reader.writer.lock { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } + class Reader { + - LOGGER : Logger {static} + - name : String + - readLock : Lock + + Reader(name : String, readLock : Lock) + + read() + + run() + } class ReaderWriterLock { - currentReaderCount : int - globalMutex : Set @@ -14,8 +27,8 @@ package com.iluwatar.reader.writer.lock { - waitUninterruptibly(o : Object) {static} + writeLock() : Lock } - -class WriteLock { - - WriteLock() + -class ReadLock { + - ReadLock() + lock() + lockInterruptibly() + newCondition() : Condition @@ -23,12 +36,8 @@ package com.iluwatar.reader.writer.lock { + tryLock(time : long, unit : TimeUnit) : boolean + unlock() } - class App { - + App() - + main(args : String[]) {static} - } - -class ReadLock { - - ReadLock() + -class WriteLock { + - WriteLock() + lock() + lockInterruptibly() + newCondition() : Condition @@ -37,19 +46,13 @@ package com.iluwatar.reader.writer.lock { + unlock() } class Writer { + - LOGGER : Logger {static} - name : String - writeLock : Lock + Writer(name : String, writeLock : Lock) + run() + write() } - class Reader { - - name : String - - readLock : Lock - + Reader(name : String, readLock : Lock) - + read() - + run() - } } ReaderWriterLock --> "-readerLock" ReadLock ReadLock --+ ReaderWriterLock diff --git a/repository/etc/repository.urm.puml b/repository/etc/repository.urm.puml index ad1759033bae..10768260cefc 100644 --- a/repository/etc/repository.urm.puml +++ b/repository/etc/repository.urm.puml @@ -1,27 +1,12 @@ @startuml package com.iluwatar.repository { - class PersonSpecifications { - + PersonSpecifications() - } - class NameEqualSpec { - + name : String - + NameEqualSpec(name : String) - + toPredicate(root : Root, query : CriteriaQuery, cb : CriteriaBuilder) : Predicate - } class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } - interface PersonRepository { - + findByName(String) : Person {abstract} - } - class AgeBetweenSpec { - - from : int - - to : int - + AgeBetweenSpec(from : int, to : int) - + toPredicate(root : Root, query : CriteriaQuery, cb : CriteriaBuilder) : Predicate - } class AppConfig { + - LOGGER : Logger {static} + AppConfig() + dataSource() : DataSource + entityManagerFactory() : LocalContainerEntityManagerFactoryBean @@ -48,9 +33,24 @@ package com.iluwatar.repository { + setSurname(surname : String) + toString() : String } + interface PersonRepository { + + findByName(String) : Person {abstract} + } + class PersonSpecifications { + + PersonSpecifications() + } + class AgeBetweenSpec { + - from : int + - to : int + + AgeBetweenSpec(from : int, to : int) + + toPredicate(root : Root, query : CriteriaQuery, cb : CriteriaBuilder) : Predicate + } + class NameEqualSpec { + + name : String + + NameEqualSpec(name : String) + + toPredicate(root : Root, query : CriteriaQuery, cb : CriteriaBuilder) : Predicate + } } -App --+ PersonSpecifications -AppConfig --+ PersonSpecifications NameEqualSpec ..+ PersonSpecifications AgeBetweenSpec ..+ PersonSpecifications @enduml \ No newline at end of file diff --git a/resource-acquisition-is-initialization/etc/resource-acquisition-is-initialization.urm.puml b/resource-acquisition-is-initialization/etc/resource-acquisition-is-initialization.urm.puml index 81560c7f5289..11309f0a6230 100644 --- a/resource-acquisition-is-initialization/etc/resource-acquisition-is-initialization.urm.puml +++ b/resource-acquisition-is-initialization/etc/resource-acquisition-is-initialization.urm.puml @@ -1,14 +1,17 @@ @startuml package com.iluwatar.resource.acquisition.is.initialization { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } class SlidingDoor { + - LOGGER : Logger {static} + SlidingDoor() + close() } class TreasureChest { + - LOGGER : Logger {static} + TreasureChest() + close() } diff --git a/semaphore/etc/semaphore.urm.puml b/semaphore/etc/semaphore.urm.puml index a94ff5a7cace..c40f4e026990 100644 --- a/semaphore/etc/semaphore.urm.puml +++ b/semaphore/etc/semaphore.urm.puml @@ -1,23 +1,29 @@ @startuml package com.iluwatar.semaphore { + class App { + + App() + + main(args : String[]) {static} + } class Fruit { - type : FruitType + Fruit(type : FruitType) + getType() : FruitType + toString() : String } - class App { - + App() - + main(args : String[]) {static} + enum FruitType { + + APPLE {static} + + LEMON {static} + + ORANGE {static} + + valueOf(name : String) : FruitType {static} + + values() : FruitType[] {static} } - class Semaphore { - - counter : int - - licenses : int - + Semaphore(licenses : int) - + acquire() - + getAvailableLicenses() : int - + getNumLicenses() : int - + release() + class FruitBowl { + - fruit : ArrayList + + FruitBowl() + + countFruit() : int + + put(f : Fruit) + + take() : Fruit + + toString() : String } class FruitShop { - available : boolean[] @@ -32,27 +38,19 @@ package com.iluwatar.semaphore { + acquire() {abstract} + release() {abstract} } - class FruitBowl { - - fruit : ArrayList - + FruitBowl() - + countFruit() : int - + put(f : Fruit) - + take() : Fruit - + toString() : String - } - enum FruitType { - + APPLE {static} - + LEMON {static} - + ORANGE {static} - + valueOf(name : String) : FruitType {static} - + values() : FruitType[] {static} + class Semaphore { + - counter : int + - licenses : int + + Semaphore(licenses : int) + + acquire() + + getAvailableLicenses() : int + + getNumLicenses() : int + + release() } } -FruitShop --+ Fruit Fruit --> "-type" FruitType FruitType ..+ Fruit -FruitBowl --+ Fruit -FruitBowl --> "-fruit" Fruit FruitShop --> "-semaphore" Semaphore +FruitBowl --> "-fruit" Fruit Semaphore ..|> Lock @enduml \ No newline at end of file diff --git a/servant/etc/servant.urm.puml b/servant/etc/servant.urm.puml index b7391f5dd21d..96dee04bce15 100644 --- a/servant/etc/servant.urm.puml +++ b/servant/etc/servant.urm.puml @@ -1,45 +1,38 @@ @startuml package com.iluwatar.servant { - class Servant { - + name : String - + Servant(name : String) - + checkIfYouWillBeHanged(tableGuests : List) : boolean - + feed(r : Royalty) - + giveCompliments(r : Royalty) - + giveWine(r : Royalty) + class App { + - LOGGER : Logger {static} + ~ jenkins : Servant {static} + ~ travis : Servant {static} + + App() + + main(args : String[]) {static} + + scenario(servant : Servant, compliment : int) {static} } - class Queen { + class King { - complimentReceived : boolean - isDrunk : boolean - - isFlirty : boolean - isHappy : boolean - isHungry : boolean - + Queen() + + King() + changeMood() + getDrink() + getFed() + getMood() : boolean + receiveCompliments() - + setFlirtiness(f : boolean) - } - class App { - ~ jenkins : Servant {static} - ~ travis : Servant {static} - + App() - + main(args : String[]) {static} - + scenario(servant : Servant, compliment : int) {static} } - class King { + class Queen { - complimentReceived : boolean - isDrunk : boolean + - isFlirty : boolean - isHappy : boolean - isHungry : boolean - + King() + + Queen() + changeMood() + getDrink() + getFed() + getMood() : boolean + receiveCompliments() + + setFlirtiness(f : boolean) } ~interface Royalty { + changeMood() {abstract} @@ -48,8 +41,16 @@ package com.iluwatar.servant { + getMood() : boolean {abstract} + receiveCompliments() {abstract} } + class Servant { + + name : String + + Servant(name : String) + + checkIfYouWillBeHanged(tableGuests : List) : boolean + + feed(r : Royalty) + + giveCompliments(r : Royalty) + + giveWine(r : Royalty) + } } App --> "-jenkins" Servant -Queen ..|> Royalty King ..|> Royalty +Queen ..|> Royalty @enduml \ No newline at end of file diff --git a/service-layer/etc/service-layer.urm.puml b/service-layer/etc/service-layer.urm.puml index 880384b9f357..ff870a5e9bfb 100644 --- a/service-layer/etc/service-layer.urm.puml +++ b/service-layer/etc/service-layer.urm.puml @@ -1,6 +1,7 @@ @startuml package com.iluwatar.servicelayer.hibernate { class HibernateUtil { + - LOGGER : Logger {static} - sessionFactory : SessionFactory {static} - HibernateUtil() + dropSession() {static} @@ -55,9 +56,6 @@ package com.iluwatar.servicelayer.magic { } } package com.iluwatar.servicelayer.wizard { - interface WizardDao { - + findByName(String) : Wizard {abstract} - } class Wizard { - id : Long - name : String @@ -73,27 +71,15 @@ package com.iluwatar.servicelayer.wizard { + setSpellbooks(spellbooks : Set) + toString() : String } + interface WizardDao { + + findByName(String) : Wizard {abstract} + } class WizardDaoImpl { + WizardDaoImpl() + findByName(name : String) : Wizard } } -package com.iluwatar.servicelayer.app { - class App { - + App() - + initData() {static} - + main(args : String[]) {static} - + queryData() {static} - } -} package com.iluwatar.servicelayer.spellbook { - interface SpellbookDao { - + findByName(String) : Spellbook {abstract} - } - class SpellbookDaoImpl { - + SpellbookDaoImpl() - + findByName(name : String) : Spellbook - } class Spellbook { - id : Long - name : String @@ -112,15 +98,15 @@ package com.iluwatar.servicelayer.spellbook { + setWizards(wizards : Set) + toString() : String } -} -package com.iluwatar.servicelayer.spell { - class SpellDaoImpl { - + SpellDaoImpl() - + findByName(name : String) : Spell + interface SpellbookDao { + + findByName(String) : Spellbook {abstract} } - interface SpellDao { - + findByName(String) : Spell {abstract} + class SpellbookDaoImpl { + + SpellbookDaoImpl() + + findByName(name : String) : Spellbook } +} +package com.iluwatar.servicelayer.spell { class Spell { - id : Long - name : String @@ -135,24 +121,40 @@ package com.iluwatar.servicelayer.spell { + setSpellbook(spellbook : Spellbook) + toString() : String } + interface SpellDao { + + findByName(String) : Spell {abstract} + } + class SpellDaoImpl { + + SpellDaoImpl() + + findByName(name : String) : Spell + } +} +package com.iluwatar.servicelayer.app { + class App { + - LOGGER : Logger {static} + + App() + + initData() {static} + + main(args : String[]) {static} + + queryData() {static} + } } MagicServiceImpl --> "-wizardDao" WizardDao MagicServiceImpl --> "-spellbookDao" SpellbookDao MagicServiceImpl --> "-spellDao" SpellDao Spellbook --> "-spells" Spell Spellbook --> "-wizards" Wizard +DaoBaseImpl ..|> Dao +MagicServiceImpl ..|> MagicService +Spell --|> BaseEntity +SpellDao --|> Dao SpellDaoImpl ..|> SpellDao SpellDaoImpl --|> DaoBaseImpl +Spellbook --|> BaseEntity SpellbookDao --|> Dao -WizardDao --|> Dao SpellbookDaoImpl ..|> SpellbookDao SpellbookDaoImpl --|> DaoBaseImpl -MagicServiceImpl ..|> MagicService -SpellDao --|> Dao -Spell --|> BaseEntity -Spellbook --|> BaseEntity Wizard --|> BaseEntity +WizardDao --|> Dao WizardDaoImpl ..|> WizardDao WizardDaoImpl --|> DaoBaseImpl -DaoBaseImpl ..|> Dao @enduml \ No newline at end of file diff --git a/service-locator/etc/service-locator.urm.puml b/service-locator/etc/service-locator.urm.puml index 9e41e7f40555..38fe7ea1b0d0 100644 --- a/service-locator/etc/service-locator.urm.puml +++ b/service-locator/etc/service-locator.urm.puml @@ -1,36 +1,39 @@ @startuml package com.iluwatar.servicelocator { - class ServiceLocator { - - serviceCache : ServiceCache {static} - - ServiceLocator() - + getService(serviceJndiName : String) : Service {static} - } class App { + App() + main(args : String[]) {static} } - class ServiceImpl { - - id : int - - serviceName : String - + ServiceImpl(serviceName : String) - + execute() - + getId() : int - + getName() : String - } class InitContext { + - LOGGER : Logger {static} + InitContext() + lookup(serviceName : String) : Object } + interface Service { + + execute() {abstract} + + getId() : int {abstract} + + getName() : String {abstract} + } class ServiceCache { + - LOGGER : Logger {static} - serviceCache : Map + ServiceCache() + addService(newService : Service) + getService(serviceName : String) : Service } - interface Service { - + execute() {abstract} - + getId() : int {abstract} - + getName() : String {abstract} + class ServiceImpl { + - LOGGER : Logger {static} + - id : int + - serviceName : String + + ServiceImpl(serviceName : String) + + execute() + + getId() : int + + getName() : String + } + class ServiceLocator { + - serviceCache : ServiceCache {static} + - ServiceLocator() + + getService(serviceJndiName : String) : Service {static} } } ServiceLocator --> "-serviceCache" ServiceCache diff --git a/singleton/etc/singleton.urm.puml b/singleton/etc/singleton.urm.puml index a130917729d2..f61377e172d2 100644 --- a/singleton/etc/singleton.urm.puml +++ b/singleton/etc/singleton.urm.puml @@ -1,37 +1,38 @@ @startuml package com.iluwatar.singleton { class App { + - LOGGER : Logger {static} + App() + main(args : String[]) {static} } - class ThreadSafeLazyLoadedIvoryTower { - - instance : ThreadSafeLazyLoadedIvoryTower {static} - - ThreadSafeLazyLoadedIvoryTower() - + getInstance() : ThreadSafeLazyLoadedIvoryTower {static} + enum EnumIvoryTower { + + INSTANCE {static} + + toString() : String + + valueOf(name : String) : EnumIvoryTower {static} + + values() : EnumIvoryTower[] {static} } class InitializingOnDemandHolderIdiom { - InitializingOnDemandHolderIdiom() + getInstance() : InitializingOnDemandHolderIdiom {static} } - class ThreadSafeDoubleCheckLocking { - - instance : ThreadSafeDoubleCheckLocking {static} - - ThreadSafeDoubleCheckLocking() - + getInstance() : ThreadSafeDoubleCheckLocking {static} + -class HelperHolder { + - INSTANCE : InitializingOnDemandHolderIdiom {static} + - HelperHolder() } class IvoryTower { - INSTANCE : IvoryTower {static} - IvoryTower() + getInstance() : IvoryTower {static} } - -class HelperHolder { - - INSTANCE : InitializingOnDemandHolderIdiom {static} - - HelperHolder() + class ThreadSafeDoubleCheckLocking { + - instance : ThreadSafeDoubleCheckLocking {static} + - ThreadSafeDoubleCheckLocking() + + getInstance() : ThreadSafeDoubleCheckLocking {static} } - enum EnumIvoryTower { - + INSTANCE {static} - + toString() : String - + valueOf(name : String) : EnumIvoryTower {static} - + values() : EnumIvoryTower[] {static} + class ThreadSafeLazyLoadedIvoryTower { + - instance : ThreadSafeLazyLoadedIvoryTower {static} + - ThreadSafeLazyLoadedIvoryTower() + + getInstance() : ThreadSafeLazyLoadedIvoryTower {static} } } IvoryTower --> "-INSTANCE" IvoryTower diff --git a/specification/etc/specification.urm.puml b/specification/etc/specification.urm.puml index 2f194d340653..fd3cbb20e5f2 100644 --- a/specification/etc/specification.urm.puml +++ b/specification/etc/specification.urm.puml @@ -12,14 +12,14 @@ package com.iluwatar.specification.creature { + getSize() : Size + toString() : String } - class Troll { - + Troll() - } - class Octopus { - + Octopus() + interface Creature { + + getColor() : Color {abstract} + + getMovement() : Movement {abstract} + + getName() : String {abstract} + + getSize() : Size {abstract} } - class Shark { - + Shark() + class Dragon { + + Dragon() } class Goblin { + Goblin() @@ -27,26 +27,17 @@ package com.iluwatar.specification.creature { class KillerBee { + KillerBee() } - interface Creature { - + getColor() : Color {abstract} - + getMovement() : Movement {abstract} - + getName() : String {abstract} - + getSize() : Size {abstract} + class Octopus { + + Octopus() } - class Dragon { - + Dragon() + class Shark { + + Shark() + } + class Troll { + + Troll() } } package com.iluwatar.specification.property { - enum Size { - + LARGE {static} - + NORMAL {static} - + SMALL {static} - - title : String - + toString() : String - + valueOf(name : String) : Size {static} - + values() : Size[] {static} - } enum Color { + DARK {static} + GREEN {static} @@ -66,30 +57,40 @@ package com.iluwatar.specification.property { + valueOf(name : String) : Movement {static} + values() : Movement[] {static} } -} -package com.iluwatar.specification.app { - class App { - + App() - + main(args : String[]) {static} + enum Size { + + LARGE {static} + + NORMAL {static} + + SMALL {static} + - title : String + + toString() : String + + valueOf(name : String) : Size {static} + + values() : Size[] {static} } } package com.iluwatar.specification.selector { - class MovementSelector { - - m : Movement - + MovementSelector(m : Movement) - + test(t : Creature) : boolean - } class ColorSelector { - c : Color + ColorSelector(c : Color) + test(t : Creature) : boolean } + class MovementSelector { + - m : Movement + + MovementSelector(m : Movement) + + test(t : Creature) : boolean + } class SizeSelector { - s : Size + SizeSelector(s : Size) + test(t : Creature) : boolean } } +package com.iluwatar.specification.app { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } +} SizeSelector --> "-s" Size AbstractCreature --> "-color" Color MovementSelector --> "-m" Movement @@ -97,10 +98,10 @@ AbstractCreature --> "-movement" Movement AbstractCreature --> "-size" Size ColorSelector --> "-c" Color AbstractCreature ..|> Creature -Troll --|> AbstractCreature -Octopus --|> AbstractCreature -Shark --|> AbstractCreature +Dragon --|> AbstractCreature Goblin --|> AbstractCreature KillerBee --|> AbstractCreature -Dragon --|> AbstractCreature +Octopus --|> AbstractCreature +Shark --|> AbstractCreature +Troll --|> AbstractCreature @enduml \ No newline at end of file diff --git a/state/etc/state.urm.puml b/state/etc/state.urm.puml index 378c11cd1f5e..ea9a6383a898 100644 --- a/state/etc/state.urm.puml +++ b/state/etc/state.urm.puml @@ -1,25 +1,16 @@ @startuml package com.iluwatar.state { - class PeacefulState { + class AngryState { + - LOGGER : Logger {static} - mammoth : Mammoth - + PeacefulState(mammoth : Mammoth) + + AngryState(mammoth : Mammoth) + observe() + onEnterState() } - interface State { - + observe() {abstract} - + onEnterState() {abstract} - } class App { + App() + main(args : String[]) {static} } - class AngryState { - - mammoth : Mammoth - + AngryState(mammoth : Mammoth) - + observe() - + onEnterState() - } class Mammoth { - state : State + Mammoth() @@ -28,10 +19,21 @@ package com.iluwatar.state { + timePasses() + toString() : String } + class PeacefulState { + - LOGGER : Logger {static} + - mammoth : Mammoth + + PeacefulState(mammoth : Mammoth) + + observe() + + onEnterState() + } + interface State { + + observe() {abstract} + + onEnterState() {abstract} + } } AngryState --> "-mammoth" Mammoth PeacefulState --> "-mammoth" Mammoth Mammoth --> "-state" State -PeacefulState ..|> State AngryState ..|> State +PeacefulState ..|> State @enduml \ No newline at end of file diff --git a/step-builder/etc/step-builder.urm.puml b/step-builder/etc/step-builder.urm.puml index 129ecbf30cb1..09fdd05ec887 100644 --- a/step-builder/etc/step-builder.urm.puml +++ b/step-builder/etc/step-builder.urm.puml @@ -1,5 +1,36 @@ @startuml package com.iluwatar.stepbuilder { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } + class Character { + - abilities : List + - fighterClass : String + - name : String + - spell : String + - weapon : String + - wizardClass : String + + Character(name : String) + + getAbilities() : List + + getFighterClass() : String + + getName() : String + + getSpell() : String + + getWeapon() : String + + getWizardClass() : String + + setAbilities(abilities : List) + + setFighterClass(fighterClass : String) + + setName(name : String) + + setSpell(spell : String) + + setWeapon(weapon : String) + + setWizardClass(wizardClass : String) + + toString() : String + } + class CharacterStepBuilder { + - CharacterStepBuilder() + + newBuilder() : NameStep {static} + } interface AbilityStep { + noAbilities() : BuildStep {abstract} + noMoreAbilities() : BuildStep {abstract} @@ -8,9 +39,6 @@ package com.iluwatar.stepbuilder { interface BuildStep { + build() : Character {abstract} } - interface NameStep { - + name(String) : ClassStep {abstract} - } -class CharacterSteps { - abilities : List - fighterClass : String @@ -31,54 +59,26 @@ package com.iluwatar.stepbuilder { + withWeapon(weapon : String) : AbilityStep + wizardClass(wizardClass : String) : SpellStep } - class App { - + App() - + main(args : String[]) {static} - } - class CharacterStepBuilder { - - CharacterStepBuilder() - + newBuilder() : NameStep {static} + interface ClassStep { + + fighterClass(String) : WeaponStep {abstract} + + wizardClass(String) : SpellStep {abstract} } - class Character { - - abilities : List - - fighterClass : String - - name : String - - spell : String - - weapon : String - - wizardClass : String - + Character(name : String) - + getAbilities() : List - + getFighterClass() : String - + getName() : String - + getSpell() : String - + getWeapon() : String - + getWizardClass() : String - + setAbilities(abilities : List) - + setFighterClass(fighterClass : String) - + setName(name : String) - + setSpell(spell : String) - + setWeapon(weapon : String) - + setWizardClass(wizardClass : String) - + toString() : String + interface NameStep { + + name(String) : ClassStep {abstract} } interface SpellStep { + noSpell() : BuildStep {abstract} + withSpell(String) : AbilityStep {abstract} } - interface ClassStep { - + fighterClass(String) : WeaponStep {abstract} - + wizardClass(String) : SpellStep {abstract} - } interface WeaponStep { + noWeapon() : BuildStep {abstract} + withWeapon(String) : AbilityStep {abstract} } } -App --+ CharacterStepBuilder WeaponStep ..+ CharacterStepBuilder -ClassStep ..+ CharacterStepBuilder SpellStep ..+ CharacterStepBuilder CharacterSteps ..+ CharacterStepBuilder +ClassStep ..+ CharacterStepBuilder AbilityStep ..+ CharacterStepBuilder NameStep ..+ CharacterStepBuilder BuildStep ..+ CharacterStepBuilder diff --git a/strategy/etc/strategy.urm.puml b/strategy/etc/strategy.urm.puml index db86b9ed6a0e..8b9daabb9db4 100644 --- a/strategy/etc/strategy.urm.puml +++ b/strategy/etc/strategy.urm.puml @@ -1,5 +1,10 @@ @startuml package com.iluwatar.strategy { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } class DragonSlayer { - strategy : DragonSlayingStrategy + DragonSlayer(strategy : DragonSlayingStrategy) @@ -9,19 +14,18 @@ package com.iluwatar.strategy { interface DragonSlayingStrategy { + execute() {abstract} } - class App { - + App() - + main(args : String[]) {static} - } class MeleeStrategy { + - LOGGER : Logger {static} + MeleeStrategy() + execute() } class ProjectileStrategy { + - LOGGER : Logger {static} + ProjectileStrategy() + execute() } class SpellStrategy { + - LOGGER : Logger {static} + SpellStrategy() + execute() } diff --git a/template-method/etc/template-method.urm.puml b/template-method/etc/template-method.urm.puml index c2c6045fe404..a6e2dc3d20fd 100644 --- a/template-method/etc/template-method.urm.puml +++ b/template-method/etc/template-method.urm.puml @@ -1,10 +1,8 @@ @startuml package com.iluwatar.templatemethod { - class HitAndRunMethod { - + HitAndRunMethod() - # confuseTarget(target : String) - # pickTarget() : String - # stealTheItem(target : String) + class App { + + App() + + main(args : String[]) {static} } class HalflingThief { - method : StealingMethod @@ -12,7 +10,15 @@ package com.iluwatar.templatemethod { + changeMethod(method : StealingMethod) + steal() } + class HitAndRunMethod { + - LOGGER : Logger {static} + + HitAndRunMethod() + # confuseTarget(target : String) + # pickTarget() : String + # stealTheItem(target : String) + } abstract class StealingMethod { + - LOGGER : Logger {static} + StealingMethod() # confuseTarget(String) {abstract} # pickTarget() : String {abstract} @@ -20,15 +26,12 @@ package com.iluwatar.templatemethod { # stealTheItem(String) {abstract} } class SubtleMethod { + - LOGGER : Logger {static} + SubtleMethod() # confuseTarget(target : String) # pickTarget() : String # stealTheItem(target : String) } - class App { - + App() - + main(args : String[]) {static} - } } HalflingThief --> "-method" StealingMethod HitAndRunMethod --|> StealingMethod diff --git a/thread-pool/etc/thread-pool.urm.puml b/thread-pool/etc/thread-pool.urm.puml index 421ea1dcedf3..251033c8157c 100644 --- a/thread-pool/etc/thread-pool.urm.puml +++ b/thread-pool/etc/thread-pool.urm.puml @@ -1,5 +1,20 @@ @startuml package com.iluwatar.threadpool { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } + class CoffeeMakingTask { + - TIME_PER_CUP : int {static} + + CoffeeMakingTask(numCups : int) + + toString() : String + } + class PotatoPeelingTask { + - TIME_PER_POTATO : int {static} + + PotatoPeelingTask(numPotatoes : int) + + toString() : String + } abstract class Task { - ID_GENERATOR : AtomicInteger {static} - id : int @@ -9,25 +24,12 @@ package com.iluwatar.threadpool { + getTimeMs() : int + toString() : String } - class CoffeeMakingTask { - - TIME_PER_CUP : int {static} - + CoffeeMakingTask(numCups : int) - + toString() : String - } class Worker { + - LOGGER : Logger {static} - task : Task + Worker(task : Task) + run() } - class PotatoPeelingTask { - - TIME_PER_POTATO : int {static} - + PotatoPeelingTask(numPotatoes : int) - + toString() : String - } - class App { - + App() - + main(args : String[]) {static} - } } Worker --> "-task" Task CoffeeMakingTask --|> Task diff --git a/tolerant-reader/etc/tolerant-reader.urm.puml b/tolerant-reader/etc/tolerant-reader.urm.puml index f203f8257b52..a73394a4ed7d 100644 --- a/tolerant-reader/etc/tolerant-reader.urm.puml +++ b/tolerant-reader/etc/tolerant-reader.urm.puml @@ -1,5 +1,10 @@ @startuml package com.iluwatar.tolerantreader { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } class RainbowFish { - age : int - lengthMeters : int @@ -12,9 +17,11 @@ package com.iluwatar.tolerantreader { + getName() : String + getWeightTons() : int } - class App { - + App() - + main(args : String[]) {static} + class RainbowFishSerializer { + - RainbowFishSerializer() + + readV1(filename : String) : RainbowFish {static} + + writeV1(rainbowFish : RainbowFish, filename : String) {static} + + writeV2(rainbowFish : RainbowFishV2, filename : String) {static} } class RainbowFishV2 { - angry : boolean @@ -27,12 +34,6 @@ package com.iluwatar.tolerantreader { + getHungry() : boolean + getSleeping() : boolean } - class RainbowFishSerializer { - - RainbowFishSerializer() - + readV1(filename : String) : RainbowFish {static} - + writeV1(rainbowFish : RainbowFish, filename : String) {static} - + writeV2(rainbowFish : RainbowFishV2, filename : String) {static} - } } RainbowFishV2 --|> RainbowFish @enduml \ No newline at end of file diff --git a/twin/etc/twin.urm.puml b/twin/etc/twin.urm.puml index b4bd52468e00..e48298f18262 100644 --- a/twin/etc/twin.urm.puml +++ b/twin/etc/twin.urm.puml @@ -1,12 +1,12 @@ @startuml package com.iluwatar.twin { - abstract class GameItem { - + GameItem() - + click() {abstract} - + doDraw() {abstract} - + draw() + class App { + + App() + + main(args : String[]) {static} + - waiting() {static} } class BallItem { + - LOGGER : Logger {static} - isSuspended : boolean - twin : BallThread + BallItem() @@ -15,10 +15,12 @@ package com.iluwatar.twin { + move() + setTwin(twin : BallThread) } - class App { - + App() - + main(args : String[]) {static} - - waiting() {static} + abstract class GameItem { + - LOGGER : Logger {static} + + GameItem() + + click() {abstract} + + doDraw() {abstract} + + draw() } } BallItem --|> GameItem diff --git a/value-object/etc/value-object.urm.puml b/value-object/etc/value-object.urm.puml index 6c81de017ee8..6149ead9ba36 100644 --- a/value-object/etc/value-object.urm.puml +++ b/value-object/etc/value-object.urm.puml @@ -1,5 +1,10 @@ @startuml package com.iluwatar.value.object { + class App { + - LOGGER : Logger {static} + + App() + + main(args : String[]) {static} + } class HeroStat { - intelligence : int - luck : int @@ -13,9 +18,5 @@ package com.iluwatar.value.object { + toString() : String + valueOf(strength : int, intelligence : int, luck : int) : HeroStat {static} } - class App { - + App() - + main(args : String[]) {static} - } } @enduml \ No newline at end of file diff --git a/visitor/etc/visitor.urm.puml b/visitor/etc/visitor.urm.puml index 1f28e4e2f316..36a67b41514b 100644 --- a/visitor/etc/visitor.urm.puml +++ b/visitor/etc/visitor.urm.puml @@ -1,57 +1,60 @@ @startuml package com.iluwatar.visitor { + class App { + + App() + + main(args : String[]) {static} + } class Commander { + Commander(children : Unit[]) + accept(visitor : UnitVisitor) + toString() : String } - interface UnitVisitor { - + visitCommander(Commander) {abstract} - + visitSergeant(Sergeant) {abstract} - + visitSoldier(Soldier) {abstract} - } class CommanderVisitor { + - LOGGER : Logger {static} + CommanderVisitor() + visitCommander(commander : Commander) + visitSergeant(sergeant : Sergeant) + visitSoldier(soldier : Soldier) } - class Soldier { - + Soldier(children : Unit[]) + class Sergeant { + + Sergeant(children : Unit[]) + accept(visitor : UnitVisitor) + toString() : String } - class App { - + App() - + main(args : String[]) {static} + class SergeantVisitor { + - LOGGER : Logger {static} + + SergeantVisitor() + + visitCommander(commander : Commander) + + visitSergeant(sergeant : Sergeant) + + visitSoldier(soldier : Soldier) } - abstract class Unit { - - children : Unit[] - + Unit(children : Unit[]) + class Soldier { + + Soldier(children : Unit[]) + accept(visitor : UnitVisitor) + + toString() : String } class SoldierVisitor { + - LOGGER : Logger {static} + SoldierVisitor() + visitCommander(commander : Commander) + visitSergeant(sergeant : Sergeant) + visitSoldier(soldier : Soldier) } - class SergeantVisitor { - + SergeantVisitor() - + visitCommander(commander : Commander) - + visitSergeant(sergeant : Sergeant) - + visitSoldier(soldier : Soldier) - } - class Sergeant { - + Sergeant(children : Unit[]) + abstract class Unit { + - children : Unit[] + + Unit(children : Unit[]) + accept(visitor : UnitVisitor) - + toString() : String + } + interface UnitVisitor { + + visitCommander(Commander) {abstract} + + visitSergeant(Sergeant) {abstract} + + visitSoldier(Soldier) {abstract} } } Commander --|> Unit CommanderVisitor ..|> UnitVisitor +Sergeant --|> Unit +SergeantVisitor ..|> UnitVisitor Soldier --|> Unit SoldierVisitor ..|> UnitVisitor -SergeantVisitor ..|> UnitVisitor -Sergeant --|> Unit @enduml \ No newline at end of file