diff --git a/abstract-document/etc/abstract-document.urm.puml b/abstract-document/etc/abstract-document.urm.puml index c738b50c..fa15eb3c 100644 --- a/abstract-document/etc/abstract-document.urm.puml +++ b/abstract-document/etc/abstract-document.urm.puml @@ -3,31 +3,30 @@ package com.iluwatar.abstractdocument.domain { class Part { + Part(properties : Map) } - class Car { - + Car(properties : Map) - } - interface HasModel { + interface HasPrice { + PROPERTY : String {static} - + getModel() : Optional + + getPrice() : Optional } interface HasParts { + PROPERTY : String {static} + getParts() : Stream } + class Car { + + Car(properties : Map) + } interface HasType { + PROPERTY : String {static} + getType() : Optional } - interface HasPrice { + interface HasModel { + PROPERTY : String {static} - + getPrice() : Optional + + getModel() : Optional } } package com.iluwatar.abstractdocument { - interface Document { - + children(String, Function, T>) : Stream {abstract} - + get(String) : Object {abstract} - + put(String, Object) {abstract} + class App { + + App() + + main(args : String[]) {static} } abstract class AbstractDocument { - properties : Map @@ -37,9 +36,10 @@ package com.iluwatar.abstractdocument { + put(key : String, value : Object) + toString() : String } - class App { - + App() - + main(args : String[]) {static} + interface Document { + + children(String, Function, T>) : Stream {abstract} + + get(String) : Object {abstract} + + put(String, Object) {abstract} } } AbstractDocument --+ Map @@ -47,13 +47,13 @@ Part ..|> HasType Part ..|> HasModel Part ..|> HasPrice Part --|> AbstractDocument +AbstractDocument ..|> Document +HasPrice --|> Document +HasParts --|> Document Car ..|> HasModel Car ..|> HasPrice Car ..|> HasParts Car --|> AbstractDocument -HasModel --|> Document -HasParts --|> Document -AbstractDocument ..|> Document HasType --|> Document -HasPrice --|> Document +HasModel --|> Document @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 88402c6d..9648a6a9 100644 --- a/abstract-factory/etc/abstract-factory.urm.puml +++ b/abstract-factory/etc/abstract-factory.urm.puml @@ -1,22 +1,5 @@ @startuml package com.iluwatar.abstractfactory { - interface Castle { - + getDescription() : String {abstract} - } - class OrcKingdomFactory { - + OrcKingdomFactory() - + createArmy() : Army - + createCastle() : Castle - + createKing() : King - } - class ElfKing { - ~ DESCRIPTION : String {static} - + ElfKing() - + getDescription() : String - } - interface King { - + getDescription() : String {abstract} - } class App { - army : Army - castle : Castle @@ -34,23 +17,20 @@ package com.iluwatar.abstractfactory { - setCastle(castle : Castle) - setKing(king : King) } - class OrcKing { - ~ DESCRIPTION : String {static} - + OrcKing() - + getDescription() : String - } - class ElfKingdomFactory { - + ElfKingdomFactory() + class OrcKingdomFactory { + + OrcKingdomFactory() + createArmy() : Army + createCastle() : Castle + createKing() : King } - interface Army { - + getDescription() : String {abstract} + class ElfCastle { + ~ DESCRIPTION : String {static} + + ElfCastle() + + getDescription() : String } - class OrcArmy { + class OrcCastle { ~ DESCRIPTION : String {static} - + OrcArmy() + + OrcCastle() + getDescription() : String } interface KingdomFactory { @@ -58,31 +38,51 @@ package com.iluwatar.abstractfactory { + createCastle() : Castle {abstract} + createKing() : King {abstract} } + class ElfKing { + ~ DESCRIPTION : String {static} + + ElfKing() + + getDescription() : String + } class ElfArmy { ~ DESCRIPTION : String {static} + ElfArmy() + getDescription() : String } - class ElfCastle { + interface Castle { + + getDescription() : String {abstract} + } + interface Army { + + getDescription() : String {abstract} + } + class OrcKing { ~ DESCRIPTION : String {static} - + ElfCastle() + + OrcKing() + getDescription() : String } - class OrcCastle { + class OrcArmy { ~ DESCRIPTION : String {static} - + OrcCastle() + + OrcArmy() + getDescription() : String } + interface King { + + getDescription() : String {abstract} + } + class ElfKingdomFactory { + + ElfKingdomFactory() + + createArmy() : Army + + createCastle() : Castle + + createKing() : King + } } App --> "-castle" Castle App --> "-king" King App --> "-army" Army OrcKingdomFactory ..|> KingdomFactory +ElfCastle ..|> Castle +OrcCastle ..|> Castle ElfKing ..|> King +ElfArmy ..|> Army OrcKing ..|> King -ElfKingdomFactory ..|> KingdomFactory OrcArmy ..|> Army -ElfArmy ..|> Army -ElfCastle ..|> Castle -OrcCastle ..|> Castle +ElfKingdomFactory ..|> KingdomFactory @enduml \ No newline at end of file diff --git a/adapter/etc/adapter.urm.puml b/adapter/etc/adapter.urm.puml index 2cee13dc..a7c962a3 100644 --- a/adapter/etc/adapter.urm.puml +++ b/adapter/etc/adapter.urm.puml @@ -1,13 +1,19 @@ @startuml package com.iluwatar.adapter { - class App { - + App() - + main(args : String[]) {static} - } interface BattleShip { + fire() {abstract} + move() {abstract} } + class BattleFishingBoat { + - boat : FishingBoat + + BattleFishingBoat() + + fire() + + move() + } + class App { + + App() + + main(args : String[]) {static} + } class Captain { - battleship : BattleShip + Captain() @@ -16,12 +22,6 @@ package com.iluwatar.adapter { + move() + setBattleship(battleship : BattleShip) } - class BattleFishingBoat { - - boat : FishingBoat - + BattleFishingBoat() - + fire() - + move() - } class FishingBoat { + FishingBoat() + fish() @@ -30,6 +30,6 @@ package com.iluwatar.adapter { } BattleFishingBoat --> "-boat" FishingBoat Captain --> "-battleship" BattleShip -Captain ..|> BattleShip BattleFishingBoat ..|> BattleShip +Captain ..|> BattleShip @enduml \ No newline at end of file diff --git a/aggregator-microservices/etc/aggregator-service.urm.puml b/aggregator-microservices/etc/aggregator-service.urm.puml index 5c2e1167..2a660053 100644 --- a/aggregator-microservices/etc/aggregator-service.urm.puml +++ b/aggregator-microservices/etc/aggregator-service.urm.puml @@ -1,17 +1,15 @@ @startuml package com.iluwatar.aggregator.microservices { - class Aggregator { - - informationClient : ProductInformationClient - - inventoryClient : ProductInventoryClient - + Aggregator() - + getProduct() : Product + class ProductInventoryClientImpl { + + ProductInventoryClientImpl() + + getProductInventories() : int } - class ProductInformationClientImpl { - + ProductInformationClientImpl() - + getProductTitle() : String + class App { + + App() + + main(args : String[]) {static} } - interface ProductInformationClient { - + getProductTitle() : String {abstract} + interface ProductInventoryClient { + + getProductInventories() : int {abstract} } class Product { - productInventories : int @@ -22,20 +20,22 @@ package com.iluwatar.aggregator.microservices { + setProductInventories(productInventories : int) + setTitle(title : String) } - class ProductInventoryClientImpl { - + ProductInventoryClientImpl() - + getProductInventories() : int + class Aggregator { + - informationClient : ProductInformationClient + - inventoryClient : ProductInventoryClient + + Aggregator() + + getProduct() : Product } - class App { - + App() - + main(args : String[]) {static} + class ProductInformationClientImpl { + + ProductInformationClientImpl() + + getProductTitle() : String } - interface ProductInventoryClient { - + getProductInventories() : int {abstract} + interface ProductInformationClient { + + getProductTitle() : String {abstract} } } Aggregator --> "-inventoryClient" ProductInventoryClient Aggregator --> "-informationClient" ProductInformationClient -ProductInformationClientImpl ..|> ProductInformationClient ProductInventoryClientImpl ..|> ProductInventoryClient +ProductInformationClientImpl ..|> ProductInformationClient @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 90f327e0..a07a3630 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 InventoryApplication { - + InventoryApplication() - + main(args : String[]) {static} - } class InventoryController { + InventoryController() + getProductInventories() : int } + class InventoryApplication { + + InventoryApplication() + + main(args : String[]) {static} + } } @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 3313f705..409e7ee9 100644 --- a/api-gateway/etc/api-gateway-service.urm.puml +++ b/api-gateway/etc/api-gateway-service.urm.puml @@ -1,7 +1,16 @@ @startuml package com.iluwatar.api.gateway { - interface ImageClient { - + getImagePath() : String {abstract} + class App { + + App() + + main(args : String[]) {static} + } + class PriceClientImpl { + + PriceClientImpl() + + getPrice() : String + } + class ImageClientImpl { + + ImageClientImpl() + + getImagePath() : String } class MobileProduct { - price : String @@ -9,6 +18,9 @@ package com.iluwatar.api.gateway { + getPrice() : String + setPrice(price : String) } + interface ImageClient { + + getImagePath() : String {abstract} + } class ApiGateway { - imageClient : ImageClient - priceClient : PriceClient @@ -28,18 +40,6 @@ package com.iluwatar.api.gateway { interface PriceClient { + getPrice() : String {abstract} } - class PriceClientImpl { - + PriceClientImpl() - + getPrice() : String - } - class ImageClientImpl { - + ImageClientImpl() - + getImagePath() : String - } - class App { - + App() - + main(args : String[]) {static} - } } ApiGateway --> "-imageClient" ImageClient ApiGateway --> "-priceClient" PriceClient diff --git a/async-method-invocation/etc/async-method-invocation.urm.puml b/async-method-invocation/etc/async-method-invocation.urm.puml index 9a90d307..b96e843d 100644 --- a/async-method-invocation/etc/async-method-invocation.urm.puml +++ b/async-method-invocation/etc/async-method-invocation.urm.puml @@ -1,13 +1,22 @@ @startuml package com.iluwatar.async.method.invocation { - interface AsyncCallback { - + onComplete(T, Optional) {abstract} + class App { + + 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 AsyncExecutor { + + endProcess(AsyncResult) : T {abstract} + + startProcess(Callable) : AsyncResult {abstract} + + startProcess(Callable, AsyncCallback) : AsyncResult {abstract} + } class ThreadAsyncExecutor { - idx : AtomicInteger + ThreadAsyncExecutor() @@ -15,12 +24,8 @@ package com.iluwatar.async.method.invocation { + startProcess(task : Callable) : AsyncResult + startProcess(task : Callable, callback : AsyncCallback) : AsyncResult } - class App { - + App() - - callback(name : String) : AsyncCallback {static} - - lazyval(value : T, delayMillis : long) : Callable {static} - - log(msg : String) {static} - + main(args : String[]) {static} + interface AsyncCallback { + + onComplete(T, Optional) {abstract} } -class CompletableResult { ~ COMPLETED : int {static} @@ -38,11 +43,6 @@ package com.iluwatar.async.method.invocation { ~ setException(exception : Exception) ~ setValue(value : T) } - interface AsyncExecutor { - + endProcess(AsyncResult) : T {abstract} - + startProcess(Callable) : AsyncResult {abstract} - + startProcess(Callable, AsyncCallback) : AsyncResult {abstract} - } } CompletableResult ..+ ThreadAsyncExecutor ThreadAsyncExecutor ..|> AsyncExecutor diff --git a/bridge/etc/bridge.urm.puml b/bridge/etc/bridge.urm.puml index d9d7a414..84e250a0 100644 --- a/bridge/etc/bridge.urm.puml +++ b/bridge/etc/bridge.urm.puml @@ -8,26 +8,6 @@ package com.iluwatar.bridge { + unwield() + wield() } - abstract class MagicWeapon { - # imp : MagicWeaponImpl - + MagicWeapon(imp : MagicWeaponImpl) - + getImp() : MagicWeaponImpl - + swing() {abstract} - + unwield() {abstract} - + wield() {abstract} - } - abstract class SoulEatingMagicWeaponImpl { - + SoulEatingMagicWeaponImpl() - + eatSoulImp() {abstract} - } - class BlindingMagicWeapon { - + BlindingMagicWeapon(imp : BlindingMagicWeaponImpl) - + blind() - + getImp() : BlindingMagicWeaponImpl - + swing() - + unwield() - + wield() - } class Stormbringer { + Stormbringer() + eatSoulImp() @@ -35,9 +15,9 @@ package com.iluwatar.bridge { + unwieldImp() + wieldImp() } - abstract class BlindingMagicWeaponImpl { - + BlindingMagicWeaponImpl() - + blindImp() {abstract} + abstract class FlyingMagicWeaponImpl { + + FlyingMagicWeaponImpl() + + flyImp() {abstract} } class SoulEatingMagicWeapon { + SoulEatingMagicWeapon(imp : SoulEatingMagicWeaponImpl) @@ -53,6 +33,10 @@ package com.iluwatar.bridge { + unwieldImp() {abstract} + wieldImp() {abstract} } + abstract class SoulEatingMagicWeaponImpl { + + SoulEatingMagicWeaponImpl() + + eatSoulImp() {abstract} + } class Excalibur { + Excalibur() + blindImp() @@ -60,10 +44,6 @@ package com.iluwatar.bridge { + unwieldImp() + wieldImp() } - abstract class FlyingMagicWeaponImpl { - + FlyingMagicWeaponImpl() - + flyImp() {abstract} - } class Mjollnir { + Mjollnir() + flyImp() @@ -75,15 +55,35 @@ package com.iluwatar.bridge { + 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 + + swing() + + unwield() + + wield() + } } MagicWeapon --> "-imp" MagicWeaponImpl FlyingMagicWeapon --|> MagicWeapon -SoulEatingMagicWeaponImpl --|> MagicWeaponImpl -BlindingMagicWeapon --|> MagicWeapon Stormbringer --|> SoulEatingMagicWeaponImpl -BlindingMagicWeaponImpl --|> MagicWeaponImpl +FlyingMagicWeaponImpl --|> MagicWeaponImpl SoulEatingMagicWeapon --|> MagicWeapon +SoulEatingMagicWeaponImpl --|> MagicWeaponImpl Excalibur --|> BlindingMagicWeaponImpl -FlyingMagicWeaponImpl --|> MagicWeaponImpl Mjollnir --|> FlyingMagicWeaponImpl +BlindingMagicWeaponImpl --|> MagicWeaponImpl +BlindingMagicWeapon --|> MagicWeapon @enduml \ No newline at end of file diff --git a/builder/etc/builder.urm.puml b/builder/etc/builder.urm.puml index 26247632..0c98f3b4 100644 --- a/builder/etc/builder.urm.puml +++ b/builder/etc/builder.urm.puml @@ -1,48 +1,58 @@ @startuml package com.iluwatar.builder { - class Hero { + class Builder { - armor : Armor - hairColor : HairColor - hairType : HairType - name : String - profession : Profession - weapon : Weapon - - Hero(builder : Builder) - + getArmor() : Armor - + getHairColor() : HairColor - + getHairType() : HairType - + getName() : String - + getProfession() : Profession - + getWeapon() : Weapon - + toString() : String + + 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 { + App() + main(args : String[]) {static} } - class Builder { + class Hero { - 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 + - Hero(builder : Builder) + + getArmor() : Armor + + getHairColor() : HairColor + + getHairType() : HairType + + getName() : String + + getProfession() : Profession + + getWeapon() : Weapon + + toString() : String } - enum Armor { - + CHAIN_MAIL {static} - + CLOTHES {static} - + LEATHER {static} - + PLATE_MAIL {static} - - title : String + enum Weapon { + + AXE {static} + + BOW {static} + + DAGGER {static} + + SWORD {static} + + WARHAMMER {static} + toString() : String - + valueOf(name : String) : Armor {static} - + values() : Armor[] {static} + + 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} } enum Profession { + MAGE {static} @@ -53,15 +63,15 @@ package com.iluwatar.builder { + valueOf(name : String) : Profession {static} + values() : Profession[] {static} } - enum Weapon { - + AXE {static} - + BOW {static} - + DAGGER {static} - + SWORD {static} - + WARHAMMER {static} + enum Armor { + + CHAIN_MAIL {static} + + CLOTHES {static} + + LEATHER {static} + + PLATE_MAIL {static} + - title : String + toString() : String - + valueOf(name : String) : Weapon {static} - + values() : Weapon[] {static} + + valueOf(name : String) : Armor {static} + + values() : Armor[] {static} } enum HairType { + BALD {static} @@ -74,19 +84,9 @@ package com.iluwatar.builder { + valueOf(name : String) : HairType {static} + values() : HairType[] {static} } - enum HairColor { - + BLACK {static} - + BLOND {static} - + BROWN {static} - + RED {static} - + WHITE {static} - + toString() : String - + valueOf(name : String) : HairColor {static} - + values() : HairColor[] {static} - } } -Builder ..+ Hero Hero --> "-profession" Profession +Builder ..+ Hero Hero --> "-armor" Armor App --+ Hero Builder --> "-weapon" Weapon diff --git a/business-delegate/etc/business-delegate.urm.puml b/business-delegate/etc/business-delegate.urm.puml index a8f31700..a58136c8 100644 --- a/business-delegate/etc/business-delegate.urm.puml +++ b/business-delegate/etc/business-delegate.urm.puml @@ -1,5 +1,9 @@ @startuml package com.iluwatar.business.delegate { + class EjbService { + + EjbService() + + doProcessing() + } class BusinessLookup { - ejbService : EjbService - jmsService : JmsService @@ -8,15 +12,18 @@ package com.iluwatar.business.delegate { + setEjbService(ejbService : EjbService) + setJmsService(jmsService : JmsService) } + class App { + + App() + + main(args : String[]) {static} + } + interface BusinessService { + + doProcessing() {abstract} + } class Client { - businessDelegate : BusinessDelegate + Client(businessDelegate : BusinessDelegate) + doTask() } - class EjbService { - + EjbService() - + doProcessing() - } class BusinessDelegate { - businessService : BusinessService - lookupService : BusinessLookup @@ -26,17 +33,10 @@ package com.iluwatar.business.delegate { + setLookupService(businessLookup : BusinessLookup) + setServiceType(serviceType : ServiceType) } - interface BusinessService { - + doProcessing() {abstract} - } class JmsService { + JmsService() + doProcessing() } - class App { - + App() - + main(args : String[]) {static} - } enum ServiceType { + EJB {static} + JMS {static} diff --git a/caching/etc/caching.urm.puml b/caching/etc/caching.urm.puml index 273c9911..b8f4fb49 100644 --- a/caching/etc/caching.urm.puml +++ b/caching/etc/caching.urm.puml @@ -1,17 +1,18 @@ @startuml package com.iluwatar.caching { - 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 App { + + App() + + main(args : String[]) {static} + + useReadAndWriteThroughStrategy() + + useReadThroughAndWriteAroundStrategy() + + useReadThroughAndWriteBehindStrategy() + } + ~class Node { + ~ next : Node + ~ previous : Node + ~ userAccount : UserAccount + ~ userId : String + + Node(this$0 : String, userId : UserAccount) } class CacheStore { ~ cache : LruCache {static} @@ -36,12 +37,18 @@ package com.iluwatar.caching { + printCacheContent() : String {static} + save(userAccount : UserAccount) {static} } - ~class Node { - ~ next : Node - ~ previous : Node - ~ userAccount : UserAccount - ~ userId : String - + Node(this$0 : LruCache, userId : String, userAccount : UserAccount) + 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 LruCache { ~ cache : Map @@ -74,13 +81,6 @@ package com.iluwatar.caching { + upsertDb(userAccount : UserAccount) {static} + writeToDb(userAccount : UserAccount) {static} } - class App { - + App() - + main(args : String[]) {static} - + useReadAndWriteThroughStrategy() - + useReadThroughAndWriteAroundStrategy() - + useReadThroughAndWriteBehindStrategy() - } enum CachingPolicy { + AROUND {static} + BEHIND {static} diff --git a/callback/etc/callback.urm.puml b/callback/etc/callback.urm.puml index 8b27ee8a..b9e1ca69 100644 --- a/callback/etc/callback.urm.puml +++ b/callback/etc/callback.urm.puml @@ -1,24 +1,24 @@ @startuml package com.iluwatar.callback { - class LambdasApp { - + LambdasApp() - + main(args : String[]) {static} + interface Callback { + + call() {abstract} } - class SimpleTask { - + SimpleTask() - + execute() + abstract class Task { + + Task() + + execute() {abstract} + + executeWith(callback : Callback) } class App { + App() + main(args : String[]) {static} } - abstract class Task { - + Task() - + execute() {abstract} - + executeWith(callback : Callback) + class SimpleTask { + + SimpleTask() + + execute() } - interface Callback { - + call() {abstract} + class LambdasApp { + + LambdasApp() + + main(args : String[]) {static} } } SimpleTask --|> Task diff --git a/chain/etc/chain.urm.puml b/chain/etc/chain.urm.puml index c75cbc8d..21365765 100644 --- a/chain/etc/chain.urm.puml +++ b/chain/etc/chain.urm.puml @@ -1,13 +1,20 @@ @startuml package com.iluwatar.chain { + class OrcSoldier { + + OrcSoldier(handler : RequestHandler) + + handleRequest(req : Request) + + toString() : String + } class OrcCommander { + OrcCommander(handler : RequestHandler) + handleRequest(req : Request) + toString() : String } - class App { - + App() - + main(args : String[]) {static} + class OrcKing { + ~ chain : RequestHandler + + OrcKing() + - buildChain() + + makeRequest(req : Request) } class Request { - handled : boolean @@ -20,21 +27,9 @@ package com.iluwatar.chain { + markHandled() + toString() : String } - class OrcOfficer { - + OrcOfficer(handler : RequestHandler) - + handleRequest(req : Request) - + toString() : String - } - class OrcKing { - ~ chain : RequestHandler - + OrcKing() - - buildChain() - + makeRequest(req : Request) - } - class OrcSoldier { - + OrcSoldier(handler : RequestHandler) - + handleRequest(req : Request) - + toString() : String + class App { + + App() + + main(args : String[]) {static} } abstract class RequestHandler { - next : RequestHandler @@ -43,6 +38,11 @@ package com.iluwatar.chain { # 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 +52,9 @@ package com.iluwatar.chain { } } RequestHandler --> "-next" RequestHandler -OrcKing --> "-chain" RequestHandler Request --> "-requestType" RequestType +OrcKing --> "-chain" RequestHandler +OrcSoldier --|> RequestHandler 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 015fb30b..27bff733 100644 --- a/command/etc/command.urm.puml +++ b/command/etc/command.urm.puml @@ -1,5 +1,28 @@ @startuml package com.iluwatar.command { + class InvisibilitySpell { + - target : Target + + InvisibilitySpell() + + execute(target : Target) + + redo() + + toString() : String + + undo() + } + class App { + + App() + + main(args : String[]) {static} + } + abstract class Command { + + Command() + + execute(Target) {abstract} + + redo() {abstract} + + toString() : String {abstract} + + undo() {abstract} + } + class Goblin { + + Goblin() + + toString() : String + } abstract class Target { - size : Size - visibility : Visibility @@ -11,9 +34,14 @@ package com.iluwatar.command { + setVisibility(visibility : Visibility) + toString() : String {abstract} } - class Goblin { - + Goblin() + class Wizard { + - redoStack : Deque + - undoStack : Deque + + Wizard() + + castSpell(command : Command, target : Target) + + redoLastSpell() + toString() : String + + undoLastSpell() } class ShrinkSpell { - oldSize : Size @@ -24,34 +52,6 @@ package com.iluwatar.command { + toString() : String + undo() } - class InvisibilitySpell { - - target : Target - + InvisibilitySpell() - + execute(target : Target) - + redo() - + toString() : String - + undo() - } - class Wizard { - - redoStack : Deque - - undoStack : Deque - + Wizard() - + castSpell(command : Command, target : Target) - + redoLastSpell() - + toString() : String - + undoLastSpell() - } - class App { - + App() - + main(args : String[]) {static} - } - abstract class Command { - + Command() - + execute(Target) {abstract} - + redo() {abstract} - + toString() : String {abstract} - + undo() {abstract} - } enum Size { + LARGE {static} + NORMAL {static} @@ -78,7 +78,7 @@ ShrinkSpell --> "-oldSize" Size InvisibilitySpell --> "-target" Target ShrinkSpell --> "-target" Target Target --> "-visibility" Visibility +InvisibilitySpell --|> Command Goblin --|> Target ShrinkSpell --|> Command -InvisibilitySpell --|> Command @enduml \ No newline at end of file diff --git a/composite/etc/composite.urm.puml b/composite/etc/composite.urm.puml index 6f6e93c9..82e9b65e 100644 --- a/composite/etc/composite.urm.puml +++ b/composite/etc/composite.urm.puml @@ -1,29 +1,29 @@ @startuml package com.iluwatar.composite { - class Letter { - - c : char - + Letter(c : char) - # printThisAfter() - # printThisBefore() - } - class Sentence { - + Sentence(words : List) - # printThisAfter() - # printThisBefore() - } class Word { + Word(letters : List) # printThisAfter() # printThisBefore() } + class App { + + App() + + main(args : String[]) {static} + } class Messenger { + Messenger() ~ messageFromElves() : LetterComposite ~ messageFromOrcs() : LetterComposite } - class App { - + App() - + main(args : String[]) {static} + class Letter { + - c : char + + Letter(c : char) + # printThisAfter() + # printThisBefore() + } + class Sentence { + + Sentence(words : List) + # printThisAfter() + # printThisBefore() } abstract class LetterComposite { - children : List @@ -36,7 +36,7 @@ package com.iluwatar.composite { } } 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 f751b967..90a9c972 100644 --- a/dao/etc/dao.urm.puml +++ b/dao/etc/dao.urm.puml @@ -1,39 +1,5 @@ @startuml package com.iluwatar.dao { - class Customer { - - firstName : String - - id : int - - lastName : String - + Customer(id : int, firstName : String, lastName : String) - + equals(that : Object) : boolean - + getFirstName() : String - + getId() : int - + getLastName() : String - + hashCode() : int - + setFirstName(firstName : String) - + setId(id : int) - + 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} - } - 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() @@ -47,6 +13,13 @@ package com.iluwatar.dao { + 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} @@ -59,7 +32,34 @@ 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 + - lastName : String + + Customer(id : int, firstName : String, lastName : String) + + equals(that : Object) : boolean + + getFirstName() : String + + getId() : int + + getLastName() : String + + hashCode() : int + + setFirstName(firstName : String) + + setId(id : int) + + setLastName(lastName : String) + + toString() : String + } } -DbCustomerDao ..|> CustomerDao InMemoryCustomerDao ..|> CustomerDao +DbCustomerDao ..|> CustomerDao @enduml \ No newline at end of file diff --git a/decorator/etc/decorator.urm.puml b/decorator/etc/decorator.urm.puml index 6c44e6cc..4862ddfe 100644 --- a/decorator/etc/decorator.urm.puml +++ b/decorator/etc/decorator.urm.puml @@ -1,5 +1,10 @@ @startuml package com.iluwatar.decorator { + interface Hostile { + + attack() {abstract} + + fleeBattle() {abstract} + + getAttackPower() : int {abstract} + } class App { + App() + main(args : String[]) {static} @@ -10,11 +15,6 @@ package com.iluwatar.decorator { + fleeBattle() + getAttackPower() : int } - interface Hostile { - + attack() {abstract} - + fleeBattle() {abstract} - + getAttackPower() : int {abstract} - } class SmartHostile { - decorated : Hostile + SmartHostile(decorated : Hostile) diff --git a/delegation/etc/delegation.urm.puml b/delegation/etc/delegation.urm.puml index c143a6ba..37858701 100644 --- a/delegation/etc/delegation.urm.puml +++ b/delegation/etc/delegation.urm.puml @@ -1,19 +1,24 @@ @startuml package com.iluwatar.delegation.simple.printers { - class EpsonPrinter { - + EpsonPrinter() - + print(message : String) - } class HpPrinter { + HpPrinter() + print(message : String) } + class EpsonPrinter { + + EpsonPrinter() + + print(message : String) + } class CanonPrinter { + CanonPrinter() + print(message : String) } } package com.iluwatar.delegation.simple { + class App { + + MESSAGE_TO_PRINT : String {static} + + App() + + main(args : String[]) {static} + } class PrinterController { - printer : Printer + PrinterController(printer : Printer) @@ -22,15 +27,10 @@ package com.iluwatar.delegation.simple { interface Printer { + print(String) {abstract} } - class App { - + MESSAGE_TO_PRINT : String {static} - + App() - + main(args : String[]) {static} - } } PrinterController --> "-printer" Printer +HpPrinter ..|> Printer PrinterController ..|> Printer EpsonPrinter ..|> Printer -HpPrinter ..|> Printer CanonPrinter ..|> 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 c22c658a..bf4d1059 100644 --- a/dependency-injection/etc/dependency-injection.urm.puml +++ b/dependency-injection/etc/dependency-injection.urm.puml @@ -1,48 +1,48 @@ @startuml package com.iluwatar.dependency.injection { + class AdvancedWizard { + - tobacco : Tobacco + + AdvancedWizard(tobacco : Tobacco) + + smoke() + } interface Wizard { + smoke() {abstract} } - class GuiceWizard { - - tobacco : Tobacco - + GuiceWizard(tobacco : Tobacco) + class RivendellTobacco { + + RivendellTobacco() + } + class SimpleWizard { + - tobacco : OldTobyTobacco + + SimpleWizard() + smoke() } class OldTobyTobacco { + OldTobyTobacco() } - abstract class Tobacco { - + Tobacco() - + smoke(wizard : Wizard) + class SecondBreakfastTobacco { + + SecondBreakfastTobacco() } class App { + App() + main(args : String[]) {static} } - class RivendellTobacco { - + RivendellTobacco() + abstract class Tobacco { + + Tobacco() + + smoke(wizard : Wizard) } - class AdvancedWizard { + class GuiceWizard { - tobacco : Tobacco - + AdvancedWizard(tobacco : Tobacco) - + smoke() - } - class SecondBreakfastTobacco { - + SecondBreakfastTobacco() - } - class SimpleWizard { - - tobacco : OldTobyTobacco - + SimpleWizard() + + GuiceWizard(tobacco : Tobacco) + smoke() } } SimpleWizard --> "-tobacco" OldTobyTobacco AdvancedWizard --> "-tobacco" Tobacco GuiceWizard --> "-tobacco" Tobacco -GuiceWizard ..|> Wizard -OldTobyTobacco --|> Tobacco -RivendellTobacco --|> Tobacco AdvancedWizard ..|> Wizard -SecondBreakfastTobacco --|> Tobacco +RivendellTobacco --|> Tobacco SimpleWizard ..|> Wizard +OldTobyTobacco --|> Tobacco +SecondBreakfastTobacco --|> Tobacco +GuiceWizard ..|> Wizard @enduml \ No newline at end of file diff --git a/double-dispatch/etc/double-dispatch.urm.puml b/double-dispatch/etc/double-dispatch.urm.puml index 725f009c..78d36132 100644 --- a/double-dispatch/etc/double-dispatch.urm.puml +++ b/double-dispatch/etc/double-dispatch.urm.puml @@ -1,17 +1,5 @@ @startuml package com.iluwatar.doubledispatch { - class App { - + App() - + main(args : String[]) {static} - } - class FlamingAsteroid { - + FlamingAsteroid(left : int, top : int, right : int, bottom : int) - + collision(gameObject : GameObject) - } - class SpaceStationIss { - + SpaceStationIss(left : int, top : int, right : int, bottom : int) - + collision(gameObject : GameObject) - } abstract class GameObject { - damaged : boolean - onFire : boolean @@ -27,6 +15,14 @@ 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) @@ -56,10 +52,14 @@ package com.iluwatar.doubledispatch { ~ intersectsWith(r : Rectangle) : boolean + toString() : String } + class App { + + App() + + main(args : String[]) {static} + } } -FlamingAsteroid --|> Meteoroid -SpaceStationIss --|> SpaceStationMir GameObject --|> Rectangle +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 18b7621c..3ccfea53 100644 --- a/event-aggregator/etc/event-aggregator.urm.puml +++ b/event-aggregator/etc/event-aggregator.urm.puml @@ -1,34 +1,10 @@ @startuml package com.iluwatar.event.aggregator { - class KingsHand { - + KingsHand() - + KingsHand(obs : EventObserver) - + onEvent(e : Event) - + timePasses(day : Weekday) - } - class KingJoffrey { - + KingJoffrey() - + onEvent(e : Event) - } - class Scout { - + Scout() - + Scout(obs : EventObserver) - + timePasses(day : Weekday) - } class LordVarys { + LordVarys() + LordVarys(obs : EventObserver) + timePasses(day : Weekday) } - class App { - + App() - + main(args : String[]) {static} - } - class LordBaelish { - + LordBaelish() - + LordBaelish(obs : EventObserver) - + timePasses(day : Weekday) - } abstract class EventEmitter { - observers : List + EventEmitter() @@ -37,9 +13,33 @@ package com.iluwatar.event.aggregator { + registerObserver(obs : EventObserver) + timePasses(Weekday) {abstract} } + class KingJoffrey { + + KingJoffrey() + + onEvent(e : Event) + } + class LordBaelish { + + LordBaelish() + + LordBaelish(obs : EventObserver) + + timePasses(day : Weekday) + } interface EventObserver { + onEvent(Event) {abstract} } + class KingsHand { + + KingsHand() + + KingsHand(obs : EventObserver) + + onEvent(e : Event) + + timePasses(day : Weekday) + } + class Scout { + + Scout() + + Scout(obs : EventObserver) + + timePasses(day : Weekday) + } + class App { + + App() + + main(args : String[]) {static} + } enum Weekday { + FRIDAY {static} + MONDAY {static} @@ -64,10 +64,10 @@ package com.iluwatar.event.aggregator { } } EventEmitter --> "-observers" EventObserver +LordVarys --|> EventEmitter +KingJoffrey ..|> EventObserver +LordBaelish --|> EventEmitter KingsHand ..|> EventObserver KingsHand --|> EventEmitter -KingJoffrey ..|> EventObserver Scout --|> EventEmitter -LordVarys --|> EventEmitter -LordBaelish --|> EventEmitter @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 55039190..8314913a 100644 --- a/event-driven-architecture/etc/event-driven-architecture.urm.puml +++ b/event-driven-architecture/etc/event-driven-architecture.urm.puml @@ -1,31 +1,34 @@ @startuml package com.iluwatar.eda.handler { - class UserUpdatedEventHandler { - + UserUpdatedEventHandler() - + onEvent(event : UserUpdatedEvent) - } class UserCreatedEventHandler { + UserCreatedEventHandler() + onEvent(event : UserCreatedEvent) } + class UserUpdatedEventHandler { + + UserUpdatedEventHandler() + + onEvent(event : UserUpdatedEvent) + } } package com.iluwatar.eda.event { abstract class AbstractEvent { + AbstractEvent() + getType() : Class } - class UserUpdatedEvent { + class UserCreatedEvent { - user : User - + UserUpdatedEvent(user : User) + + UserCreatedEvent(user : User) + getUser() : User } - class UserCreatedEvent { + class UserUpdatedEvent { - user : User - + UserCreatedEvent(user : User) + + UserUpdatedEvent(user : User) + getUser() : User } } package com.iluwatar.eda.framework { + interface Handler { + + onEvent(E extends Event) {abstract} + } class EventDispatcher { - handlers : Map, Handler> + EventDispatcher() @@ -35,9 +38,6 @@ package com.iluwatar.eda.framework { interface Event { + getType() : Class {abstract} } - interface Handler { - + onEvent(E extends Event) {abstract} - } } package com.iluwatar.eda.model { class User { @@ -52,11 +52,11 @@ package com.iluwatar.eda { + main(args : String[]) {static} } } -UserCreatedEvent --> "-user" User UserUpdatedEvent --> "-user" User +UserCreatedEvent --> "-user" User AbstractEvent ..|> Event -UserUpdatedEventHandler ..|> Handler +UserCreatedEvent --|> AbstractEvent UserCreatedEventHandler ..|> Handler UserUpdatedEvent --|> AbstractEvent -UserCreatedEvent --|> AbstractEvent +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 66d23ce7..4fdc4bff 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 { - interface FileWriterAction { - + writeFile(FileWriter) {abstract} - } class SimpleFileWriter { + SimpleFileWriter(filename : String, action : FileWriterAction) } @@ -10,5 +7,8 @@ package com.iluwatar.execute.around { + App() + main(args : String[]) {static} } + interface FileWriterAction { + + writeFile(FileWriter) {abstract} + } } @enduml \ No newline at end of file diff --git a/facade/etc/facade.urm.puml b/facade/etc/facade.urm.puml index f72bc2b6..8c53cb72 100644 --- a/facade/etc/facade.urm.puml +++ b/facade/etc/facade.urm.puml @@ -1,7 +1,7 @@ @startuml package com.iluwatar.facade { - class DwarvenTunnelDigger { - + DwarvenTunnelDigger() + class DwarvenGoldDigger { + + DwarvenGoldDigger() + name() : String + work() } @@ -13,15 +13,11 @@ package com.iluwatar.facade { - makeActions(workers : Collection, actions : Action[]) {static} + startNewDay() } - class DwarvenGoldDigger { - + DwarvenGoldDigger() + class DwarvenTunnelDigger { + + DwarvenTunnelDigger() + name() : String + work() } - class App { - + App() - + main(args : String[]) {static} - } abstract class DwarvenMineWorker { + DwarvenMineWorker() - action(action : Action) @@ -33,6 +29,10 @@ package com.iluwatar.facade { + wakeUp() + work() {abstract} } + class App { + + App() + + main(args : String[]) {static} + } class DwarvenCartOperator { + DwarvenCartOperator() + name() : String @@ -51,7 +51,7 @@ package com.iluwatar.facade { DwarvenGoldmineFacade --+ DwarvenMineWorker DwarvenGoldmineFacade --> "-workers" DwarvenMineWorker Action ..+ DwarvenMineWorker -DwarvenTunnelDigger --|> 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 faf5727e..fdee9a01 100644 --- a/factory-kit/etc/factory-kit.urm.puml +++ b/factory-kit/etc/factory-kit.urm.puml @@ -1,34 +1,34 @@ @startuml package com.iluwatar.factorykit { - interface Builder { - + add(WeaponType, Supplier) {abstract} - } class Spear { + Spear() + toString() : String } - class Bow { - + Bow() - + toString() : String - } - class Sword { - + Sword() - + toString() : String - } - interface Weapon { - } class App { + App() + main(args : String[]) {static} } - class Axe { - + Axe() - + toString() : String + 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 + } + interface Builder { + + add(WeaponType, Supplier) {abstract} + } enum WeaponType { + AXE {static} + BOW {static} @@ -39,7 +39,7 @@ package com.iluwatar.factorykit { } } Spear ..|> Weapon -Bow ..|> Weapon -Sword ..|> Weapon Axe ..|> Weapon +Sword ..|> Weapon +Bow ..|> 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 ebc9d2ff..d61984a8 100644 --- a/factory-method/etc/factory-method.urm.puml +++ b/factory-method/etc/factory-method.urm.puml @@ -17,9 +17,6 @@ package com.iluwatar.factory.method { interface Blacksmith { + manufactureWeapon(WeaponType) : Weapon {abstract} } - interface Weapon { - + getWeaponType() : WeaponType {abstract} - } class ElfWeapon { - weaponType : WeaponType + ElfWeapon(weaponType : WeaponType) @@ -32,6 +29,9 @@ package com.iluwatar.factory.method { + main(args : String[]) {static} - manufactureWeapons() } + interface Weapon { + + getWeaponType() : WeaponType {abstract} + } enum WeaponType { + AXE {static} + SHORT_SWORD {static} diff --git a/feature-toggle/etc/feature-toggle.urm.puml b/feature-toggle/etc/feature-toggle.urm.puml index 762d49cb..6c935f3e 100644 --- a/feature-toggle/etc/feature-toggle.urm.puml +++ b/feature-toggle/etc/feature-toggle.urm.puml @@ -20,17 +20,17 @@ package com.iluwatar.featuretoggle.user { + isPaid(user : User) : boolean {static} } } -package com.iluwatar.featuretoggle.pattern.propertiesversion { - class PropertiesFeatureToggleVersion { - - isEnhanced : boolean - + PropertiesFeatureToggleVersion(properties : Properties) +package com.iluwatar.featuretoggle.pattern.tieredversion { + class TieredFeatureToggleVersion { + + TieredFeatureToggleVersion() + getWelcomeMessage(user : User) : String + isEnhanced() : boolean } } -package com.iluwatar.featuretoggle.pattern.tieredversion { - class TieredFeatureToggleVersion { - + TieredFeatureToggleVersion() +package com.iluwatar.featuretoggle.pattern.propertiesversion { + class PropertiesFeatureToggleVersion { + - isEnhanced : boolean + + PropertiesFeatureToggleVersion(properties : Properties) + getWelcomeMessage(user : User) : String + isEnhanced() : boolean } @@ -42,6 +42,6 @@ package com.iluwatar.featuretoggle { } } UserGroup --> "-freeGroup" User -TieredFeatureToggleVersion ..|> Service PropertiesFeatureToggleVersion ..|> Service +TieredFeatureToggleVersion ..|> Service @enduml \ No newline at end of file diff --git a/fluentinterface/etc/fluentinterface.urm.puml b/fluentinterface/etc/fluentinterface.urm.puml index 436fcb2e..0283e20b 100644 --- a/fluentinterface/etc/fluentinterface.urm.puml +++ b/fluentinterface/etc/fluentinterface.urm.puml @@ -31,6 +31,14 @@ package com.iluwatar.fluentinterface.app { } } package com.iluwatar.fluentinterface.fluentiterable.lazy { + abstract class DecoratingIterator { + # fromIterator : Iterator + - next : E + + DecoratingIterator(fromIterator : Iterator) + + computeNext() : E {abstract} + + hasNext() : boolean + + next() : E + } class LazyFluentIterable { - iterable : Iterable # LazyFluentIterable() @@ -45,14 +53,6 @@ package com.iluwatar.fluentinterface.fluentiterable.lazy { + last(count : int) : FluentIterable + map(function : Function) : FluentIterable } - abstract class DecoratingIterator { - # fromIterator : Iterator - - next : E - + DecoratingIterator(fromIterator : Iterator) - + computeNext() : E {abstract} - + hasNext() : boolean - + next() : E - } } package com.iluwatar.fluentinterface.fluentiterable { interface FluentIterable { diff --git a/flux/etc/flux.urm.puml b/flux/etc/flux.urm.puml index e4bece2f..a4e0b062 100644 --- a/flux/etc/flux.urm.puml +++ b/flux/etc/flux.urm.puml @@ -1,10 +1,8 @@ @startuml package com.iluwatar.flux.view { - class ContentView { - - content : Content - + ContentView() - + render() - + storeChanged(store : Store) + interface View { + + render() {abstract} + + storeChanged(Store) {abstract} } class MenuView { - selected : MenuItem @@ -13,27 +11,35 @@ package com.iluwatar.flux.view { + render() + storeChanged(store : Store) } - interface View { - + render() {abstract} - + storeChanged(Store) {abstract} + class ContentView { + - content : Content + + ContentView() + + render() + + storeChanged(store : Store) } } package com.iluwatar.flux.action { - class ContentAction { - - content : Content - + ContentAction(content : Content) - + getContent() : Content - } 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) + getType() : ActionType } + enum ActionType { + + CONTENT_CHANGED {static} + + MENU_ITEM_SELECTED {static} + + valueOf(name : String) : ActionType {static} + + values() : ActionType[] {static} + } enum MenuItem { + COMPANY {static} + HOME {static} @@ -51,12 +57,6 @@ package com.iluwatar.flux.action { + valueOf(name : String) : Content {static} + values() : Content[] {static} } - enum ActionType { - + CONTENT_CHANGED {static} - + MENU_ITEM_SELECTED {static} - + valueOf(name : String) : ActionType {static} - + values() : ActionType[] {static} - } } package com.iluwatar.flux.app { class App { @@ -64,14 +64,18 @@ package com.iluwatar.flux.app { + main(args : String[]) {static} } } -package com.iluwatar.flux.store { - abstract class Store { - - views : List - + Store() - # notifyChange() - + onAction(Action) {abstract} - + 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) } +} +package com.iluwatar.flux.store { class ContentStore { - content : Content + ContentStore() @@ -84,16 +88,12 @@ package com.iluwatar.flux.store { + getSelected() : MenuItem + onAction(action : Action) } -} -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) + abstract class Store { + - views : List + + Store() + # notifyChange() + + onAction(Action) {abstract} + + registerView(view : View) } } MenuAction --> "-menuItem" MenuItem @@ -104,12 +104,12 @@ ContentView --> "-content" Content Dispatcher --> "-stores" Store MenuView --> "-selected" MenuItem Store --> "-views" View -ContentStore --> "-content" Content ContentAction --> "-content" Content -ContentAction --|> Action +ContentStore --> "-content" Content ContentStore --|> Store -ContentView ..|> View MenuAction --|> Action -MenuView ..|> View MenuStore --|> Store +ContentAction --|> Action +MenuView ..|> View +ContentView ..|> View @enduml \ No newline at end of file diff --git a/flyweight/etc/flyweight.urm.puml b/flyweight/etc/flyweight.urm.puml index 98a2b472..3f220371 100644 --- a/flyweight/etc/flyweight.urm.puml +++ b/flyweight/etc/flyweight.urm.puml @@ -1,28 +1,17 @@ @startuml package com.iluwatar.flyweight { - class PoisonPotion { - + PoisonPotion() - + drink() - } - class StrengthPotion { - + StrengthPotion() - + drink() - } - class HealingPotion { - + HealingPotion() - + drink() - } class PotionFactory { - potions : Map + PotionFactory() ~ createPotion(type : PotionType) : Potion } - interface Potion { - + drink() {abstract} + class HealingPotion { + + HealingPotion() + + drink() } - class App { - + App() - + main(args : String[]) {static} + class InvisibilityPotion { + + InvisibilityPotion() + + drink() } class AlchemistShop { - bottomShelf : List @@ -33,12 +22,23 @@ package com.iluwatar.flyweight { + getBottomShelf() : List + getTopShelf() : List } - class HolyWaterPotion { - + HolyWaterPotion() + class App { + + App() + + main(args : String[]) {static} + } + interface Potion { + + drink() {abstract} + } + class PoisonPotion { + + PoisonPotion() + drink() } - class InvisibilityPotion { - + InvisibilityPotion() + class StrengthPotion { + + StrengthPotion() + + drink() + } + class HolyWaterPotion { + + HolyWaterPotion() + drink() } enum PotionType { @@ -52,9 +52,9 @@ package com.iluwatar.flyweight { } } AlchemistShop --> "-topShelf" Potion +HealingPotion ..|> Potion +InvisibilityPotion ..|> Potion PoisonPotion ..|> Potion StrengthPotion ..|> Potion -HealingPotion ..|> Potion HolyWaterPotion ..|> Potion -InvisibilityPotion ..|> 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 17ccebae..8fb9be18 100644 --- a/front-controller/etc/front-controller.urm.puml +++ b/front-controller/etc/front-controller.urm.puml @@ -1,15 +1,5 @@ @startuml package com.iluwatar.front.controller { - class App { - + App() - + main(args : String[]) {static} - } - class FrontController { - + FrontController() - - getCommand(request : String) : Command - - getCommandClass(request : String) : Class {static} - + handleRequest(request : String) - } class ArcherView { + ArcherView() + display() @@ -17,34 +7,44 @@ package com.iluwatar.front.controller { interface View { + display() {abstract} } - interface Command { - + process() {abstract} - } - class ErrorView { - + ErrorView() + class CatapultView { + + CatapultView() + display() } class ArcherCommand { + ArcherCommand() + process() } - class CatapultView { - + CatapultView() + class App { + + App() + + main(args : String[]) {static} + } + class FrontController { + + FrontController() + - getCommand(request : String) : Command + - getCommandClass(request : String) : Class {static} + + handleRequest(request : String) + } + class UnknownCommand { + + UnknownCommand() + + process() + } + class ErrorView { + + ErrorView() + display() } class CatapultCommand { + CatapultCommand() + process() } - class UnknownCommand { - + UnknownCommand() - + process() + interface Command { + + process() {abstract} } } ArcherView ..|> View -ErrorView ..|> View -ArcherCommand ..|> Command CatapultView ..|> View -CatapultCommand ..|> Command +ArcherCommand ..|> Command UnknownCommand ..|> Command +ErrorView ..|> View +CatapultCommand ..|> 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 e733dd58..88f49eb4 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,5 +1,18 @@ @startuml package com.iluwatar.halfsynchalfasync { + class AsynchronousService { + - service : ExecutorService + + AsynchronousService(workQueue : BlockingQueue) + + execute(task : AsyncTask) + } + ~class ArithmeticSumTask { + - n : long + + ArithmeticSumTask(n : long) + + call() : Long + + onError(throwable : Throwable) + + onPostCall(result : Long) + + onPreCall() + } class App { + App() - ap(i : long) : long {static} @@ -11,19 +24,6 @@ package com.iluwatar.halfsynchalfasync { + onPostCall(O) {abstract} + onPreCall() {abstract} } - ~class ArithmeticSumTask { - - n : long - + ArithmeticSumTask(n : long) - + call() : Long - + onError(throwable : Throwable) - + onPostCall(result : Long) - + onPreCall() - } - 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 c4b0d0a7..a2f5d046 100644 --- a/hexagonal/etc/hexagonal.urm.puml +++ b/hexagonal/etc/hexagonal.urm.puml @@ -1,31 +1,47 @@ @startuml +package com.iluwatar.hexagonal.sampledata { + class SampleData { + - PLAYERS : List {static} + + SampleData() + - getRandomPlayerDetails() : PlayerDetails {static} + + submitTickets(lotteryService : LotteryService, numTickets : int) {static} + } +} package com.iluwatar.hexagonal.service { - class LotteryServiceImpl { - - bank : WireTransfers - - notifications : LotteryNotifications - - repository : LotteryTicketRepository - + LotteryServiceImpl() - + checkTicketForPrize(id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult - + submitTicket(ticket : LotteryTicket) : Optional + class ConsoleLottery { + + ConsoleLottery() + + main(args : String[]) {static} + - printMainMenu() {static} + - readString(scanner : Scanner) : String {static} } - interface LotteryService { - + checkTicketForPrize(LotteryTicketId, LotteryNumbers) : LotteryTicketCheckResult {abstract} - + submitTicket(LotteryTicket) : Optional {abstract} +} +package com.iluwatar.hexagonal.mongo { + class MongoConnectionPropertiesLoader { + - DEFAULT_HOST : String {static} + - DEFAULT_PORT : int {static} + + MongoConnectionPropertiesLoader() + + load() {static} } } package com.iluwatar.hexagonal.domain { class LotteryTicketId { - - id : UUID + - id : int + - numAllocated : int {static} + LotteryTicketId() - + getId() : UUID + + LotteryTicketId(id : int) + + equals(o : Object) : boolean + + getId() : int + + hashCode() : int + + toString() : String } - 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 LotteryAdministration { + - notifications : LotteryEventLog + - repository : LotteryTicketRepository + - wireTransfers : WireTransfers + + LotteryAdministration(repository : LotteryTicketRepository, notifications : LotteryEventLog, wireTransfers : WireTransfers) + + getAllSubmittedTickets() : Map + + performLottery() : LotteryNumbers + + resetLottery() } class LotteryNumbers { + MAX_NUMBER : int {static} @@ -39,19 +55,34 @@ package com.iluwatar.hexagonal.domain { + equals(obj : Object) : boolean - generateRandomNumbers() + getNumbers() : Set + + getNumbersAsString() : String + hashCode() : int + + toString() : String + } + class LotteryService { + - notifications : LotteryEventLog + - repository : LotteryTicketRepository + - wireTransfers : WireTransfers + + LotteryService(repository : LotteryTicketRepository, notifications : LotteryEventLog, wireTransfers : WireTransfers) + + 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) - + create(email : String, bankAccount : String, phone : String) : PlayerDetails {static} + + PlayerDetails(email : String, bankAccount : String, phone : String) + equals(obj : Object) : boolean + getBankAccount() : String + getEmail() : String + getPhoneNumber() : String + hashCode() : int + + toString() : String } class LotteryTicketCheckResult { - checkResult : CheckResult @@ -63,20 +94,30 @@ 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() + } class LotteryTicket { + - id : LotteryTicketId - lotteryNumbers : LotteryNumbers - playerDetails : PlayerDetails - - LotteryTicket(details : PlayerDetails, numbers : LotteryNumbers) - + create(details : PlayerDetails, numbers : LotteryNumbers) : LotteryTicket {static} + + LotteryTicket(id : LotteryTicketId, details : PlayerDetails, numbers : LotteryNumbers) + equals(obj : Object) : boolean + + getId() : LotteryTicketId + getNumbers() : LotteryNumbers + getPlayerDetails() : PlayerDetails + hashCode() : int + + setId(id : LotteryTicketId) + + toString() : String } - -class RandomNumberGenerator { - - randomIterator : OfInt - + RandomNumberGenerator(min : int, max : int) - + nextInt() : int + class LotteryUtils { + - LotteryUtils() + + checkTicketForPrize(repository : LotteryTicketRepository, id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult {static} } enum CheckResult { + NO_PRIZE {static} @@ -87,23 +128,64 @@ package com.iluwatar.hexagonal.domain { } } package com.iluwatar.hexagonal.banking { - class WireTransfersImpl { - - accounts : Map {static} - + WireTransfersImpl() - + 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} } + class MongoBank { + - DEFAULT_ACCOUNTS_COLLECTION : String {static} + - DEFAULT_DB : String {static} + - accountsCollection : MongoCollection + - database : MongoDatabase + - mongoClient : MongoClient + + MongoBank() + + MongoBank(dbName : String, accountsCollectionName : String) + + connect() + + connect(dbName : String, accountsCollectionName : String) + + getAccountsCollection() : MongoCollection + + getFunds(bankAccount : String) : int + + getMongoClient() : MongoClient + + getMongoDatabase() : MongoDatabase + + 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 + } } package com.iluwatar.hexagonal.database { - class LotteryTicketInMemoryRepository { + class MongoTicketRepository { + - DEFAULT_COUNTERS_COLLECTION : String {static} + - DEFAULT_DB : String {static} + - DEFAULT_TICKETS_COLLECTION : String {static} + - countersCollection : MongoCollection + - database : MongoDatabase + - mongoClient : MongoClient + - ticketsCollection : MongoCollection + + MongoTicketRepository() + + MongoTicketRepository(dbName : String, ticketsCollectionName : String, countersCollectionName : String) + + connect() + + connect(dbName : String, ticketsCollectionName : String, countersCollectionName : String) + + deleteAll() + - docToTicket(doc : Document) : LotteryTicket + + findAll() : Map + + findById(id : LotteryTicketId) : Optional + + getCountersCollection() : MongoCollection + + getMongoClient() : MongoClient + + getMongoDatabase() : MongoDatabase + + getNextId() : int + + getTicketsCollection() : MongoCollection + - initCounters() + + save(ticket : LotteryTicket) : Optional + } + class InMemoryTicketRepository { - tickets : Map {static} - + LotteryTicketInMemoryRepository() + + InMemoryTicketRepository() + deleteAll() + findAll() : Map + findById(id : LotteryTicketId) : Optional @@ -116,68 +198,79 @@ package com.iluwatar.hexagonal.database { + save(LotteryTicket) : Optional {abstract} } } -package com.iluwatar.hexagonal.eventlog { - interface LotteryNotifications { - + notifyNoWin(PlayerDetails) {abstract} - + notifyPrize(PlayerDetails, int) {abstract} - + notifyPrizeError(PlayerDetails, int) {abstract} - + notifyTicketSubmitError(PlayerDetails) {abstract} - + notifyTicketSubmitted(PlayerDetails) {abstract} - } - class LotteryNotificationsImpl { - + LotteryNotificationsImpl() - + notifyNoWin(details : PlayerDetails) - + notifyPrize(details : PlayerDetails, prizeAmount : int) - + notifyPrizeError(details : PlayerDetails, prizeAmount : int) - + notifyTicketSubmitError(details : PlayerDetails) - + notifyTicketSubmitted(details : PlayerDetails) - } -} package com.iluwatar.hexagonal { class App { - - allPlayerDetails : List {static} + App() - - getRandomPlayerDetails() : PlayerDetails {static} + main(args : String[]) {static} - - submitTickets(lotteryService : LotteryService, numTickets : int) {static} } } package com.iluwatar.hexagonal.administration { - interface LotteryAdministration { - + getAllSubmittedTickets() : Map {abstract} - + performLottery() : LotteryNumbers {abstract} - + resetLottery() {abstract} - } - class LotteryAdministrationImpl { - - bank : WireTransfers - - notifications : LotteryNotifications - - repository : LotteryTicketRepository - - service : LotteryService - + LotteryAdministrationImpl() - + getAllSubmittedTickets() : Map - + performLottery() : LotteryNumbers - + resetLottery() + class ConsoleAdministration { + + ConsoleAdministration() + + main(args : String[]) {static} + - printMainMenu() {static} + - readString(scanner : Scanner) : String {static} + } +} +package com.iluwatar.hexagonal.eventlog { + interface LotteryEventLog { + + prizeError(PlayerDetails, int) {abstract} + + ticketDidNotWin(PlayerDetails) {abstract} + + ticketSubmitError(PlayerDetails) {abstract} + + 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} + - database : MongoDatabase + - eventsCollection : MongoCollection + - mongoClient : MongoClient + - stdOutEventLog : StdOutEventLog + + MongoEventLog() + + MongoEventLog(dbName : String, eventsCollectionName : String) + + connect() + + connect(dbName : String, eventsCollectionName : String) + + getEventsCollection() : MongoCollection + + getMongoClient() : MongoClient + + getMongoDatabase() : MongoDatabase + + prizeError(details : PlayerDetails, prizeAmount : int) + + ticketDidNotWin(details : PlayerDetails) + + ticketSubmitError(details : PlayerDetails) + + ticketSubmitted(details : PlayerDetails) + + ticketWon(details : PlayerDetails, prizeAmount : int) } } +LotteryAdministration --+ LotteryTicketCheckResult LotteryTicket --> "-playerDetails" PlayerDetails -LotteryAdministrationImpl --> "-bank" WireTransfers -App --> "-allPlayerDetails" PlayerDetails +MongoEventLog --> "-stdOutEventLog" StdOutEventLog +LotteryService --> "-wireTransfers" WireTransfers +LotteryAdministration --> "-notifications" LotteryEventLog RandomNumberGenerator ..+ PrimitiveIterator -LotteryAdministrationImpl --> "-repository" LotteryTicketRepository -LotteryAdministrationImpl --+ LotteryTicketCheckResult -LotteryServiceImpl --> "-notifications" LotteryNotifications +LotteryAdministration --> "-wireTransfers" WireTransfers +LotteryTicket --> "-id" LotteryTicketId +LotteryService --> "-notifications" LotteryEventLog +LotteryAdministration --> "-repository" LotteryTicketRepository LotteryTicket --> "-lotteryNumbers" LotteryNumbers -LotteryAdministrationImpl --> "-notifications" LotteryNotifications -LotteryServiceImpl --> "-repository" LotteryTicketRepository -LotteryServiceImpl --+ LotteryTicketCheckResult -LotteryServiceImpl --> "-bank" WireTransfers +SampleData --> "-PLAYERS" PlayerDetails +ConsoleLottery --+ LotteryTicketCheckResult RandomNumberGenerator ..+ LotteryNumbers -LotteryAdministrationImpl --> "-service" LotteryService +LotteryService --> "-repository" LotteryTicketRepository +LotteryUtils --+ LotteryTicketCheckResult LotteryTicketCheckResult --> "-checkResult" CheckResult CheckResult ..+ LotteryTicketCheckResult -LotteryTicketInMemoryRepository ..|> LotteryTicketRepository -WireTransfersImpl ..|> WireTransfers -LotteryServiceImpl ..|> LotteryService -LotteryNotificationsImpl ..|> LotteryNotifications -LotteryAdministrationImpl ..|> LotteryAdministration +MongoTicketRepository ..|> LotteryTicketRepository +MongoBank ..|> WireTransfers +InMemoryBank ..|> WireTransfers +StdOutEventLog ..|> LotteryEventLog +InMemoryTicketRepository ..|> LotteryTicketRepository +MongoEventLog ..|> 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 f5bfb54e..e3616c3a 100644 --- a/intercepting-filter/etc/intercepting-filter.urm.puml +++ b/intercepting-filter/etc/intercepting-filter.urm.puml @@ -1,10 +1,16 @@ @startuml package com.iluwatar.intercepting.filter { - interface Filter { - + execute(Order) : String {abstract} - + getLast() : Filter {abstract} - + getNext() : Filter {abstract} - + setNext(Filter) {abstract} + class DepositFilter { + + DepositFilter() + + execute(order : Order) : String + } + class AddressFilter { + + AddressFilter() + + execute(order : Order) : String + } + class App { + + App() + + main(args : String[]) {static} } abstract class AbstractFilter { - next : Filter @@ -15,14 +21,6 @@ package com.iluwatar.intercepting.filter { + getNext() : Filter + setNext(filter : Filter) } - class ContactFilter { - + ContactFilter() - + execute(order : Order) : String - } - class OrderFilter { - + OrderFilter() - + execute(order : Order) : String - } class Order { - address : String - contactNumber : String @@ -42,36 +40,38 @@ package com.iluwatar.intercepting.filter { + setName(name : String) + setOrder(order : String) } - class AddressFilter { - + AddressFilter() - + execute(order : Order) : String - } - ~class DListener { - ~ DListener(this$0 : Target) - + actionPerformed(e : ActionEvent) - } class FilterManager { - filterChain : FilterChain + FilterManager() + addFilter(filter : Filter) + filterRequest(order : Order) : String } - class FilterChain { - - chain : Filter - + FilterChain() - + addFilter(filter : Filter) + class NameFilter { + + NameFilter() + execute(order : Order) : String } - class DepositFilter { - + DepositFilter() + class ContactFilter { + + ContactFilter() + execute(order : Order) : String } - class App { - + App() - + main(args : String[]) {static} + interface Filter { + + execute(Order) : String {abstract} + + getLast() : Filter {abstract} + + getNext() : Filter {abstract} + + setNext(Filter) {abstract} } - class NameFilter { - + NameFilter() + ~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 } } @@ -79,10 +79,10 @@ AbstractFilter --> "-next" Filter DListener --+ Target FilterChain --> "-chain" Filter FilterManager --> "-filterChain" FilterChain +DepositFilter --|> AbstractFilter +AddressFilter --|> AbstractFilter AbstractFilter ..|> Filter +NameFilter --|> AbstractFilter ContactFilter --|> AbstractFilter OrderFilter --|> AbstractFilter -AddressFilter --|> AbstractFilter -DepositFilter --|> AbstractFilter -NameFilter --|> AbstractFilter @enduml \ No newline at end of file diff --git a/interpreter/etc/interpreter.urm.puml b/interpreter/etc/interpreter.urm.puml index bdbd369d..dc0d83bf 100644 --- a/interpreter/etc/interpreter.urm.puml +++ b/interpreter/etc/interpreter.urm.puml @@ -1,14 +1,16 @@ @startuml package com.iluwatar.interpreter { - abstract class Expression { - + Expression() - + interpret() : int {abstract} - + toString() : String {abstract} + class NumberExpression { + - number : int + + NumberExpression(number : int) + + NumberExpression(s : String) + + interpret() : int + + toString() : String } - class PlusExpression { + class MinusExpression { - leftExpression : Expression - rightExpression : Expression - + PlusExpression(leftExpression : Expression, rightExpression : Expression) + + MinusExpression(leftExpression : Expression, rightExpression : Expression) + interpret() : int + toString() : String } @@ -18,12 +20,10 @@ package com.iluwatar.interpreter { + isOperator(s : String) : boolean {static} + main(args : String[]) {static} } - class NumberExpression { - - number : int - + NumberExpression(number : int) - + NumberExpression(s : String) - + interpret() : int - + toString() : String + abstract class Expression { + + Expression() + + interpret() : int {abstract} + + toString() : String {abstract} } class MultiplyExpression { - leftExpression : Expression @@ -32,10 +32,10 @@ package com.iluwatar.interpreter { + interpret() : int + toString() : String } - class MinusExpression { + class PlusExpression { - leftExpression : Expression - rightExpression : Expression - + MinusExpression(leftExpression : Expression, rightExpression : Expression) + + PlusExpression(leftExpression : Expression, rightExpression : Expression) + interpret() : int + toString() : String } @@ -43,8 +43,8 @@ package com.iluwatar.interpreter { MultiplyExpression --> "-leftExpression" Expression MinusExpression --> "-leftExpression" Expression PlusExpression --> "-leftExpression" Expression -PlusExpression --|> Expression NumberExpression --|> Expression -MultiplyExpression --|> Expression MinusExpression --|> Expression +MultiplyExpression --|> 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 cbafd659..032cd4c1 100644 --- a/iterator/etc/iterator.urm.puml +++ b/iterator/etc/iterator.urm.puml @@ -1,13 +1,17 @@ @startuml package com.iluwatar.iterator { - interface ItemIterator { - + hasNext() : boolean {abstract} - + next() : Item {abstract} - } class App { + App() + main(args : String[]) {static} } + class Item { + - name : String + - type : ItemType + + Item(type : ItemType, name : String) + + getType() : ItemType + + setType(type : ItemType) + + toString() : String + } class TreasureChestItemIterator { - chest : TreasureChest - idx : int @@ -23,13 +27,9 @@ package com.iluwatar.iterator { + getItems() : List ~ iterator(itemType : ItemType) : ItemIterator } - class Item { - - name : String - - type : ItemType - + Item(type : ItemType, name : String) - + getType() : ItemType - + setType(type : ItemType) - + toString() : String + interface ItemIterator { + + hasNext() : boolean {abstract} + + next() : Item {abstract} } enum ItemType { + ANY {static} diff --git a/layers/etc/layers.urm.puml b/layers/etc/layers.urm.puml index d67216ff..2ec6e142 100644 --- a/layers/etc/layers.urm.puml +++ b/layers/etc/layers.urm.puml @@ -3,6 +3,44 @@ package com.iluwatar.layers { interface View { + render() {abstract} } + class CakeToppingInfo { + + calories : int + + id : Optional + + name : String + + CakeToppingInfo(id : Long, name : String, calories : int) + + CakeToppingInfo(name : String, calories : int) + + toString() : String + } + class CakeLayer { + - cake : Cake + - calories : int + - id : Long + - name : String + + CakeLayer() + + CakeLayer(name : String, calories : int) + + getCake() : Cake + + getCalories() : int + + getId() : Long + + getName() : String + + setCake(cake : Cake) + + setCalories(calories : int) + + setId(id : Long) + + setName(name : String) + + toString() : String + } + class CakeLayerInfo { + + calories : int + + id : Optional + + name : String + + CakeLayerInfo(id : Long, name : String, calories : int) + + CakeLayerInfo(name : String, calories : int) + + toString() : String + } + class CakeViewImpl { + - cakeBakingService : CakeBakingService + + CakeViewImpl(cakeBakingService : CakeBakingService) + + render() + } class CakeBakingServiceImpl { - context : AbstractApplicationContext + CakeBakingServiceImpl() @@ -15,8 +53,6 @@ package com.iluwatar.layers { + saveNewLayer(layerInfo : CakeLayerInfo) + saveNewTopping(toppingInfo : CakeToppingInfo) } - interface CakeDao { - } class CakeTopping { - cake : Cake - calories : int @@ -34,16 +70,20 @@ package com.iluwatar.layers { + setName(name : String) + toString() : String } - class CakeLayerInfo { - + calories : int - + id : Optional - + name : String - + CakeLayerInfo(id : Long, name : String, calories : int) - + CakeLayerInfo(name : String, 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 CakeLayerDao { - } interface CakeToppingDao { } interface CakeBakingService { @@ -54,18 +94,15 @@ package com.iluwatar.layers { + saveNewLayer(CakeLayerInfo) {abstract} + saveNewTopping(CakeToppingInfo) {abstract} } - class CakeViewImpl { - - cakeBakingService : CakeBakingService - + CakeViewImpl(cakeBakingService : CakeBakingService) - + render() + class App { + - cakeBakingService : CakeBakingService {static} + + App() + - initializeData(cakeBakingService : CakeBakingService) {static} + + main(args : String[]) {static} } - class CakeToppingInfo { - + calories : int - + id : Optional - + name : String - + CakeToppingInfo(id : Long, name : String, calories : int) - + CakeToppingInfo(name : String, calories : int) - + toString() : String + interface CakeDao { + } + interface CakeLayerDao { } class CakeInfo { + cakeLayerInfos : List @@ -76,43 +113,6 @@ package com.iluwatar.layers { + calculateTotalCalories() : int + toString() : String } - class App { - - cakeBakingService : CakeBakingService {static} - + App() - - initializeData(cakeBakingService : CakeBakingService) {static} - + main(args : String[]) {static} - } - 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 - } - class CakeLayer { - - cake : Cake - - calories : int - - id : Long - - name : String - + CakeLayer() - + CakeLayer(name : String, calories : int) - + getCake() : Cake - + getCalories() : int - + getId() : Long - + getName() : String - + setCake(cake : Cake) - + setCalories(calories : int) - + setId(id : Long) - + setName(name : String) - + toString() : String - } } CakeViewImpl --> "-cakeBakingService" CakeBakingService CakeInfo --> "-cakeToppingInfo" CakeToppingInfo @@ -120,6 +120,6 @@ CakeInfo --> "-cakeLayerInfos" CakeLayerInfo App --> "-cakeBakingService" CakeBakingService CakeLayer --> "-cake" Cake Cake --> "-topping" CakeTopping -CakeBakingServiceImpl ..|> CakeBakingService CakeViewImpl ..|> View +CakeBakingServiceImpl ..|> CakeBakingService @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 96c42755..80192160 100644 --- a/lazy-loading/etc/lazy-loading.urm.puml +++ b/lazy-loading/etc/lazy-loading.urm.puml @@ -2,20 +2,24 @@ package com.iluwatar.lazy.loading { ~class HeavyFactory { - heavyInstance : Heavy - ~ HeavyFactory(this$0 : Java8Holder) + ~ HeavyFactory() + get() : Heavy } - class HolderNaive { + class App { + + App() + + main(args : String[]) {static} + } + class HolderThreadSafe { - heavy : Heavy - + HolderNaive() + + HolderThreadSafe() + getHeavy() : Heavy } class Heavy { + Heavy() } - class HolderThreadSafe { + class HolderNaive { - heavy : Heavy - + HolderThreadSafe() + + HolderNaive() + getHeavy() : Heavy } class Java8Holder { @@ -24,12 +28,8 @@ package com.iluwatar.lazy.loading { - createAndCacheHeavy() : Heavy + getHeavy() : Heavy } - class App { - + App() - + main(args : String[]) {static} - } } -HolderThreadSafe --> "-heavy" Heavy HolderNaive --> "-heavy" Heavy +HolderThreadSafe --> "-heavy" Heavy HeavyFactory --> "-heavyInstance" Heavy @enduml \ No newline at end of file diff --git a/mediator/etc/mediator.urm.puml b/mediator/etc/mediator.urm.puml index 0b3baab5..330e024a 100644 --- a/mediator/etc/mediator.urm.puml +++ b/mediator/etc/mediator.urm.puml @@ -1,24 +1,20 @@ @startuml package com.iluwatar.mediator { - class App { - + App() - + main(args : String[]) {static} - } - class Hobbit { - + Hobbit() - + toString() : String + interface Party { + + act(PartyMember, Action) {abstract} + + addMember(PartyMember) {abstract} } interface PartyMember { + act(Action) {abstract} + joinedParty(Party) {abstract} + partyAction(Action) {abstract} } - interface Party { - + act(PartyMember, Action) {abstract} - + addMember(PartyMember) {abstract} + class Rogue { + + Rogue() + + toString() : String } - class Wizard { - + Wizard() + class Hunter { + + Hunter() + toString() : String } class PartyImpl { @@ -27,12 +23,12 @@ package com.iluwatar.mediator { + act(actor : PartyMember, action : Action) + addMember(member : PartyMember) } - class Hunter { - + Hunter() + class Hobbit { + + Hobbit() + toString() : String } - class Rogue { - + Rogue() + class Wizard { + + Wizard() + toString() : String } abstract class PartyMemberBase { @@ -43,6 +39,10 @@ package com.iluwatar.mediator { + partyAction(action : Action) + toString() : String {abstract} } + class App { + + App() + + main(args : String[]) {static} + } enum Action { + ENEMY {static} + GOLD {static} @@ -59,10 +59,10 @@ package com.iluwatar.mediator { } PartyImpl --> "-members" PartyMember PartyMemberBase --> "-party" Party +Rogue --|> PartyMemberBase +Hunter --|> PartyMemberBase +PartyImpl ..|> Party Hobbit --|> PartyMemberBase Wizard --|> PartyMemberBase -PartyImpl ..|> Party -Hunter --|> PartyMemberBase -Rogue --|> PartyMemberBase PartyMemberBase ..|> PartyMember @enduml \ No newline at end of file diff --git a/memento/etc/memento.urm.puml b/memento/etc/memento.urm.puml index aa63b4eb..316d4047 100644 --- a/memento/etc/memento.urm.puml +++ b/memento/etc/memento.urm.puml @@ -1,17 +1,5 @@ @startuml package com.iluwatar.memento { - class Star { - - ageYears : int - - massTons : int - - type : StarType - + Star(startType : StarType, startAge : int, startMass : int) - ~ getMemento() : StarMemento - ~ setMemento(memento : StarMemento) - + timePasses() - + toString() : String - } - interface StarMemento { - } -class StarMementoInternal { - ageYears : int - massTons : int @@ -28,6 +16,18 @@ package com.iluwatar.memento { + App() + main(args : String[]) {static} } + interface StarMemento { + } + class Star { + - ageYears : int + - massTons : int + - type : StarType + + Star(startType : StarType, startAge : int, startMass : int) + ~ getMemento() : StarMemento + ~ setMemento(memento : StarMemento) + + timePasses() + + toString() : String + } enum StarType { + DEAD {static} + RED_GIANT {static} diff --git a/model-view-controller/etc/model-view-controller.urm.puml b/model-view-controller/etc/model-view-controller.urm.puml index f8137bda..ad979fe0 100644 --- a/model-view-controller/etc/model-view-controller.urm.puml +++ b/model-view-controller/etc/model-view-controller.urm.puml @@ -13,14 +13,6 @@ package com.iluwatar.model.view.controller { + setNourishment(nourishment : Nourishment) + toString() : String } - class App { - + App() - + main(args : String[]) {static} - } - class GiantView { - + GiantView() - + displayGiant(giant : GiantModel) - } class GiantController { - giant : GiantModel - view : GiantView @@ -33,6 +25,23 @@ package com.iluwatar.model.view.controller { + setNourishment(nourishment : Nourishment) + updateView() } + class GiantView { + + GiantView() + + displayGiant(giant : GiantModel) + } + class App { + + App() + + main(args : String[]) {static} + } + enum Health { + + DEAD {static} + + HEALTHY {static} + + WOUNDED {static} + - title : String + + toString() : String + + valueOf(name : String) : Health {static} + + values() : Health[] {static} + } enum Nourishment { + HUNGRY {static} + SATURATED {static} @@ -51,15 +60,6 @@ package com.iluwatar.model.view.controller { + valueOf(name : String) : Fatigue {static} + values() : Fatigue[] {static} } - enum Health { - + DEAD {static} - + HEALTHY {static} - + WOUNDED {static} - - title : String - + toString() : String - + valueOf(name : String) : Health {static} - + values() : Health[] {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 64bcfba3..0cec653e 100644 --- a/model-view-presenter/etc/model-view-presenter.urm.puml +++ b/model-view-presenter/etc/model-view-presenter.urm.puml @@ -1,42 +1,5 @@ @startuml package com.iluwatar.model.view.presenter { - class FileLoader { - - fileName : String - - loaded : boolean - + FileLoader() - + fileExists() : boolean - + getFileName() : String - + isLoaded() : boolean - + loadData() : String - + setFileName(fileName : String) - } - class FileSelectorJFrame { - - area : JTextArea - - cancel : JButton - - contents : JLabel - - fileName : String - - info : JLabel - - input : JTextField - - ok : JButton - - panel : JPanel - - presenter : FileSelectorPresenter - - serialVersionUID : long {static} - + FileSelectorJFrame() - + actionPerformed(e : ActionEvent) - + close() - + displayData(data : String) - + getFileName() : String - + getPresenter() : FileSelectorPresenter - + isOpened() : boolean - + open() - + setFileName(name : String) - + setPresenter(presenter : FileSelectorPresenter) - + showMessage(message : String) - } - class App { - + App() - + main(args : String[]) {static} - } interface FileSelectorView { + close() {abstract} + displayData(String) {abstract} @@ -67,6 +30,16 @@ package com.iluwatar.model.view.presenter { + setPresenter(presenter : FileSelectorPresenter) + showMessage(message : String) } + class FileLoader { + - fileName : String + - loaded : boolean + + FileLoader() + + fileExists() : boolean + + getFileName() : String + + isLoaded() : boolean + + loadData() : String + + setFileName(fileName : String) + } class FileSelectorPresenter { - loader : FileLoader - view : FileSelectorView @@ -77,11 +50,38 @@ package com.iluwatar.model.view.presenter { + setLoader(loader : FileLoader) + start() } + class App { + + App() + + main(args : String[]) {static} + } + class FileSelectorJFrame { + - area : JTextArea + - cancel : JButton + - contents : JLabel + - fileName : String + - info : JLabel + - input : JTextField + - ok : JButton + - panel : JPanel + - presenter : FileSelectorPresenter + - serialVersionUID : long {static} + + FileSelectorJFrame() + + actionPerformed(e : ActionEvent) + + close() + + displayData(data : String) + + getFileName() : String + + getPresenter() : FileSelectorPresenter + + isOpened() : boolean + + open() + + setFileName(name : String) + + setPresenter(presenter : FileSelectorPresenter) + + showMessage(message : String) + } } -FileSelectorStub --> "-presenter" FileSelectorPresenter FileSelectorJFrame --> "-presenter" FileSelectorPresenter +FileSelectorStub --> "-presenter" FileSelectorPresenter FileSelectorPresenter --> "-loader" FileLoader FileSelectorPresenter --> "-view" FileSelectorView -FileSelectorJFrame ..|> FileSelectorView FileSelectorStub ..|> FileSelectorView +FileSelectorJFrame ..|> FileSelectorView @enduml \ No newline at end of file diff --git a/monostate/etc/monostate.urm.puml b/monostate/etc/monostate.urm.puml index 3c09bb4e..6574bcad 100644 --- a/monostate/etc/monostate.urm.puml +++ b/monostate/etc/monostate.urm.puml @@ -1,5 +1,13 @@ @startuml package com.iluwatar.monostate { + class App { + + App() + + main(args : String[]) {static} + } + class Request { + + value : String + + Request(value : String) + } class LoadBalancer { - id : int {static} - lastServedId : int {static} @@ -10,14 +18,6 @@ package com.iluwatar.monostate { + getNoOfServers() : int + serverRequest(request : Request) } - class App { - + App() - + main(args : String[]) {static} - } - class Request { - + value : String - + Request(value : String) - } class Server { + host : String + id : int diff --git a/mute-idiom/etc/mute-idiom.urm.puml b/mute-idiom/etc/mute-idiom.urm.puml index d4efc2db..c992773f 100644 --- a/mute-idiom/etc/mute-idiom.urm.puml +++ b/mute-idiom/etc/mute-idiom.urm.puml @@ -1,6 +1,7 @@ @startuml package com.iluwatar.mute { - interface Resource { + interface CheckedRunnable { + + run() {abstract} } class App { + App() @@ -16,8 +17,7 @@ package com.iluwatar.mute { + loggedMute(runnable : CheckedRunnable) {static} + mute(runnable : CheckedRunnable) {static} } - interface CheckedRunnable { - + run() {abstract} + interface Resource { } } @enduml \ No newline at end of file diff --git a/mutex/etc/mutex.urm.puml b/mutex/etc/mutex.urm.puml index 24ea8363..68b96d66 100644 --- a/mutex/etc/mutex.urm.puml +++ b/mutex/etc/mutex.urm.puml @@ -1,5 +1,11 @@ @startuml package com.iluwatar.mutex { + class Jar { + - beans : int + - lock : Lock + + Jar(beans : int, lock : Lock) + + takeBean() : boolean + } interface Lock { + acquire() {abstract} + release() {abstract} @@ -11,12 +17,6 @@ package com.iluwatar.mutex { + getOwner() : Object + release() } - class Jar { - - beans : int - - lock : Lock - + Jar(beans : int, lock : Lock) - + takeBean() : boolean - } class App { + App() + main(args : String[]) {static} diff --git a/naked-objects/etc/naked-objects-dom.urm.puml b/naked-objects/etc/naked-objects-dom.urm.puml index ea32b578..6662a560 100644 --- a/naked-objects/etc/naked-objects-dom.urm.puml +++ b/naked-objects/etc/naked-objects-dom.urm.puml @@ -23,58 +23,13 @@ package domainapp.dom.modules.simple { } class SimpleObject { - container : DomainObjectContainer - - dnFieldFlags : byte[] {static} - - dnFieldNames : String[] {static} - - dnFieldTypes : Class[] {static} - # dnFlags : byte - - dnInheritedFieldCount : int {static} - - dnPersistableSuperclass : Class {static} - # dnStateManager : StateManager - name : String + SimpleObject() - + ___dn$loadClass(className : String) : Class {static} - - __dnFieldFlagsInit() : byte[] {static} - - __dnFieldNamesInit() : String[] {static} - - __dnFieldTypesInit() : Class[] {static} - # __dnGetInheritedFieldCount() : int {static} - - __dnPersistableSuperclassInit() : Class {static} + compareTo(other : SimpleObject) : int + default0UpdateName() : String - # dnCopyField(obj : SimpleObject, index : int) - + dnCopyFields(obj : Object, indices : int[]) - + dnCopyKeyFieldsFromObjectId(fc : ObjectIdFieldConsumer, oid : Object) - # dnCopyKeyFieldsFromObjectId(oid : Object) - + dnCopyKeyFieldsToObjectId(fs : ObjectIdFieldSupplier, oid : Object) - + dnCopyKeyFieldsToObjectId(oid : Object) - + dnGetExecutionContext() : ExecutionContextReference - # dnGetManagedFieldCount() : int {static} - + dnGetObjectId() : Object - + dnGetTransactionalObjectId() : Object - + dnGetVersion() : Object - + dnGetname() : String - + dnIsDeleted() : boolean - + dnIsDetached() : boolean - + dnIsDirty() : boolean - + dnIsNew() : boolean - + dnIsPersistent() : boolean - + dnIsTransactional() : boolean - + dnMakeDirty(fieldName : String) - + dnNewInstance(sm : StateManager) : Persistable - + dnNewInstance(sm : StateManager, obj : Object) : Persistable - + dnNewObjectIdInstance() : Object - + dnNewObjectIdInstance(key : Object) : Object - # dnPreSerialize() - + dnProvideField(index : int) - + dnProvideFields(indices : int[]) - + dnReplaceField(index : int) - + dnReplaceFields(indices : int[]) - + dnReplaceFlags() - + dnReplaceStateManager(sm : StateManager) - + dnSetname(name : String) - - dnSuperClone() : Object + getName() : String + getVersionSequence() : Long - + setName(val : String) + + setName(name : String) + title() : TranslatableString + updateName(name : String) : SimpleObject + validateUpdateName(name : String) : TranslatableString diff --git a/naked-objects/etc/naked-objects-fixture.urm.puml b/naked-objects/etc/naked-objects-fixture.urm.puml index 65c44410..21e38d71 100644 --- a/naked-objects/etc/naked-objects-fixture.urm.puml +++ b/naked-objects/etc/naked-objects-fixture.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 { diff --git a/naked-objects/etc/naked-objects-integtests.urm.puml b/naked-objects/etc/naked-objects-integtests.urm.puml index 1f2dfc4c..65c44410 100644 --- a/naked-objects/etc/naked-objects-integtests.urm.puml +++ b/naked-objects/etc/naked-objects-integtests.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 } -} -package domainapp.dom.modules.simple { - class SimpleObjects { + class HomePageService { ~ container : DomainObjectContainer - + SimpleObjects() - + create(name : String) : SimpleObject - + findByName(name : String) : List - + listAll() : List - + title() : TranslatableString + + HomePageService() + + homePage() : HomePageViewModel } +} +package domainapp.dom.modules.simple { class SimpleObject { - container : DomainObjectContainer - dnFieldFlags : byte[] {static} @@ -79,6 +71,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 + } } package domainapp.fixture { class DomainAppFixturesProvider { diff --git a/null-object/etc/null-object.urm.puml b/null-object/etc/null-object.urm.puml index d0b2936c..bd4f8446 100644 --- a/null-object/etc/null-object.urm.puml +++ b/null-object/etc/null-object.urm.puml @@ -1,9 +1,14 @@ @startuml package com.iluwatar.nullobject { - class NullNode { - - instance : NullNode {static} - - NullNode() - + getInstance() : NullNode {static} + class App { + + App() + + main(args : String[]) {static} + } + class NodeImpl { + - left : Node + - name : String + - right : Node + + NodeImpl(name : String, left : Node, right : Node) + getLeft() : Node + getName() : String + getRight() : Node @@ -17,15 +22,10 @@ package com.iluwatar.nullobject { + getTreeSize() : int {abstract} + walk() {abstract} } - class App { - + App() - + main(args : String[]) {static} - } - class NodeImpl { - - left : Node - - name : String - - right : Node - + NodeImpl(name : String, left : Node, right : Node) + class NullNode { + - instance : NullNode {static} + - NullNode() + + getInstance() : NullNode {static} + getLeft() : Node + getName() : String + getRight() : Node @@ -35,6 +35,6 @@ package com.iluwatar.nullobject { } NullNode --> "-instance" NullNode NodeImpl --> "-left" Node -NullNode ..|> Node NodeImpl ..|> Node +NullNode ..|> Node @enduml \ No newline at end of file diff --git a/object-pool/etc/object-pool.urm.puml b/object-pool/etc/object-pool.urm.puml index 9df1081d..caf0b6d7 100644 --- a/object-pool/etc/object-pool.urm.puml +++ b/object-pool/etc/object-pool.urm.puml @@ -1,5 +1,9 @@ @startuml package com.iluwatar.object.pool { + class OliphauntPool { + + OliphauntPool() + # create() : Oliphaunt + } class Oliphaunt { - counter : int {static} - id : int @@ -7,14 +11,6 @@ package com.iluwatar.object.pool { + getId() : int + toString() : String } - class OliphauntPool { - + OliphauntPool() - # create() : Oliphaunt - } - class App { - + App() - + main(args : String[]) {static} - } abstract class ObjectPool { - available : HashSet - inUse : HashSet @@ -24,6 +20,10 @@ package com.iluwatar.object.pool { # create() : T {abstract} + toString() : String } + class App { + + App() + + main(args : String[]) {static} + } } OliphauntPool --|> ObjectPool @enduml \ No newline at end of file diff --git a/observer/etc/observer.urm.puml b/observer/etc/observer.urm.puml index 33485d73..e9a8f7b9 100644 --- a/observer/etc/observer.urm.puml +++ b/observer/etc/observer.urm.puml @@ -4,9 +4,12 @@ package com.iluwatar.observer { + Orcs() + update(currentWeather : WeatherType) } - class Hobbits { - + Hobbits() - + update(currentWeather : WeatherType) + interface WeatherObserver { + + update(WeatherType) {abstract} + } + class App { + + App() + + main(args : String[]) {static} } class Weather { - currentWeather : WeatherType @@ -17,12 +20,9 @@ package com.iluwatar.observer { + removeObserver(obs : WeatherObserver) + timePasses() } - class App { - + App() - + main(args : String[]) {static} - } - interface WeatherObserver { - + update(WeatherType) {abstract} + class Hobbits { + + Hobbits() + + update(currentWeather : WeatherType) } enum WeatherType { + COLD {static} @@ -41,6 +41,11 @@ package com.iluwatar.observer.generic { } interface Race { } + class GWeather { + - currentWeather : WeatherType + + GWeather() + + timePasses() + } abstract class Observable, A> { # observers : List> + Observable, A>() @@ -48,26 +53,21 @@ package com.iluwatar.observer.generic { + notifyObservers(argument : A) + removeObserver(observer : O extends Observer) } - class GWeather { - - currentWeather : WeatherType - + GWeather() - + timePasses() - } - interface Observer, O extends Observer, A> { - + update(S extends Observable, A) {abstract} - } class GHobbits { + GHobbits() + update(weather : GWeather, weatherType : WeatherType) } + interface Observer, O extends Observer, A> { + + update(S extends Observable, A) {abstract} + } } Weather --> "-currentWeather" WeatherType GWeather --> "-currentWeather" WeatherType Weather --> "-observers" WeatherObserver GOrcs ..|> Race Orcs ..|> WeatherObserver -Hobbits ..|> WeatherObserver Race --|> Observer GWeather --|> Observable GHobbits ..|> Race +Hobbits ..|> WeatherObserver @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 58f9eb93..f05c4069 100644 --- a/poison-pill/etc/poison-pill.urm.puml +++ b/poison-pill/etc/poison-pill.urm.puml @@ -1,5 +1,8 @@ @startuml package com.iluwatar.poison.pill { + interface MqPublishPoint { + + put(Message) {abstract} + } interface Message { + POISON_PILL : Message {static} + addHeader(Headers, String) {abstract} @@ -12,21 +15,7 @@ package com.iluwatar.poison.pill { + App() + main(args : String[]) {static} } - class SimpleMessage { - - body : String - - headers : Map - + SimpleMessage() - + addHeader(header : Headers, value : String) - + getBody() : String - + getHeader(header : Headers) : String - + getHeaders() : Map - + setBody(body : String) - } - class SimpleMessageQueue { - - queue : BlockingQueue - + SimpleMessageQueue(bound : int) - + put(msg : Message) - + take() : Message + interface MessageQueue { } class Producer { - isStopped : boolean @@ -36,19 +25,30 @@ package com.iluwatar.poison.pill { + send(body : String) + stop() } - interface MqSubscribePoint { - + take() : Message {abstract} - } class Consumer { - name : String - queue : MqSubscribePoint + Consumer(name : String, queue : MqSubscribePoint) + consume() } - interface MessageQueue { + class SimpleMessageQueue { + - queue : BlockingQueue + + SimpleMessageQueue(bound : int) + + put(msg : Message) + + take() : Message } - interface MqPublishPoint { - + put(Message) {abstract} + interface MqSubscribePoint { + + take() : Message {abstract} + } + class SimpleMessage { + - body : String + - headers : Map + + SimpleMessage() + + addHeader(header : Headers, value : String) + + getBody() : String + + getHeader(header : Headers) : String + + getHeaders() : Map + + setBody(body : String) } enum Headers { + DATE {static} @@ -65,8 +65,8 @@ SimpleMessage --+ Message Producer --+ Message Message --> "-POISON_PILL" Message Consumer --+ Message -SimpleMessage ..|> Message -SimpleMessageQueue ..|> MessageQueue MessageQueue --|> MqPublishPoint MessageQueue --|> MqSubscribePoint +SimpleMessageQueue ..|> MessageQueue +SimpleMessage ..|> Message @enduml \ No newline at end of file diff --git a/pom.xml b/pom.xml index b1ae7d81..fcf1671c 100644 --- a/pom.xml +++ b/pom.xml @@ -282,6 +282,25 @@ + + + + com.github.markusmo3.urm + + + urm-maven-plugin + + + [1.4.1,) + + + map + + + + + + diff --git a/private-class-data/etc/private-class-data.urm.puml b/private-class-data/etc/private-class-data.urm.puml index 0edc2c1a..ad35c0bd 100644 --- a/private-class-data/etc/private-class-data.urm.puml +++ b/private-class-data/etc/private-class-data.urm.puml @@ -1,28 +1,28 @@ @startuml package com.iluwatar.privateclassdata { - class Stew { + class StewData { - numCarrots : int - numMeat : int - numPeppers : int - numPotatoes : int - + Stew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int) - + mix() - + taste() + + 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 StewData { + class Stew { - 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 + + Stew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int) + + mix() + + taste() } class ImmutableStew { - data : StewData diff --git a/producer-consumer/etc/producer-consumer.urm.puml b/producer-consumer/etc/producer-consumer.urm.puml index 9a674855..8b793d75 100644 --- a/producer-consumer/etc/producer-consumer.urm.puml +++ b/producer-consumer/etc/producer-consumer.urm.puml @@ -1,17 +1,10 @@ @startuml package com.iluwatar.producer.consumer { - class Producer { - - itemId : int + class Consumer { - name : String - queue : ItemQueue - + Producer(name : String, queue : ItemQueue) - + produce() - } - class ItemQueue { - - queue : BlockingQueue - + ItemQueue() - + put(item : Item) - + take() : Item + + Consumer(name : String, queue : ItemQueue) + + consume() } class Item { - id : int @@ -24,11 +17,18 @@ package com.iluwatar.producer.consumer { + App() + main(args : String[]) {static} } - class Consumer { + class Producer { + - itemId : int - name : String - queue : ItemQueue - + Consumer(name : String, queue : ItemQueue) - + consume() + + Producer(name : String, queue : ItemQueue) + + produce() + } + class ItemQueue { + - queue : BlockingQueue + + ItemQueue() + + put(item : Item) + + take() : Item } } Consumer --> "-queue" ItemQueue diff --git a/promise/etc/promise.urm.puml b/promise/etc/promise.urm.puml index d9787141..cd6e7325 100644 --- a/promise/etc/promise.urm.puml +++ b/promise/etc/promise.urm.puml @@ -24,12 +24,18 @@ package com.iluwatar.promise { - ConsumeAction(src : Promise, dest : Promise, action : Consumer) + run() } - -class TransformAction { - - dest : Promise - - func : Function - - src : Promise - - TransformAction(src : Promise, dest : Promise, func : Function) - + 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} @@ -47,18 +53,12 @@ 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 TransformAction { + - dest : Promise + - func : Function + - src : Promise + - TransformAction(src : Promise, dest : Promise, func : Function) + + run() } class Utility { + Utility() diff --git a/property/etc/property.urm.puml b/property/etc/property.urm.puml index 7c90edcc..6ff0e5c5 100644 --- a/property/etc/property.urm.puml +++ b/property/etc/property.urm.puml @@ -1,5 +1,15 @@ @startuml package com.iluwatar.property { + class App { + + 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 @@ -16,15 +26,12 @@ package com.iluwatar.property { + toString() : String + type() : Type } - interface Prototype { - + get(Stats) : Integer {abstract} - + has(Stats) : boolean {abstract} - + remove(Stats) {abstract} - + set(Stats, Integer) {abstract} - } - class App { - + App() - + main(args : String[]) {static} + enum Type { + + MAGE {static} + + ROGUE {static} + + WARRIOR {static} + + valueOf(name : String) : Type {static} + + values() : Type[] {static} } enum Stats { + AGILITY {static} @@ -38,13 +45,6 @@ package com.iluwatar.property { + valueOf(name : String) : Stats {static} + values() : Stats[] {static} } - enum Type { - + MAGE {static} - + ROGUE {static} - + WARRIOR {static} - + valueOf(name : String) : Type {static} - + values() : Type[] {static} - } } App --+ Character Character --> "-prototype" Prototype diff --git a/prototype/etc/prototype.urm.puml b/prototype/etc/prototype.urm.puml index 7bfc00e1..7ab26dd1 100644 --- a/prototype/etc/prototype.urm.puml +++ b/prototype/etc/prototype.urm.puml @@ -1,59 +1,42 @@ @startuml package com.iluwatar.prototype { - interface HeroFactory { - + createBeast() : Beast {abstract} - + createMage() : Mage {abstract} - + createWarlord() : Warlord {abstract} + class OrcWarlord { + + OrcWarlord() + + clone() : Warlord + + toString() : String } class OrcBeast { + OrcBeast() + clone() : Beast + toString() : String } - abstract class Mage { - + Mage() - + clone() : Mage {abstract} - } - class HeroFactoryImpl { - - beast : Beast - - mage : Mage - - warlord : Warlord - + HeroFactoryImpl(mage : Mage, warlord : Warlord, beast : Beast) - + createBeast() : Beast - + createMage() : Mage - + createWarlord() : Warlord + abstract class Beast { + + Beast() + + clone() : Beast {abstract} } class ElfMage { + ElfMage() + clone() : Mage + toString() : String } + abstract class Mage { + + Mage() + + clone() : Mage {abstract} + } abstract class Prototype { + Prototype() + clone() : Object {abstract} } - class App { - + App() - + main(args : String[]) {static} - } - abstract class Warlord { - + Warlord() - + clone() : Warlord {abstract} - } - class OrcWarlord { - + OrcWarlord() - + clone() : Warlord - + toString() : String + interface HeroFactory { + + createBeast() : Beast {abstract} + + createMage() : Mage {abstract} + + createWarlord() : Warlord {abstract} } class ElfWarlord { + ElfWarlord() + clone() : Warlord + toString() : String } - abstract class Beast { - + Beast() - + clone() : Beast {abstract} - } class OrcMage { + OrcMage() + clone() : Mage @@ -64,18 +47,35 @@ package com.iluwatar.prototype { + clone() : Beast + toString() : String } + 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 -Mage --|> Prototype -HeroFactoryImpl ..|> HeroFactory +Beast --|> Prototype ElfMage --|> Mage -Warlord --|> Prototype -OrcWarlord --|> Warlord +Mage --|> Prototype ElfWarlord --|> Warlord -Beast --|> Prototype OrcMage --|> Mage ElfBeast --|> Beast +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 4203174d..1dc58087 100644 --- a/proxy/etc/proxy.urm.puml +++ b/proxy/etc/proxy.urm.puml @@ -1,5 +1,11 @@ @startuml package com.iluwatar.proxy { + class WizardTowerProxy { + - NUM_WIZARDS_ALLOWED : int {static} + - numWizards : int + + WizardTowerProxy() + + enter(wizard : Wizard) + } class WizardTower { + WizardTower() + enter(wizard : Wizard) @@ -8,12 +14,6 @@ package com.iluwatar.proxy { + App() + main(args : String[]) {static} } - class WizardTowerProxy { - - NUM_WIZARDS_ALLOWED : int {static} - - numWizards : int - + WizardTowerProxy() - + enter(wizard : Wizard) - } class Wizard { - name : String + Wizard(name : String) diff --git a/reactor/etc/reactor.urm.puml b/reactor/etc/reactor.urm.puml index 302f2663..ecf2f40f 100644 --- a/reactor/etc/reactor.urm.puml +++ b/reactor/etc/reactor.urm.puml @@ -1,5 +1,24 @@ @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 @@ -13,14 +32,6 @@ package com.iluwatar.reactor.app { + UdpLoggingClient(clientName : String, port : int) + run() } - 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 AppClient { - service : ExecutorService + AppClient() @@ -29,33 +40,30 @@ package com.iluwatar.reactor.app { + start() + stop() } - 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 - } } package com.iluwatar.reactor.framework { - interface Dispatcher { - + onChannelReadEvent(AbstractNioChannel, Object, SelectionKey) {abstract} - + stop() {abstract} - } - class SameThreadDispatcher { - + SameThreadDispatcher() - + onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey) - + stop() + abstract class AbstractNioChannel { + - channel : SelectableChannel + - channelToPendingWrites : Map> + - handler : ChannelHandler + - reactor : NioReactor + + AbstractNioChannel(handler : ChannelHandler, channel : SelectableChannel) + + bind() {abstract} + # doWrite(Object, SelectionKey) {abstract} + ~ flush(key : SelectionKey) + + getHandler() : ChannelHandler + + getInterestedOps() : int {abstract} + + getJavaChannel() : SelectableChannel + + read(SelectionKey) : Object {abstract} + ~ setReactor(reactor : NioReactor) + + write(data : Object, key : SelectionKey) } - class ThreadPoolDispatcher { - - executorService : ExecutorService - + ThreadPoolDispatcher(poolSize : int) - + onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey) - + stop() + ~class ChangeKeyOpsCommand { + - interestedOps : int + - key : SelectionKey + + ChangeKeyOpsCommand(this$0 : SelectionKey, key : int) + + run() + + toString() : String } interface ChannelHandler { + handleChannelRead(AbstractNioChannel, Object, SelectionKey) {abstract} @@ -70,6 +78,30 @@ 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 @@ -81,31 +113,6 @@ package com.iluwatar.reactor.framework { + setReceiver(receiver : SocketAddress) + setSender(sender : SocketAddress) } - abstract class AbstractNioChannel { - - channel : SelectableChannel - - channelToPendingWrites : Map> - - handler : ChannelHandler - - reactor : NioReactor - + AbstractNioChannel(handler : ChannelHandler, channel : SelectableChannel) - + bind() {abstract} - # doWrite(Object, SelectionKey) {abstract} - ~ flush(key : SelectionKey) - + getHandler() : ChannelHandler - + getInterestedOps() : int {abstract} - + getJavaChannel() : SelectableChannel - + read(SelectionKey) : Object {abstract} - ~ setReactor(reactor : NioReactor) - + write(data : Object, key : SelectionKey) - } - class NioServerSocketChannel { - - port : int - + NioServerSocketChannel(port : int, handler : ChannelHandler) - + bind() - # doWrite(pendingWrite : Object, key : SelectionKey) - + getInterestedOps() : int - + getJavaChannel() : ServerSocketChannel - + read(key : SelectionKey) : ByteBuffer - } class NioReactor { - dispatcher : Dispatcher - pendingCommands : Queue @@ -124,28 +131,21 @@ package com.iluwatar.reactor.framework { + start() + stop() } - ~class ChangeKeyOpsCommand { - - interestedOps : int - - key : SelectionKey - + ChangeKeyOpsCommand(this$0 : NioReactor, key : SelectionKey, interestedOps : int) - + run() - + toString() : String - } } AbstractNioChannel --> "-handler" ChannelHandler UdpLoggingClient ..+ AppClient -AbstractNioChannel --> "-reactor" NioReactor TcpLoggingClient ..+ AppClient +AbstractNioChannel --> "-reactor" NioReactor NioReactor --> "-dispatcher" Dispatcher App --> "-reactor" NioReactor App --> "-channels" AbstractNioChannel DatagramPacket ..+ NioDatagramChannel -ChangeKeyOpsCommand --+ NioReactor -App --> "-dispatcher" Dispatcher LoggingHandler --+ NioDatagramChannel -SameThreadDispatcher ..|> Dispatcher +App --> "-dispatcher" Dispatcher +ChangeKeyOpsCommand --+ NioReactor +NioDatagramChannel --|> AbstractNioChannel LoggingHandler ..|> ChannelHandler ThreadPoolDispatcher ..|> Dispatcher -NioDatagramChannel --|> AbstractNioChannel NioServerSocketChannel --|> AbstractNioChannel +SameThreadDispatcher ..|> 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 22b303cf..1760cf3e 100644 --- a/reader-writer-lock/etc/reader-writer-lock.urm.puml +++ b/reader-writer-lock/etc/reader-writer-lock.urm.puml @@ -1,21 +1,5 @@ @startuml package com.iluwatar.reader.writer.lock { - -class ReadLock { - - ReadLock(ReaderWriterLock) - + lock() - + lockInterruptibly() - + newCondition() : Condition - + tryLock() : boolean - + tryLock(time : long, unit : TimeUnit) : boolean - + unlock() - } - class Writer { - - name : String - - writeLock : Lock - + Writer(name : String, writeLock : Lock) - + run() - + write() - } class ReaderWriterLock { - currentReaderCount : int - globalMutex : Set @@ -31,7 +15,7 @@ package com.iluwatar.reader.writer.lock { + writeLock() : Lock } -class WriteLock { - - WriteLock(ReaderWriterLock) + - WriteLock() + lock() + lockInterruptibly() + newCondition() : Condition @@ -43,6 +27,22 @@ package com.iluwatar.reader.writer.lock { + App() + main(args : String[]) {static} } + -class ReadLock { + - ReadLock() + + lock() + + lockInterruptibly() + + newCondition() : Condition + + tryLock() : boolean + + tryLock(time : long, unit : TimeUnit) : boolean + + unlock() + } + class Writer { + - name : String + - writeLock : Lock + + Writer(name : String, writeLock : Lock) + + run() + + write() + } class Reader { - name : String - readLock : Lock @@ -51,8 +51,8 @@ package com.iluwatar.reader.writer.lock { + run() } } -ReadLock --+ ReaderWriterLock ReaderWriterLock --> "-readerLock" ReadLock +ReadLock --+ ReaderWriterLock ReaderWriterLock --> "-writerLock" WriteLock WriteLock --+ ReaderWriterLock @enduml \ No newline at end of file diff --git a/repository/etc/repository.urm.puml b/repository/etc/repository.urm.puml index 49a2c8fd..ad175903 100644 --- a/repository/etc/repository.urm.puml +++ b/repository/etc/repository.urm.puml @@ -1,9 +1,34 @@ @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 { + 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 { + + AppConfig() + + dataSource() : DataSource + + entityManagerFactory() : LocalContainerEntityManagerFactoryBean + - jpaProperties() : Properties {static} + + main(args : String[]) {static} + + transactionManager() : JpaTransactionManager + } class Person { - age : int - id : Long @@ -23,31 +48,6 @@ package com.iluwatar.repository { + setSurname(surname : String) + toString() : String } - class AgeBetweenSpec { - - from : int - - to : int - + AgeBetweenSpec(from : int, to : int) - + toPredicate(root : Root, query : CriteriaQuery, cb : CriteriaBuilder) : Predicate - } - class AppConfig { - + AppConfig() - + dataSource() : DataSource - + entityManagerFactory() : LocalContainerEntityManagerFactoryBean - - jpaProperties() : Properties {static} - + main(args : String[]) {static} - + transactionManager() : JpaTransactionManager - } - interface PersonRepository { - + findByName(String) : Person {abstract} - } - class NameEqualSpec { - + name : String - + NameEqualSpec(name : String) - + toPredicate(root : Root, query : CriteriaQuery, cb : CriteriaBuilder) : Predicate - } - class PersonSpecifications { - + PersonSpecifications() - } } App --+ PersonSpecifications AppConfig --+ PersonSpecifications 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 847b716a..81560c7f 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 @@ -4,13 +4,13 @@ package com.iluwatar.resource.acquisition.is.initialization { + App() + main(args : String[]) {static} } - class TreasureChest { - + TreasureChest() - + close() - } class SlidingDoor { + SlidingDoor() + close() } + class TreasureChest { + + TreasureChest() + + close() + } } @enduml \ No newline at end of file diff --git a/semaphore/etc/semaphore.urm.puml b/semaphore/etc/semaphore.urm.puml index f85fff92..a94ff5a7 100644 --- a/semaphore/etc/semaphore.urm.puml +++ b/semaphore/etc/semaphore.urm.puml @@ -1,32 +1,11 @@ @startuml package com.iluwatar.semaphore { - class FruitShop { - - available : boolean[] - - bowls : FruitBowl[] - - semaphore : Semaphore - + FruitShop() - + countFruit() : int - + returnBowl(bowl : FruitBowl) - + takeBowl() : FruitBowl - } - class FruitBowl { - - fruit : ArrayList - + FruitBowl() - + countFruit() : int - + put(f : Fruit) - + take() : Fruit - + toString() : String - } class Fruit { - type : FruitType + Fruit(type : FruitType) + getType() : FruitType + toString() : String } - interface Lock { - + acquire() {abstract} - + release() {abstract} - } class App { + App() + main(args : String[]) {static} @@ -40,6 +19,27 @@ package com.iluwatar.semaphore { + getNumLicenses() : int + release() } + class FruitShop { + - available : boolean[] + - bowls : FruitBowl[] + - semaphore : Semaphore + + FruitShop() + + countFruit() : int + + returnBowl(bowl : FruitBowl) + + takeBowl() : FruitBowl + } + interface Lock { + + acquire() {abstract} + + release() {abstract} + } + class FruitBowl { + - fruit : ArrayList + + FruitBowl() + + countFruit() : int + + put(f : Fruit) + + take() : Fruit + + toString() : String + } enum FruitType { + APPLE {static} + LEMON {static} diff --git a/servant/etc/servant.urm.puml b/servant/etc/servant.urm.puml index 48d48bd8..b7391f5d 100644 --- a/servant/etc/servant.urm.puml +++ b/servant/etc/servant.urm.puml @@ -1,24 +1,5 @@ @startuml package com.iluwatar.servant { - class King { - - complimentReceived : boolean - - isDrunk : boolean - - isHappy : boolean - - isHungry : boolean - + King() - + changeMood() - + getDrink() - + getFed() - + getMood() : boolean - + receiveCompliments() - } - ~interface Royalty { - + changeMood() {abstract} - + getDrink() {abstract} - + getFed() {abstract} - + getMood() : boolean {abstract} - + receiveCompliments() {abstract} - } class Servant { + name : String + Servant(name : String) @@ -48,8 +29,27 @@ package com.iluwatar.servant { + main(args : String[]) {static} + scenario(servant : Servant, compliment : int) {static} } + class King { + - complimentReceived : boolean + - isDrunk : boolean + - isHappy : boolean + - isHungry : boolean + + King() + + changeMood() + + getDrink() + + getFed() + + getMood() : boolean + + receiveCompliments() + } + ~interface Royalty { + + changeMood() {abstract} + + getDrink() {abstract} + + getFed() {abstract} + + getMood() : boolean {abstract} + + receiveCompliments() {abstract} + } } App --> "-jenkins" Servant -King ..|> Royalty Queen ..|> Royalty +King ..|> 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 c67ffa64..880384b9 100644 --- a/service-layer/etc/service-layer.urm.puml +++ b/service-layer/etc/service-layer.urm.puml @@ -55,6 +55,9 @@ package com.iluwatar.servicelayer.magic { } } package com.iluwatar.servicelayer.wizard { + interface WizardDao { + + findByName(String) : Wizard {abstract} + } class Wizard { - id : Long - name : String @@ -74,9 +77,6 @@ package com.iluwatar.servicelayer.wizard { + WizardDaoImpl() + findByName(name : String) : Wizard } - interface WizardDao { - + findByName(String) : Wizard {abstract} - } } package com.iluwatar.servicelayer.app { class App { @@ -86,33 +86,14 @@ package com.iluwatar.servicelayer.app { + queryData() {static} } } -package com.iluwatar.servicelayer.spell { - class SpellDaoImpl { - + SpellDaoImpl() - + findByName(name : String) : Spell - } - class Spell { - - id : Long - - name : String - - spellbook : Spellbook - + Spell() - + Spell(name : String) - + getId() : Long - + getName() : String - + getSpellbook() : Spellbook - + setId(id : Long) - + setName(name : String) - + setSpellbook(spellbook : Spellbook) - + toString() : String - } - interface SpellDao { - + findByName(String) : Spell {abstract} - } -} package com.iluwatar.servicelayer.spellbook { interface SpellbookDao { + findByName(String) : Spellbook {abstract} } + class SpellbookDaoImpl { + + SpellbookDaoImpl() + + findByName(name : String) : Spellbook + } class Spellbook { - id : Long - name : String @@ -131,9 +112,28 @@ package com.iluwatar.servicelayer.spellbook { + setWizards(wizards : Set) + toString() : String } - class SpellbookDaoImpl { - + SpellbookDaoImpl() - + findByName(name : String) : Spellbook +} +package com.iluwatar.servicelayer.spell { + class SpellDaoImpl { + + SpellDaoImpl() + + findByName(name : String) : Spell + } + interface SpellDao { + + findByName(String) : Spell {abstract} + } + class Spell { + - id : Long + - name : String + - spellbook : Spellbook + + Spell() + + Spell(name : String) + + getId() : Long + + getName() : String + + getSpellbook() : Spellbook + + setId(id : Long) + + setName(name : String) + + setSpellbook(spellbook : Spellbook) + + toString() : String } } MagicServiceImpl --> "-wizardDao" WizardDao @@ -141,18 +141,18 @@ MagicServiceImpl --> "-spellbookDao" SpellbookDao MagicServiceImpl --> "-spellDao" SpellDao Spellbook --> "-spells" Spell Spellbook --> "-wizards" Wizard -Wizard --|> BaseEntity -SpellbookDao --|> Dao SpellDaoImpl ..|> SpellDao SpellDaoImpl --|> DaoBaseImpl -MagicServiceImpl ..|> MagicService -DaoBaseImpl ..|> Dao -WizardDaoImpl ..|> WizardDao -WizardDaoImpl --|> DaoBaseImpl -Spellbook --|> BaseEntity +SpellbookDao --|> Dao +WizardDao --|> Dao SpellbookDaoImpl ..|> SpellbookDao SpellbookDaoImpl --|> DaoBaseImpl -Spell --|> BaseEntity -WizardDao --|> Dao +MagicServiceImpl ..|> MagicService SpellDao --|> Dao +Spell --|> BaseEntity +Spellbook --|> BaseEntity +Wizard --|> BaseEntity +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 085b05b2..9e41e7f4 100644 --- a/service-locator/etc/service-locator.urm.puml +++ b/service-locator/etc/service-locator.urm.puml @@ -1,25 +1,10 @@ @startuml package com.iluwatar.servicelocator { - interface Service { - + execute() {abstract} - + getId() : int {abstract} - + getName() : String {abstract} - } - class InitContext { - + InitContext() - + lookup(serviceName : String) : Object - } class ServiceLocator { - serviceCache : ServiceCache {static} - ServiceLocator() + getService(serviceJndiName : String) : Service {static} } - class ServiceCache { - - serviceCache : Map - + ServiceCache() - + addService(newService : Service) - + getService(serviceName : String) : Service - } class App { + App() + main(args : String[]) {static} @@ -32,6 +17,21 @@ package com.iluwatar.servicelocator { + getId() : int + getName() : String } + class InitContext { + + InitContext() + + lookup(serviceName : String) : Object + } + class ServiceCache { + - serviceCache : Map + + ServiceCache() + + addService(newService : Service) + + getService(serviceName : String) : Service + } + interface Service { + + execute() {abstract} + + getId() : int {abstract} + + getName() : String {abstract} + } } ServiceLocator --> "-serviceCache" ServiceCache ServiceImpl ..|> Service diff --git a/singleton/etc/singleton.urm.puml b/singleton/etc/singleton.urm.puml index f5ec1987..a1309177 100644 --- a/singleton/etc/singleton.urm.puml +++ b/singleton/etc/singleton.urm.puml @@ -1,32 +1,32 @@ @startuml package com.iluwatar.singleton { + class App { + + App() + + main(args : String[]) {static} + } class ThreadSafeLazyLoadedIvoryTower { - instance : ThreadSafeLazyLoadedIvoryTower {static} - ThreadSafeLazyLoadedIvoryTower() + getInstance() : ThreadSafeLazyLoadedIvoryTower {static} } - -class HelperHolder { - + INSTANCE : InitializingOnDemandHolderIdiom {static} - - HelperHolder() - } - class App { - + App() - + main(args : String[]) {static} + class InitializingOnDemandHolderIdiom { + - InitializingOnDemandHolderIdiom() + + getInstance() : InitializingOnDemandHolderIdiom {static} } class ThreadSafeDoubleCheckLocking { - instance : ThreadSafeDoubleCheckLocking {static} - ThreadSafeDoubleCheckLocking() + getInstance() : ThreadSafeDoubleCheckLocking {static} } - class InitializingOnDemandHolderIdiom { - - InitializingOnDemandHolderIdiom() - + getInstance() : InitializingOnDemandHolderIdiom {static} - } class IvoryTower { - INSTANCE : IvoryTower {static} - IvoryTower() + getInstance() : IvoryTower {static} } + -class HelperHolder { + - INSTANCE : InitializingOnDemandHolderIdiom {static} + - HelperHolder() + } enum EnumIvoryTower { + INSTANCE {static} + toString() : String diff --git a/specification/etc/specification.urm.puml b/specification/etc/specification.urm.puml index 0009a1bc..2f194d34 100644 --- a/specification/etc/specification.urm.puml +++ b/specification/etc/specification.urm.puml @@ -1,17 +1,5 @@ @startuml package com.iluwatar.specification.creature { - class Goblin { - + Goblin() - } - interface Creature { - + getColor() : Color {abstract} - + getMovement() : Movement {abstract} - + getName() : String {abstract} - + getSize() : Size {abstract} - } - class Troll { - + Troll() - } abstract class AbstractCreature { - color : Color - movement : Movement @@ -24,20 +12,41 @@ package com.iluwatar.specification.creature { + getSize() : Size + toString() : String } + class Troll { + + Troll() + } + class Octopus { + + Octopus() + } class Shark { + Shark() } + class Goblin { + + Goblin() + } class KillerBee { + KillerBee() } - class Octopus { - + Octopus() + interface Creature { + + getColor() : Color {abstract} + + getMovement() : Movement {abstract} + + getName() : String {abstract} + + getSize() : Size {abstract} } class Dragon { + Dragon() } } 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} @@ -57,15 +66,6 @@ package com.iluwatar.specification.property { + valueOf(name : String) : Movement {static} + values() : Movement[] {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.app { class App { @@ -74,9 +74,9 @@ package com.iluwatar.specification.app { } } package com.iluwatar.specification.selector { - class SizeSelector { - - s : Size - + SizeSelector(s : Size) + class MovementSelector { + - m : Movement + + MovementSelector(m : Movement) + test(t : Creature) : boolean } class ColorSelector { @@ -84,9 +84,9 @@ package com.iluwatar.specification.selector { + ColorSelector(c : Color) + test(t : Creature) : boolean } - class MovementSelector { - - m : Movement - + MovementSelector(m : Movement) + class SizeSelector { + - s : Size + + SizeSelector(s : Size) + test(t : Creature) : boolean } } @@ -96,11 +96,11 @@ MovementSelector --> "-m" Movement AbstractCreature --> "-movement" Movement AbstractCreature --> "-size" Size ColorSelector --> "-c" Color -Goblin --|> AbstractCreature -Troll --|> AbstractCreature AbstractCreature ..|> Creature +Troll --|> AbstractCreature +Octopus --|> AbstractCreature Shark --|> AbstractCreature +Goblin --|> AbstractCreature KillerBee --|> AbstractCreature -Octopus --|> AbstractCreature Dragon --|> AbstractCreature @enduml \ No newline at end of file diff --git a/state/etc/state.urm.puml b/state/etc/state.urm.puml index a0951ff6..378c11cd 100644 --- a/state/etc/state.urm.puml +++ b/state/etc/state.urm.puml @@ -1,5 +1,19 @@ @startuml package com.iluwatar.state { + class PeacefulState { + - mammoth : Mammoth + + PeacefulState(mammoth : Mammoth) + + observe() + + onEnterState() + } + interface State { + + observe() {abstract} + + onEnterState() {abstract} + } + class App { + + App() + + main(args : String[]) {static} + } class AngryState { - mammoth : Mammoth + AngryState(mammoth : Mammoth) @@ -14,24 +28,10 @@ package com.iluwatar.state { + timePasses() + toString() : String } - interface State { - + observe() {abstract} - + onEnterState() {abstract} - } - class PeacefulState { - - mammoth : Mammoth - + PeacefulState(mammoth : Mammoth) - + observe() - + onEnterState() - } - class App { - + App() - + main(args : String[]) {static} - } } -PeacefulState --> "-mammoth" Mammoth AngryState --> "-mammoth" Mammoth +PeacefulState --> "-mammoth" Mammoth Mammoth --> "-state" State -AngryState ..|> State PeacefulState ..|> State +AngryState ..|> 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 cc1f88ef..129ecbf3 100644 --- a/step-builder/etc/step-builder.urm.puml +++ b/step-builder/etc/step-builder.urm.puml @@ -1,8 +1,16 @@ @startuml package com.iluwatar.stepbuilder { + interface AbilityStep { + + noAbilities() : BuildStep {abstract} + + noMoreAbilities() : BuildStep {abstract} + + withAbility(String) : AbilityStep {abstract} + } interface BuildStep { + build() : Character {abstract} } + interface NameStep { + + name(String) : ClassStep {abstract} + } -class CharacterSteps { - abilities : List - fighterClass : String @@ -27,22 +35,6 @@ package com.iluwatar.stepbuilder { + App() + main(args : String[]) {static} } - interface ClassStep { - + fighterClass(String) : WeaponStep {abstract} - + wizardClass(String) : SpellStep {abstract} - } - interface WeaponStep { - + noWeapon() : BuildStep {abstract} - + withWeapon(String) : AbilityStep {abstract} - } - interface AbilityStep { - + noAbilities() : BuildStep {abstract} - + noMoreAbilities() : BuildStep {abstract} - + withAbility(String) : AbilityStep {abstract} - } - interface NameStep { - + name(String) : ClassStep {abstract} - } class CharacterStepBuilder { - CharacterStepBuilder() + newBuilder() : NameStep {static} @@ -73,13 +65,21 @@ package com.iluwatar.stepbuilder { + 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 -SpellStep ..+ CharacterStepBuilder -AbilityStep ..+ CharacterStepBuilder ClassStep ..+ CharacterStepBuilder +SpellStep ..+ CharacterStepBuilder CharacterSteps ..+ CharacterStepBuilder +AbilityStep ..+ CharacterStepBuilder NameStep ..+ CharacterStepBuilder BuildStep ..+ CharacterStepBuilder CharacterSteps ..|> NameStep diff --git a/strategy/etc/strategy.urm.puml b/strategy/etc/strategy.urm.puml index 2cc07286..db86b9ed 100644 --- a/strategy/etc/strategy.urm.puml +++ b/strategy/etc/strategy.urm.puml @@ -6,28 +6,28 @@ package com.iluwatar.strategy { + changeStrategy(strategy : DragonSlayingStrategy) + goToBattle() } - class SpellStrategy { - + SpellStrategy() - + execute() - } - class ProjectileStrategy { - + ProjectileStrategy() - + execute() - } interface DragonSlayingStrategy { + execute() {abstract} } + class App { + + App() + + main(args : String[]) {static} + } class MeleeStrategy { + MeleeStrategy() + execute() } - class App { - + App() - + main(args : String[]) {static} + class ProjectileStrategy { + + ProjectileStrategy() + + execute() + } + class SpellStrategy { + + SpellStrategy() + + execute() } } DragonSlayer --> "-strategy" DragonSlayingStrategy -SpellStrategy ..|> DragonSlayingStrategy -ProjectileStrategy ..|> DragonSlayingStrategy MeleeStrategy ..|> DragonSlayingStrategy +ProjectileStrategy ..|> DragonSlayingStrategy +SpellStrategy ..|> DragonSlayingStrategy @enduml \ No newline at end of file diff --git a/template-method/etc/template-method.urm.puml b/template-method/etc/template-method.urm.puml index c98287bc..c2c6045f 100644 --- a/template-method/etc/template-method.urm.puml +++ b/template-method/etc/template-method.urm.puml @@ -1,17 +1,17 @@ @startuml package com.iluwatar.templatemethod { - class SubtleMethod { - + SubtleMethod() - # confuseTarget(target : String) - # pickTarget() : String - # stealTheItem(target : String) - } class HitAndRunMethod { + HitAndRunMethod() # confuseTarget(target : String) # pickTarget() : String # stealTheItem(target : String) } + class HalflingThief { + - method : StealingMethod + + HalflingThief(method : StealingMethod) + + changeMethod(method : StealingMethod) + + steal() + } abstract class StealingMethod { + StealingMethod() # confuseTarget(String) {abstract} @@ -19,18 +19,18 @@ package com.iluwatar.templatemethod { + steal() # stealTheItem(String) {abstract} } + class SubtleMethod { + + SubtleMethod() + # confuseTarget(target : String) + # pickTarget() : String + # stealTheItem(target : String) + } class App { + App() + main(args : String[]) {static} } - class HalflingThief { - - method : StealingMethod - + HalflingThief(method : StealingMethod) - + changeMethod(method : StealingMethod) - + steal() - } } HalflingThief --> "-method" StealingMethod -SubtleMethod --|> StealingMethod HitAndRunMethod --|> StealingMethod +SubtleMethod --|> StealingMethod @enduml \ No newline at end of file diff --git a/thread-pool/etc/thread-pool.urm.puml b/thread-pool/etc/thread-pool.urm.puml index 2b73e2d5..421ea1dc 100644 --- a/thread-pool/etc/thread-pool.urm.puml +++ b/thread-pool/etc/thread-pool.urm.puml @@ -1,14 +1,5 @@ @startuml package com.iluwatar.threadpool { - class Worker { - - task : Task - + Worker(task : Task) - + run() - } - class App { - + App() - + main(args : String[]) {static} - } abstract class Task { - ID_GENERATOR : AtomicInteger {static} - id : int @@ -18,18 +9,27 @@ package com.iluwatar.threadpool { + getTimeMs() : int + toString() : String } + class CoffeeMakingTask { + - TIME_PER_CUP : int {static} + + CoffeeMakingTask(numCups : int) + + toString() : String + } + class Worker { + - task : Task + + Worker(task : Task) + + run() + } class PotatoPeelingTask { - TIME_PER_POTATO : int {static} + PotatoPeelingTask(numPotatoes : int) + toString() : String } - class CoffeeMakingTask { - - TIME_PER_CUP : int {static} - + CoffeeMakingTask(numCups : int) - + toString() : String + class App { + + App() + + main(args : String[]) {static} } } Worker --> "-task" Task -PotatoPeelingTask --|> Task CoffeeMakingTask --|> Task +PotatoPeelingTask --|> Task @enduml \ No newline at end of file diff --git a/tolerant-reader/etc/tolerant-reader.urm.puml b/tolerant-reader/etc/tolerant-reader.urm.puml index 9e2bc83b..f203f825 100644 --- a/tolerant-reader/etc/tolerant-reader.urm.puml +++ b/tolerant-reader/etc/tolerant-reader.urm.puml @@ -1,11 +1,5 @@ @startuml package com.iluwatar.tolerantreader { - class RainbowFishSerializer { - - RainbowFishSerializer() - + readV1(filename : String) : RainbowFish {static} - + writeV1(rainbowFish : RainbowFish, filename : String) {static} - + writeV2(rainbowFish : RainbowFishV2, filename : String) {static} - } class RainbowFish { - age : int - lengthMeters : int @@ -18,6 +12,10 @@ package com.iluwatar.tolerantreader { + getName() : String + getWeightTons() : int } + class App { + + App() + + main(args : String[]) {static} + } class RainbowFishV2 { - angry : boolean - hungry : boolean @@ -29,9 +27,11 @@ package com.iluwatar.tolerantreader { + getHungry() : boolean + getSleeping() : boolean } - 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} } } RainbowFishV2 --|> RainbowFish diff --git a/twin/etc/twin.urm.puml b/twin/etc/twin.urm.puml index b95325ab..b4bd5246 100644 --- a/twin/etc/twin.urm.puml +++ b/twin/etc/twin.urm.puml @@ -1,9 +1,10 @@ @startuml package com.iluwatar.twin { - class App { - + App() - + main(args : String[]) {static} - - waiting() {static} + abstract class GameItem { + + GameItem() + + click() {abstract} + + doDraw() {abstract} + + draw() } class BallItem { - isSuspended : boolean @@ -14,11 +15,10 @@ package com.iluwatar.twin { + move() + setTwin(twin : BallThread) } - abstract class GameItem { - + GameItem() - + click() {abstract} - + doDraw() {abstract} - + draw() + class App { + + App() + + main(args : String[]) {static} + - waiting() {static} } } BallItem --|> GameItem diff --git a/value-object/etc/value-object.urm.puml b/value-object/etc/value-object.urm.puml index 223f9195..6c81de01 100644 --- a/value-object/etc/value-object.urm.puml +++ b/value-object/etc/value-object.urm.puml @@ -1,9 +1,5 @@ @startuml package com.iluwatar.value.object { - class App { - + App() - + main(args : String[]) {static} - } class HeroStat { - intelligence : int - luck : int @@ -17,5 +13,9 @@ 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 3f5689f7..1f28e4e2 100644 --- a/visitor/etc/visitor.urm.puml +++ b/visitor/etc/visitor.urm.puml @@ -1,57 +1,57 @@ @startuml package com.iluwatar.visitor { + class Commander { + + Commander(children : Unit[]) + + accept(visitor : UnitVisitor) + + toString() : String + } + interface UnitVisitor { + + visitCommander(Commander) {abstract} + + visitSergeant(Sergeant) {abstract} + + visitSoldier(Soldier) {abstract} + } class CommanderVisitor { + CommanderVisitor() + visitCommander(commander : Commander) + visitSergeant(sergeant : Sergeant) + visitSoldier(soldier : Soldier) } - class Sergeant { - + Sergeant(children : Unit[]) + class Soldier { + + Soldier(children : Unit[]) + accept(visitor : UnitVisitor) + toString() : String } - class Commander { - + Commander(children : Unit[]) - + accept(visitor : UnitVisitor) - + toString() : String + class App { + + App() + + main(args : String[]) {static} } abstract class Unit { - children : Unit[] + Unit(children : Unit[]) + accept(visitor : UnitVisitor) } - class Soldier { - + Soldier(children : Unit[]) - + accept(visitor : UnitVisitor) - + toString() : String - } - class SergeantVisitor { - + SergeantVisitor() + class SoldierVisitor { + + SoldierVisitor() + visitCommander(commander : Commander) + visitSergeant(sergeant : Sergeant) + visitSoldier(soldier : Soldier) } - interface UnitVisitor { - + visitCommander(Commander) {abstract} - + visitSergeant(Sergeant) {abstract} - + visitSoldier(Soldier) {abstract} - } - class App { - + App() - + main(args : String[]) {static} - } - class SoldierVisitor { - + SoldierVisitor() + class SergeantVisitor { + + SergeantVisitor() + visitCommander(commander : Commander) + visitSergeant(sergeant : Sergeant) + visitSoldier(soldier : Soldier) } + class Sergeant { + + Sergeant(children : Unit[]) + + accept(visitor : UnitVisitor) + + toString() : String + } } -CommanderVisitor ..|> UnitVisitor -Sergeant --|> Unit Commander --|> Unit +CommanderVisitor ..|> UnitVisitor Soldier --|> Unit -SergeantVisitor ..|> UnitVisitor SoldierVisitor ..|> UnitVisitor +SergeantVisitor ..|> UnitVisitor +Sergeant --|> Unit @enduml \ No newline at end of file