UML generation: Mark the urm-maven-plugin execution to be ignored in Eclipse and recreate all .puml files
This commit is contained in:
parent
b030cd4eba
commit
6026eedd51
@ -3,31 +3,30 @@ package com.iluwatar.abstractdocument.domain {
|
|||||||
class Part {
|
class Part {
|
||||||
+ Part(properties : Map<String, Object>)
|
+ Part(properties : Map<String, Object>)
|
||||||
}
|
}
|
||||||
class Car {
|
interface HasPrice {
|
||||||
+ Car(properties : Map<String, Object>)
|
|
||||||
}
|
|
||||||
interface HasModel {
|
|
||||||
+ PROPERTY : String {static}
|
+ PROPERTY : String {static}
|
||||||
+ getModel() : Optional<String>
|
+ getPrice() : Optional<Number>
|
||||||
}
|
}
|
||||||
interface HasParts {
|
interface HasParts {
|
||||||
+ PROPERTY : String {static}
|
+ PROPERTY : String {static}
|
||||||
+ getParts() : Stream<Part>
|
+ getParts() : Stream<Part>
|
||||||
}
|
}
|
||||||
|
class Car {
|
||||||
|
+ Car(properties : Map<String, Object>)
|
||||||
|
}
|
||||||
interface HasType {
|
interface HasType {
|
||||||
+ PROPERTY : String {static}
|
+ PROPERTY : String {static}
|
||||||
+ getType() : Optional<String>
|
+ getType() : Optional<String>
|
||||||
}
|
}
|
||||||
interface HasPrice {
|
interface HasModel {
|
||||||
+ PROPERTY : String {static}
|
+ PROPERTY : String {static}
|
||||||
+ getPrice() : Optional<Number>
|
+ getModel() : Optional<String>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.abstractdocument {
|
package com.iluwatar.abstractdocument {
|
||||||
interface Document {
|
class App {
|
||||||
+ children(String, Function<Map<String, Object>, T>) : Stream<T> {abstract}
|
+ App()
|
||||||
+ get(String) : Object {abstract}
|
+ main(args : String[]) {static}
|
||||||
+ put(String, Object) {abstract}
|
|
||||||
}
|
}
|
||||||
abstract class AbstractDocument {
|
abstract class AbstractDocument {
|
||||||
- properties : Map<String, Object>
|
- properties : Map<String, Object>
|
||||||
@ -37,9 +36,10 @@ package com.iluwatar.abstractdocument {
|
|||||||
+ put(key : String, value : Object)
|
+ put(key : String, value : Object)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class App {
|
interface Document {
|
||||||
+ App()
|
+ children(String, Function<Map<String, Object>, T>) : Stream<T> {abstract}
|
||||||
+ main(args : String[]) {static}
|
+ get(String) : Object {abstract}
|
||||||
|
+ put(String, Object) {abstract}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AbstractDocument --+ Map
|
AbstractDocument --+ Map
|
||||||
@ -47,13 +47,13 @@ Part ..|> HasType
|
|||||||
Part ..|> HasModel
|
Part ..|> HasModel
|
||||||
Part ..|> HasPrice
|
Part ..|> HasPrice
|
||||||
Part --|> AbstractDocument
|
Part --|> AbstractDocument
|
||||||
|
AbstractDocument ..|> Document
|
||||||
|
HasPrice --|> Document
|
||||||
|
HasParts --|> Document
|
||||||
Car ..|> HasModel
|
Car ..|> HasModel
|
||||||
Car ..|> HasPrice
|
Car ..|> HasPrice
|
||||||
Car ..|> HasParts
|
Car ..|> HasParts
|
||||||
Car --|> AbstractDocument
|
Car --|> AbstractDocument
|
||||||
HasModel --|> Document
|
|
||||||
HasParts --|> Document
|
|
||||||
AbstractDocument ..|> Document
|
|
||||||
HasType --|> Document
|
HasType --|> Document
|
||||||
HasPrice --|> Document
|
HasModel --|> Document
|
||||||
@enduml
|
@enduml
|
@ -1,22 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.abstractfactory {
|
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 {
|
class App {
|
||||||
- army : Army
|
- army : Army
|
||||||
- castle : Castle
|
- castle : Castle
|
||||||
@ -34,35 +17,12 @@ package com.iluwatar.abstractfactory {
|
|||||||
- setCastle(castle : Castle)
|
- setCastle(castle : Castle)
|
||||||
- setKing(king : King)
|
- setKing(king : King)
|
||||||
}
|
}
|
||||||
class OrcKing {
|
class OrcKingdomFactory {
|
||||||
~ DESCRIPTION : String {static}
|
+ OrcKingdomFactory()
|
||||||
+ OrcKing()
|
|
||||||
+ getDescription() : String
|
|
||||||
}
|
|
||||||
class ElfKingdomFactory {
|
|
||||||
+ ElfKingdomFactory()
|
|
||||||
+ createArmy() : Army
|
+ createArmy() : Army
|
||||||
+ createCastle() : Castle
|
+ createCastle() : Castle
|
||||||
+ createKing() : King
|
+ createKing() : King
|
||||||
}
|
}
|
||||||
interface Army {
|
|
||||||
+ getDescription() : String {abstract}
|
|
||||||
}
|
|
||||||
class OrcArmy {
|
|
||||||
~ DESCRIPTION : String {static}
|
|
||||||
+ OrcArmy()
|
|
||||||
+ getDescription() : String
|
|
||||||
}
|
|
||||||
interface KingdomFactory {
|
|
||||||
+ createArmy() : Army {abstract}
|
|
||||||
+ createCastle() : Castle {abstract}
|
|
||||||
+ createKing() : King {abstract}
|
|
||||||
}
|
|
||||||
class ElfArmy {
|
|
||||||
~ DESCRIPTION : String {static}
|
|
||||||
+ ElfArmy()
|
|
||||||
+ getDescription() : String
|
|
||||||
}
|
|
||||||
class ElfCastle {
|
class ElfCastle {
|
||||||
~ DESCRIPTION : String {static}
|
~ DESCRIPTION : String {static}
|
||||||
+ ElfCastle()
|
+ ElfCastle()
|
||||||
@ -73,16 +33,56 @@ package com.iluwatar.abstractfactory {
|
|||||||
+ OrcCastle()
|
+ OrcCastle()
|
||||||
+ getDescription() : String
|
+ getDescription() : String
|
||||||
}
|
}
|
||||||
|
interface KingdomFactory {
|
||||||
|
+ createArmy() : Army {abstract}
|
||||||
|
+ createCastle() : Castle {abstract}
|
||||||
|
+ createKing() : King {abstract}
|
||||||
|
}
|
||||||
|
class ElfKing {
|
||||||
|
~ DESCRIPTION : String {static}
|
||||||
|
+ ElfKing()
|
||||||
|
+ getDescription() : String
|
||||||
|
}
|
||||||
|
class ElfArmy {
|
||||||
|
~ DESCRIPTION : String {static}
|
||||||
|
+ ElfArmy()
|
||||||
|
+ getDescription() : String
|
||||||
|
}
|
||||||
|
interface Castle {
|
||||||
|
+ getDescription() : String {abstract}
|
||||||
|
}
|
||||||
|
interface Army {
|
||||||
|
+ getDescription() : String {abstract}
|
||||||
|
}
|
||||||
|
class OrcKing {
|
||||||
|
~ DESCRIPTION : String {static}
|
||||||
|
+ OrcKing()
|
||||||
|
+ getDescription() : String
|
||||||
|
}
|
||||||
|
class OrcArmy {
|
||||||
|
~ DESCRIPTION : String {static}
|
||||||
|
+ OrcArmy()
|
||||||
|
+ getDescription() : String
|
||||||
|
}
|
||||||
|
interface King {
|
||||||
|
+ getDescription() : String {abstract}
|
||||||
|
}
|
||||||
|
class ElfKingdomFactory {
|
||||||
|
+ ElfKingdomFactory()
|
||||||
|
+ createArmy() : Army
|
||||||
|
+ createCastle() : Castle
|
||||||
|
+ createKing() : King
|
||||||
|
}
|
||||||
}
|
}
|
||||||
App --> "-castle" Castle
|
App --> "-castle" Castle
|
||||||
App --> "-king" King
|
App --> "-king" King
|
||||||
App --> "-army" Army
|
App --> "-army" Army
|
||||||
OrcKingdomFactory ..|> KingdomFactory
|
OrcKingdomFactory ..|> KingdomFactory
|
||||||
ElfKing ..|> King
|
|
||||||
OrcKing ..|> King
|
|
||||||
ElfKingdomFactory ..|> KingdomFactory
|
|
||||||
OrcArmy ..|> Army
|
|
||||||
ElfArmy ..|> Army
|
|
||||||
ElfCastle ..|> Castle
|
ElfCastle ..|> Castle
|
||||||
OrcCastle ..|> Castle
|
OrcCastle ..|> Castle
|
||||||
|
ElfKing ..|> King
|
||||||
|
ElfArmy ..|> Army
|
||||||
|
OrcKing ..|> King
|
||||||
|
OrcArmy ..|> Army
|
||||||
|
ElfKingdomFactory ..|> KingdomFactory
|
||||||
@enduml
|
@enduml
|
@ -1,13 +1,19 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.adapter {
|
package com.iluwatar.adapter {
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
interface BattleShip {
|
interface BattleShip {
|
||||||
+ fire() {abstract}
|
+ fire() {abstract}
|
||||||
+ move() {abstract}
|
+ move() {abstract}
|
||||||
}
|
}
|
||||||
|
class BattleFishingBoat {
|
||||||
|
- boat : FishingBoat
|
||||||
|
+ BattleFishingBoat()
|
||||||
|
+ fire()
|
||||||
|
+ move()
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class Captain {
|
class Captain {
|
||||||
- battleship : BattleShip
|
- battleship : BattleShip
|
||||||
+ Captain()
|
+ Captain()
|
||||||
@ -16,12 +22,6 @@ package com.iluwatar.adapter {
|
|||||||
+ move()
|
+ move()
|
||||||
+ setBattleship(battleship : BattleShip)
|
+ setBattleship(battleship : BattleShip)
|
||||||
}
|
}
|
||||||
class BattleFishingBoat {
|
|
||||||
- boat : FishingBoat
|
|
||||||
+ BattleFishingBoat()
|
|
||||||
+ fire()
|
|
||||||
+ move()
|
|
||||||
}
|
|
||||||
class FishingBoat {
|
class FishingBoat {
|
||||||
+ FishingBoat()
|
+ FishingBoat()
|
||||||
+ fish()
|
+ fish()
|
||||||
@ -30,6 +30,6 @@ package com.iluwatar.adapter {
|
|||||||
}
|
}
|
||||||
BattleFishingBoat --> "-boat" FishingBoat
|
BattleFishingBoat --> "-boat" FishingBoat
|
||||||
Captain --> "-battleship" BattleShip
|
Captain --> "-battleship" BattleShip
|
||||||
Captain ..|> BattleShip
|
|
||||||
BattleFishingBoat ..|> BattleShip
|
BattleFishingBoat ..|> BattleShip
|
||||||
|
Captain ..|> BattleShip
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,25 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.aggregator.microservices {
|
package com.iluwatar.aggregator.microservices {
|
||||||
|
class ProductInventoryClientImpl {
|
||||||
|
+ ProductInventoryClientImpl()
|
||||||
|
+ getProductInventories() : int
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
interface ProductInventoryClient {
|
||||||
|
+ getProductInventories() : int {abstract}
|
||||||
|
}
|
||||||
|
class Product {
|
||||||
|
- productInventories : int
|
||||||
|
- title : String
|
||||||
|
+ Product()
|
||||||
|
+ getProductInventories() : int
|
||||||
|
+ getTitle() : String
|
||||||
|
+ setProductInventories(productInventories : int)
|
||||||
|
+ setTitle(title : String)
|
||||||
|
}
|
||||||
class Aggregator {
|
class Aggregator {
|
||||||
- informationClient : ProductInformationClient
|
- informationClient : ProductInformationClient
|
||||||
- inventoryClient : ProductInventoryClient
|
- inventoryClient : ProductInventoryClient
|
||||||
@ -13,29 +33,9 @@ package com.iluwatar.aggregator.microservices {
|
|||||||
interface ProductInformationClient {
|
interface ProductInformationClient {
|
||||||
+ getProductTitle() : String {abstract}
|
+ getProductTitle() : String {abstract}
|
||||||
}
|
}
|
||||||
class Product {
|
|
||||||
- productInventories : int
|
|
||||||
- title : String
|
|
||||||
+ Product()
|
|
||||||
+ getProductInventories() : int
|
|
||||||
+ getTitle() : String
|
|
||||||
+ setProductInventories(productInventories : int)
|
|
||||||
+ setTitle(title : String)
|
|
||||||
}
|
|
||||||
class ProductInventoryClientImpl {
|
|
||||||
+ ProductInventoryClientImpl()
|
|
||||||
+ getProductInventories() : int
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
interface ProductInventoryClient {
|
|
||||||
+ getProductInventories() : int {abstract}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Aggregator --> "-inventoryClient" ProductInventoryClient
|
Aggregator --> "-inventoryClient" ProductInventoryClient
|
||||||
Aggregator --> "-informationClient" ProductInformationClient
|
Aggregator --> "-informationClient" ProductInformationClient
|
||||||
ProductInformationClientImpl ..|> ProductInformationClient
|
|
||||||
ProductInventoryClientImpl ..|> ProductInventoryClient
|
ProductInventoryClientImpl ..|> ProductInventoryClient
|
||||||
|
ProductInformationClientImpl ..|> ProductInformationClient
|
||||||
@enduml
|
@enduml
|
@ -1,12 +1,12 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.inventory.microservice {
|
package com.iluwatar.inventory.microservice {
|
||||||
class InventoryApplication {
|
|
||||||
+ InventoryApplication()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class InventoryController {
|
class InventoryController {
|
||||||
+ InventoryController()
|
+ InventoryController()
|
||||||
+ getProductInventories() : int
|
+ getProductInventories() : int
|
||||||
}
|
}
|
||||||
|
class InventoryApplication {
|
||||||
|
+ InventoryApplication()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@enduml
|
@enduml
|
@ -1,7 +1,16 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.api.gateway {
|
package com.iluwatar.api.gateway {
|
||||||
interface ImageClient {
|
class App {
|
||||||
+ getImagePath() : String {abstract}
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class PriceClientImpl {
|
||||||
|
+ PriceClientImpl()
|
||||||
|
+ getPrice() : String
|
||||||
|
}
|
||||||
|
class ImageClientImpl {
|
||||||
|
+ ImageClientImpl()
|
||||||
|
+ getImagePath() : String
|
||||||
}
|
}
|
||||||
class MobileProduct {
|
class MobileProduct {
|
||||||
- price : String
|
- price : String
|
||||||
@ -9,6 +18,9 @@ package com.iluwatar.api.gateway {
|
|||||||
+ getPrice() : String
|
+ getPrice() : String
|
||||||
+ setPrice(price : String)
|
+ setPrice(price : String)
|
||||||
}
|
}
|
||||||
|
interface ImageClient {
|
||||||
|
+ getImagePath() : String {abstract}
|
||||||
|
}
|
||||||
class ApiGateway {
|
class ApiGateway {
|
||||||
- imageClient : ImageClient
|
- imageClient : ImageClient
|
||||||
- priceClient : PriceClient
|
- priceClient : PriceClient
|
||||||
@ -28,18 +40,6 @@ package com.iluwatar.api.gateway {
|
|||||||
interface PriceClient {
|
interface PriceClient {
|
||||||
+ getPrice() : String {abstract}
|
+ getPrice() : String {abstract}
|
||||||
}
|
}
|
||||||
class PriceClientImpl {
|
|
||||||
+ PriceClientImpl()
|
|
||||||
+ getPrice() : String
|
|
||||||
}
|
|
||||||
class ImageClientImpl {
|
|
||||||
+ ImageClientImpl()
|
|
||||||
+ getImagePath() : String
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ApiGateway --> "-imageClient" ImageClient
|
ApiGateway --> "-imageClient" ImageClient
|
||||||
ApiGateway --> "-priceClient" PriceClient
|
ApiGateway --> "-priceClient" PriceClient
|
||||||
|
@ -1,13 +1,22 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.async.method.invocation {
|
package com.iluwatar.async.method.invocation {
|
||||||
interface AsyncCallback<T> {
|
class App {
|
||||||
+ onComplete(T, Optional<Exception>) {abstract}
|
+ App()
|
||||||
|
- callback(name : String) : AsyncCallback<T> {static}
|
||||||
|
- lazyval(value : T, delayMillis : long) : Callable<T> {static}
|
||||||
|
- log(msg : String) {static}
|
||||||
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
interface AsyncResult<T> {
|
interface AsyncResult<T> {
|
||||||
+ await() {abstract}
|
+ await() {abstract}
|
||||||
+ getValue() : T {abstract}
|
+ getValue() : T {abstract}
|
||||||
+ isCompleted() : boolean {abstract}
|
+ isCompleted() : boolean {abstract}
|
||||||
}
|
}
|
||||||
|
interface AsyncExecutor {
|
||||||
|
+ endProcess(AsyncResult<T>) : T {abstract}
|
||||||
|
+ startProcess(Callable<T>) : AsyncResult<T> {abstract}
|
||||||
|
+ startProcess(Callable<T>, AsyncCallback<T>) : AsyncResult<T> {abstract}
|
||||||
|
}
|
||||||
class ThreadAsyncExecutor {
|
class ThreadAsyncExecutor {
|
||||||
- idx : AtomicInteger
|
- idx : AtomicInteger
|
||||||
+ ThreadAsyncExecutor()
|
+ ThreadAsyncExecutor()
|
||||||
@ -15,12 +24,8 @@ package com.iluwatar.async.method.invocation {
|
|||||||
+ startProcess(task : Callable<T>) : AsyncResult<T>
|
+ startProcess(task : Callable<T>) : AsyncResult<T>
|
||||||
+ startProcess(task : Callable<T>, callback : AsyncCallback<T>) : AsyncResult<T>
|
+ startProcess(task : Callable<T>, callback : AsyncCallback<T>) : AsyncResult<T>
|
||||||
}
|
}
|
||||||
class App {
|
interface AsyncCallback<T> {
|
||||||
+ App()
|
+ onComplete(T, Optional<Exception>) {abstract}
|
||||||
- callback(name : String) : AsyncCallback<T> {static}
|
|
||||||
- lazyval(value : T, delayMillis : long) : Callable<T> {static}
|
|
||||||
- log(msg : String) {static}
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
}
|
||||||
-class CompletableResult<T> {
|
-class CompletableResult<T> {
|
||||||
~ COMPLETED : int {static}
|
~ COMPLETED : int {static}
|
||||||
@ -38,11 +43,6 @@ package com.iluwatar.async.method.invocation {
|
|||||||
~ setException(exception : Exception)
|
~ setException(exception : Exception)
|
||||||
~ setValue(value : T)
|
~ setValue(value : T)
|
||||||
}
|
}
|
||||||
interface AsyncExecutor {
|
|
||||||
+ endProcess(AsyncResult<T>) : T {abstract}
|
|
||||||
+ startProcess(Callable<T>) : AsyncResult<T> {abstract}
|
|
||||||
+ startProcess(Callable<T>, AsyncCallback<T>) : AsyncResult<T> {abstract}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CompletableResult ..+ ThreadAsyncExecutor
|
CompletableResult ..+ ThreadAsyncExecutor
|
||||||
ThreadAsyncExecutor ..|> AsyncExecutor
|
ThreadAsyncExecutor ..|> AsyncExecutor
|
||||||
|
@ -8,26 +8,6 @@ package com.iluwatar.bridge {
|
|||||||
+ unwield()
|
+ unwield()
|
||||||
+ wield()
|
+ 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 {
|
class Stormbringer {
|
||||||
+ Stormbringer()
|
+ Stormbringer()
|
||||||
+ eatSoulImp()
|
+ eatSoulImp()
|
||||||
@ -35,9 +15,9 @@ package com.iluwatar.bridge {
|
|||||||
+ unwieldImp()
|
+ unwieldImp()
|
||||||
+ wieldImp()
|
+ wieldImp()
|
||||||
}
|
}
|
||||||
abstract class BlindingMagicWeaponImpl {
|
abstract class FlyingMagicWeaponImpl {
|
||||||
+ BlindingMagicWeaponImpl()
|
+ FlyingMagicWeaponImpl()
|
||||||
+ blindImp() {abstract}
|
+ flyImp() {abstract}
|
||||||
}
|
}
|
||||||
class SoulEatingMagicWeapon {
|
class SoulEatingMagicWeapon {
|
||||||
+ SoulEatingMagicWeapon(imp : SoulEatingMagicWeaponImpl)
|
+ SoulEatingMagicWeapon(imp : SoulEatingMagicWeaponImpl)
|
||||||
@ -53,6 +33,10 @@ package com.iluwatar.bridge {
|
|||||||
+ unwieldImp() {abstract}
|
+ unwieldImp() {abstract}
|
||||||
+ wieldImp() {abstract}
|
+ wieldImp() {abstract}
|
||||||
}
|
}
|
||||||
|
abstract class SoulEatingMagicWeaponImpl {
|
||||||
|
+ SoulEatingMagicWeaponImpl()
|
||||||
|
+ eatSoulImp() {abstract}
|
||||||
|
}
|
||||||
class Excalibur {
|
class Excalibur {
|
||||||
+ Excalibur()
|
+ Excalibur()
|
||||||
+ blindImp()
|
+ blindImp()
|
||||||
@ -60,10 +44,6 @@ package com.iluwatar.bridge {
|
|||||||
+ unwieldImp()
|
+ unwieldImp()
|
||||||
+ wieldImp()
|
+ wieldImp()
|
||||||
}
|
}
|
||||||
abstract class FlyingMagicWeaponImpl {
|
|
||||||
+ FlyingMagicWeaponImpl()
|
|
||||||
+ flyImp() {abstract}
|
|
||||||
}
|
|
||||||
class Mjollnir {
|
class Mjollnir {
|
||||||
+ Mjollnir()
|
+ Mjollnir()
|
||||||
+ flyImp()
|
+ flyImp()
|
||||||
@ -75,15 +55,35 @@ package com.iluwatar.bridge {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ 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
|
MagicWeapon --> "-imp" MagicWeaponImpl
|
||||||
FlyingMagicWeapon --|> MagicWeapon
|
FlyingMagicWeapon --|> MagicWeapon
|
||||||
SoulEatingMagicWeaponImpl --|> MagicWeaponImpl
|
|
||||||
BlindingMagicWeapon --|> MagicWeapon
|
|
||||||
Stormbringer --|> SoulEatingMagicWeaponImpl
|
Stormbringer --|> SoulEatingMagicWeaponImpl
|
||||||
BlindingMagicWeaponImpl --|> MagicWeaponImpl
|
|
||||||
SoulEatingMagicWeapon --|> MagicWeapon
|
|
||||||
Excalibur --|> BlindingMagicWeaponImpl
|
|
||||||
FlyingMagicWeaponImpl --|> MagicWeaponImpl
|
FlyingMagicWeaponImpl --|> MagicWeaponImpl
|
||||||
|
SoulEatingMagicWeapon --|> MagicWeapon
|
||||||
|
SoulEatingMagicWeaponImpl --|> MagicWeaponImpl
|
||||||
|
Excalibur --|> BlindingMagicWeaponImpl
|
||||||
Mjollnir --|> FlyingMagicWeaponImpl
|
Mjollnir --|> FlyingMagicWeaponImpl
|
||||||
|
BlindingMagicWeaponImpl --|> MagicWeaponImpl
|
||||||
|
BlindingMagicWeapon --|> MagicWeapon
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,23 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.builder {
|
package com.iluwatar.builder {
|
||||||
|
class Builder {
|
||||||
|
- armor : Armor
|
||||||
|
- hairColor : HairColor
|
||||||
|
- hairType : HairType
|
||||||
|
- name : String
|
||||||
|
- profession : Profession
|
||||||
|
- weapon : Weapon
|
||||||
|
+ Builder(profession : Profession, name : String)
|
||||||
|
+ build() : Hero
|
||||||
|
+ withArmor(armor : Armor) : Builder
|
||||||
|
+ withHairColor(hairColor : HairColor) : Builder
|
||||||
|
+ withHairType(hairType : HairType) : Builder
|
||||||
|
+ withWeapon(weapon : Weapon) : Builder
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class Hero {
|
class Hero {
|
||||||
- armor : Armor
|
- armor : Armor
|
||||||
- hairColor : HairColor
|
- hairColor : HairColor
|
||||||
@ -16,33 +34,25 @@ package com.iluwatar.builder {
|
|||||||
+ getWeapon() : Weapon
|
+ getWeapon() : Weapon
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class App {
|
enum Weapon {
|
||||||
+ App()
|
+ AXE {static}
|
||||||
+ main(args : String[]) {static}
|
+ BOW {static}
|
||||||
}
|
+ DAGGER {static}
|
||||||
class Builder {
|
+ SWORD {static}
|
||||||
- armor : Armor
|
+ WARHAMMER {static}
|
||||||
- hairColor : HairColor
|
|
||||||
- hairType : HairType
|
|
||||||
- name : String
|
|
||||||
- profession : Profession
|
|
||||||
- weapon : Weapon
|
|
||||||
+ Builder(profession : Profession, name : String)
|
|
||||||
+ build() : Hero
|
|
||||||
+ withArmor(armor : Armor) : Builder
|
|
||||||
+ withHairColor(hairColor : HairColor) : Builder
|
|
||||||
+ withHairType(hairType : HairType) : Builder
|
|
||||||
+ withWeapon(weapon : Weapon) : Builder
|
|
||||||
}
|
|
||||||
enum Armor {
|
|
||||||
+ CHAIN_MAIL {static}
|
|
||||||
+ CLOTHES {static}
|
|
||||||
+ LEATHER {static}
|
|
||||||
+ PLATE_MAIL {static}
|
|
||||||
- title : String
|
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
+ valueOf(name : String) : Armor {static}
|
+ valueOf(name : String) : Weapon {static}
|
||||||
+ values() : Armor[] {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 {
|
enum Profession {
|
||||||
+ MAGE {static}
|
+ MAGE {static}
|
||||||
@ -53,15 +63,15 @@ package com.iluwatar.builder {
|
|||||||
+ valueOf(name : String) : Profession {static}
|
+ valueOf(name : String) : Profession {static}
|
||||||
+ values() : Profession[] {static}
|
+ values() : Profession[] {static}
|
||||||
}
|
}
|
||||||
enum Weapon {
|
enum Armor {
|
||||||
+ AXE {static}
|
+ CHAIN_MAIL {static}
|
||||||
+ BOW {static}
|
+ CLOTHES {static}
|
||||||
+ DAGGER {static}
|
+ LEATHER {static}
|
||||||
+ SWORD {static}
|
+ PLATE_MAIL {static}
|
||||||
+ WARHAMMER {static}
|
- title : String
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
+ valueOf(name : String) : Weapon {static}
|
+ valueOf(name : String) : Armor {static}
|
||||||
+ values() : Weapon[] {static}
|
+ values() : Armor[] {static}
|
||||||
}
|
}
|
||||||
enum HairType {
|
enum HairType {
|
||||||
+ BALD {static}
|
+ BALD {static}
|
||||||
@ -74,19 +84,9 @@ package com.iluwatar.builder {
|
|||||||
+ valueOf(name : String) : HairType {static}
|
+ valueOf(name : String) : HairType {static}
|
||||||
+ values() : 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
|
Hero --> "-profession" Profession
|
||||||
|
Builder ..+ Hero
|
||||||
Hero --> "-armor" Armor
|
Hero --> "-armor" Armor
|
||||||
App --+ Hero
|
App --+ Hero
|
||||||
Builder --> "-weapon" Weapon
|
Builder --> "-weapon" Weapon
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.business.delegate {
|
package com.iluwatar.business.delegate {
|
||||||
|
class EjbService {
|
||||||
|
+ EjbService()
|
||||||
|
+ doProcessing()
|
||||||
|
}
|
||||||
class BusinessLookup {
|
class BusinessLookup {
|
||||||
- ejbService : EjbService
|
- ejbService : EjbService
|
||||||
- jmsService : JmsService
|
- jmsService : JmsService
|
||||||
@ -8,15 +12,18 @@ package com.iluwatar.business.delegate {
|
|||||||
+ setEjbService(ejbService : EjbService)
|
+ setEjbService(ejbService : EjbService)
|
||||||
+ setJmsService(jmsService : JmsService)
|
+ setJmsService(jmsService : JmsService)
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
interface BusinessService {
|
||||||
|
+ doProcessing() {abstract}
|
||||||
|
}
|
||||||
class Client {
|
class Client {
|
||||||
- businessDelegate : BusinessDelegate
|
- businessDelegate : BusinessDelegate
|
||||||
+ Client(businessDelegate : BusinessDelegate)
|
+ Client(businessDelegate : BusinessDelegate)
|
||||||
+ doTask()
|
+ doTask()
|
||||||
}
|
}
|
||||||
class EjbService {
|
|
||||||
+ EjbService()
|
|
||||||
+ doProcessing()
|
|
||||||
}
|
|
||||||
class BusinessDelegate {
|
class BusinessDelegate {
|
||||||
- businessService : BusinessService
|
- businessService : BusinessService
|
||||||
- lookupService : BusinessLookup
|
- lookupService : BusinessLookup
|
||||||
@ -26,17 +33,10 @@ package com.iluwatar.business.delegate {
|
|||||||
+ setLookupService(businessLookup : BusinessLookup)
|
+ setLookupService(businessLookup : BusinessLookup)
|
||||||
+ setServiceType(serviceType : ServiceType)
|
+ setServiceType(serviceType : ServiceType)
|
||||||
}
|
}
|
||||||
interface BusinessService {
|
|
||||||
+ doProcessing() {abstract}
|
|
||||||
}
|
|
||||||
class JmsService {
|
class JmsService {
|
||||||
+ JmsService()
|
+ JmsService()
|
||||||
+ doProcessing()
|
+ doProcessing()
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
enum ServiceType {
|
enum ServiceType {
|
||||||
+ EJB {static}
|
+ EJB {static}
|
||||||
+ JMS {static}
|
+ JMS {static}
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.caching {
|
package com.iluwatar.caching {
|
||||||
class UserAccount {
|
class App {
|
||||||
- additionalInfo : String
|
+ App()
|
||||||
- userId : String
|
+ main(args : String[]) {static}
|
||||||
- userName : String
|
+ useReadAndWriteThroughStrategy()
|
||||||
+ UserAccount(userId : String, userName : String, additionalInfo : String)
|
+ useReadThroughAndWriteAroundStrategy()
|
||||||
+ getAdditionalInfo() : String
|
+ useReadThroughAndWriteBehindStrategy()
|
||||||
+ getUserId() : String
|
}
|
||||||
+ getUserName() : String
|
~class Node {
|
||||||
+ setAdditionalInfo(additionalInfo : String)
|
~ next : Node
|
||||||
+ setUserId(userId : String)
|
~ previous : Node
|
||||||
+ setUserName(userName : String)
|
~ userAccount : UserAccount
|
||||||
+ toString() : String
|
~ userId : String
|
||||||
|
+ Node(this$0 : String, userId : UserAccount)
|
||||||
}
|
}
|
||||||
class CacheStore {
|
class CacheStore {
|
||||||
~ cache : LruCache {static}
|
~ cache : LruCache {static}
|
||||||
@ -36,12 +37,18 @@ package com.iluwatar.caching {
|
|||||||
+ printCacheContent() : String {static}
|
+ printCacheContent() : String {static}
|
||||||
+ save(userAccount : UserAccount) {static}
|
+ save(userAccount : UserAccount) {static}
|
||||||
}
|
}
|
||||||
~class Node {
|
class UserAccount {
|
||||||
~ next : Node
|
- additionalInfo : String
|
||||||
~ previous : Node
|
- userId : String
|
||||||
~ userAccount : UserAccount
|
- userName : String
|
||||||
~ userId : String
|
+ UserAccount(userId : String, userName : String, additionalInfo : String)
|
||||||
+ Node(this$0 : LruCache, userId : String, userAccount : UserAccount)
|
+ getAdditionalInfo() : String
|
||||||
|
+ getUserId() : String
|
||||||
|
+ getUserName() : String
|
||||||
|
+ setAdditionalInfo(additionalInfo : String)
|
||||||
|
+ setUserId(userId : String)
|
||||||
|
+ setUserName(userName : String)
|
||||||
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class LruCache {
|
class LruCache {
|
||||||
~ cache : Map<String, Node>
|
~ cache : Map<String, Node>
|
||||||
@ -74,13 +81,6 @@ package com.iluwatar.caching {
|
|||||||
+ upsertDb(userAccount : UserAccount) {static}
|
+ upsertDb(userAccount : UserAccount) {static}
|
||||||
+ writeToDb(userAccount : UserAccount) {static}
|
+ writeToDb(userAccount : UserAccount) {static}
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
+ useReadAndWriteThroughStrategy()
|
|
||||||
+ useReadThroughAndWriteAroundStrategy()
|
|
||||||
+ useReadThroughAndWriteBehindStrategy()
|
|
||||||
}
|
|
||||||
enum CachingPolicy {
|
enum CachingPolicy {
|
||||||
+ AROUND {static}
|
+ AROUND {static}
|
||||||
+ BEHIND {static}
|
+ BEHIND {static}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.callback {
|
package com.iluwatar.callback {
|
||||||
class LambdasApp {
|
interface Callback {
|
||||||
+ LambdasApp()
|
+ call() {abstract}
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class SimpleTask {
|
|
||||||
+ SimpleTask()
|
|
||||||
+ execute()
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
}
|
||||||
abstract class Task {
|
abstract class Task {
|
||||||
+ Task()
|
+ Task()
|
||||||
+ execute() {abstract}
|
+ execute() {abstract}
|
||||||
+ executeWith(callback : Callback)
|
+ executeWith(callback : Callback)
|
||||||
}
|
}
|
||||||
interface Callback {
|
class App {
|
||||||
+ call() {abstract}
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class SimpleTask {
|
||||||
|
+ SimpleTask()
|
||||||
|
+ execute()
|
||||||
|
}
|
||||||
|
class LambdasApp {
|
||||||
|
+ LambdasApp()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SimpleTask --|> Task
|
SimpleTask --|> Task
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.chain {
|
package com.iluwatar.chain {
|
||||||
|
class OrcSoldier {
|
||||||
|
+ OrcSoldier(handler : RequestHandler)
|
||||||
|
+ handleRequest(req : Request)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
class OrcCommander {
|
class OrcCommander {
|
||||||
+ OrcCommander(handler : RequestHandler)
|
+ OrcCommander(handler : RequestHandler)
|
||||||
+ handleRequest(req : Request)
|
+ handleRequest(req : Request)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class App {
|
class OrcKing {
|
||||||
+ App()
|
~ chain : RequestHandler
|
||||||
+ main(args : String[]) {static}
|
+ OrcKing()
|
||||||
|
- buildChain()
|
||||||
|
+ makeRequest(req : Request)
|
||||||
}
|
}
|
||||||
class Request {
|
class Request {
|
||||||
- handled : boolean
|
- handled : boolean
|
||||||
@ -20,21 +27,9 @@ package com.iluwatar.chain {
|
|||||||
+ markHandled()
|
+ markHandled()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class OrcOfficer {
|
class App {
|
||||||
+ OrcOfficer(handler : RequestHandler)
|
+ App()
|
||||||
+ handleRequest(req : Request)
|
+ main(args : String[]) {static}
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class OrcKing {
|
|
||||||
~ chain : RequestHandler
|
|
||||||
+ OrcKing()
|
|
||||||
- buildChain()
|
|
||||||
+ makeRequest(req : Request)
|
|
||||||
}
|
|
||||||
class OrcSoldier {
|
|
||||||
+ OrcSoldier(handler : RequestHandler)
|
|
||||||
+ handleRequest(req : Request)
|
|
||||||
+ toString() : String
|
|
||||||
}
|
}
|
||||||
abstract class RequestHandler {
|
abstract class RequestHandler {
|
||||||
- next : RequestHandler
|
- next : RequestHandler
|
||||||
@ -43,6 +38,11 @@ package com.iluwatar.chain {
|
|||||||
# printHandling(req : Request)
|
# printHandling(req : Request)
|
||||||
+ toString() : String {abstract}
|
+ toString() : String {abstract}
|
||||||
}
|
}
|
||||||
|
class OrcOfficer {
|
||||||
|
+ OrcOfficer(handler : RequestHandler)
|
||||||
|
+ handleRequest(req : Request)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
enum RequestType {
|
enum RequestType {
|
||||||
+ COLLECT_TAX {static}
|
+ COLLECT_TAX {static}
|
||||||
+ DEFEND_CASTLE {static}
|
+ DEFEND_CASTLE {static}
|
||||||
@ -52,9 +52,9 @@ package com.iluwatar.chain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RequestHandler --> "-next" RequestHandler
|
RequestHandler --> "-next" RequestHandler
|
||||||
OrcKing --> "-chain" RequestHandler
|
|
||||||
Request --> "-requestType" RequestType
|
Request --> "-requestType" RequestType
|
||||||
|
OrcKing --> "-chain" RequestHandler
|
||||||
|
OrcSoldier --|> RequestHandler
|
||||||
OrcCommander --|> RequestHandler
|
OrcCommander --|> RequestHandler
|
||||||
OrcOfficer --|> RequestHandler
|
OrcOfficer --|> RequestHandler
|
||||||
OrcSoldier --|> RequestHandler
|
|
||||||
@enduml
|
@enduml
|
@ -1,29 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.command {
|
package com.iluwatar.command {
|
||||||
abstract class Target {
|
|
||||||
- size : Size
|
|
||||||
- visibility : Visibility
|
|
||||||
+ Target()
|
|
||||||
+ getSize() : Size
|
|
||||||
+ getVisibility() : Visibility
|
|
||||||
+ printStatus()
|
|
||||||
+ setSize(size : Size)
|
|
||||||
+ setVisibility(visibility : Visibility)
|
|
||||||
+ toString() : String {abstract}
|
|
||||||
}
|
|
||||||
class Goblin {
|
|
||||||
+ Goblin()
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class ShrinkSpell {
|
|
||||||
- oldSize : Size
|
|
||||||
- target : Target
|
|
||||||
+ ShrinkSpell()
|
|
||||||
+ execute(target : Target)
|
|
||||||
+ redo()
|
|
||||||
+ toString() : String
|
|
||||||
+ undo()
|
|
||||||
}
|
|
||||||
class InvisibilitySpell {
|
class InvisibilitySpell {
|
||||||
- target : Target
|
- target : Target
|
||||||
+ InvisibilitySpell()
|
+ InvisibilitySpell()
|
||||||
@ -32,15 +8,6 @@ package com.iluwatar.command {
|
|||||||
+ toString() : String
|
+ toString() : String
|
||||||
+ undo()
|
+ undo()
|
||||||
}
|
}
|
||||||
class Wizard {
|
|
||||||
- redoStack : Deque<Command>
|
|
||||||
- undoStack : Deque<Command>
|
|
||||||
+ Wizard()
|
|
||||||
+ castSpell(command : Command, target : Target)
|
|
||||||
+ redoLastSpell()
|
|
||||||
+ toString() : String
|
|
||||||
+ undoLastSpell()
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
@ -52,6 +19,39 @@ package com.iluwatar.command {
|
|||||||
+ toString() : String {abstract}
|
+ toString() : String {abstract}
|
||||||
+ undo() {abstract}
|
+ undo() {abstract}
|
||||||
}
|
}
|
||||||
|
class Goblin {
|
||||||
|
+ Goblin()
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
abstract class Target {
|
||||||
|
- size : Size
|
||||||
|
- visibility : Visibility
|
||||||
|
+ Target()
|
||||||
|
+ getSize() : Size
|
||||||
|
+ getVisibility() : Visibility
|
||||||
|
+ printStatus()
|
||||||
|
+ setSize(size : Size)
|
||||||
|
+ setVisibility(visibility : Visibility)
|
||||||
|
+ toString() : String {abstract}
|
||||||
|
}
|
||||||
|
class Wizard {
|
||||||
|
- redoStack : Deque<Command>
|
||||||
|
- undoStack : Deque<Command>
|
||||||
|
+ Wizard()
|
||||||
|
+ castSpell(command : Command, target : Target)
|
||||||
|
+ redoLastSpell()
|
||||||
|
+ toString() : String
|
||||||
|
+ undoLastSpell()
|
||||||
|
}
|
||||||
|
class ShrinkSpell {
|
||||||
|
- oldSize : Size
|
||||||
|
- target : Target
|
||||||
|
+ ShrinkSpell()
|
||||||
|
+ execute(target : Target)
|
||||||
|
+ redo()
|
||||||
|
+ toString() : String
|
||||||
|
+ undo()
|
||||||
|
}
|
||||||
enum Size {
|
enum Size {
|
||||||
+ LARGE {static}
|
+ LARGE {static}
|
||||||
+ NORMAL {static}
|
+ NORMAL {static}
|
||||||
@ -78,7 +78,7 @@ ShrinkSpell --> "-oldSize" Size
|
|||||||
InvisibilitySpell --> "-target" Target
|
InvisibilitySpell --> "-target" Target
|
||||||
ShrinkSpell --> "-target" Target
|
ShrinkSpell --> "-target" Target
|
||||||
Target --> "-visibility" Visibility
|
Target --> "-visibility" Visibility
|
||||||
|
InvisibilitySpell --|> Command
|
||||||
Goblin --|> Target
|
Goblin --|> Target
|
||||||
ShrinkSpell --|> Command
|
ShrinkSpell --|> Command
|
||||||
InvisibilitySpell --|> Command
|
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,19 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.composite {
|
package com.iluwatar.composite {
|
||||||
|
class Word {
|
||||||
|
+ Word(letters : List<Letter>)
|
||||||
|
# printThisAfter()
|
||||||
|
# printThisBefore()
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class Messenger {
|
||||||
|
+ Messenger()
|
||||||
|
~ messageFromElves() : LetterComposite
|
||||||
|
~ messageFromOrcs() : LetterComposite
|
||||||
|
}
|
||||||
class Letter {
|
class Letter {
|
||||||
- c : char
|
- c : char
|
||||||
+ Letter(c : char)
|
+ Letter(c : char)
|
||||||
@ -11,20 +25,6 @@ package com.iluwatar.composite {
|
|||||||
# printThisAfter()
|
# printThisAfter()
|
||||||
# printThisBefore()
|
# printThisBefore()
|
||||||
}
|
}
|
||||||
class Word {
|
|
||||||
+ Word(letters : List<Letter>)
|
|
||||||
# printThisAfter()
|
|
||||||
# printThisBefore()
|
|
||||||
}
|
|
||||||
class Messenger {
|
|
||||||
+ Messenger()
|
|
||||||
~ messageFromElves() : LetterComposite
|
|
||||||
~ messageFromOrcs() : LetterComposite
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
abstract class LetterComposite {
|
abstract class LetterComposite {
|
||||||
- children : List<LetterComposite>
|
- children : List<LetterComposite>
|
||||||
+ LetterComposite()
|
+ LetterComposite()
|
||||||
@ -36,7 +36,7 @@ package com.iluwatar.composite {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LetterComposite --> "-children" LetterComposite
|
LetterComposite --> "-children" LetterComposite
|
||||||
|
Word --|> LetterComposite
|
||||||
Letter --|> LetterComposite
|
Letter --|> LetterComposite
|
||||||
Sentence --|> LetterComposite
|
Sentence --|> LetterComposite
|
||||||
Word --|> LetterComposite
|
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,49 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.dao {
|
package com.iluwatar.dao {
|
||||||
|
class InMemoryCustomerDao {
|
||||||
|
- idToCustomer : Map<Integer, Customer>
|
||||||
|
+ InMemoryCustomerDao()
|
||||||
|
+ add(customer : Customer) : boolean
|
||||||
|
+ delete(customer : Customer) : boolean
|
||||||
|
+ getAll() : Stream<Customer>
|
||||||
|
+ getById(id : int) : Optional<Customer>
|
||||||
|
+ update(customer : Customer) : boolean
|
||||||
|
}
|
||||||
|
interface CustomerSchemaSql {
|
||||||
|
+ CREATE_SCHEMA_SQL : String {static}
|
||||||
|
+ DELETE_SCHEMA_SQL : String {static}
|
||||||
|
}
|
||||||
|
interface CustomerDao {
|
||||||
|
+ add(Customer) : boolean {abstract}
|
||||||
|
+ delete(Customer) : boolean {abstract}
|
||||||
|
+ getAll() : Stream<Customer> {abstract}
|
||||||
|
+ getById(int) : Optional<Customer> {abstract}
|
||||||
|
+ update(Customer) : boolean {abstract}
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
- DB_URL : String {static}
|
||||||
|
- log : Logger {static}
|
||||||
|
+ App()
|
||||||
|
- addCustomers(customerDao : CustomerDao) {static}
|
||||||
|
- createDataSource() : DataSource {static}
|
||||||
|
- createSchema(dataSource : DataSource) {static}
|
||||||
|
- deleteSchema(dataSource : DataSource) {static}
|
||||||
|
+ generateSampleCustomers() : List<Customer> {static}
|
||||||
|
+ 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<Customer>
|
||||||
|
+ getById(id : int) : Optional<Customer>
|
||||||
|
- getConnection() : Connection
|
||||||
|
- mutedClose(connection : Connection)
|
||||||
|
+ update(customer : Customer) : boolean
|
||||||
|
}
|
||||||
class Customer {
|
class Customer {
|
||||||
- firstName : String
|
- firstName : String
|
||||||
- id : int
|
- id : int
|
||||||
@ -15,51 +59,7 @@ package com.iluwatar.dao {
|
|||||||
+ setLastName(lastName : String)
|
+ setLastName(lastName : String)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
interface CustomerDao {
|
|
||||||
+ add(Customer) : boolean {abstract}
|
|
||||||
+ delete(Customer) : boolean {abstract}
|
|
||||||
+ getAll() : Stream<Customer> {abstract}
|
|
||||||
+ getById(int) : Optional<Customer> {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<Customer>
|
|
||||||
+ getById(id : int) : Optional<Customer>
|
|
||||||
- getConnection() : Connection
|
|
||||||
- mutedClose(connection : Connection)
|
|
||||||
+ update(customer : Customer) : boolean
|
|
||||||
}
|
|
||||||
class InMemoryCustomerDao {
|
|
||||||
- idToCustomer : Map<Integer, Customer>
|
|
||||||
+ InMemoryCustomerDao()
|
|
||||||
+ add(customer : Customer) : boolean
|
|
||||||
+ delete(customer : Customer) : boolean
|
|
||||||
+ getAll() : Stream<Customer>
|
|
||||||
+ getById(id : int) : Optional<Customer>
|
|
||||||
+ update(customer : Customer) : boolean
|
|
||||||
}
|
|
||||||
interface CustomerSchemaSql {
|
|
||||||
+ CREATE_SCHEMA_SQL : String {static}
|
|
||||||
+ DELETE_SCHEMA_SQL : String {static}
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
- DB_URL : String {static}
|
|
||||||
- log : Logger {static}
|
|
||||||
+ App()
|
|
||||||
- addCustomers(customerDao : CustomerDao) {static}
|
|
||||||
- createDataSource() : DataSource {static}
|
|
||||||
- createSchema(dataSource : DataSource) {static}
|
|
||||||
- deleteSchema(dataSource : DataSource) {static}
|
|
||||||
+ generateSampleCustomers() : List<Customer> {static}
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
- performOperationsUsing(customerDao : CustomerDao) {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DbCustomerDao ..|> CustomerDao
|
|
||||||
InMemoryCustomerDao ..|> CustomerDao
|
InMemoryCustomerDao ..|> CustomerDao
|
||||||
|
DbCustomerDao ..|> CustomerDao
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,10 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.decorator {
|
package com.iluwatar.decorator {
|
||||||
|
interface Hostile {
|
||||||
|
+ attack() {abstract}
|
||||||
|
+ fleeBattle() {abstract}
|
||||||
|
+ getAttackPower() : int {abstract}
|
||||||
|
}
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
@ -10,11 +15,6 @@ package com.iluwatar.decorator {
|
|||||||
+ fleeBattle()
|
+ fleeBattle()
|
||||||
+ getAttackPower() : int
|
+ getAttackPower() : int
|
||||||
}
|
}
|
||||||
interface Hostile {
|
|
||||||
+ attack() {abstract}
|
|
||||||
+ fleeBattle() {abstract}
|
|
||||||
+ getAttackPower() : int {abstract}
|
|
||||||
}
|
|
||||||
class SmartHostile {
|
class SmartHostile {
|
||||||
- decorated : Hostile
|
- decorated : Hostile
|
||||||
+ SmartHostile(decorated : Hostile)
|
+ SmartHostile(decorated : Hostile)
|
||||||
|
@ -1,19 +1,24 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.delegation.simple.printers {
|
package com.iluwatar.delegation.simple.printers {
|
||||||
class EpsonPrinter {
|
|
||||||
+ EpsonPrinter()
|
|
||||||
+ print(message : String)
|
|
||||||
}
|
|
||||||
class HpPrinter {
|
class HpPrinter {
|
||||||
+ HpPrinter()
|
+ HpPrinter()
|
||||||
+ print(message : String)
|
+ print(message : String)
|
||||||
}
|
}
|
||||||
|
class EpsonPrinter {
|
||||||
|
+ EpsonPrinter()
|
||||||
|
+ print(message : String)
|
||||||
|
}
|
||||||
class CanonPrinter {
|
class CanonPrinter {
|
||||||
+ CanonPrinter()
|
+ CanonPrinter()
|
||||||
+ print(message : String)
|
+ print(message : String)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.delegation.simple {
|
package com.iluwatar.delegation.simple {
|
||||||
|
class App {
|
||||||
|
+ MESSAGE_TO_PRINT : String {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class PrinterController {
|
class PrinterController {
|
||||||
- printer : Printer
|
- printer : Printer
|
||||||
+ PrinterController(printer : Printer)
|
+ PrinterController(printer : Printer)
|
||||||
@ -22,15 +27,10 @@ package com.iluwatar.delegation.simple {
|
|||||||
interface Printer {
|
interface Printer {
|
||||||
+ print(String) {abstract}
|
+ print(String) {abstract}
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ MESSAGE_TO_PRINT : String {static}
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PrinterController --> "-printer" Printer
|
PrinterController --> "-printer" Printer
|
||||||
|
HpPrinter ..|> Printer
|
||||||
PrinterController ..|> Printer
|
PrinterController ..|> Printer
|
||||||
EpsonPrinter ..|> Printer
|
EpsonPrinter ..|> Printer
|
||||||
HpPrinter ..|> Printer
|
|
||||||
CanonPrinter ..|> Printer
|
CanonPrinter ..|> Printer
|
||||||
@enduml
|
@enduml
|
@ -1,48 +1,48 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.dependency.injection {
|
package com.iluwatar.dependency.injection {
|
||||||
interface Wizard {
|
|
||||||
+ smoke() {abstract}
|
|
||||||
}
|
|
||||||
class GuiceWizard {
|
|
||||||
- tobacco : Tobacco
|
|
||||||
+ GuiceWizard(tobacco : Tobacco)
|
|
||||||
+ smoke()
|
|
||||||
}
|
|
||||||
class OldTobyTobacco {
|
|
||||||
+ OldTobyTobacco()
|
|
||||||
}
|
|
||||||
abstract class Tobacco {
|
|
||||||
+ Tobacco()
|
|
||||||
+ smoke(wizard : Wizard)
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class RivendellTobacco {
|
|
||||||
+ RivendellTobacco()
|
|
||||||
}
|
|
||||||
class AdvancedWizard {
|
class AdvancedWizard {
|
||||||
- tobacco : Tobacco
|
- tobacco : Tobacco
|
||||||
+ AdvancedWizard(tobacco : Tobacco)
|
+ AdvancedWizard(tobacco : Tobacco)
|
||||||
+ smoke()
|
+ smoke()
|
||||||
}
|
}
|
||||||
class SecondBreakfastTobacco {
|
interface Wizard {
|
||||||
+ SecondBreakfastTobacco()
|
+ smoke() {abstract}
|
||||||
|
}
|
||||||
|
class RivendellTobacco {
|
||||||
|
+ RivendellTobacco()
|
||||||
}
|
}
|
||||||
class SimpleWizard {
|
class SimpleWizard {
|
||||||
- tobacco : OldTobyTobacco
|
- tobacco : OldTobyTobacco
|
||||||
+ SimpleWizard()
|
+ SimpleWizard()
|
||||||
+ smoke()
|
+ smoke()
|
||||||
}
|
}
|
||||||
|
class OldTobyTobacco {
|
||||||
|
+ OldTobyTobacco()
|
||||||
|
}
|
||||||
|
class SecondBreakfastTobacco {
|
||||||
|
+ SecondBreakfastTobacco()
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
abstract class Tobacco {
|
||||||
|
+ Tobacco()
|
||||||
|
+ smoke(wizard : Wizard)
|
||||||
|
}
|
||||||
|
class GuiceWizard {
|
||||||
|
- tobacco : Tobacco
|
||||||
|
+ GuiceWizard(tobacco : Tobacco)
|
||||||
|
+ smoke()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SimpleWizard --> "-tobacco" OldTobyTobacco
|
SimpleWizard --> "-tobacco" OldTobyTobacco
|
||||||
AdvancedWizard --> "-tobacco" Tobacco
|
AdvancedWizard --> "-tobacco" Tobacco
|
||||||
GuiceWizard --> "-tobacco" Tobacco
|
GuiceWizard --> "-tobacco" Tobacco
|
||||||
GuiceWizard ..|> Wizard
|
|
||||||
OldTobyTobacco --|> Tobacco
|
|
||||||
RivendellTobacco --|> Tobacco
|
|
||||||
AdvancedWizard ..|> Wizard
|
AdvancedWizard ..|> Wizard
|
||||||
SecondBreakfastTobacco --|> Tobacco
|
RivendellTobacco --|> Tobacco
|
||||||
SimpleWizard ..|> Wizard
|
SimpleWizard ..|> Wizard
|
||||||
|
OldTobyTobacco --|> Tobacco
|
||||||
|
SecondBreakfastTobacco --|> Tobacco
|
||||||
|
GuiceWizard ..|> Wizard
|
||||||
@enduml
|
@enduml
|
@ -1,17 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.doubledispatch {
|
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 {
|
abstract class GameObject {
|
||||||
- damaged : boolean
|
- damaged : boolean
|
||||||
- onFire : boolean
|
- onFire : boolean
|
||||||
@ -27,6 +15,14 @@ package com.iluwatar.doubledispatch {
|
|||||||
+ setOnFire(onFire : boolean)
|
+ setOnFire(onFire : boolean)
|
||||||
+ toString() : String
|
+ 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 {
|
class SpaceStationMir {
|
||||||
+ SpaceStationMir(left : int, top : int, right : int, bottom : int)
|
+ SpaceStationMir(left : int, top : int, right : int, bottom : int)
|
||||||
+ collision(gameObject : GameObject)
|
+ collision(gameObject : GameObject)
|
||||||
@ -56,10 +52,14 @@ package com.iluwatar.doubledispatch {
|
|||||||
~ intersectsWith(r : Rectangle) : boolean
|
~ intersectsWith(r : Rectangle) : boolean
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FlamingAsteroid --|> Meteoroid
|
|
||||||
SpaceStationIss --|> SpaceStationMir
|
|
||||||
GameObject --|> Rectangle
|
GameObject --|> Rectangle
|
||||||
|
SpaceStationIss --|> SpaceStationMir
|
||||||
|
FlamingAsteroid --|> Meteoroid
|
||||||
SpaceStationMir --|> GameObject
|
SpaceStationMir --|> GameObject
|
||||||
Meteoroid --|> GameObject
|
Meteoroid --|> GameObject
|
||||||
@enduml
|
@enduml
|
@ -1,34 +1,10 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.event.aggregator {
|
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 {
|
class LordVarys {
|
||||||
+ LordVarys()
|
+ LordVarys()
|
||||||
+ LordVarys(obs : EventObserver)
|
+ LordVarys(obs : EventObserver)
|
||||||
+ timePasses(day : Weekday)
|
+ timePasses(day : Weekday)
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class LordBaelish {
|
|
||||||
+ LordBaelish()
|
|
||||||
+ LordBaelish(obs : EventObserver)
|
|
||||||
+ timePasses(day : Weekday)
|
|
||||||
}
|
|
||||||
abstract class EventEmitter {
|
abstract class EventEmitter {
|
||||||
- observers : List<EventObserver>
|
- observers : List<EventObserver>
|
||||||
+ EventEmitter()
|
+ EventEmitter()
|
||||||
@ -37,9 +13,33 @@ package com.iluwatar.event.aggregator {
|
|||||||
+ registerObserver(obs : EventObserver)
|
+ registerObserver(obs : EventObserver)
|
||||||
+ timePasses(Weekday) {abstract}
|
+ timePasses(Weekday) {abstract}
|
||||||
}
|
}
|
||||||
|
class KingJoffrey {
|
||||||
|
+ KingJoffrey()
|
||||||
|
+ onEvent(e : Event)
|
||||||
|
}
|
||||||
|
class LordBaelish {
|
||||||
|
+ LordBaelish()
|
||||||
|
+ LordBaelish(obs : EventObserver)
|
||||||
|
+ timePasses(day : Weekday)
|
||||||
|
}
|
||||||
interface EventObserver {
|
interface EventObserver {
|
||||||
+ onEvent(Event) {abstract}
|
+ 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 {
|
enum Weekday {
|
||||||
+ FRIDAY {static}
|
+ FRIDAY {static}
|
||||||
+ MONDAY {static}
|
+ MONDAY {static}
|
||||||
@ -64,10 +64,10 @@ package com.iluwatar.event.aggregator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EventEmitter --> "-observers" EventObserver
|
EventEmitter --> "-observers" EventObserver
|
||||||
|
LordVarys --|> EventEmitter
|
||||||
|
KingJoffrey ..|> EventObserver
|
||||||
|
LordBaelish --|> EventEmitter
|
||||||
KingsHand ..|> EventObserver
|
KingsHand ..|> EventObserver
|
||||||
KingsHand --|> EventEmitter
|
KingsHand --|> EventEmitter
|
||||||
KingJoffrey ..|> EventObserver
|
|
||||||
Scout --|> EventEmitter
|
Scout --|> EventEmitter
|
||||||
LordVarys --|> EventEmitter
|
|
||||||
LordBaelish --|> EventEmitter
|
|
||||||
@enduml
|
@enduml
|
@ -1,31 +1,34 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.eda.handler {
|
package com.iluwatar.eda.handler {
|
||||||
class UserUpdatedEventHandler {
|
|
||||||
+ UserUpdatedEventHandler()
|
|
||||||
+ onEvent(event : UserUpdatedEvent)
|
|
||||||
}
|
|
||||||
class UserCreatedEventHandler {
|
class UserCreatedEventHandler {
|
||||||
+ UserCreatedEventHandler()
|
+ UserCreatedEventHandler()
|
||||||
+ onEvent(event : UserCreatedEvent)
|
+ onEvent(event : UserCreatedEvent)
|
||||||
}
|
}
|
||||||
|
class UserUpdatedEventHandler {
|
||||||
|
+ UserUpdatedEventHandler()
|
||||||
|
+ onEvent(event : UserUpdatedEvent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.eda.event {
|
package com.iluwatar.eda.event {
|
||||||
abstract class AbstractEvent {
|
abstract class AbstractEvent {
|
||||||
+ AbstractEvent()
|
+ AbstractEvent()
|
||||||
+ getType() : Class<? extends Event>
|
+ getType() : Class<? extends Event>
|
||||||
}
|
}
|
||||||
class UserUpdatedEvent {
|
|
||||||
- user : User
|
|
||||||
+ UserUpdatedEvent(user : User)
|
|
||||||
+ getUser() : User
|
|
||||||
}
|
|
||||||
class UserCreatedEvent {
|
class UserCreatedEvent {
|
||||||
- user : User
|
- user : User
|
||||||
+ UserCreatedEvent(user : User)
|
+ UserCreatedEvent(user : User)
|
||||||
+ getUser() : User
|
+ getUser() : User
|
||||||
}
|
}
|
||||||
|
class UserUpdatedEvent {
|
||||||
|
- user : User
|
||||||
|
+ UserUpdatedEvent(user : User)
|
||||||
|
+ getUser() : User
|
||||||
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.eda.framework {
|
package com.iluwatar.eda.framework {
|
||||||
|
interface Handler<E extends Event> {
|
||||||
|
+ onEvent(E extends Event) {abstract}
|
||||||
|
}
|
||||||
class EventDispatcher {
|
class EventDispatcher {
|
||||||
- handlers : Map<Class<? extends Event>, Handler<? extends Event>>
|
- handlers : Map<Class<? extends Event>, Handler<? extends Event>>
|
||||||
+ EventDispatcher()
|
+ EventDispatcher()
|
||||||
@ -35,9 +38,6 @@ package com.iluwatar.eda.framework {
|
|||||||
interface Event {
|
interface Event {
|
||||||
+ getType() : Class<? extends Event> {abstract}
|
+ getType() : Class<? extends Event> {abstract}
|
||||||
}
|
}
|
||||||
interface Handler<E extends Event> {
|
|
||||||
+ onEvent(E extends Event) {abstract}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
package com.iluwatar.eda.model {
|
package com.iluwatar.eda.model {
|
||||||
class User {
|
class User {
|
||||||
@ -52,11 +52,11 @@ package com.iluwatar.eda {
|
|||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UserCreatedEvent --> "-user" User
|
|
||||||
UserUpdatedEvent --> "-user" User
|
UserUpdatedEvent --> "-user" User
|
||||||
|
UserCreatedEvent --> "-user" User
|
||||||
AbstractEvent ..|> Event
|
AbstractEvent ..|> Event
|
||||||
UserUpdatedEventHandler ..|> Handler
|
UserCreatedEvent --|> AbstractEvent
|
||||||
UserCreatedEventHandler ..|> Handler
|
UserCreatedEventHandler ..|> Handler
|
||||||
UserUpdatedEvent --|> AbstractEvent
|
UserUpdatedEvent --|> AbstractEvent
|
||||||
UserCreatedEvent --|> AbstractEvent
|
UserUpdatedEventHandler ..|> Handler
|
||||||
@enduml
|
@enduml
|
@ -1,8 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.execute.around {
|
package com.iluwatar.execute.around {
|
||||||
interface FileWriterAction {
|
|
||||||
+ writeFile(FileWriter) {abstract}
|
|
||||||
}
|
|
||||||
class SimpleFileWriter {
|
class SimpleFileWriter {
|
||||||
+ SimpleFileWriter(filename : String, action : FileWriterAction)
|
+ SimpleFileWriter(filename : String, action : FileWriterAction)
|
||||||
}
|
}
|
||||||
@ -10,5 +7,8 @@ package com.iluwatar.execute.around {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
interface FileWriterAction {
|
||||||
|
+ writeFile(FileWriter) {abstract}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@enduml
|
@enduml
|
@ -1,7 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.facade {
|
package com.iluwatar.facade {
|
||||||
class DwarvenTunnelDigger {
|
class DwarvenGoldDigger {
|
||||||
+ DwarvenTunnelDigger()
|
+ DwarvenGoldDigger()
|
||||||
+ name() : String
|
+ name() : String
|
||||||
+ work()
|
+ work()
|
||||||
}
|
}
|
||||||
@ -13,15 +13,11 @@ package com.iluwatar.facade {
|
|||||||
- makeActions(workers : Collection<DwarvenMineWorker>, actions : Action[]) {static}
|
- makeActions(workers : Collection<DwarvenMineWorker>, actions : Action[]) {static}
|
||||||
+ startNewDay()
|
+ startNewDay()
|
||||||
}
|
}
|
||||||
class DwarvenGoldDigger {
|
class DwarvenTunnelDigger {
|
||||||
+ DwarvenGoldDigger()
|
+ DwarvenTunnelDigger()
|
||||||
+ name() : String
|
+ name() : String
|
||||||
+ work()
|
+ work()
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
abstract class DwarvenMineWorker {
|
abstract class DwarvenMineWorker {
|
||||||
+ DwarvenMineWorker()
|
+ DwarvenMineWorker()
|
||||||
- action(action : Action)
|
- action(action : Action)
|
||||||
@ -33,6 +29,10 @@ package com.iluwatar.facade {
|
|||||||
+ wakeUp()
|
+ wakeUp()
|
||||||
+ work() {abstract}
|
+ work() {abstract}
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class DwarvenCartOperator {
|
class DwarvenCartOperator {
|
||||||
+ DwarvenCartOperator()
|
+ DwarvenCartOperator()
|
||||||
+ name() : String
|
+ name() : String
|
||||||
@ -51,7 +51,7 @@ package com.iluwatar.facade {
|
|||||||
DwarvenGoldmineFacade --+ DwarvenMineWorker
|
DwarvenGoldmineFacade --+ DwarvenMineWorker
|
||||||
DwarvenGoldmineFacade --> "-workers" DwarvenMineWorker
|
DwarvenGoldmineFacade --> "-workers" DwarvenMineWorker
|
||||||
Action ..+ DwarvenMineWorker
|
Action ..+ DwarvenMineWorker
|
||||||
DwarvenTunnelDigger --|> DwarvenMineWorker
|
|
||||||
DwarvenGoldDigger --|> DwarvenMineWorker
|
DwarvenGoldDigger --|> DwarvenMineWorker
|
||||||
|
DwarvenTunnelDigger --|> DwarvenMineWorker
|
||||||
DwarvenCartOperator --|> DwarvenMineWorker
|
DwarvenCartOperator --|> DwarvenMineWorker
|
||||||
@enduml
|
@enduml
|
@ -1,33 +1,33 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.factorykit {
|
package com.iluwatar.factorykit {
|
||||||
interface Builder {
|
|
||||||
+ add(WeaponType, Supplier<Weapon>) {abstract}
|
|
||||||
}
|
|
||||||
class Spear {
|
class Spear {
|
||||||
+ Spear()
|
+ Spear()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class Bow {
|
class App {
|
||||||
+ Bow()
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
interface Weapon {
|
||||||
|
}
|
||||||
|
interface WeaponFactory {
|
||||||
|
+ create(WeaponType) : Weapon {abstract}
|
||||||
|
+ factory(consumer : Consumer<Builder>) : WeaponFactory {static}
|
||||||
|
}
|
||||||
|
class Axe {
|
||||||
|
+ Axe()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class Sword {
|
class Sword {
|
||||||
+ Sword()
|
+ Sword()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
interface Weapon {
|
class Bow {
|
||||||
}
|
+ Bow()
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class Axe {
|
|
||||||
+ Axe()
|
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
interface WeaponFactory {
|
interface Builder {
|
||||||
+ create(WeaponType) : Weapon {abstract}
|
+ add(WeaponType, Supplier<Weapon>) {abstract}
|
||||||
+ factory(consumer : Consumer<Builder>) : WeaponFactory {static}
|
|
||||||
}
|
}
|
||||||
enum WeaponType {
|
enum WeaponType {
|
||||||
+ AXE {static}
|
+ AXE {static}
|
||||||
@ -39,7 +39,7 @@ package com.iluwatar.factorykit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Spear ..|> Weapon
|
Spear ..|> Weapon
|
||||||
Bow ..|> Weapon
|
|
||||||
Sword ..|> Weapon
|
|
||||||
Axe ..|> Weapon
|
Axe ..|> Weapon
|
||||||
|
Sword ..|> Weapon
|
||||||
|
Bow ..|> Weapon
|
||||||
@enduml
|
@enduml
|
@ -17,9 +17,6 @@ package com.iluwatar.factory.method {
|
|||||||
interface Blacksmith {
|
interface Blacksmith {
|
||||||
+ manufactureWeapon(WeaponType) : Weapon {abstract}
|
+ manufactureWeapon(WeaponType) : Weapon {abstract}
|
||||||
}
|
}
|
||||||
interface Weapon {
|
|
||||||
+ getWeaponType() : WeaponType {abstract}
|
|
||||||
}
|
|
||||||
class ElfWeapon {
|
class ElfWeapon {
|
||||||
- weaponType : WeaponType
|
- weaponType : WeaponType
|
||||||
+ ElfWeapon(weaponType : WeaponType)
|
+ ElfWeapon(weaponType : WeaponType)
|
||||||
@ -32,6 +29,9 @@ package com.iluwatar.factory.method {
|
|||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
- manufactureWeapons()
|
- manufactureWeapons()
|
||||||
}
|
}
|
||||||
|
interface Weapon {
|
||||||
|
+ getWeaponType() : WeaponType {abstract}
|
||||||
|
}
|
||||||
enum WeaponType {
|
enum WeaponType {
|
||||||
+ AXE {static}
|
+ AXE {static}
|
||||||
+ SHORT_SWORD {static}
|
+ SHORT_SWORD {static}
|
||||||
|
@ -20,17 +20,17 @@ package com.iluwatar.featuretoggle.user {
|
|||||||
+ isPaid(user : User) : boolean {static}
|
+ isPaid(user : User) : boolean {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.featuretoggle.pattern.propertiesversion {
|
package com.iluwatar.featuretoggle.pattern.tieredversion {
|
||||||
class PropertiesFeatureToggleVersion {
|
class TieredFeatureToggleVersion {
|
||||||
- isEnhanced : boolean
|
+ TieredFeatureToggleVersion()
|
||||||
+ PropertiesFeatureToggleVersion(properties : Properties)
|
|
||||||
+ getWelcomeMessage(user : User) : String
|
+ getWelcomeMessage(user : User) : String
|
||||||
+ isEnhanced() : boolean
|
+ isEnhanced() : boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.featuretoggle.pattern.tieredversion {
|
package com.iluwatar.featuretoggle.pattern.propertiesversion {
|
||||||
class TieredFeatureToggleVersion {
|
class PropertiesFeatureToggleVersion {
|
||||||
+ TieredFeatureToggleVersion()
|
- isEnhanced : boolean
|
||||||
|
+ PropertiesFeatureToggleVersion(properties : Properties)
|
||||||
+ getWelcomeMessage(user : User) : String
|
+ getWelcomeMessage(user : User) : String
|
||||||
+ isEnhanced() : boolean
|
+ isEnhanced() : boolean
|
||||||
}
|
}
|
||||||
@ -42,6 +42,6 @@ package com.iluwatar.featuretoggle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
UserGroup --> "-freeGroup" User
|
UserGroup --> "-freeGroup" User
|
||||||
TieredFeatureToggleVersion ..|> Service
|
|
||||||
PropertiesFeatureToggleVersion ..|> Service
|
PropertiesFeatureToggleVersion ..|> Service
|
||||||
|
TieredFeatureToggleVersion ..|> Service
|
||||||
@enduml
|
@enduml
|
@ -31,6 +31,14 @@ package com.iluwatar.fluentinterface.app {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.fluentinterface.fluentiterable.lazy {
|
package com.iluwatar.fluentinterface.fluentiterable.lazy {
|
||||||
|
abstract class DecoratingIterator<E> {
|
||||||
|
# fromIterator : Iterator<E>
|
||||||
|
- next : E
|
||||||
|
+ DecoratingIterator<E>(fromIterator : Iterator<E>)
|
||||||
|
+ computeNext() : E {abstract}
|
||||||
|
+ hasNext() : boolean
|
||||||
|
+ next() : E
|
||||||
|
}
|
||||||
class LazyFluentIterable<E> {
|
class LazyFluentIterable<E> {
|
||||||
- iterable : Iterable<E>
|
- iterable : Iterable<E>
|
||||||
# LazyFluentIterable<E>()
|
# LazyFluentIterable<E>()
|
||||||
@ -45,14 +53,6 @@ package com.iluwatar.fluentinterface.fluentiterable.lazy {
|
|||||||
+ last(count : int) : FluentIterable<E>
|
+ last(count : int) : FluentIterable<E>
|
||||||
+ map(function : Function<? super E, T>) : FluentIterable<T>
|
+ map(function : Function<? super E, T>) : FluentIterable<T>
|
||||||
}
|
}
|
||||||
abstract class DecoratingIterator<E> {
|
|
||||||
# fromIterator : Iterator<E>
|
|
||||||
- next : E
|
|
||||||
+ DecoratingIterator<E>(fromIterator : Iterator<E>)
|
|
||||||
+ computeNext() : E {abstract}
|
|
||||||
+ hasNext() : boolean
|
|
||||||
+ next() : E
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
package com.iluwatar.fluentinterface.fluentiterable {
|
package com.iluwatar.fluentinterface.fluentiterable {
|
||||||
interface FluentIterable<E> {
|
interface FluentIterable<E> {
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.flux.view {
|
package com.iluwatar.flux.view {
|
||||||
class ContentView {
|
interface View {
|
||||||
- content : Content
|
+ render() {abstract}
|
||||||
+ ContentView()
|
+ storeChanged(Store) {abstract}
|
||||||
+ render()
|
|
||||||
+ storeChanged(store : Store)
|
|
||||||
}
|
}
|
||||||
class MenuView {
|
class MenuView {
|
||||||
- selected : MenuItem
|
- selected : MenuItem
|
||||||
@ -13,27 +11,35 @@ package com.iluwatar.flux.view {
|
|||||||
+ render()
|
+ render()
|
||||||
+ storeChanged(store : Store)
|
+ storeChanged(store : Store)
|
||||||
}
|
}
|
||||||
interface View {
|
class ContentView {
|
||||||
+ render() {abstract}
|
- content : Content
|
||||||
+ storeChanged(Store) {abstract}
|
+ ContentView()
|
||||||
|
+ render()
|
||||||
|
+ storeChanged(store : Store)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.flux.action {
|
package com.iluwatar.flux.action {
|
||||||
class ContentAction {
|
|
||||||
- content : Content
|
|
||||||
+ ContentAction(content : Content)
|
|
||||||
+ getContent() : Content
|
|
||||||
}
|
|
||||||
class MenuAction {
|
class MenuAction {
|
||||||
- menuItem : MenuItem
|
- menuItem : MenuItem
|
||||||
+ MenuAction(menuItem : MenuItem)
|
+ MenuAction(menuItem : MenuItem)
|
||||||
+ getMenuItem() : MenuItem
|
+ getMenuItem() : MenuItem
|
||||||
}
|
}
|
||||||
|
class ContentAction {
|
||||||
|
- content : Content
|
||||||
|
+ ContentAction(content : Content)
|
||||||
|
+ getContent() : Content
|
||||||
|
}
|
||||||
abstract class Action {
|
abstract class Action {
|
||||||
- type : ActionType
|
- type : ActionType
|
||||||
+ Action(type : ActionType)
|
+ Action(type : ActionType)
|
||||||
+ getType() : ActionType
|
+ getType() : ActionType
|
||||||
}
|
}
|
||||||
|
enum ActionType {
|
||||||
|
+ CONTENT_CHANGED {static}
|
||||||
|
+ MENU_ITEM_SELECTED {static}
|
||||||
|
+ valueOf(name : String) : ActionType {static}
|
||||||
|
+ values() : ActionType[] {static}
|
||||||
|
}
|
||||||
enum MenuItem {
|
enum MenuItem {
|
||||||
+ COMPANY {static}
|
+ COMPANY {static}
|
||||||
+ HOME {static}
|
+ HOME {static}
|
||||||
@ -51,12 +57,6 @@ package com.iluwatar.flux.action {
|
|||||||
+ valueOf(name : String) : Content {static}
|
+ valueOf(name : String) : Content {static}
|
||||||
+ values() : 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 {
|
package com.iluwatar.flux.app {
|
||||||
class App {
|
class App {
|
||||||
@ -64,27 +64,6 @@ package com.iluwatar.flux.app {
|
|||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.flux.store {
|
|
||||||
abstract class Store {
|
|
||||||
- views : List<View>
|
|
||||||
+ Store()
|
|
||||||
# notifyChange()
|
|
||||||
+ onAction(Action) {abstract}
|
|
||||||
+ registerView(view : View)
|
|
||||||
}
|
|
||||||
class ContentStore {
|
|
||||||
- content : Content
|
|
||||||
+ ContentStore()
|
|
||||||
+ getContent() : Content
|
|
||||||
+ onAction(action : Action)
|
|
||||||
}
|
|
||||||
class MenuStore {
|
|
||||||
- selected : MenuItem
|
|
||||||
+ MenuStore()
|
|
||||||
+ getSelected() : MenuItem
|
|
||||||
+ onAction(action : Action)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
package com.iluwatar.flux.dispatcher {
|
package com.iluwatar.flux.dispatcher {
|
||||||
class Dispatcher {
|
class Dispatcher {
|
||||||
- instance : Dispatcher {static}
|
- instance : Dispatcher {static}
|
||||||
@ -96,6 +75,27 @@ package com.iluwatar.flux.dispatcher {
|
|||||||
+ registerStore(store : Store)
|
+ registerStore(store : Store)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
package com.iluwatar.flux.store {
|
||||||
|
class ContentStore {
|
||||||
|
- content : Content
|
||||||
|
+ ContentStore()
|
||||||
|
+ getContent() : Content
|
||||||
|
+ onAction(action : Action)
|
||||||
|
}
|
||||||
|
class MenuStore {
|
||||||
|
- selected : MenuItem
|
||||||
|
+ MenuStore()
|
||||||
|
+ getSelected() : MenuItem
|
||||||
|
+ onAction(action : Action)
|
||||||
|
}
|
||||||
|
abstract class Store {
|
||||||
|
- views : List<View>
|
||||||
|
+ Store()
|
||||||
|
# notifyChange()
|
||||||
|
+ onAction(Action) {abstract}
|
||||||
|
+ registerView(view : View)
|
||||||
|
}
|
||||||
|
}
|
||||||
MenuAction --> "-menuItem" MenuItem
|
MenuAction --> "-menuItem" MenuItem
|
||||||
Action --> "-type" ActionType
|
Action --> "-type" ActionType
|
||||||
MenuStore --> "-selected" MenuItem
|
MenuStore --> "-selected" MenuItem
|
||||||
@ -104,12 +104,12 @@ ContentView --> "-content" Content
|
|||||||
Dispatcher --> "-stores" Store
|
Dispatcher --> "-stores" Store
|
||||||
MenuView --> "-selected" MenuItem
|
MenuView --> "-selected" MenuItem
|
||||||
Store --> "-views" View
|
Store --> "-views" View
|
||||||
ContentStore --> "-content" Content
|
|
||||||
ContentAction --> "-content" Content
|
ContentAction --> "-content" Content
|
||||||
ContentAction --|> Action
|
ContentStore --> "-content" Content
|
||||||
ContentStore --|> Store
|
ContentStore --|> Store
|
||||||
ContentView ..|> View
|
|
||||||
MenuAction --|> Action
|
MenuAction --|> Action
|
||||||
MenuView ..|> View
|
|
||||||
MenuStore --|> Store
|
MenuStore --|> Store
|
||||||
|
ContentAction --|> Action
|
||||||
|
MenuView ..|> View
|
||||||
|
ContentView ..|> View
|
||||||
@enduml
|
@enduml
|
@ -1,28 +1,17 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.flyweight {
|
package com.iluwatar.flyweight {
|
||||||
class PoisonPotion {
|
|
||||||
+ PoisonPotion()
|
|
||||||
+ drink()
|
|
||||||
}
|
|
||||||
class StrengthPotion {
|
|
||||||
+ StrengthPotion()
|
|
||||||
+ drink()
|
|
||||||
}
|
|
||||||
class HealingPotion {
|
|
||||||
+ HealingPotion()
|
|
||||||
+ drink()
|
|
||||||
}
|
|
||||||
class PotionFactory {
|
class PotionFactory {
|
||||||
- potions : Map<PotionType, Potion>
|
- potions : Map<PotionType, Potion>
|
||||||
+ PotionFactory()
|
+ PotionFactory()
|
||||||
~ createPotion(type : PotionType) : Potion
|
~ createPotion(type : PotionType) : Potion
|
||||||
}
|
}
|
||||||
interface Potion {
|
class HealingPotion {
|
||||||
+ drink() {abstract}
|
+ HealingPotion()
|
||||||
|
+ drink()
|
||||||
}
|
}
|
||||||
class App {
|
class InvisibilityPotion {
|
||||||
+ App()
|
+ InvisibilityPotion()
|
||||||
+ main(args : String[]) {static}
|
+ drink()
|
||||||
}
|
}
|
||||||
class AlchemistShop {
|
class AlchemistShop {
|
||||||
- bottomShelf : List<Potion>
|
- bottomShelf : List<Potion>
|
||||||
@ -33,12 +22,23 @@ package com.iluwatar.flyweight {
|
|||||||
+ getBottomShelf() : List<Potion>
|
+ getBottomShelf() : List<Potion>
|
||||||
+ getTopShelf() : List<Potion>
|
+ getTopShelf() : List<Potion>
|
||||||
}
|
}
|
||||||
class HolyWaterPotion {
|
class App {
|
||||||
+ HolyWaterPotion()
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
interface Potion {
|
||||||
|
+ drink() {abstract}
|
||||||
|
}
|
||||||
|
class PoisonPotion {
|
||||||
|
+ PoisonPotion()
|
||||||
+ drink()
|
+ drink()
|
||||||
}
|
}
|
||||||
class InvisibilityPotion {
|
class StrengthPotion {
|
||||||
+ InvisibilityPotion()
|
+ StrengthPotion()
|
||||||
|
+ drink()
|
||||||
|
}
|
||||||
|
class HolyWaterPotion {
|
||||||
|
+ HolyWaterPotion()
|
||||||
+ drink()
|
+ drink()
|
||||||
}
|
}
|
||||||
enum PotionType {
|
enum PotionType {
|
||||||
@ -52,9 +52,9 @@ package com.iluwatar.flyweight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AlchemistShop --> "-topShelf" Potion
|
AlchemistShop --> "-topShelf" Potion
|
||||||
|
HealingPotion ..|> Potion
|
||||||
|
InvisibilityPotion ..|> Potion
|
||||||
PoisonPotion ..|> Potion
|
PoisonPotion ..|> Potion
|
||||||
StrengthPotion ..|> Potion
|
StrengthPotion ..|> Potion
|
||||||
HealingPotion ..|> Potion
|
|
||||||
HolyWaterPotion ..|> Potion
|
HolyWaterPotion ..|> Potion
|
||||||
InvisibilityPotion ..|> Potion
|
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,20 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.front.controller {
|
package com.iluwatar.front.controller {
|
||||||
|
class ArcherView {
|
||||||
|
+ ArcherView()
|
||||||
|
+ display()
|
||||||
|
}
|
||||||
|
interface View {
|
||||||
|
+ display() {abstract}
|
||||||
|
}
|
||||||
|
class CatapultView {
|
||||||
|
+ CatapultView()
|
||||||
|
+ display()
|
||||||
|
}
|
||||||
|
class ArcherCommand {
|
||||||
|
+ ArcherCommand()
|
||||||
|
+ process()
|
||||||
|
}
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
@ -10,41 +25,26 @@ package com.iluwatar.front.controller {
|
|||||||
- getCommandClass(request : String) : Class<T> {static}
|
- getCommandClass(request : String) : Class<T> {static}
|
||||||
+ handleRequest(request : String)
|
+ handleRequest(request : String)
|
||||||
}
|
}
|
||||||
class ArcherView {
|
class UnknownCommand {
|
||||||
+ ArcherView()
|
+ UnknownCommand()
|
||||||
+ display()
|
+ process()
|
||||||
}
|
|
||||||
interface View {
|
|
||||||
+ display() {abstract}
|
|
||||||
}
|
|
||||||
interface Command {
|
|
||||||
+ process() {abstract}
|
|
||||||
}
|
}
|
||||||
class ErrorView {
|
class ErrorView {
|
||||||
+ ErrorView()
|
+ ErrorView()
|
||||||
+ display()
|
+ display()
|
||||||
}
|
}
|
||||||
class ArcherCommand {
|
|
||||||
+ ArcherCommand()
|
|
||||||
+ process()
|
|
||||||
}
|
|
||||||
class CatapultView {
|
|
||||||
+ CatapultView()
|
|
||||||
+ display()
|
|
||||||
}
|
|
||||||
class CatapultCommand {
|
class CatapultCommand {
|
||||||
+ CatapultCommand()
|
+ CatapultCommand()
|
||||||
+ process()
|
+ process()
|
||||||
}
|
}
|
||||||
class UnknownCommand {
|
interface Command {
|
||||||
+ UnknownCommand()
|
+ process() {abstract}
|
||||||
+ process()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ArcherView ..|> View
|
ArcherView ..|> View
|
||||||
ErrorView ..|> View
|
|
||||||
ArcherCommand ..|> Command
|
|
||||||
CatapultView ..|> View
|
CatapultView ..|> View
|
||||||
CatapultCommand ..|> Command
|
ArcherCommand ..|> Command
|
||||||
UnknownCommand ..|> Command
|
UnknownCommand ..|> Command
|
||||||
|
ErrorView ..|> View
|
||||||
|
CatapultCommand ..|> Command
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,18 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.halfsynchalfasync {
|
package com.iluwatar.halfsynchalfasync {
|
||||||
|
class AsynchronousService {
|
||||||
|
- service : ExecutorService
|
||||||
|
+ AsynchronousService(workQueue : BlockingQueue<Runnable>)
|
||||||
|
+ execute(task : AsyncTask<T>)
|
||||||
|
}
|
||||||
|
~class ArithmeticSumTask {
|
||||||
|
- n : long
|
||||||
|
+ ArithmeticSumTask(n : long)
|
||||||
|
+ call() : Long
|
||||||
|
+ onError(throwable : Throwable)
|
||||||
|
+ onPostCall(result : Long)
|
||||||
|
+ onPreCall()
|
||||||
|
}
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
- ap(i : long) : long {static}
|
- ap(i : long) : long {static}
|
||||||
@ -11,19 +24,6 @@ package com.iluwatar.halfsynchalfasync {
|
|||||||
+ onPostCall(O) {abstract}
|
+ onPostCall(O) {abstract}
|
||||||
+ onPreCall() {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<Runnable>)
|
|
||||||
+ execute(task : AsyncTask<T>)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ArithmeticSumTask ..+ App
|
ArithmeticSumTask ..+ App
|
||||||
ArithmeticSumTask ..|> AsyncTask
|
ArithmeticSumTask ..|> AsyncTask
|
||||||
|
@ -1,31 +1,47 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.hexagonal.service {
|
package com.iluwatar.hexagonal.sampledata {
|
||||||
class LotteryServiceImpl {
|
class SampleData {
|
||||||
- bank : WireTransfers
|
- PLAYERS : List<PlayerDetails> {static}
|
||||||
- notifications : LotteryNotifications
|
+ SampleData()
|
||||||
- repository : LotteryTicketRepository
|
- getRandomPlayerDetails() : PlayerDetails {static}
|
||||||
+ LotteryServiceImpl()
|
+ submitTickets(lotteryService : LotteryService, numTickets : int) {static}
|
||||||
+ checkTicketForPrize(id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult
|
|
||||||
+ submitTicket(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
|
||||||
}
|
}
|
||||||
interface LotteryService {
|
}
|
||||||
+ checkTicketForPrize(LotteryTicketId, LotteryNumbers) : LotteryTicketCheckResult {abstract}
|
package com.iluwatar.hexagonal.service {
|
||||||
+ submitTicket(LotteryTicket) : Optional<LotteryTicketId> {abstract}
|
class ConsoleLottery {
|
||||||
|
+ ConsoleLottery()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
- printMainMenu() {static}
|
||||||
|
- readString(scanner : Scanner) : String {static}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
package com.iluwatar.hexagonal.mongo {
|
||||||
|
class MongoConnectionPropertiesLoader {
|
||||||
|
- DEFAULT_HOST : String {static}
|
||||||
|
- DEFAULT_PORT : int {static}
|
||||||
|
+ MongoConnectionPropertiesLoader()
|
||||||
|
+ load() {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.hexagonal.domain {
|
package com.iluwatar.hexagonal.domain {
|
||||||
class LotteryTicketId {
|
class LotteryTicketId {
|
||||||
- id : UUID
|
- id : int
|
||||||
|
- numAllocated : int {static}
|
||||||
+ LotteryTicketId()
|
+ LotteryTicketId()
|
||||||
+ getId() : UUID
|
+ LotteryTicketId(id : int)
|
||||||
|
+ equals(o : Object) : boolean
|
||||||
|
+ getId() : int
|
||||||
|
+ hashCode() : int
|
||||||
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class LotteryConstants {
|
class LotteryAdministration {
|
||||||
+ PLAYER_MAX_SALDO : int {static}
|
- notifications : LotteryEventLog
|
||||||
+ PRIZE_AMOUNT : int {static}
|
- repository : LotteryTicketRepository
|
||||||
+ SERVICE_BANK_ACCOUNT : String {static}
|
- wireTransfers : WireTransfers
|
||||||
+ SERVICE_BANK_ACCOUNT_SALDO : int {static}
|
+ LotteryAdministration(repository : LotteryTicketRepository, notifications : LotteryEventLog, wireTransfers : WireTransfers)
|
||||||
+ TICKET_PRIZE : int {static}
|
+ getAllSubmittedTickets() : Map<LotteryTicketId, LotteryTicket>
|
||||||
+ LotteryConstants()
|
+ performLottery() : LotteryNumbers
|
||||||
|
+ resetLottery()
|
||||||
}
|
}
|
||||||
class LotteryNumbers {
|
class LotteryNumbers {
|
||||||
+ MAX_NUMBER : int {static}
|
+ MAX_NUMBER : int {static}
|
||||||
@ -39,19 +55,34 @@ package com.iluwatar.hexagonal.domain {
|
|||||||
+ equals(obj : Object) : boolean
|
+ equals(obj : Object) : boolean
|
||||||
- generateRandomNumbers()
|
- generateRandomNumbers()
|
||||||
+ getNumbers() : Set<Integer>
|
+ getNumbers() : Set<Integer>
|
||||||
|
+ getNumbersAsString() : String
|
||||||
+ hashCode() : int
|
+ 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<LotteryTicketId>
|
||||||
|
}
|
||||||
|
-class RandomNumberGenerator {
|
||||||
|
- randomIterator : OfInt
|
||||||
|
+ RandomNumberGenerator(min : int, max : int)
|
||||||
|
+ nextInt() : int
|
||||||
}
|
}
|
||||||
class PlayerDetails {
|
class PlayerDetails {
|
||||||
- bankAccountNumber : String
|
- bankAccountNumber : String
|
||||||
- emailAddress : String
|
- emailAddress : String
|
||||||
- phoneNumber : String
|
- phoneNumber : String
|
||||||
- PlayerDetails(email : String, bankAccount : String, phone : String)
|
+ PlayerDetails(email : String, bankAccount : String, phone : String)
|
||||||
+ create(email : String, bankAccount : String, phone : String) : PlayerDetails {static}
|
|
||||||
+ equals(obj : Object) : boolean
|
+ equals(obj : Object) : boolean
|
||||||
+ getBankAccount() : String
|
+ getBankAccount() : String
|
||||||
+ getEmail() : String
|
+ getEmail() : String
|
||||||
+ getPhoneNumber() : String
|
+ getPhoneNumber() : String
|
||||||
+ hashCode() : int
|
+ hashCode() : int
|
||||||
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class LotteryTicketCheckResult {
|
class LotteryTicketCheckResult {
|
||||||
- checkResult : CheckResult
|
- checkResult : CheckResult
|
||||||
@ -63,20 +94,30 @@ package com.iluwatar.hexagonal.domain {
|
|||||||
+ getResult() : CheckResult
|
+ getResult() : CheckResult
|
||||||
+ hashCode() : int
|
+ 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 {
|
class LotteryTicket {
|
||||||
|
- id : LotteryTicketId
|
||||||
- lotteryNumbers : LotteryNumbers
|
- lotteryNumbers : LotteryNumbers
|
||||||
- playerDetails : PlayerDetails
|
- playerDetails : PlayerDetails
|
||||||
- LotteryTicket(details : PlayerDetails, numbers : LotteryNumbers)
|
+ LotteryTicket(id : LotteryTicketId, details : PlayerDetails, numbers : LotteryNumbers)
|
||||||
+ create(details : PlayerDetails, numbers : LotteryNumbers) : LotteryTicket {static}
|
|
||||||
+ equals(obj : Object) : boolean
|
+ equals(obj : Object) : boolean
|
||||||
|
+ getId() : LotteryTicketId
|
||||||
+ getNumbers() : LotteryNumbers
|
+ getNumbers() : LotteryNumbers
|
||||||
+ getPlayerDetails() : PlayerDetails
|
+ getPlayerDetails() : PlayerDetails
|
||||||
+ hashCode() : int
|
+ hashCode() : int
|
||||||
|
+ setId(id : LotteryTicketId)
|
||||||
|
+ toString() : String
|
||||||
}
|
}
|
||||||
-class RandomNumberGenerator {
|
class LotteryUtils {
|
||||||
- randomIterator : OfInt
|
- LotteryUtils()
|
||||||
+ RandomNumberGenerator(min : int, max : int)
|
+ checkTicketForPrize(repository : LotteryTicketRepository, id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult {static}
|
||||||
+ nextInt() : int
|
|
||||||
}
|
}
|
||||||
enum CheckResult {
|
enum CheckResult {
|
||||||
+ NO_PRIZE {static}
|
+ NO_PRIZE {static}
|
||||||
@ -87,23 +128,64 @@ package com.iluwatar.hexagonal.domain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.hexagonal.banking {
|
package com.iluwatar.hexagonal.banking {
|
||||||
class WireTransfersImpl {
|
|
||||||
- accounts : Map<String, Integer> {static}
|
|
||||||
+ WireTransfersImpl()
|
|
||||||
+ getFunds(bankAccount : String) : int
|
|
||||||
+ setFunds(bankAccount : String, amount : int)
|
|
||||||
+ transferFunds(amount : int, sourceBackAccount : String, destinationBankAccount : String) : boolean
|
|
||||||
}
|
|
||||||
interface WireTransfers {
|
interface WireTransfers {
|
||||||
+ getFunds(String) : int {abstract}
|
+ getFunds(String) : int {abstract}
|
||||||
+ setFunds(String, int) {abstract}
|
+ setFunds(String, int) {abstract}
|
||||||
+ transferFunds(int, String, String) : boolean {abstract}
|
+ transferFunds(int, String, String) : boolean {abstract}
|
||||||
}
|
}
|
||||||
|
class MongoBank {
|
||||||
|
- DEFAULT_ACCOUNTS_COLLECTION : String {static}
|
||||||
|
- DEFAULT_DB : String {static}
|
||||||
|
- accountsCollection : MongoCollection<Document>
|
||||||
|
- database : MongoDatabase
|
||||||
|
- mongoClient : MongoClient
|
||||||
|
+ MongoBank()
|
||||||
|
+ MongoBank(dbName : String, accountsCollectionName : String)
|
||||||
|
+ connect()
|
||||||
|
+ connect(dbName : String, accountsCollectionName : String)
|
||||||
|
+ getAccountsCollection() : MongoCollection<Document>
|
||||||
|
+ 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<String, Integer> {static}
|
||||||
|
+ InMemoryBank()
|
||||||
|
+ getFunds(bankAccount : String) : int
|
||||||
|
+ setFunds(bankAccount : String, amount : int)
|
||||||
|
+ transferFunds(amount : int, sourceBackAccount : String, destinationBankAccount : String) : boolean
|
||||||
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.hexagonal.database {
|
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<Document>
|
||||||
|
- database : MongoDatabase
|
||||||
|
- mongoClient : MongoClient
|
||||||
|
- ticketsCollection : MongoCollection<Document>
|
||||||
|
+ MongoTicketRepository()
|
||||||
|
+ MongoTicketRepository(dbName : String, ticketsCollectionName : String, countersCollectionName : String)
|
||||||
|
+ connect()
|
||||||
|
+ connect(dbName : String, ticketsCollectionName : String, countersCollectionName : String)
|
||||||
|
+ deleteAll()
|
||||||
|
- docToTicket(doc : Document) : LotteryTicket
|
||||||
|
+ findAll() : Map<LotteryTicketId, LotteryTicket>
|
||||||
|
+ findById(id : LotteryTicketId) : Optional<LotteryTicket>
|
||||||
|
+ getCountersCollection() : MongoCollection<Document>
|
||||||
|
+ getMongoClient() : MongoClient
|
||||||
|
+ getMongoDatabase() : MongoDatabase
|
||||||
|
+ getNextId() : int
|
||||||
|
+ getTicketsCollection() : MongoCollection<Document>
|
||||||
|
- initCounters()
|
||||||
|
+ save(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
||||||
|
}
|
||||||
|
class InMemoryTicketRepository {
|
||||||
- tickets : Map<LotteryTicketId, LotteryTicket> {static}
|
- tickets : Map<LotteryTicketId, LotteryTicket> {static}
|
||||||
+ LotteryTicketInMemoryRepository()
|
+ InMemoryTicketRepository()
|
||||||
+ deleteAll()
|
+ deleteAll()
|
||||||
+ findAll() : Map<LotteryTicketId, LotteryTicket>
|
+ findAll() : Map<LotteryTicketId, LotteryTicket>
|
||||||
+ findById(id : LotteryTicketId) : Optional<LotteryTicket>
|
+ findById(id : LotteryTicketId) : Optional<LotteryTicket>
|
||||||
@ -116,68 +198,79 @@ package com.iluwatar.hexagonal.database {
|
|||||||
+ save(LotteryTicket) : Optional<LotteryTicketId> {abstract}
|
+ save(LotteryTicket) : Optional<LotteryTicketId> {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 {
|
package com.iluwatar.hexagonal {
|
||||||
class App {
|
class App {
|
||||||
- allPlayerDetails : List<PlayerDetails> {static}
|
|
||||||
+ App()
|
+ App()
|
||||||
- getRandomPlayerDetails() : PlayerDetails {static}
|
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
- submitTickets(lotteryService : LotteryService, numTickets : int) {static}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.hexagonal.administration {
|
package com.iluwatar.hexagonal.administration {
|
||||||
interface LotteryAdministration {
|
class ConsoleAdministration {
|
||||||
+ getAllSubmittedTickets() : Map<LotteryTicketId, LotteryTicket> {abstract}
|
+ ConsoleAdministration()
|
||||||
+ performLottery() : LotteryNumbers {abstract}
|
+ main(args : String[]) {static}
|
||||||
+ resetLottery() {abstract}
|
- printMainMenu() {static}
|
||||||
}
|
- readString(scanner : Scanner) : String {static}
|
||||||
class LotteryAdministrationImpl {
|
|
||||||
- bank : WireTransfers
|
|
||||||
- notifications : LotteryNotifications
|
|
||||||
- repository : LotteryTicketRepository
|
|
||||||
- service : LotteryService
|
|
||||||
+ LotteryAdministrationImpl()
|
|
||||||
+ getAllSubmittedTickets() : Map<LotteryTicketId, LotteryTicket>
|
|
||||||
+ performLottery() : LotteryNumbers
|
|
||||||
+ resetLottery()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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<Document>
|
||||||
|
- mongoClient : MongoClient
|
||||||
|
- stdOutEventLog : StdOutEventLog
|
||||||
|
+ MongoEventLog()
|
||||||
|
+ MongoEventLog(dbName : String, eventsCollectionName : String)
|
||||||
|
+ connect()
|
||||||
|
+ connect(dbName : String, eventsCollectionName : String)
|
||||||
|
+ getEventsCollection() : MongoCollection<Document>
|
||||||
|
+ 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
|
LotteryTicket --> "-playerDetails" PlayerDetails
|
||||||
LotteryAdministrationImpl --> "-bank" WireTransfers
|
MongoEventLog --> "-stdOutEventLog" StdOutEventLog
|
||||||
App --> "-allPlayerDetails" PlayerDetails
|
LotteryService --> "-wireTransfers" WireTransfers
|
||||||
|
LotteryAdministration --> "-notifications" LotteryEventLog
|
||||||
RandomNumberGenerator ..+ PrimitiveIterator
|
RandomNumberGenerator ..+ PrimitiveIterator
|
||||||
LotteryAdministrationImpl --> "-repository" LotteryTicketRepository
|
LotteryAdministration --> "-wireTransfers" WireTransfers
|
||||||
LotteryAdministrationImpl --+ LotteryTicketCheckResult
|
LotteryTicket --> "-id" LotteryTicketId
|
||||||
LotteryServiceImpl --> "-notifications" LotteryNotifications
|
LotteryService --> "-notifications" LotteryEventLog
|
||||||
|
LotteryAdministration --> "-repository" LotteryTicketRepository
|
||||||
LotteryTicket --> "-lotteryNumbers" LotteryNumbers
|
LotteryTicket --> "-lotteryNumbers" LotteryNumbers
|
||||||
LotteryAdministrationImpl --> "-notifications" LotteryNotifications
|
SampleData --> "-PLAYERS" PlayerDetails
|
||||||
LotteryServiceImpl --> "-repository" LotteryTicketRepository
|
ConsoleLottery --+ LotteryTicketCheckResult
|
||||||
LotteryServiceImpl --+ LotteryTicketCheckResult
|
|
||||||
LotteryServiceImpl --> "-bank" WireTransfers
|
|
||||||
RandomNumberGenerator ..+ LotteryNumbers
|
RandomNumberGenerator ..+ LotteryNumbers
|
||||||
LotteryAdministrationImpl --> "-service" LotteryService
|
LotteryService --> "-repository" LotteryTicketRepository
|
||||||
|
LotteryUtils --+ LotteryTicketCheckResult
|
||||||
LotteryTicketCheckResult --> "-checkResult" CheckResult
|
LotteryTicketCheckResult --> "-checkResult" CheckResult
|
||||||
CheckResult ..+ LotteryTicketCheckResult
|
CheckResult ..+ LotteryTicketCheckResult
|
||||||
LotteryTicketInMemoryRepository ..|> LotteryTicketRepository
|
MongoTicketRepository ..|> LotteryTicketRepository
|
||||||
WireTransfersImpl ..|> WireTransfers
|
MongoBank ..|> WireTransfers
|
||||||
LotteryServiceImpl ..|> LotteryService
|
InMemoryBank ..|> WireTransfers
|
||||||
LotteryNotificationsImpl ..|> LotteryNotifications
|
StdOutEventLog ..|> LotteryEventLog
|
||||||
LotteryAdministrationImpl ..|> LotteryAdministration
|
InMemoryTicketRepository ..|> LotteryTicketRepository
|
||||||
|
MongoEventLog ..|> LotteryEventLog
|
||||||
@enduml
|
@enduml
|
@ -1,10 +1,16 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.intercepting.filter {
|
package com.iluwatar.intercepting.filter {
|
||||||
interface Filter {
|
class DepositFilter {
|
||||||
+ execute(Order) : String {abstract}
|
+ DepositFilter()
|
||||||
+ getLast() : Filter {abstract}
|
+ execute(order : Order) : String
|
||||||
+ getNext() : Filter {abstract}
|
}
|
||||||
+ setNext(Filter) {abstract}
|
class AddressFilter {
|
||||||
|
+ AddressFilter()
|
||||||
|
+ execute(order : Order) : String
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
abstract class AbstractFilter {
|
abstract class AbstractFilter {
|
||||||
- next : Filter
|
- next : Filter
|
||||||
@ -15,14 +21,6 @@ package com.iluwatar.intercepting.filter {
|
|||||||
+ getNext() : Filter
|
+ getNext() : Filter
|
||||||
+ setNext(filter : Filter)
|
+ setNext(filter : Filter)
|
||||||
}
|
}
|
||||||
class ContactFilter {
|
|
||||||
+ ContactFilter()
|
|
||||||
+ execute(order : Order) : String
|
|
||||||
}
|
|
||||||
class OrderFilter {
|
|
||||||
+ OrderFilter()
|
|
||||||
+ execute(order : Order) : String
|
|
||||||
}
|
|
||||||
class Order {
|
class Order {
|
||||||
- address : String
|
- address : String
|
||||||
- contactNumber : String
|
- contactNumber : String
|
||||||
@ -42,47 +40,49 @@ package com.iluwatar.intercepting.filter {
|
|||||||
+ setName(name : String)
|
+ setName(name : String)
|
||||||
+ setOrder(order : String)
|
+ setOrder(order : String)
|
||||||
}
|
}
|
||||||
class AddressFilter {
|
|
||||||
+ AddressFilter()
|
|
||||||
+ execute(order : Order) : String
|
|
||||||
}
|
|
||||||
~class DListener {
|
|
||||||
~ DListener(this$0 : Target)
|
|
||||||
+ actionPerformed(e : ActionEvent)
|
|
||||||
}
|
|
||||||
class FilterManager {
|
class FilterManager {
|
||||||
- filterChain : FilterChain
|
- filterChain : FilterChain
|
||||||
+ FilterManager()
|
+ FilterManager()
|
||||||
+ addFilter(filter : Filter)
|
+ addFilter(filter : Filter)
|
||||||
+ filterRequest(order : Order) : String
|
+ filterRequest(order : Order) : String
|
||||||
}
|
}
|
||||||
|
class NameFilter {
|
||||||
|
+ NameFilter()
|
||||||
|
+ execute(order : Order) : String
|
||||||
|
}
|
||||||
|
class ContactFilter {
|
||||||
|
+ ContactFilter()
|
||||||
|
+ execute(order : Order) : String
|
||||||
|
}
|
||||||
|
interface Filter {
|
||||||
|
+ execute(Order) : String {abstract}
|
||||||
|
+ getLast() : Filter {abstract}
|
||||||
|
+ getNext() : Filter {abstract}
|
||||||
|
+ setNext(Filter) {abstract}
|
||||||
|
}
|
||||||
|
~class DListener {
|
||||||
|
~ DListener()
|
||||||
|
+ actionPerformed(e : ActionEvent)
|
||||||
|
}
|
||||||
|
class OrderFilter {
|
||||||
|
+ OrderFilter()
|
||||||
|
+ execute(order : Order) : String
|
||||||
|
}
|
||||||
class FilterChain {
|
class FilterChain {
|
||||||
- chain : Filter
|
- chain : Filter
|
||||||
+ FilterChain()
|
+ FilterChain()
|
||||||
+ addFilter(filter : Filter)
|
+ addFilter(filter : Filter)
|
||||||
+ execute(order : Order) : String
|
+ execute(order : Order) : String
|
||||||
}
|
}
|
||||||
class DepositFilter {
|
|
||||||
+ DepositFilter()
|
|
||||||
+ execute(order : Order) : String
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class NameFilter {
|
|
||||||
+ NameFilter()
|
|
||||||
+ execute(order : Order) : String
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AbstractFilter --> "-next" Filter
|
AbstractFilter --> "-next" Filter
|
||||||
DListener --+ Target
|
DListener --+ Target
|
||||||
FilterChain --> "-chain" Filter
|
FilterChain --> "-chain" Filter
|
||||||
FilterManager --> "-filterChain" FilterChain
|
FilterManager --> "-filterChain" FilterChain
|
||||||
|
DepositFilter --|> AbstractFilter
|
||||||
|
AddressFilter --|> AbstractFilter
|
||||||
AbstractFilter ..|> Filter
|
AbstractFilter ..|> Filter
|
||||||
|
NameFilter --|> AbstractFilter
|
||||||
ContactFilter --|> AbstractFilter
|
ContactFilter --|> AbstractFilter
|
||||||
OrderFilter --|> AbstractFilter
|
OrderFilter --|> AbstractFilter
|
||||||
AddressFilter --|> AbstractFilter
|
|
||||||
DepositFilter --|> AbstractFilter
|
|
||||||
NameFilter --|> AbstractFilter
|
|
||||||
@enduml
|
@enduml
|
@ -1,23 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.interpreter {
|
package com.iluwatar.interpreter {
|
||||||
abstract class Expression {
|
|
||||||
+ Expression()
|
|
||||||
+ interpret() : int {abstract}
|
|
||||||
+ toString() : String {abstract}
|
|
||||||
}
|
|
||||||
class PlusExpression {
|
|
||||||
- leftExpression : Expression
|
|
||||||
- rightExpression : Expression
|
|
||||||
+ PlusExpression(leftExpression : Expression, rightExpression : Expression)
|
|
||||||
+ interpret() : int
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ getOperatorInstance(s : String, left : Expression, right : Expression) : Expression {static}
|
|
||||||
+ isOperator(s : String) : boolean {static}
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class NumberExpression {
|
class NumberExpression {
|
||||||
- number : int
|
- number : int
|
||||||
+ NumberExpression(number : int)
|
+ NumberExpression(number : int)
|
||||||
@ -25,13 +7,6 @@ package com.iluwatar.interpreter {
|
|||||||
+ interpret() : int
|
+ interpret() : int
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class MultiplyExpression {
|
|
||||||
- leftExpression : Expression
|
|
||||||
- rightExpression : Expression
|
|
||||||
+ MultiplyExpression(leftExpression : Expression, rightExpression : Expression)
|
|
||||||
+ interpret() : int
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class MinusExpression {
|
class MinusExpression {
|
||||||
- leftExpression : Expression
|
- leftExpression : Expression
|
||||||
- rightExpression : Expression
|
- rightExpression : Expression
|
||||||
@ -39,12 +14,37 @@ package com.iluwatar.interpreter {
|
|||||||
+ interpret() : int
|
+ interpret() : int
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ getOperatorInstance(s : String, left : Expression, right : Expression) : Expression {static}
|
||||||
|
+ isOperator(s : String) : boolean {static}
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
abstract class Expression {
|
||||||
|
+ Expression()
|
||||||
|
+ interpret() : int {abstract}
|
||||||
|
+ toString() : String {abstract}
|
||||||
|
}
|
||||||
|
class MultiplyExpression {
|
||||||
|
- leftExpression : Expression
|
||||||
|
- rightExpression : Expression
|
||||||
|
+ MultiplyExpression(leftExpression : Expression, rightExpression : Expression)
|
||||||
|
+ interpret() : int
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class PlusExpression {
|
||||||
|
- leftExpression : Expression
|
||||||
|
- rightExpression : Expression
|
||||||
|
+ PlusExpression(leftExpression : Expression, rightExpression : Expression)
|
||||||
|
+ interpret() : int
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MultiplyExpression --> "-leftExpression" Expression
|
MultiplyExpression --> "-leftExpression" Expression
|
||||||
MinusExpression --> "-leftExpression" Expression
|
MinusExpression --> "-leftExpression" Expression
|
||||||
PlusExpression --> "-leftExpression" Expression
|
PlusExpression --> "-leftExpression" Expression
|
||||||
PlusExpression --|> Expression
|
|
||||||
NumberExpression --|> Expression
|
NumberExpression --|> Expression
|
||||||
MultiplyExpression --|> Expression
|
|
||||||
MinusExpression --|> Expression
|
MinusExpression --|> Expression
|
||||||
|
MultiplyExpression --|> Expression
|
||||||
|
PlusExpression --|> Expression
|
||||||
@enduml
|
@enduml
|
@ -1,13 +1,17 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.iterator {
|
package com.iluwatar.iterator {
|
||||||
interface ItemIterator {
|
|
||||||
+ hasNext() : boolean {abstract}
|
|
||||||
+ next() : Item {abstract}
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
class Item {
|
||||||
|
- name : String
|
||||||
|
- type : ItemType
|
||||||
|
+ Item(type : ItemType, name : String)
|
||||||
|
+ getType() : ItemType
|
||||||
|
+ setType(type : ItemType)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
class TreasureChestItemIterator {
|
class TreasureChestItemIterator {
|
||||||
- chest : TreasureChest
|
- chest : TreasureChest
|
||||||
- idx : int
|
- idx : int
|
||||||
@ -23,13 +27,9 @@ package com.iluwatar.iterator {
|
|||||||
+ getItems() : List<Item>
|
+ getItems() : List<Item>
|
||||||
~ iterator(itemType : ItemType) : ItemIterator
|
~ iterator(itemType : ItemType) : ItemIterator
|
||||||
}
|
}
|
||||||
class Item {
|
interface ItemIterator {
|
||||||
- name : String
|
+ hasNext() : boolean {abstract}
|
||||||
- type : ItemType
|
+ next() : Item {abstract}
|
||||||
+ Item(type : ItemType, name : String)
|
|
||||||
+ getType() : ItemType
|
|
||||||
+ setType(type : ItemType)
|
|
||||||
+ toString() : String
|
|
||||||
}
|
}
|
||||||
enum ItemType {
|
enum ItemType {
|
||||||
+ ANY {static}
|
+ ANY {static}
|
||||||
|
@ -3,62 +3,6 @@ package com.iluwatar.layers {
|
|||||||
interface View {
|
interface View {
|
||||||
+ render() {abstract}
|
+ render() {abstract}
|
||||||
}
|
}
|
||||||
class CakeBakingServiceImpl {
|
|
||||||
- context : AbstractApplicationContext
|
|
||||||
+ CakeBakingServiceImpl()
|
|
||||||
+ bakeNewCake(cakeInfo : CakeInfo)
|
|
||||||
+ getAllCakes() : List<CakeInfo>
|
|
||||||
- getAvailableLayerEntities() : List<CakeLayer>
|
|
||||||
+ getAvailableLayers() : List<CakeLayerInfo>
|
|
||||||
- getAvailableToppingEntities() : List<CakeTopping>
|
|
||||||
+ getAvailableToppings() : List<CakeToppingInfo>
|
|
||||||
+ saveNewLayer(layerInfo : CakeLayerInfo)
|
|
||||||
+ saveNewTopping(toppingInfo : CakeToppingInfo)
|
|
||||||
}
|
|
||||||
interface CakeDao {
|
|
||||||
}
|
|
||||||
class CakeTopping {
|
|
||||||
- cake : Cake
|
|
||||||
- calories : int
|
|
||||||
- id : Long
|
|
||||||
- name : String
|
|
||||||
+ CakeTopping()
|
|
||||||
+ CakeTopping(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<Long>
|
|
||||||
+ name : String
|
|
||||||
+ CakeLayerInfo(id : Long, name : String, calories : int)
|
|
||||||
+ CakeLayerInfo(name : String, calories : int)
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
interface CakeLayerDao {
|
|
||||||
}
|
|
||||||
interface CakeToppingDao {
|
|
||||||
}
|
|
||||||
interface CakeBakingService {
|
|
||||||
+ bakeNewCake(CakeInfo) {abstract}
|
|
||||||
+ getAllCakes() : List<CakeInfo> {abstract}
|
|
||||||
+ getAvailableLayers() : List<CakeLayerInfo> {abstract}
|
|
||||||
+ getAvailableToppings() : List<CakeToppingInfo> {abstract}
|
|
||||||
+ saveNewLayer(CakeLayerInfo) {abstract}
|
|
||||||
+ saveNewTopping(CakeToppingInfo) {abstract}
|
|
||||||
}
|
|
||||||
class CakeViewImpl {
|
|
||||||
- cakeBakingService : CakeBakingService
|
|
||||||
+ CakeViewImpl(cakeBakingService : CakeBakingService)
|
|
||||||
+ render()
|
|
||||||
}
|
|
||||||
class CakeToppingInfo {
|
class CakeToppingInfo {
|
||||||
+ calories : int
|
+ calories : int
|
||||||
+ id : Optional<Long>
|
+ id : Optional<Long>
|
||||||
@ -67,35 +11,6 @@ package com.iluwatar.layers {
|
|||||||
+ CakeToppingInfo(name : String, calories : int)
|
+ CakeToppingInfo(name : String, calories : int)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class CakeInfo {
|
|
||||||
+ cakeLayerInfos : List<CakeLayerInfo>
|
|
||||||
+ cakeToppingInfo : CakeToppingInfo
|
|
||||||
+ id : Optional<Long>
|
|
||||||
+ CakeInfo(cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List<CakeLayerInfo>)
|
|
||||||
+ CakeInfo(id : Long, cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List<CakeLayerInfo>)
|
|
||||||
+ calculateTotalCalories() : int
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
- cakeBakingService : CakeBakingService {static}
|
|
||||||
+ App()
|
|
||||||
- initializeData(cakeBakingService : CakeBakingService) {static}
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class Cake {
|
|
||||||
- id : Long
|
|
||||||
- layers : Set<CakeLayer>
|
|
||||||
- topping : CakeTopping
|
|
||||||
+ Cake()
|
|
||||||
+ addLayer(layer : CakeLayer)
|
|
||||||
+ getId() : Long
|
|
||||||
+ getLayers() : Set<CakeLayer>
|
|
||||||
+ getTopping() : CakeTopping
|
|
||||||
+ setId(id : Long)
|
|
||||||
+ setLayers(layers : Set<CakeLayer>)
|
|
||||||
+ setTopping(topping : CakeTopping)
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class CakeLayer {
|
class CakeLayer {
|
||||||
- cake : Cake
|
- cake : Cake
|
||||||
- calories : int
|
- calories : int
|
||||||
@ -113,6 +28,91 @@ package com.iluwatar.layers {
|
|||||||
+ setName(name : String)
|
+ setName(name : String)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
class CakeLayerInfo {
|
||||||
|
+ calories : int
|
||||||
|
+ id : Optional<Long>
|
||||||
|
+ 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()
|
||||||
|
+ bakeNewCake(cakeInfo : CakeInfo)
|
||||||
|
+ getAllCakes() : List<CakeInfo>
|
||||||
|
- getAvailableLayerEntities() : List<CakeLayer>
|
||||||
|
+ getAvailableLayers() : List<CakeLayerInfo>
|
||||||
|
- getAvailableToppingEntities() : List<CakeTopping>
|
||||||
|
+ getAvailableToppings() : List<CakeToppingInfo>
|
||||||
|
+ saveNewLayer(layerInfo : CakeLayerInfo)
|
||||||
|
+ saveNewTopping(toppingInfo : CakeToppingInfo)
|
||||||
|
}
|
||||||
|
class CakeTopping {
|
||||||
|
- cake : Cake
|
||||||
|
- calories : int
|
||||||
|
- id : Long
|
||||||
|
- name : String
|
||||||
|
+ CakeTopping()
|
||||||
|
+ CakeTopping(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 Cake {
|
||||||
|
- id : Long
|
||||||
|
- layers : Set<CakeLayer>
|
||||||
|
- topping : CakeTopping
|
||||||
|
+ Cake()
|
||||||
|
+ addLayer(layer : CakeLayer)
|
||||||
|
+ getId() : Long
|
||||||
|
+ getLayers() : Set<CakeLayer>
|
||||||
|
+ getTopping() : CakeTopping
|
||||||
|
+ setId(id : Long)
|
||||||
|
+ setLayers(layers : Set<CakeLayer>)
|
||||||
|
+ setTopping(topping : CakeTopping)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
interface CakeToppingDao {
|
||||||
|
}
|
||||||
|
interface CakeBakingService {
|
||||||
|
+ bakeNewCake(CakeInfo) {abstract}
|
||||||
|
+ getAllCakes() : List<CakeInfo> {abstract}
|
||||||
|
+ getAvailableLayers() : List<CakeLayerInfo> {abstract}
|
||||||
|
+ getAvailableToppings() : List<CakeToppingInfo> {abstract}
|
||||||
|
+ saveNewLayer(CakeLayerInfo) {abstract}
|
||||||
|
+ saveNewTopping(CakeToppingInfo) {abstract}
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
- cakeBakingService : CakeBakingService {static}
|
||||||
|
+ App()
|
||||||
|
- initializeData(cakeBakingService : CakeBakingService) {static}
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
interface CakeDao {
|
||||||
|
}
|
||||||
|
interface CakeLayerDao {
|
||||||
|
}
|
||||||
|
class CakeInfo {
|
||||||
|
+ cakeLayerInfos : List<CakeLayerInfo>
|
||||||
|
+ cakeToppingInfo : CakeToppingInfo
|
||||||
|
+ id : Optional<Long>
|
||||||
|
+ CakeInfo(cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List<CakeLayerInfo>)
|
||||||
|
+ CakeInfo(id : Long, cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List<CakeLayerInfo>)
|
||||||
|
+ calculateTotalCalories() : int
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CakeViewImpl --> "-cakeBakingService" CakeBakingService
|
CakeViewImpl --> "-cakeBakingService" CakeBakingService
|
||||||
CakeInfo --> "-cakeToppingInfo" CakeToppingInfo
|
CakeInfo --> "-cakeToppingInfo" CakeToppingInfo
|
||||||
@ -120,6 +120,6 @@ CakeInfo --> "-cakeLayerInfos" CakeLayerInfo
|
|||||||
App --> "-cakeBakingService" CakeBakingService
|
App --> "-cakeBakingService" CakeBakingService
|
||||||
CakeLayer --> "-cake" Cake
|
CakeLayer --> "-cake" Cake
|
||||||
Cake --> "-topping" CakeTopping
|
Cake --> "-topping" CakeTopping
|
||||||
CakeBakingServiceImpl ..|> CakeBakingService
|
|
||||||
CakeViewImpl ..|> View
|
CakeViewImpl ..|> View
|
||||||
|
CakeBakingServiceImpl ..|> CakeBakingService
|
||||||
@enduml
|
@enduml
|
@ -2,20 +2,24 @@
|
|||||||
package com.iluwatar.lazy.loading {
|
package com.iluwatar.lazy.loading {
|
||||||
~class HeavyFactory {
|
~class HeavyFactory {
|
||||||
- heavyInstance : Heavy
|
- heavyInstance : Heavy
|
||||||
~ HeavyFactory(this$0 : Java8Holder)
|
~ HeavyFactory()
|
||||||
+ get() : Heavy
|
+ get() : Heavy
|
||||||
}
|
}
|
||||||
class HolderNaive {
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class HolderThreadSafe {
|
||||||
- heavy : Heavy
|
- heavy : Heavy
|
||||||
+ HolderNaive()
|
+ HolderThreadSafe()
|
||||||
+ getHeavy() : Heavy
|
+ getHeavy() : Heavy
|
||||||
}
|
}
|
||||||
class Heavy {
|
class Heavy {
|
||||||
+ Heavy()
|
+ Heavy()
|
||||||
}
|
}
|
||||||
class HolderThreadSafe {
|
class HolderNaive {
|
||||||
- heavy : Heavy
|
- heavy : Heavy
|
||||||
+ HolderThreadSafe()
|
+ HolderNaive()
|
||||||
+ getHeavy() : Heavy
|
+ getHeavy() : Heavy
|
||||||
}
|
}
|
||||||
class Java8Holder {
|
class Java8Holder {
|
||||||
@ -24,12 +28,8 @@ package com.iluwatar.lazy.loading {
|
|||||||
- createAndCacheHeavy() : Heavy
|
- createAndCacheHeavy() : Heavy
|
||||||
+ getHeavy() : Heavy
|
+ getHeavy() : Heavy
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
HolderThreadSafe --> "-heavy" Heavy
|
|
||||||
HolderNaive --> "-heavy" Heavy
|
HolderNaive --> "-heavy" Heavy
|
||||||
|
HolderThreadSafe --> "-heavy" Heavy
|
||||||
HeavyFactory --> "-heavyInstance" Heavy
|
HeavyFactory --> "-heavyInstance" Heavy
|
||||||
@enduml
|
@enduml
|
@ -1,24 +1,20 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.mediator {
|
package com.iluwatar.mediator {
|
||||||
class App {
|
interface Party {
|
||||||
+ App()
|
+ act(PartyMember, Action) {abstract}
|
||||||
+ main(args : String[]) {static}
|
+ addMember(PartyMember) {abstract}
|
||||||
}
|
|
||||||
class Hobbit {
|
|
||||||
+ Hobbit()
|
|
||||||
+ toString() : String
|
|
||||||
}
|
}
|
||||||
interface PartyMember {
|
interface PartyMember {
|
||||||
+ act(Action) {abstract}
|
+ act(Action) {abstract}
|
||||||
+ joinedParty(Party) {abstract}
|
+ joinedParty(Party) {abstract}
|
||||||
+ partyAction(Action) {abstract}
|
+ partyAction(Action) {abstract}
|
||||||
}
|
}
|
||||||
interface Party {
|
class Rogue {
|
||||||
+ act(PartyMember, Action) {abstract}
|
+ Rogue()
|
||||||
+ addMember(PartyMember) {abstract}
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class Wizard {
|
class Hunter {
|
||||||
+ Wizard()
|
+ Hunter()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class PartyImpl {
|
class PartyImpl {
|
||||||
@ -27,12 +23,12 @@ package com.iluwatar.mediator {
|
|||||||
+ act(actor : PartyMember, action : Action)
|
+ act(actor : PartyMember, action : Action)
|
||||||
+ addMember(member : PartyMember)
|
+ addMember(member : PartyMember)
|
||||||
}
|
}
|
||||||
class Hunter {
|
class Hobbit {
|
||||||
+ Hunter()
|
+ Hobbit()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class Rogue {
|
class Wizard {
|
||||||
+ Rogue()
|
+ Wizard()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
abstract class PartyMemberBase {
|
abstract class PartyMemberBase {
|
||||||
@ -43,6 +39,10 @@ package com.iluwatar.mediator {
|
|||||||
+ partyAction(action : Action)
|
+ partyAction(action : Action)
|
||||||
+ toString() : String {abstract}
|
+ toString() : String {abstract}
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
enum Action {
|
enum Action {
|
||||||
+ ENEMY {static}
|
+ ENEMY {static}
|
||||||
+ GOLD {static}
|
+ GOLD {static}
|
||||||
@ -59,10 +59,10 @@ package com.iluwatar.mediator {
|
|||||||
}
|
}
|
||||||
PartyImpl --> "-members" PartyMember
|
PartyImpl --> "-members" PartyMember
|
||||||
PartyMemberBase --> "-party" Party
|
PartyMemberBase --> "-party" Party
|
||||||
|
Rogue --|> PartyMemberBase
|
||||||
|
Hunter --|> PartyMemberBase
|
||||||
|
PartyImpl ..|> Party
|
||||||
Hobbit --|> PartyMemberBase
|
Hobbit --|> PartyMemberBase
|
||||||
Wizard --|> PartyMemberBase
|
Wizard --|> PartyMemberBase
|
||||||
PartyImpl ..|> Party
|
|
||||||
Hunter --|> PartyMemberBase
|
|
||||||
Rogue --|> PartyMemberBase
|
|
||||||
PartyMemberBase ..|> PartyMember
|
PartyMemberBase ..|> PartyMember
|
||||||
@enduml
|
@enduml
|
@ -1,17 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.memento {
|
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 {
|
-class StarMementoInternal {
|
||||||
- ageYears : int
|
- ageYears : int
|
||||||
- massTons : int
|
- massTons : int
|
||||||
@ -28,6 +16,18 @@ package com.iluwatar.memento {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ 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 {
|
enum StarType {
|
||||||
+ DEAD {static}
|
+ DEAD {static}
|
||||||
+ RED_GIANT {static}
|
+ RED_GIANT {static}
|
||||||
|
@ -13,14 +13,6 @@ package com.iluwatar.model.view.controller {
|
|||||||
+ setNourishment(nourishment : Nourishment)
|
+ setNourishment(nourishment : Nourishment)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class GiantView {
|
|
||||||
+ GiantView()
|
|
||||||
+ displayGiant(giant : GiantModel)
|
|
||||||
}
|
|
||||||
class GiantController {
|
class GiantController {
|
||||||
- giant : GiantModel
|
- giant : GiantModel
|
||||||
- view : GiantView
|
- view : GiantView
|
||||||
@ -33,6 +25,23 @@ package com.iluwatar.model.view.controller {
|
|||||||
+ setNourishment(nourishment : Nourishment)
|
+ setNourishment(nourishment : Nourishment)
|
||||||
+ updateView()
|
+ 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 {
|
enum Nourishment {
|
||||||
+ HUNGRY {static}
|
+ HUNGRY {static}
|
||||||
+ SATURATED {static}
|
+ SATURATED {static}
|
||||||
@ -51,15 +60,6 @@ package com.iluwatar.model.view.controller {
|
|||||||
+ valueOf(name : String) : Fatigue {static}
|
+ valueOf(name : String) : Fatigue {static}
|
||||||
+ values() : 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
|
GiantModel --> "-nourishment" Nourishment
|
||||||
GiantController --> "-giant" GiantModel
|
GiantController --> "-giant" GiantModel
|
||||||
|
@ -1,42 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.model.view.presenter {
|
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 {
|
interface FileSelectorView {
|
||||||
+ close() {abstract}
|
+ close() {abstract}
|
||||||
+ displayData(String) {abstract}
|
+ displayData(String) {abstract}
|
||||||
@ -67,6 +30,16 @@ package com.iluwatar.model.view.presenter {
|
|||||||
+ setPresenter(presenter : FileSelectorPresenter)
|
+ setPresenter(presenter : FileSelectorPresenter)
|
||||||
+ showMessage(message : String)
|
+ showMessage(message : String)
|
||||||
}
|
}
|
||||||
|
class FileLoader {
|
||||||
|
- fileName : String
|
||||||
|
- loaded : boolean
|
||||||
|
+ FileLoader()
|
||||||
|
+ fileExists() : boolean
|
||||||
|
+ getFileName() : String
|
||||||
|
+ isLoaded() : boolean
|
||||||
|
+ loadData() : String
|
||||||
|
+ setFileName(fileName : String)
|
||||||
|
}
|
||||||
class FileSelectorPresenter {
|
class FileSelectorPresenter {
|
||||||
- loader : FileLoader
|
- loader : FileLoader
|
||||||
- view : FileSelectorView
|
- view : FileSelectorView
|
||||||
@ -77,11 +50,38 @@ package com.iluwatar.model.view.presenter {
|
|||||||
+ setLoader(loader : FileLoader)
|
+ setLoader(loader : FileLoader)
|
||||||
+ start()
|
+ 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
|
FileSelectorJFrame --> "-presenter" FileSelectorPresenter
|
||||||
|
FileSelectorStub --> "-presenter" FileSelectorPresenter
|
||||||
FileSelectorPresenter --> "-loader" FileLoader
|
FileSelectorPresenter --> "-loader" FileLoader
|
||||||
FileSelectorPresenter --> "-view" FileSelectorView
|
FileSelectorPresenter --> "-view" FileSelectorView
|
||||||
FileSelectorJFrame ..|> FileSelectorView
|
|
||||||
FileSelectorStub ..|> FileSelectorView
|
FileSelectorStub ..|> FileSelectorView
|
||||||
|
FileSelectorJFrame ..|> FileSelectorView
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,13 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.monostate {
|
package com.iluwatar.monostate {
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class Request {
|
||||||
|
+ value : String
|
||||||
|
+ Request(value : String)
|
||||||
|
}
|
||||||
class LoadBalancer {
|
class LoadBalancer {
|
||||||
- id : int {static}
|
- id : int {static}
|
||||||
- lastServedId : int {static}
|
- lastServedId : int {static}
|
||||||
@ -10,14 +18,6 @@ package com.iluwatar.monostate {
|
|||||||
+ getNoOfServers() : int
|
+ getNoOfServers() : int
|
||||||
+ serverRequest(request : Request)
|
+ serverRequest(request : Request)
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class Request {
|
|
||||||
+ value : String
|
|
||||||
+ Request(value : String)
|
|
||||||
}
|
|
||||||
class Server {
|
class Server {
|
||||||
+ host : String
|
+ host : String
|
||||||
+ id : int
|
+ id : int
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.mute {
|
package com.iluwatar.mute {
|
||||||
interface Resource {
|
interface CheckedRunnable {
|
||||||
|
+ run() {abstract}
|
||||||
}
|
}
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
@ -16,8 +17,7 @@ package com.iluwatar.mute {
|
|||||||
+ loggedMute(runnable : CheckedRunnable) {static}
|
+ loggedMute(runnable : CheckedRunnable) {static}
|
||||||
+ mute(runnable : CheckedRunnable) {static}
|
+ mute(runnable : CheckedRunnable) {static}
|
||||||
}
|
}
|
||||||
interface CheckedRunnable {
|
interface Resource {
|
||||||
+ run() {abstract}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,11 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.mutex {
|
package com.iluwatar.mutex {
|
||||||
|
class Jar {
|
||||||
|
- beans : int
|
||||||
|
- lock : Lock
|
||||||
|
+ Jar(beans : int, lock : Lock)
|
||||||
|
+ takeBean() : boolean
|
||||||
|
}
|
||||||
interface Lock {
|
interface Lock {
|
||||||
+ acquire() {abstract}
|
+ acquire() {abstract}
|
||||||
+ release() {abstract}
|
+ release() {abstract}
|
||||||
@ -11,12 +17,6 @@ package com.iluwatar.mutex {
|
|||||||
+ getOwner() : Object
|
+ getOwner() : Object
|
||||||
+ release()
|
+ release()
|
||||||
}
|
}
|
||||||
class Jar {
|
|
||||||
- beans : int
|
|
||||||
- lock : Lock
|
|
||||||
+ Jar(beans : int, lock : Lock)
|
|
||||||
+ takeBean() : boolean
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
|
@ -23,58 +23,13 @@ package domainapp.dom.modules.simple {
|
|||||||
}
|
}
|
||||||
class SimpleObject {
|
class SimpleObject {
|
||||||
- container : DomainObjectContainer
|
- container : DomainObjectContainer
|
||||||
- dnFieldFlags : byte[] {static}
|
|
||||||
- dnFieldNames : String[] {static}
|
|
||||||
- dnFieldTypes : Class[] {static}
|
|
||||||
# dnFlags : byte
|
|
||||||
- dnInheritedFieldCount : int {static}
|
|
||||||
- dnPersistableSuperclass : Class<T> {static}
|
|
||||||
# dnStateManager : StateManager
|
|
||||||
- name : String
|
- name : String
|
||||||
+ SimpleObject()
|
+ SimpleObject()
|
||||||
+ ___dn$loadClass(className : String) : Class<T> {static}
|
|
||||||
- __dnFieldFlagsInit() : byte[] {static}
|
|
||||||
- __dnFieldNamesInit() : String[] {static}
|
|
||||||
- __dnFieldTypesInit() : Class[] {static}
|
|
||||||
# __dnGetInheritedFieldCount() : int {static}
|
|
||||||
- __dnPersistableSuperclassInit() : Class<T> {static}
|
|
||||||
+ compareTo(other : SimpleObject) : int
|
+ compareTo(other : SimpleObject) : int
|
||||||
+ default0UpdateName() : String
|
+ 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
|
+ getName() : String
|
||||||
+ getVersionSequence() : Long
|
+ getVersionSequence() : Long
|
||||||
+ setName(val : String)
|
+ setName(name : String)
|
||||||
+ title() : TranslatableString
|
+ title() : TranslatableString
|
||||||
+ updateName(name : String) : SimpleObject
|
+ updateName(name : String) : SimpleObject
|
||||||
+ validateUpdateName(name : String) : TranslatableString
|
+ validateUpdateName(name : String) : TranslatableString
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package domainapp.dom.app.homepage {
|
package domainapp.dom.app.homepage {
|
||||||
|
class HomePageService {
|
||||||
|
~ container : DomainObjectContainer
|
||||||
|
+ HomePageService()
|
||||||
|
+ homePage() : HomePageViewModel
|
||||||
|
}
|
||||||
class HomePageViewModel {
|
class HomePageViewModel {
|
||||||
~ simpleObjects : SimpleObjects
|
~ simpleObjects : SimpleObjects
|
||||||
+ HomePageViewModel()
|
+ HomePageViewModel()
|
||||||
+ getObjects() : List<SimpleObject>
|
+ getObjects() : List<SimpleObject>
|
||||||
+ title() : String
|
+ title() : String
|
||||||
}
|
}
|
||||||
class HomePageService {
|
|
||||||
~ container : DomainObjectContainer
|
|
||||||
+ HomePageService()
|
|
||||||
+ homePage() : HomePageViewModel
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
package domainapp.dom.modules.simple {
|
package domainapp.dom.modules.simple {
|
||||||
class SimpleObject {
|
class SimpleObject {
|
||||||
|
@ -1,26 +1,18 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package domainapp.dom.app.homepage {
|
package domainapp.dom.app.homepage {
|
||||||
class HomePageService {
|
|
||||||
~ container : DomainObjectContainer
|
|
||||||
+ HomePageService()
|
|
||||||
+ homePage() : HomePageViewModel
|
|
||||||
}
|
|
||||||
class HomePageViewModel {
|
class HomePageViewModel {
|
||||||
~ simpleObjects : SimpleObjects
|
~ simpleObjects : SimpleObjects
|
||||||
+ HomePageViewModel()
|
+ HomePageViewModel()
|
||||||
+ getObjects() : List<SimpleObject>
|
+ getObjects() : List<SimpleObject>
|
||||||
+ title() : String
|
+ title() : String
|
||||||
}
|
}
|
||||||
|
class HomePageService {
|
||||||
|
~ container : DomainObjectContainer
|
||||||
|
+ HomePageService()
|
||||||
|
+ homePage() : HomePageViewModel
|
||||||
|
}
|
||||||
}
|
}
|
||||||
package domainapp.dom.modules.simple {
|
package domainapp.dom.modules.simple {
|
||||||
class SimpleObjects {
|
|
||||||
~ container : DomainObjectContainer
|
|
||||||
+ SimpleObjects()
|
|
||||||
+ create(name : String) : SimpleObject
|
|
||||||
+ findByName(name : String) : List<SimpleObject>
|
|
||||||
+ listAll() : List<SimpleObject>
|
|
||||||
+ title() : TranslatableString
|
|
||||||
}
|
|
||||||
class SimpleObject {
|
class SimpleObject {
|
||||||
- container : DomainObjectContainer
|
- container : DomainObjectContainer
|
||||||
- dnFieldFlags : byte[] {static}
|
- dnFieldFlags : byte[] {static}
|
||||||
@ -79,6 +71,14 @@ package domainapp.dom.modules.simple {
|
|||||||
+ updateName(name : String) : SimpleObject
|
+ updateName(name : String) : SimpleObject
|
||||||
+ validateUpdateName(name : String) : TranslatableString
|
+ validateUpdateName(name : String) : TranslatableString
|
||||||
}
|
}
|
||||||
|
class SimpleObjects {
|
||||||
|
~ container : DomainObjectContainer
|
||||||
|
+ SimpleObjects()
|
||||||
|
+ create(name : String) : SimpleObject
|
||||||
|
+ findByName(name : String) : List<SimpleObject>
|
||||||
|
+ listAll() : List<SimpleObject>
|
||||||
|
+ title() : TranslatableString
|
||||||
|
}
|
||||||
}
|
}
|
||||||
package domainapp.fixture {
|
package domainapp.fixture {
|
||||||
class DomainAppFixturesProvider {
|
class DomainAppFixturesProvider {
|
||||||
|
@ -1,22 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.nullobject {
|
package com.iluwatar.nullobject {
|
||||||
class NullNode {
|
|
||||||
- instance : NullNode {static}
|
|
||||||
- NullNode()
|
|
||||||
+ getInstance() : NullNode {static}
|
|
||||||
+ getLeft() : Node
|
|
||||||
+ getName() : String
|
|
||||||
+ getRight() : Node
|
|
||||||
+ getTreeSize() : int
|
|
||||||
+ walk()
|
|
||||||
}
|
|
||||||
interface Node {
|
|
||||||
+ getLeft() : Node {abstract}
|
|
||||||
+ getName() : String {abstract}
|
|
||||||
+ getRight() : Node {abstract}
|
|
||||||
+ getTreeSize() : int {abstract}
|
|
||||||
+ walk() {abstract}
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
@ -32,9 +15,26 @@ package com.iluwatar.nullobject {
|
|||||||
+ getTreeSize() : int
|
+ getTreeSize() : int
|
||||||
+ walk()
|
+ walk()
|
||||||
}
|
}
|
||||||
|
interface Node {
|
||||||
|
+ getLeft() : Node {abstract}
|
||||||
|
+ getName() : String {abstract}
|
||||||
|
+ getRight() : Node {abstract}
|
||||||
|
+ getTreeSize() : int {abstract}
|
||||||
|
+ walk() {abstract}
|
||||||
|
}
|
||||||
|
class NullNode {
|
||||||
|
- instance : NullNode {static}
|
||||||
|
- NullNode()
|
||||||
|
+ getInstance() : NullNode {static}
|
||||||
|
+ getLeft() : Node
|
||||||
|
+ getName() : String
|
||||||
|
+ getRight() : Node
|
||||||
|
+ getTreeSize() : int
|
||||||
|
+ walk()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
NullNode --> "-instance" NullNode
|
NullNode --> "-instance" NullNode
|
||||||
NodeImpl --> "-left" Node
|
NodeImpl --> "-left" Node
|
||||||
NullNode ..|> Node
|
|
||||||
NodeImpl ..|> Node
|
NodeImpl ..|> Node
|
||||||
|
NullNode ..|> Node
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,9 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.object.pool {
|
package com.iluwatar.object.pool {
|
||||||
|
class OliphauntPool {
|
||||||
|
+ OliphauntPool()
|
||||||
|
# create() : Oliphaunt
|
||||||
|
}
|
||||||
class Oliphaunt {
|
class Oliphaunt {
|
||||||
- counter : int {static}
|
- counter : int {static}
|
||||||
- id : int
|
- id : int
|
||||||
@ -7,14 +11,6 @@ package com.iluwatar.object.pool {
|
|||||||
+ getId() : int
|
+ getId() : int
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class OliphauntPool {
|
|
||||||
+ OliphauntPool()
|
|
||||||
# create() : Oliphaunt
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
abstract class ObjectPool<T> {
|
abstract class ObjectPool<T> {
|
||||||
- available : HashSet<T>
|
- available : HashSet<T>
|
||||||
- inUse : HashSet<T>
|
- inUse : HashSet<T>
|
||||||
@ -24,6 +20,10 @@ package com.iluwatar.object.pool {
|
|||||||
# create() : T {abstract}
|
# create() : T {abstract}
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
OliphauntPool --|> ObjectPool
|
OliphauntPool --|> ObjectPool
|
||||||
@enduml
|
@enduml
|
@ -4,9 +4,12 @@ package com.iluwatar.observer {
|
|||||||
+ Orcs()
|
+ Orcs()
|
||||||
+ update(currentWeather : WeatherType)
|
+ update(currentWeather : WeatherType)
|
||||||
}
|
}
|
||||||
class Hobbits {
|
interface WeatherObserver {
|
||||||
+ Hobbits()
|
+ update(WeatherType) {abstract}
|
||||||
+ update(currentWeather : WeatherType)
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class Weather {
|
class Weather {
|
||||||
- currentWeather : WeatherType
|
- currentWeather : WeatherType
|
||||||
@ -17,12 +20,9 @@ package com.iluwatar.observer {
|
|||||||
+ removeObserver(obs : WeatherObserver)
|
+ removeObserver(obs : WeatherObserver)
|
||||||
+ timePasses()
|
+ timePasses()
|
||||||
}
|
}
|
||||||
class App {
|
class Hobbits {
|
||||||
+ App()
|
+ Hobbits()
|
||||||
+ main(args : String[]) {static}
|
+ update(currentWeather : WeatherType)
|
||||||
}
|
|
||||||
interface WeatherObserver {
|
|
||||||
+ update(WeatherType) {abstract}
|
|
||||||
}
|
}
|
||||||
enum WeatherType {
|
enum WeatherType {
|
||||||
+ COLD {static}
|
+ COLD {static}
|
||||||
@ -41,6 +41,11 @@ package com.iluwatar.observer.generic {
|
|||||||
}
|
}
|
||||||
interface Race {
|
interface Race {
|
||||||
}
|
}
|
||||||
|
class GWeather {
|
||||||
|
- currentWeather : WeatherType
|
||||||
|
+ GWeather()
|
||||||
|
+ timePasses()
|
||||||
|
}
|
||||||
abstract class Observable<S extends Observable, O extends Observer<S, O, A>, A> {
|
abstract class Observable<S extends Observable, O extends Observer<S, O, A>, A> {
|
||||||
# observers : List<O extends Observer<S, O, A>>
|
# observers : List<O extends Observer<S, O, A>>
|
||||||
+ Observable<S extends Observable, O extends Observer<S, O, A>, A>()
|
+ Observable<S extends Observable, O extends Observer<S, O, A>, A>()
|
||||||
@ -48,26 +53,21 @@ package com.iluwatar.observer.generic {
|
|||||||
+ notifyObservers(argument : A)
|
+ notifyObservers(argument : A)
|
||||||
+ removeObserver(observer : O extends Observer<S, O, A>)
|
+ removeObserver(observer : O extends Observer<S, O, A>)
|
||||||
}
|
}
|
||||||
class GWeather {
|
|
||||||
- currentWeather : WeatherType
|
|
||||||
+ GWeather()
|
|
||||||
+ timePasses()
|
|
||||||
}
|
|
||||||
interface Observer<S extends Observable<S, O, A>, O extends Observer, A> {
|
|
||||||
+ update(S extends Observable<S, O, A>, A) {abstract}
|
|
||||||
}
|
|
||||||
class GHobbits {
|
class GHobbits {
|
||||||
+ GHobbits()
|
+ GHobbits()
|
||||||
+ update(weather : GWeather, weatherType : WeatherType)
|
+ update(weather : GWeather, weatherType : WeatherType)
|
||||||
}
|
}
|
||||||
|
interface Observer<S extends Observable<S, O, A>, O extends Observer, A> {
|
||||||
|
+ update(S extends Observable<S, O, A>, A) {abstract}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Weather --> "-currentWeather" WeatherType
|
Weather --> "-currentWeather" WeatherType
|
||||||
GWeather --> "-currentWeather" WeatherType
|
GWeather --> "-currentWeather" WeatherType
|
||||||
Weather --> "-observers" WeatherObserver
|
Weather --> "-observers" WeatherObserver
|
||||||
GOrcs ..|> Race
|
GOrcs ..|> Race
|
||||||
Orcs ..|> WeatherObserver
|
Orcs ..|> WeatherObserver
|
||||||
Hobbits ..|> WeatherObserver
|
|
||||||
Race --|> Observer
|
Race --|> Observer
|
||||||
GWeather --|> Observable
|
GWeather --|> Observable
|
||||||
GHobbits ..|> Race
|
GHobbits ..|> Race
|
||||||
|
Hobbits ..|> WeatherObserver
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,8 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.poison.pill {
|
package com.iluwatar.poison.pill {
|
||||||
|
interface MqPublishPoint {
|
||||||
|
+ put(Message) {abstract}
|
||||||
|
}
|
||||||
interface Message {
|
interface Message {
|
||||||
+ POISON_PILL : Message {static}
|
+ POISON_PILL : Message {static}
|
||||||
+ addHeader(Headers, String) {abstract}
|
+ addHeader(Headers, String) {abstract}
|
||||||
@ -12,21 +15,7 @@ package com.iluwatar.poison.pill {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class SimpleMessage {
|
interface MessageQueue {
|
||||||
- body : String
|
|
||||||
- headers : Map<Headers, String>
|
|
||||||
+ SimpleMessage()
|
|
||||||
+ addHeader(header : Headers, value : String)
|
|
||||||
+ getBody() : String
|
|
||||||
+ getHeader(header : Headers) : String
|
|
||||||
+ getHeaders() : Map<Headers, String>
|
|
||||||
+ setBody(body : String)
|
|
||||||
}
|
|
||||||
class SimpleMessageQueue {
|
|
||||||
- queue : BlockingQueue<Message>
|
|
||||||
+ SimpleMessageQueue(bound : int)
|
|
||||||
+ put(msg : Message)
|
|
||||||
+ take() : Message
|
|
||||||
}
|
}
|
||||||
class Producer {
|
class Producer {
|
||||||
- isStopped : boolean
|
- isStopped : boolean
|
||||||
@ -36,19 +25,30 @@ package com.iluwatar.poison.pill {
|
|||||||
+ send(body : String)
|
+ send(body : String)
|
||||||
+ stop()
|
+ stop()
|
||||||
}
|
}
|
||||||
interface MqSubscribePoint {
|
|
||||||
+ take() : Message {abstract}
|
|
||||||
}
|
|
||||||
class Consumer {
|
class Consumer {
|
||||||
- name : String
|
- name : String
|
||||||
- queue : MqSubscribePoint
|
- queue : MqSubscribePoint
|
||||||
+ Consumer(name : String, queue : MqSubscribePoint)
|
+ Consumer(name : String, queue : MqSubscribePoint)
|
||||||
+ consume()
|
+ consume()
|
||||||
}
|
}
|
||||||
interface MessageQueue {
|
class SimpleMessageQueue {
|
||||||
|
- queue : BlockingQueue<Message>
|
||||||
|
+ SimpleMessageQueue(bound : int)
|
||||||
|
+ put(msg : Message)
|
||||||
|
+ take() : Message
|
||||||
}
|
}
|
||||||
interface MqPublishPoint {
|
interface MqSubscribePoint {
|
||||||
+ put(Message) {abstract}
|
+ take() : Message {abstract}
|
||||||
|
}
|
||||||
|
class SimpleMessage {
|
||||||
|
- body : String
|
||||||
|
- headers : Map<Headers, String>
|
||||||
|
+ SimpleMessage()
|
||||||
|
+ addHeader(header : Headers, value : String)
|
||||||
|
+ getBody() : String
|
||||||
|
+ getHeader(header : Headers) : String
|
||||||
|
+ getHeaders() : Map<Headers, String>
|
||||||
|
+ setBody(body : String)
|
||||||
}
|
}
|
||||||
enum Headers {
|
enum Headers {
|
||||||
+ DATE {static}
|
+ DATE {static}
|
||||||
@ -65,8 +65,8 @@ SimpleMessage --+ Message
|
|||||||
Producer --+ Message
|
Producer --+ Message
|
||||||
Message --> "-POISON_PILL" Message
|
Message --> "-POISON_PILL" Message
|
||||||
Consumer --+ Message
|
Consumer --+ Message
|
||||||
SimpleMessage ..|> Message
|
|
||||||
SimpleMessageQueue ..|> MessageQueue
|
|
||||||
MessageQueue --|> MqPublishPoint
|
MessageQueue --|> MqPublishPoint
|
||||||
MessageQueue --|> MqSubscribePoint
|
MessageQueue --|> MqSubscribePoint
|
||||||
|
SimpleMessageQueue ..|> MessageQueue
|
||||||
|
SimpleMessage ..|> Message
|
||||||
@enduml
|
@enduml
|
19
pom.xml
19
pom.xml
@ -282,6 +282,25 @@
|
|||||||
<ignore/>
|
<ignore/>
|
||||||
</action>
|
</action>
|
||||||
</pluginExecution>
|
</pluginExecution>
|
||||||
|
<pluginExecution>
|
||||||
|
<pluginExecutionFilter>
|
||||||
|
<groupId>
|
||||||
|
com.github.markusmo3.urm
|
||||||
|
</groupId>
|
||||||
|
<artifactId>
|
||||||
|
urm-maven-plugin
|
||||||
|
</artifactId>
|
||||||
|
<versionRange>
|
||||||
|
[1.4.1,)
|
||||||
|
</versionRange>
|
||||||
|
<goals>
|
||||||
|
<goal>map</goal>
|
||||||
|
</goals>
|
||||||
|
</pluginExecutionFilter>
|
||||||
|
<action>
|
||||||
|
<ignore></ignore>
|
||||||
|
</action>
|
||||||
|
</pluginExecution>
|
||||||
</pluginExecutions>
|
</pluginExecutions>
|
||||||
</lifecycleMappingMetadata>
|
</lifecycleMappingMetadata>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -1,18 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.privateclassdata {
|
package com.iluwatar.privateclassdata {
|
||||||
class Stew {
|
|
||||||
- numCarrots : int
|
|
||||||
- numMeat : int
|
|
||||||
- numPeppers : int
|
|
||||||
- numPotatoes : int
|
|
||||||
+ Stew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int)
|
|
||||||
+ mix()
|
|
||||||
+ taste()
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class StewData {
|
class StewData {
|
||||||
- numCarrots : int
|
- numCarrots : int
|
||||||
- numMeat : int
|
- numMeat : int
|
||||||
@ -24,6 +11,19 @@ package com.iluwatar.privateclassdata {
|
|||||||
+ getNumPeppers() : int
|
+ getNumPeppers() : int
|
||||||
+ getNumPotatoes() : int
|
+ getNumPotatoes() : int
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class Stew {
|
||||||
|
- numCarrots : int
|
||||||
|
- numMeat : int
|
||||||
|
- numPeppers : int
|
||||||
|
- numPotatoes : int
|
||||||
|
+ Stew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int)
|
||||||
|
+ mix()
|
||||||
|
+ taste()
|
||||||
|
}
|
||||||
class ImmutableStew {
|
class ImmutableStew {
|
||||||
- data : StewData
|
- data : StewData
|
||||||
+ ImmutableStew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int)
|
+ ImmutableStew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int)
|
||||||
|
@ -1,5 +1,22 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.producer.consumer {
|
package com.iluwatar.producer.consumer {
|
||||||
|
class Consumer {
|
||||||
|
- name : String
|
||||||
|
- queue : ItemQueue
|
||||||
|
+ Consumer(name : String, queue : ItemQueue)
|
||||||
|
+ consume()
|
||||||
|
}
|
||||||
|
class Item {
|
||||||
|
- id : int
|
||||||
|
- producer : String
|
||||||
|
+ Item(producer : String, id : int)
|
||||||
|
+ getId() : int
|
||||||
|
+ getProducer() : String
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class Producer {
|
class Producer {
|
||||||
- itemId : int
|
- itemId : int
|
||||||
- name : String
|
- name : String
|
||||||
@ -13,23 +30,6 @@ package com.iluwatar.producer.consumer {
|
|||||||
+ put(item : Item)
|
+ put(item : Item)
|
||||||
+ take() : Item
|
+ take() : Item
|
||||||
}
|
}
|
||||||
class Item {
|
|
||||||
- id : int
|
|
||||||
- producer : String
|
|
||||||
+ Item(producer : String, id : int)
|
|
||||||
+ getId() : int
|
|
||||||
+ getProducer() : String
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class Consumer {
|
|
||||||
- name : String
|
|
||||||
- queue : ItemQueue
|
|
||||||
+ Consumer(name : String, queue : ItemQueue)
|
|
||||||
+ consume()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Consumer --> "-queue" ItemQueue
|
Consumer --> "-queue" ItemQueue
|
||||||
Producer --> "-queue" ItemQueue
|
Producer --> "-queue" ItemQueue
|
||||||
|
@ -24,12 +24,18 @@ package com.iluwatar.promise {
|
|||||||
- ConsumeAction(src : Promise<T>, dest : Promise<T>, action : Consumer<T>)
|
- ConsumeAction(src : Promise<T>, dest : Promise<T>, action : Consumer<T>)
|
||||||
+ run()
|
+ run()
|
||||||
}
|
}
|
||||||
-class TransformAction<V> {
|
class Promise<T> {
|
||||||
- dest : Promise<V>
|
- exceptionHandler : Consumer<? super Throwable>
|
||||||
- func : Function<? super T, V>
|
- fulfillmentAction : Runnable
|
||||||
- src : Promise<T>
|
+ Promise<T>()
|
||||||
- TransformAction<V>(src : Promise<T>, dest : Promise<T>, func : Function<T, R>)
|
+ fulfill(value : T)
|
||||||
+ run()
|
+ fulfillExceptionally(exception : Exception)
|
||||||
|
+ fulfillInAsync(task : Callable<T>, executor : Executor) : Promise<T>
|
||||||
|
- handleException(exception : Exception)
|
||||||
|
+ onError(exceptionHandler : Consumer<? super Throwable>) : Promise<T>
|
||||||
|
- postFulfillment()
|
||||||
|
+ thenAccept(action : Consumer<? super T>) : Promise<Void>
|
||||||
|
+ thenApply(func : Function<? super T, V>) : Promise<V>
|
||||||
}
|
}
|
||||||
class App {
|
class App {
|
||||||
- DEFAULT_URL : String {static}
|
- DEFAULT_URL : String {static}
|
||||||
@ -47,18 +53,12 @@ package com.iluwatar.promise {
|
|||||||
- stop()
|
- stop()
|
||||||
- taskCompleted()
|
- taskCompleted()
|
||||||
}
|
}
|
||||||
class Promise<T> {
|
-class TransformAction<V> {
|
||||||
- exceptionHandler : Consumer<? super Throwable>
|
- dest : Promise<V>
|
||||||
- fulfillmentAction : Runnable
|
- func : Function<? super T, V>
|
||||||
+ Promise<T>()
|
- src : Promise<T>
|
||||||
+ fulfill(value : T)
|
- TransformAction<V>(src : Promise<T>, dest : Promise<T>, func : Function<T, R>)
|
||||||
+ fulfillExceptionally(exception : Exception)
|
+ run()
|
||||||
+ fulfillInAsync(task : Callable<T>, executor : Executor) : Promise<T>
|
|
||||||
- handleException(exception : Exception)
|
|
||||||
+ onError(exceptionHandler : Consumer<? super Throwable>) : Promise<T>
|
|
||||||
- postFulfillment()
|
|
||||||
+ thenAccept(action : Consumer<? super T>) : Promise<Void>
|
|
||||||
+ thenApply(func : Function<? super T, V>) : Promise<V>
|
|
||||||
}
|
}
|
||||||
class Utility {
|
class Utility {
|
||||||
+ Utility()
|
+ Utility()
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.property {
|
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 {
|
class Character {
|
||||||
- name : String
|
- name : String
|
||||||
- properties : Map<Stats, Integer>
|
- properties : Map<Stats, Integer>
|
||||||
@ -16,15 +26,12 @@ package com.iluwatar.property {
|
|||||||
+ toString() : String
|
+ toString() : String
|
||||||
+ type() : Type
|
+ type() : Type
|
||||||
}
|
}
|
||||||
interface Prototype {
|
enum Type {
|
||||||
+ get(Stats) : Integer {abstract}
|
+ MAGE {static}
|
||||||
+ has(Stats) : boolean {abstract}
|
+ ROGUE {static}
|
||||||
+ remove(Stats) {abstract}
|
+ WARRIOR {static}
|
||||||
+ set(Stats, Integer) {abstract}
|
+ valueOf(name : String) : Type {static}
|
||||||
}
|
+ values() : Type[] {static}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
}
|
||||||
enum Stats {
|
enum Stats {
|
||||||
+ AGILITY {static}
|
+ AGILITY {static}
|
||||||
@ -38,13 +45,6 @@ package com.iluwatar.property {
|
|||||||
+ valueOf(name : String) : Stats {static}
|
+ valueOf(name : String) : Stats {static}
|
||||||
+ values() : Stats[] {static}
|
+ values() : Stats[] {static}
|
||||||
}
|
}
|
||||||
enum Type {
|
|
||||||
+ MAGE {static}
|
|
||||||
+ ROGUE {static}
|
|
||||||
+ WARRIOR {static}
|
|
||||||
+ valueOf(name : String) : Type {static}
|
|
||||||
+ values() : Type[] {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
App --+ Character
|
App --+ Character
|
||||||
Character --> "-prototype" Prototype
|
Character --> "-prototype" Prototype
|
||||||
|
@ -1,59 +1,42 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.prototype {
|
package com.iluwatar.prototype {
|
||||||
interface HeroFactory {
|
class OrcWarlord {
|
||||||
+ createBeast() : Beast {abstract}
|
+ OrcWarlord()
|
||||||
+ createMage() : Mage {abstract}
|
+ clone() : Warlord
|
||||||
+ createWarlord() : Warlord {abstract}
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class OrcBeast {
|
class OrcBeast {
|
||||||
+ OrcBeast()
|
+ OrcBeast()
|
||||||
+ clone() : Beast
|
+ clone() : Beast
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
abstract class Mage {
|
abstract class Beast {
|
||||||
+ Mage()
|
+ Beast()
|
||||||
+ clone() : Mage {abstract}
|
+ clone() : Beast {abstract}
|
||||||
}
|
|
||||||
class HeroFactoryImpl {
|
|
||||||
- beast : Beast
|
|
||||||
- mage : Mage
|
|
||||||
- warlord : Warlord
|
|
||||||
+ HeroFactoryImpl(mage : Mage, warlord : Warlord, beast : Beast)
|
|
||||||
+ createBeast() : Beast
|
|
||||||
+ createMage() : Mage
|
|
||||||
+ createWarlord() : Warlord
|
|
||||||
}
|
}
|
||||||
class ElfMage {
|
class ElfMage {
|
||||||
+ ElfMage()
|
+ ElfMage()
|
||||||
+ clone() : Mage
|
+ clone() : Mage
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
abstract class Mage {
|
||||||
|
+ Mage()
|
||||||
|
+ clone() : Mage {abstract}
|
||||||
|
}
|
||||||
abstract class Prototype {
|
abstract class Prototype {
|
||||||
+ Prototype()
|
+ Prototype()
|
||||||
+ clone() : Object {abstract}
|
+ clone() : Object {abstract}
|
||||||
}
|
}
|
||||||
class App {
|
interface HeroFactory {
|
||||||
+ App()
|
+ createBeast() : Beast {abstract}
|
||||||
+ main(args : String[]) {static}
|
+ createMage() : Mage {abstract}
|
||||||
}
|
+ createWarlord() : Warlord {abstract}
|
||||||
abstract class Warlord {
|
|
||||||
+ Warlord()
|
|
||||||
+ clone() : Warlord {abstract}
|
|
||||||
}
|
|
||||||
class OrcWarlord {
|
|
||||||
+ OrcWarlord()
|
|
||||||
+ clone() : Warlord
|
|
||||||
+ toString() : String
|
|
||||||
}
|
}
|
||||||
class ElfWarlord {
|
class ElfWarlord {
|
||||||
+ ElfWarlord()
|
+ ElfWarlord()
|
||||||
+ clone() : Warlord
|
+ clone() : Warlord
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
abstract class Beast {
|
|
||||||
+ Beast()
|
|
||||||
+ clone() : Beast {abstract}
|
|
||||||
}
|
|
||||||
class OrcMage {
|
class OrcMage {
|
||||||
+ OrcMage()
|
+ OrcMage()
|
||||||
+ clone() : Mage
|
+ clone() : Mage
|
||||||
@ -64,18 +47,35 @@ package com.iluwatar.prototype {
|
|||||||
+ clone() : Beast
|
+ clone() : Beast
|
||||||
+ toString() : String
|
+ 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 --> "-beast" Beast
|
||||||
HeroFactoryImpl --> "-warlord" Warlord
|
HeroFactoryImpl --> "-warlord" Warlord
|
||||||
HeroFactoryImpl --> "-mage" Mage
|
HeroFactoryImpl --> "-mage" Mage
|
||||||
OrcBeast --|> Beast
|
|
||||||
Mage --|> Prototype
|
|
||||||
HeroFactoryImpl ..|> HeroFactory
|
|
||||||
ElfMage --|> Mage
|
|
||||||
Warlord --|> Prototype
|
|
||||||
OrcWarlord --|> Warlord
|
OrcWarlord --|> Warlord
|
||||||
ElfWarlord --|> Warlord
|
OrcBeast --|> Beast
|
||||||
Beast --|> Prototype
|
Beast --|> Prototype
|
||||||
|
ElfMage --|> Mage
|
||||||
|
Mage --|> Prototype
|
||||||
|
ElfWarlord --|> Warlord
|
||||||
OrcMage --|> Mage
|
OrcMage --|> Mage
|
||||||
ElfBeast --|> Beast
|
ElfBeast --|> Beast
|
||||||
|
Warlord --|> Prototype
|
||||||
|
HeroFactoryImpl ..|> HeroFactory
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,11 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.proxy {
|
package com.iluwatar.proxy {
|
||||||
|
class WizardTowerProxy {
|
||||||
|
- NUM_WIZARDS_ALLOWED : int {static}
|
||||||
|
- numWizards : int
|
||||||
|
+ WizardTowerProxy()
|
||||||
|
+ enter(wizard : Wizard)
|
||||||
|
}
|
||||||
class WizardTower {
|
class WizardTower {
|
||||||
+ WizardTower()
|
+ WizardTower()
|
||||||
+ enter(wizard : Wizard)
|
+ enter(wizard : Wizard)
|
||||||
@ -8,12 +14,6 @@ package com.iluwatar.proxy {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class WizardTowerProxy {
|
|
||||||
- NUM_WIZARDS_ALLOWED : int {static}
|
|
||||||
- numWizards : int
|
|
||||||
+ WizardTowerProxy()
|
|
||||||
+ enter(wizard : Wizard)
|
|
||||||
}
|
|
||||||
class Wizard {
|
class Wizard {
|
||||||
- name : String
|
- name : String
|
||||||
+ Wizard(name : String)
|
+ Wizard(name : String)
|
||||||
|
@ -1,5 +1,24 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.reactor.app {
|
package com.iluwatar.reactor.app {
|
||||||
|
class App {
|
||||||
|
- channels : List<AbstractNioChannel>
|
||||||
|
- 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 {
|
~class TcpLoggingClient {
|
||||||
- clientName : String
|
- clientName : String
|
||||||
- serverPort : int
|
- serverPort : int
|
||||||
@ -13,14 +32,6 @@ package com.iluwatar.reactor.app {
|
|||||||
+ UdpLoggingClient(clientName : String, port : int)
|
+ UdpLoggingClient(clientName : String, port : int)
|
||||||
+ run()
|
+ 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 {
|
class AppClient {
|
||||||
- service : ExecutorService
|
- service : ExecutorService
|
||||||
+ AppClient()
|
+ AppClient()
|
||||||
@ -29,58 +40,8 @@ package com.iluwatar.reactor.app {
|
|||||||
+ start()
|
+ start()
|
||||||
+ stop()
|
+ stop()
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
- channels : List<AbstractNioChannel>
|
|
||||||
- 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 {
|
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()
|
|
||||||
}
|
|
||||||
class ThreadPoolDispatcher {
|
|
||||||
- executorService : ExecutorService
|
|
||||||
+ ThreadPoolDispatcher(poolSize : int)
|
|
||||||
+ onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey)
|
|
||||||
+ stop()
|
|
||||||
}
|
|
||||||
interface ChannelHandler {
|
|
||||||
+ handleChannelRead(AbstractNioChannel, Object, SelectionKey) {abstract}
|
|
||||||
}
|
|
||||||
class NioDatagramChannel {
|
|
||||||
- port : int
|
|
||||||
+ NioDatagramChannel(port : int, handler : ChannelHandler)
|
|
||||||
+ bind()
|
|
||||||
# doWrite(pendingWrite : Object, key : SelectionKey)
|
|
||||||
+ getInterestedOps() : int
|
|
||||||
+ getJavaChannel() : DatagramChannel
|
|
||||||
+ read(key : SelectionKey) : DatagramPacket
|
|
||||||
+ write(data : Object, key : SelectionKey)
|
|
||||||
}
|
|
||||||
class DatagramPacket {
|
|
||||||
- data : ByteBuffer
|
|
||||||
- receiver : SocketAddress
|
|
||||||
- sender : SocketAddress
|
|
||||||
+ DatagramPacket(data : ByteBuffer)
|
|
||||||
+ getData() : ByteBuffer
|
|
||||||
+ getReceiver() : SocketAddress
|
|
||||||
+ getSender() : SocketAddress
|
|
||||||
+ setReceiver(receiver : SocketAddress)
|
|
||||||
+ setSender(sender : SocketAddress)
|
|
||||||
}
|
|
||||||
abstract class AbstractNioChannel {
|
abstract class AbstractNioChannel {
|
||||||
- channel : SelectableChannel
|
- channel : SelectableChannel
|
||||||
- channelToPendingWrites : Map<SelectableChannel, Queue<Object>>
|
- channelToPendingWrites : Map<SelectableChannel, Queue<Object>>
|
||||||
@ -97,6 +58,32 @@ package com.iluwatar.reactor.framework {
|
|||||||
~ setReactor(reactor : NioReactor)
|
~ setReactor(reactor : NioReactor)
|
||||||
+ write(data : Object, key : SelectionKey)
|
+ write(data : Object, key : SelectionKey)
|
||||||
}
|
}
|
||||||
|
~class ChangeKeyOpsCommand {
|
||||||
|
- interestedOps : int
|
||||||
|
- key : SelectionKey
|
||||||
|
+ ChangeKeyOpsCommand(this$0 : SelectionKey, key : int)
|
||||||
|
+ run()
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
interface ChannelHandler {
|
||||||
|
+ handleChannelRead(AbstractNioChannel, Object, SelectionKey) {abstract}
|
||||||
|
}
|
||||||
|
class NioDatagramChannel {
|
||||||
|
- port : int
|
||||||
|
+ NioDatagramChannel(port : int, handler : ChannelHandler)
|
||||||
|
+ bind()
|
||||||
|
# doWrite(pendingWrite : Object, key : SelectionKey)
|
||||||
|
+ getInterestedOps() : int
|
||||||
|
+ getJavaChannel() : DatagramChannel
|
||||||
|
+ 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 {
|
class NioServerSocketChannel {
|
||||||
- port : int
|
- port : int
|
||||||
+ NioServerSocketChannel(port : int, handler : ChannelHandler)
|
+ NioServerSocketChannel(port : int, handler : ChannelHandler)
|
||||||
@ -106,6 +93,26 @@ package com.iluwatar.reactor.framework {
|
|||||||
+ getJavaChannel() : ServerSocketChannel
|
+ getJavaChannel() : ServerSocketChannel
|
||||||
+ read(key : SelectionKey) : ByteBuffer
|
+ 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
|
||||||
|
- sender : SocketAddress
|
||||||
|
+ DatagramPacket(data : ByteBuffer)
|
||||||
|
+ getData() : ByteBuffer
|
||||||
|
+ getReceiver() : SocketAddress
|
||||||
|
+ getSender() : SocketAddress
|
||||||
|
+ setReceiver(receiver : SocketAddress)
|
||||||
|
+ setSender(sender : SocketAddress)
|
||||||
|
}
|
||||||
class NioReactor {
|
class NioReactor {
|
||||||
- dispatcher : Dispatcher
|
- dispatcher : Dispatcher
|
||||||
- pendingCommands : Queue<Runnable>
|
- pendingCommands : Queue<Runnable>
|
||||||
@ -124,28 +131,21 @@ package com.iluwatar.reactor.framework {
|
|||||||
+ start()
|
+ start()
|
||||||
+ stop()
|
+ stop()
|
||||||
}
|
}
|
||||||
~class ChangeKeyOpsCommand {
|
|
||||||
- interestedOps : int
|
|
||||||
- key : SelectionKey
|
|
||||||
+ ChangeKeyOpsCommand(this$0 : NioReactor, key : SelectionKey, interestedOps : int)
|
|
||||||
+ run()
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AbstractNioChannel --> "-handler" ChannelHandler
|
AbstractNioChannel --> "-handler" ChannelHandler
|
||||||
UdpLoggingClient ..+ AppClient
|
UdpLoggingClient ..+ AppClient
|
||||||
AbstractNioChannel --> "-reactor" NioReactor
|
|
||||||
TcpLoggingClient ..+ AppClient
|
TcpLoggingClient ..+ AppClient
|
||||||
|
AbstractNioChannel --> "-reactor" NioReactor
|
||||||
NioReactor --> "-dispatcher" Dispatcher
|
NioReactor --> "-dispatcher" Dispatcher
|
||||||
App --> "-reactor" NioReactor
|
App --> "-reactor" NioReactor
|
||||||
App --> "-channels" AbstractNioChannel
|
App --> "-channels" AbstractNioChannel
|
||||||
DatagramPacket ..+ NioDatagramChannel
|
DatagramPacket ..+ NioDatagramChannel
|
||||||
ChangeKeyOpsCommand --+ NioReactor
|
|
||||||
App --> "-dispatcher" Dispatcher
|
|
||||||
LoggingHandler --+ NioDatagramChannel
|
LoggingHandler --+ NioDatagramChannel
|
||||||
SameThreadDispatcher ..|> Dispatcher
|
App --> "-dispatcher" Dispatcher
|
||||||
|
ChangeKeyOpsCommand --+ NioReactor
|
||||||
|
NioDatagramChannel --|> AbstractNioChannel
|
||||||
LoggingHandler ..|> ChannelHandler
|
LoggingHandler ..|> ChannelHandler
|
||||||
ThreadPoolDispatcher ..|> Dispatcher
|
ThreadPoolDispatcher ..|> Dispatcher
|
||||||
NioDatagramChannel --|> AbstractNioChannel
|
|
||||||
NioServerSocketChannel --|> AbstractNioChannel
|
NioServerSocketChannel --|> AbstractNioChannel
|
||||||
|
SameThreadDispatcher ..|> Dispatcher
|
||||||
@enduml
|
@enduml
|
@ -1,21 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.reader.writer.lock {
|
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 {
|
class ReaderWriterLock {
|
||||||
- currentReaderCount : int
|
- currentReaderCount : int
|
||||||
- globalMutex : Set<Object>
|
- globalMutex : Set<Object>
|
||||||
@ -31,7 +15,7 @@ package com.iluwatar.reader.writer.lock {
|
|||||||
+ writeLock() : Lock
|
+ writeLock() : Lock
|
||||||
}
|
}
|
||||||
-class WriteLock {
|
-class WriteLock {
|
||||||
- WriteLock(ReaderWriterLock)
|
- WriteLock()
|
||||||
+ lock()
|
+ lock()
|
||||||
+ lockInterruptibly()
|
+ lockInterruptibly()
|
||||||
+ newCondition() : Condition
|
+ newCondition() : Condition
|
||||||
@ -43,6 +27,22 @@ package com.iluwatar.reader.writer.lock {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ 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 {
|
class Reader {
|
||||||
- name : String
|
- name : String
|
||||||
- readLock : Lock
|
- readLock : Lock
|
||||||
@ -51,8 +51,8 @@ package com.iluwatar.reader.writer.lock {
|
|||||||
+ run()
|
+ run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ReadLock --+ ReaderWriterLock
|
|
||||||
ReaderWriterLock --> "-readerLock" ReadLock
|
ReaderWriterLock --> "-readerLock" ReadLock
|
||||||
|
ReadLock --+ ReaderWriterLock
|
||||||
ReaderWriterLock --> "-writerLock" WriteLock
|
ReaderWriterLock --> "-writerLock" WriteLock
|
||||||
WriteLock --+ ReaderWriterLock
|
WriteLock --+ ReaderWriterLock
|
||||||
@enduml
|
@enduml
|
@ -1,9 +1,34 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.repository {
|
package com.iluwatar.repository {
|
||||||
|
class PersonSpecifications {
|
||||||
|
+ PersonSpecifications()
|
||||||
|
}
|
||||||
|
class NameEqualSpec {
|
||||||
|
+ name : String
|
||||||
|
+ NameEqualSpec(name : String)
|
||||||
|
+ toPredicate(root : Root<Person>, query : CriteriaQuery<?>, cb : CriteriaBuilder) : Predicate
|
||||||
|
}
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
interface PersonRepository {
|
||||||
|
+ findByName(String) : Person {abstract}
|
||||||
|
}
|
||||||
|
class AgeBetweenSpec {
|
||||||
|
- from : int
|
||||||
|
- to : int
|
||||||
|
+ AgeBetweenSpec(from : int, to : int)
|
||||||
|
+ toPredicate(root : Root<Person>, query : CriteriaQuery<?>, cb : CriteriaBuilder) : Predicate
|
||||||
|
}
|
||||||
|
class AppConfig {
|
||||||
|
+ AppConfig()
|
||||||
|
+ dataSource() : DataSource
|
||||||
|
+ entityManagerFactory() : LocalContainerEntityManagerFactoryBean
|
||||||
|
- jpaProperties() : Properties {static}
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
+ transactionManager() : JpaTransactionManager
|
||||||
|
}
|
||||||
class Person {
|
class Person {
|
||||||
- age : int
|
- age : int
|
||||||
- id : Long
|
- id : Long
|
||||||
@ -23,31 +48,6 @@ package com.iluwatar.repository {
|
|||||||
+ setSurname(surname : String)
|
+ setSurname(surname : String)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class AgeBetweenSpec {
|
|
||||||
- from : int
|
|
||||||
- to : int
|
|
||||||
+ AgeBetweenSpec(from : int, to : int)
|
|
||||||
+ toPredicate(root : Root<Person>, 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<Person>, query : CriteriaQuery<?>, cb : CriteriaBuilder) : Predicate
|
|
||||||
}
|
|
||||||
class PersonSpecifications {
|
|
||||||
+ PersonSpecifications()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
App --+ PersonSpecifications
|
App --+ PersonSpecifications
|
||||||
AppConfig --+ PersonSpecifications
|
AppConfig --+ PersonSpecifications
|
||||||
|
@ -4,13 +4,13 @@ package com.iluwatar.resource.acquisition.is.initialization {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class TreasureChest {
|
|
||||||
+ TreasureChest()
|
|
||||||
+ close()
|
|
||||||
}
|
|
||||||
class SlidingDoor {
|
class SlidingDoor {
|
||||||
+ SlidingDoor()
|
+ SlidingDoor()
|
||||||
+ close()
|
+ close()
|
||||||
}
|
}
|
||||||
|
class TreasureChest {
|
||||||
|
+ TreasureChest()
|
||||||
|
+ close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@enduml
|
@enduml
|
@ -1,32 +1,11 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.semaphore {
|
package com.iluwatar.semaphore {
|
||||||
class FruitShop {
|
|
||||||
- available : boolean[]
|
|
||||||
- bowls : FruitBowl[]
|
|
||||||
- semaphore : Semaphore
|
|
||||||
+ FruitShop()
|
|
||||||
+ countFruit() : int
|
|
||||||
+ returnBowl(bowl : FruitBowl)
|
|
||||||
+ takeBowl() : FruitBowl
|
|
||||||
}
|
|
||||||
class FruitBowl {
|
|
||||||
- fruit : ArrayList<Fruit>
|
|
||||||
+ FruitBowl()
|
|
||||||
+ countFruit() : int
|
|
||||||
+ put(f : Fruit)
|
|
||||||
+ take() : Fruit
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class Fruit {
|
class Fruit {
|
||||||
- type : FruitType
|
- type : FruitType
|
||||||
+ Fruit(type : FruitType)
|
+ Fruit(type : FruitType)
|
||||||
+ getType() : FruitType
|
+ getType() : FruitType
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
interface Lock {
|
|
||||||
+ acquire() {abstract}
|
|
||||||
+ release() {abstract}
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
@ -40,6 +19,27 @@ package com.iluwatar.semaphore {
|
|||||||
+ getNumLicenses() : int
|
+ getNumLicenses() : int
|
||||||
+ release()
|
+ 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<Fruit>
|
||||||
|
+ FruitBowl()
|
||||||
|
+ countFruit() : int
|
||||||
|
+ put(f : Fruit)
|
||||||
|
+ take() : Fruit
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
enum FruitType {
|
enum FruitType {
|
||||||
+ APPLE {static}
|
+ APPLE {static}
|
||||||
+ LEMON {static}
|
+ LEMON {static}
|
||||||
|
@ -1,24 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.servant {
|
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 {
|
class Servant {
|
||||||
+ name : String
|
+ name : String
|
||||||
+ Servant(name : String)
|
+ Servant(name : String)
|
||||||
@ -48,8 +29,27 @@ package com.iluwatar.servant {
|
|||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
+ scenario(servant : Servant, compliment : int) {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
|
App --> "-jenkins" Servant
|
||||||
King ..|> Royalty
|
|
||||||
Queen ..|> Royalty
|
Queen ..|> Royalty
|
||||||
|
King ..|> Royalty
|
||||||
@enduml
|
@enduml
|
@ -55,6 +55,9 @@ package com.iluwatar.servicelayer.magic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.servicelayer.wizard {
|
package com.iluwatar.servicelayer.wizard {
|
||||||
|
interface WizardDao {
|
||||||
|
+ findByName(String) : Wizard {abstract}
|
||||||
|
}
|
||||||
class Wizard {
|
class Wizard {
|
||||||
- id : Long
|
- id : Long
|
||||||
- name : String
|
- name : String
|
||||||
@ -74,9 +77,6 @@ package com.iluwatar.servicelayer.wizard {
|
|||||||
+ WizardDaoImpl()
|
+ WizardDaoImpl()
|
||||||
+ findByName(name : String) : Wizard
|
+ findByName(name : String) : Wizard
|
||||||
}
|
}
|
||||||
interface WizardDao {
|
|
||||||
+ findByName(String) : Wizard {abstract}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
package com.iluwatar.servicelayer.app {
|
package com.iluwatar.servicelayer.app {
|
||||||
class App {
|
class App {
|
||||||
@ -86,33 +86,14 @@ package com.iluwatar.servicelayer.app {
|
|||||||
+ queryData() {static}
|
+ 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 {
|
package com.iluwatar.servicelayer.spellbook {
|
||||||
interface SpellbookDao {
|
interface SpellbookDao {
|
||||||
+ findByName(String) : Spellbook {abstract}
|
+ findByName(String) : Spellbook {abstract}
|
||||||
}
|
}
|
||||||
|
class SpellbookDaoImpl {
|
||||||
|
+ SpellbookDaoImpl()
|
||||||
|
+ findByName(name : String) : Spellbook
|
||||||
|
}
|
||||||
class Spellbook {
|
class Spellbook {
|
||||||
- id : Long
|
- id : Long
|
||||||
- name : String
|
- name : String
|
||||||
@ -131,9 +112,28 @@ package com.iluwatar.servicelayer.spellbook {
|
|||||||
+ setWizards(wizards : Set<Wizard>)
|
+ setWizards(wizards : Set<Wizard>)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class SpellbookDaoImpl {
|
}
|
||||||
+ SpellbookDaoImpl()
|
package com.iluwatar.servicelayer.spell {
|
||||||
+ findByName(name : String) : Spellbook
|
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
|
MagicServiceImpl --> "-wizardDao" WizardDao
|
||||||
@ -141,18 +141,18 @@ MagicServiceImpl --> "-spellbookDao" SpellbookDao
|
|||||||
MagicServiceImpl --> "-spellDao" SpellDao
|
MagicServiceImpl --> "-spellDao" SpellDao
|
||||||
Spellbook --> "-spells" Spell
|
Spellbook --> "-spells" Spell
|
||||||
Spellbook --> "-wizards" Wizard
|
Spellbook --> "-wizards" Wizard
|
||||||
Wizard --|> BaseEntity
|
|
||||||
SpellbookDao --|> Dao
|
|
||||||
SpellDaoImpl ..|> SpellDao
|
SpellDaoImpl ..|> SpellDao
|
||||||
SpellDaoImpl --|> DaoBaseImpl
|
SpellDaoImpl --|> DaoBaseImpl
|
||||||
MagicServiceImpl ..|> MagicService
|
SpellbookDao --|> Dao
|
||||||
DaoBaseImpl ..|> Dao
|
WizardDao --|> Dao
|
||||||
WizardDaoImpl ..|> WizardDao
|
|
||||||
WizardDaoImpl --|> DaoBaseImpl
|
|
||||||
Spellbook --|> BaseEntity
|
|
||||||
SpellbookDaoImpl ..|> SpellbookDao
|
SpellbookDaoImpl ..|> SpellbookDao
|
||||||
SpellbookDaoImpl --|> DaoBaseImpl
|
SpellbookDaoImpl --|> DaoBaseImpl
|
||||||
Spell --|> BaseEntity
|
MagicServiceImpl ..|> MagicService
|
||||||
WizardDao --|> Dao
|
|
||||||
SpellDao --|> Dao
|
SpellDao --|> Dao
|
||||||
|
Spell --|> BaseEntity
|
||||||
|
Spellbook --|> BaseEntity
|
||||||
|
Wizard --|> BaseEntity
|
||||||
|
WizardDaoImpl ..|> WizardDao
|
||||||
|
WizardDaoImpl --|> DaoBaseImpl
|
||||||
|
DaoBaseImpl ..|> Dao
|
||||||
@enduml
|
@enduml
|
@ -1,25 +1,10 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.servicelocator {
|
package com.iluwatar.servicelocator {
|
||||||
interface Service {
|
|
||||||
+ execute() {abstract}
|
|
||||||
+ getId() : int {abstract}
|
|
||||||
+ getName() : String {abstract}
|
|
||||||
}
|
|
||||||
class InitContext {
|
|
||||||
+ InitContext()
|
|
||||||
+ lookup(serviceName : String) : Object
|
|
||||||
}
|
|
||||||
class ServiceLocator {
|
class ServiceLocator {
|
||||||
- serviceCache : ServiceCache {static}
|
- serviceCache : ServiceCache {static}
|
||||||
- ServiceLocator()
|
- ServiceLocator()
|
||||||
+ getService(serviceJndiName : String) : Service {static}
|
+ getService(serviceJndiName : String) : Service {static}
|
||||||
}
|
}
|
||||||
class ServiceCache {
|
|
||||||
- serviceCache : Map<String, Service>
|
|
||||||
+ ServiceCache()
|
|
||||||
+ addService(newService : Service)
|
|
||||||
+ getService(serviceName : String) : Service
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
@ -32,6 +17,21 @@ package com.iluwatar.servicelocator {
|
|||||||
+ getId() : int
|
+ getId() : int
|
||||||
+ getName() : String
|
+ getName() : String
|
||||||
}
|
}
|
||||||
|
class InitContext {
|
||||||
|
+ InitContext()
|
||||||
|
+ lookup(serviceName : String) : Object
|
||||||
|
}
|
||||||
|
class ServiceCache {
|
||||||
|
- serviceCache : Map<String, Service>
|
||||||
|
+ ServiceCache()
|
||||||
|
+ addService(newService : Service)
|
||||||
|
+ getService(serviceName : String) : Service
|
||||||
|
}
|
||||||
|
interface Service {
|
||||||
|
+ execute() {abstract}
|
||||||
|
+ getId() : int {abstract}
|
||||||
|
+ getName() : String {abstract}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ServiceLocator --> "-serviceCache" ServiceCache
|
ServiceLocator --> "-serviceCache" ServiceCache
|
||||||
ServiceImpl ..|> Service
|
ServiceImpl ..|> Service
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.singleton {
|
package com.iluwatar.singleton {
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class ThreadSafeLazyLoadedIvoryTower {
|
class ThreadSafeLazyLoadedIvoryTower {
|
||||||
- instance : ThreadSafeLazyLoadedIvoryTower {static}
|
- instance : ThreadSafeLazyLoadedIvoryTower {static}
|
||||||
- ThreadSafeLazyLoadedIvoryTower()
|
- ThreadSafeLazyLoadedIvoryTower()
|
||||||
+ getInstance() : ThreadSafeLazyLoadedIvoryTower {static}
|
+ getInstance() : ThreadSafeLazyLoadedIvoryTower {static}
|
||||||
}
|
}
|
||||||
-class HelperHolder {
|
class InitializingOnDemandHolderIdiom {
|
||||||
+ INSTANCE : InitializingOnDemandHolderIdiom {static}
|
- InitializingOnDemandHolderIdiom()
|
||||||
- HelperHolder()
|
+ getInstance() : InitializingOnDemandHolderIdiom {static}
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
}
|
||||||
class ThreadSafeDoubleCheckLocking {
|
class ThreadSafeDoubleCheckLocking {
|
||||||
- instance : ThreadSafeDoubleCheckLocking {static}
|
- instance : ThreadSafeDoubleCheckLocking {static}
|
||||||
- ThreadSafeDoubleCheckLocking()
|
- ThreadSafeDoubleCheckLocking()
|
||||||
+ getInstance() : ThreadSafeDoubleCheckLocking {static}
|
+ getInstance() : ThreadSafeDoubleCheckLocking {static}
|
||||||
}
|
}
|
||||||
class InitializingOnDemandHolderIdiom {
|
|
||||||
- InitializingOnDemandHolderIdiom()
|
|
||||||
+ getInstance() : InitializingOnDemandHolderIdiom {static}
|
|
||||||
}
|
|
||||||
class IvoryTower {
|
class IvoryTower {
|
||||||
- INSTANCE : IvoryTower {static}
|
- INSTANCE : IvoryTower {static}
|
||||||
- IvoryTower()
|
- IvoryTower()
|
||||||
+ getInstance() : IvoryTower {static}
|
+ getInstance() : IvoryTower {static}
|
||||||
}
|
}
|
||||||
|
-class HelperHolder {
|
||||||
|
- INSTANCE : InitializingOnDemandHolderIdiom {static}
|
||||||
|
- HelperHolder()
|
||||||
|
}
|
||||||
enum EnumIvoryTower {
|
enum EnumIvoryTower {
|
||||||
+ INSTANCE {static}
|
+ INSTANCE {static}
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.specification.creature {
|
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 {
|
abstract class AbstractCreature {
|
||||||
- color : Color
|
- color : Color
|
||||||
- movement : Movement
|
- movement : Movement
|
||||||
@ -24,20 +12,41 @@ package com.iluwatar.specification.creature {
|
|||||||
+ getSize() : Size
|
+ getSize() : Size
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
class Troll {
|
||||||
|
+ Troll()
|
||||||
|
}
|
||||||
|
class Octopus {
|
||||||
|
+ Octopus()
|
||||||
|
}
|
||||||
class Shark {
|
class Shark {
|
||||||
+ Shark()
|
+ Shark()
|
||||||
}
|
}
|
||||||
|
class Goblin {
|
||||||
|
+ Goblin()
|
||||||
|
}
|
||||||
class KillerBee {
|
class KillerBee {
|
||||||
+ KillerBee()
|
+ KillerBee()
|
||||||
}
|
}
|
||||||
class Octopus {
|
interface Creature {
|
||||||
+ Octopus()
|
+ getColor() : Color {abstract}
|
||||||
|
+ getMovement() : Movement {abstract}
|
||||||
|
+ getName() : String {abstract}
|
||||||
|
+ getSize() : Size {abstract}
|
||||||
}
|
}
|
||||||
class Dragon {
|
class Dragon {
|
||||||
+ Dragon()
|
+ Dragon()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.specification.property {
|
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 {
|
enum Color {
|
||||||
+ DARK {static}
|
+ DARK {static}
|
||||||
+ GREEN {static}
|
+ GREEN {static}
|
||||||
@ -57,15 +66,6 @@ package com.iluwatar.specification.property {
|
|||||||
+ valueOf(name : String) : Movement {static}
|
+ valueOf(name : String) : Movement {static}
|
||||||
+ values() : 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 {
|
package com.iluwatar.specification.app {
|
||||||
class App {
|
class App {
|
||||||
@ -74,9 +74,9 @@ package com.iluwatar.specification.app {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.specification.selector {
|
package com.iluwatar.specification.selector {
|
||||||
class SizeSelector {
|
class MovementSelector {
|
||||||
- s : Size
|
- m : Movement
|
||||||
+ SizeSelector(s : Size)
|
+ MovementSelector(m : Movement)
|
||||||
+ test(t : Creature) : boolean
|
+ test(t : Creature) : boolean
|
||||||
}
|
}
|
||||||
class ColorSelector {
|
class ColorSelector {
|
||||||
@ -84,9 +84,9 @@ package com.iluwatar.specification.selector {
|
|||||||
+ ColorSelector(c : Color)
|
+ ColorSelector(c : Color)
|
||||||
+ test(t : Creature) : boolean
|
+ test(t : Creature) : boolean
|
||||||
}
|
}
|
||||||
class MovementSelector {
|
class SizeSelector {
|
||||||
- m : Movement
|
- s : Size
|
||||||
+ MovementSelector(m : Movement)
|
+ SizeSelector(s : Size)
|
||||||
+ test(t : Creature) : boolean
|
+ test(t : Creature) : boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,11 +96,11 @@ MovementSelector --> "-m" Movement
|
|||||||
AbstractCreature --> "-movement" Movement
|
AbstractCreature --> "-movement" Movement
|
||||||
AbstractCreature --> "-size" Size
|
AbstractCreature --> "-size" Size
|
||||||
ColorSelector --> "-c" Color
|
ColorSelector --> "-c" Color
|
||||||
Goblin --|> AbstractCreature
|
|
||||||
Troll --|> AbstractCreature
|
|
||||||
AbstractCreature ..|> Creature
|
AbstractCreature ..|> Creature
|
||||||
Shark --|> AbstractCreature
|
Troll --|> AbstractCreature
|
||||||
KillerBee --|> AbstractCreature
|
|
||||||
Octopus --|> AbstractCreature
|
Octopus --|> AbstractCreature
|
||||||
|
Shark --|> AbstractCreature
|
||||||
|
Goblin --|> AbstractCreature
|
||||||
|
KillerBee --|> AbstractCreature
|
||||||
Dragon --|> AbstractCreature
|
Dragon --|> AbstractCreature
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,19 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.state {
|
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 {
|
class AngryState {
|
||||||
- mammoth : Mammoth
|
- mammoth : Mammoth
|
||||||
+ AngryState(mammoth : Mammoth)
|
+ AngryState(mammoth : Mammoth)
|
||||||
@ -14,24 +28,10 @@ package com.iluwatar.state {
|
|||||||
+ timePasses()
|
+ timePasses()
|
||||||
+ toString() : String
|
+ 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
|
AngryState --> "-mammoth" Mammoth
|
||||||
|
PeacefulState --> "-mammoth" Mammoth
|
||||||
Mammoth --> "-state" State
|
Mammoth --> "-state" State
|
||||||
AngryState ..|> State
|
|
||||||
PeacefulState ..|> State
|
PeacefulState ..|> State
|
||||||
|
AngryState ..|> State
|
||||||
@enduml
|
@enduml
|
@ -1,8 +1,16 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.stepbuilder {
|
package com.iluwatar.stepbuilder {
|
||||||
|
interface AbilityStep {
|
||||||
|
+ noAbilities() : BuildStep {abstract}
|
||||||
|
+ noMoreAbilities() : BuildStep {abstract}
|
||||||
|
+ withAbility(String) : AbilityStep {abstract}
|
||||||
|
}
|
||||||
interface BuildStep {
|
interface BuildStep {
|
||||||
+ build() : Character {abstract}
|
+ build() : Character {abstract}
|
||||||
}
|
}
|
||||||
|
interface NameStep {
|
||||||
|
+ name(String) : ClassStep {abstract}
|
||||||
|
}
|
||||||
-class CharacterSteps {
|
-class CharacterSteps {
|
||||||
- abilities : List<String>
|
- abilities : List<String>
|
||||||
- fighterClass : String
|
- fighterClass : String
|
||||||
@ -27,22 +35,6 @@ package com.iluwatar.stepbuilder {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ 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 {
|
class CharacterStepBuilder {
|
||||||
- CharacterStepBuilder()
|
- CharacterStepBuilder()
|
||||||
+ newBuilder() : NameStep {static}
|
+ newBuilder() : NameStep {static}
|
||||||
@ -73,13 +65,21 @@ package com.iluwatar.stepbuilder {
|
|||||||
+ noSpell() : BuildStep {abstract}
|
+ noSpell() : BuildStep {abstract}
|
||||||
+ withSpell(String) : AbilityStep {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
|
App --+ CharacterStepBuilder
|
||||||
WeaponStep ..+ CharacterStepBuilder
|
WeaponStep ..+ CharacterStepBuilder
|
||||||
SpellStep ..+ CharacterStepBuilder
|
|
||||||
AbilityStep ..+ CharacterStepBuilder
|
|
||||||
ClassStep ..+ CharacterStepBuilder
|
ClassStep ..+ CharacterStepBuilder
|
||||||
|
SpellStep ..+ CharacterStepBuilder
|
||||||
CharacterSteps ..+ CharacterStepBuilder
|
CharacterSteps ..+ CharacterStepBuilder
|
||||||
|
AbilityStep ..+ CharacterStepBuilder
|
||||||
NameStep ..+ CharacterStepBuilder
|
NameStep ..+ CharacterStepBuilder
|
||||||
BuildStep ..+ CharacterStepBuilder
|
BuildStep ..+ CharacterStepBuilder
|
||||||
CharacterSteps ..|> NameStep
|
CharacterSteps ..|> NameStep
|
||||||
|
@ -6,28 +6,28 @@ package com.iluwatar.strategy {
|
|||||||
+ changeStrategy(strategy : DragonSlayingStrategy)
|
+ changeStrategy(strategy : DragonSlayingStrategy)
|
||||||
+ goToBattle()
|
+ goToBattle()
|
||||||
}
|
}
|
||||||
class SpellStrategy {
|
interface DragonSlayingStrategy {
|
||||||
+ SpellStrategy()
|
+ execute() {abstract}
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class MeleeStrategy {
|
||||||
|
+ MeleeStrategy()
|
||||||
+ execute()
|
+ execute()
|
||||||
}
|
}
|
||||||
class ProjectileStrategy {
|
class ProjectileStrategy {
|
||||||
+ ProjectileStrategy()
|
+ ProjectileStrategy()
|
||||||
+ execute()
|
+ execute()
|
||||||
}
|
}
|
||||||
interface DragonSlayingStrategy {
|
class SpellStrategy {
|
||||||
+ execute() {abstract}
|
+ SpellStrategy()
|
||||||
}
|
|
||||||
class MeleeStrategy {
|
|
||||||
+ MeleeStrategy()
|
|
||||||
+ execute()
|
+ execute()
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DragonSlayer --> "-strategy" DragonSlayingStrategy
|
DragonSlayer --> "-strategy" DragonSlayingStrategy
|
||||||
SpellStrategy ..|> DragonSlayingStrategy
|
|
||||||
ProjectileStrategy ..|> DragonSlayingStrategy
|
|
||||||
MeleeStrategy ..|> DragonSlayingStrategy
|
MeleeStrategy ..|> DragonSlayingStrategy
|
||||||
|
ProjectileStrategy ..|> DragonSlayingStrategy
|
||||||
|
SpellStrategy ..|> DragonSlayingStrategy
|
||||||
@enduml
|
@enduml
|
@ -1,17 +1,17 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.templatemethod {
|
package com.iluwatar.templatemethod {
|
||||||
class SubtleMethod {
|
|
||||||
+ SubtleMethod()
|
|
||||||
# confuseTarget(target : String)
|
|
||||||
# pickTarget() : String
|
|
||||||
# stealTheItem(target : String)
|
|
||||||
}
|
|
||||||
class HitAndRunMethod {
|
class HitAndRunMethod {
|
||||||
+ HitAndRunMethod()
|
+ HitAndRunMethod()
|
||||||
# confuseTarget(target : String)
|
# confuseTarget(target : String)
|
||||||
# pickTarget() : String
|
# pickTarget() : String
|
||||||
# stealTheItem(target : String)
|
# stealTheItem(target : String)
|
||||||
}
|
}
|
||||||
|
class HalflingThief {
|
||||||
|
- method : StealingMethod
|
||||||
|
+ HalflingThief(method : StealingMethod)
|
||||||
|
+ changeMethod(method : StealingMethod)
|
||||||
|
+ steal()
|
||||||
|
}
|
||||||
abstract class StealingMethod {
|
abstract class StealingMethod {
|
||||||
+ StealingMethod()
|
+ StealingMethod()
|
||||||
# confuseTarget(String) {abstract}
|
# confuseTarget(String) {abstract}
|
||||||
@ -19,18 +19,18 @@ package com.iluwatar.templatemethod {
|
|||||||
+ steal()
|
+ steal()
|
||||||
# stealTheItem(String) {abstract}
|
# stealTheItem(String) {abstract}
|
||||||
}
|
}
|
||||||
|
class SubtleMethod {
|
||||||
|
+ SubtleMethod()
|
||||||
|
# confuseTarget(target : String)
|
||||||
|
# pickTarget() : String
|
||||||
|
# stealTheItem(target : String)
|
||||||
|
}
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class HalflingThief {
|
|
||||||
- method : StealingMethod
|
|
||||||
+ HalflingThief(method : StealingMethod)
|
|
||||||
+ changeMethod(method : StealingMethod)
|
|
||||||
+ steal()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
HalflingThief --> "-method" StealingMethod
|
HalflingThief --> "-method" StealingMethod
|
||||||
SubtleMethod --|> StealingMethod
|
|
||||||
HitAndRunMethod --|> StealingMethod
|
HitAndRunMethod --|> StealingMethod
|
||||||
|
SubtleMethod --|> StealingMethod
|
||||||
@enduml
|
@enduml
|
@ -1,14 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.threadpool {
|
package com.iluwatar.threadpool {
|
||||||
class Worker {
|
|
||||||
- task : Task
|
|
||||||
+ Worker(task : Task)
|
|
||||||
+ run()
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
abstract class Task {
|
abstract class Task {
|
||||||
- ID_GENERATOR : AtomicInteger {static}
|
- ID_GENERATOR : AtomicInteger {static}
|
||||||
- id : int
|
- id : int
|
||||||
@ -18,18 +9,27 @@ package com.iluwatar.threadpool {
|
|||||||
+ getTimeMs() : int
|
+ getTimeMs() : int
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class PotatoPeelingTask {
|
|
||||||
- TIME_PER_POTATO : int {static}
|
|
||||||
+ PotatoPeelingTask(numPotatoes : int)
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class CoffeeMakingTask {
|
class CoffeeMakingTask {
|
||||||
- TIME_PER_CUP : int {static}
|
- TIME_PER_CUP : int {static}
|
||||||
+ CoffeeMakingTask(numCups : int)
|
+ CoffeeMakingTask(numCups : int)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
class Worker {
|
||||||
|
- task : Task
|
||||||
|
+ Worker(task : Task)
|
||||||
|
+ run()
|
||||||
|
}
|
||||||
|
class PotatoPeelingTask {
|
||||||
|
- TIME_PER_POTATO : int {static}
|
||||||
|
+ PotatoPeelingTask(numPotatoes : int)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Worker --> "-task" Task
|
Worker --> "-task" Task
|
||||||
PotatoPeelingTask --|> Task
|
|
||||||
CoffeeMakingTask --|> Task
|
CoffeeMakingTask --|> Task
|
||||||
|
PotatoPeelingTask --|> Task
|
||||||
@enduml
|
@enduml
|
@ -1,11 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.tolerantreader {
|
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 {
|
class RainbowFish {
|
||||||
- age : int
|
- age : int
|
||||||
- lengthMeters : int
|
- lengthMeters : int
|
||||||
@ -18,6 +12,10 @@ package com.iluwatar.tolerantreader {
|
|||||||
+ getName() : String
|
+ getName() : String
|
||||||
+ getWeightTons() : int
|
+ getWeightTons() : int
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class RainbowFishV2 {
|
class RainbowFishV2 {
|
||||||
- angry : boolean
|
- angry : boolean
|
||||||
- hungry : boolean
|
- hungry : boolean
|
||||||
@ -29,9 +27,11 @@ package com.iluwatar.tolerantreader {
|
|||||||
+ getHungry() : boolean
|
+ getHungry() : boolean
|
||||||
+ getSleeping() : boolean
|
+ getSleeping() : boolean
|
||||||
}
|
}
|
||||||
class App {
|
class RainbowFishSerializer {
|
||||||
+ App()
|
- RainbowFishSerializer()
|
||||||
+ main(args : String[]) {static}
|
+ readV1(filename : String) : RainbowFish {static}
|
||||||
|
+ writeV1(rainbowFish : RainbowFish, filename : String) {static}
|
||||||
|
+ writeV2(rainbowFish : RainbowFishV2, filename : String) {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RainbowFishV2 --|> RainbowFish
|
RainbowFishV2 --|> RainbowFish
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.twin {
|
package com.iluwatar.twin {
|
||||||
class App {
|
abstract class GameItem {
|
||||||
+ App()
|
+ GameItem()
|
||||||
+ main(args : String[]) {static}
|
+ click() {abstract}
|
||||||
- waiting() {static}
|
+ doDraw() {abstract}
|
||||||
|
+ draw()
|
||||||
}
|
}
|
||||||
class BallItem {
|
class BallItem {
|
||||||
- isSuspended : boolean
|
- isSuspended : boolean
|
||||||
@ -14,11 +15,10 @@ package com.iluwatar.twin {
|
|||||||
+ move()
|
+ move()
|
||||||
+ setTwin(twin : BallThread)
|
+ setTwin(twin : BallThread)
|
||||||
}
|
}
|
||||||
abstract class GameItem {
|
class App {
|
||||||
+ GameItem()
|
+ App()
|
||||||
+ click() {abstract}
|
+ main(args : String[]) {static}
|
||||||
+ doDraw() {abstract}
|
- waiting() {static}
|
||||||
+ draw()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BallItem --|> GameItem
|
BallItem --|> GameItem
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.value.object {
|
package com.iluwatar.value.object {
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class HeroStat {
|
class HeroStat {
|
||||||
- intelligence : int
|
- intelligence : int
|
||||||
- luck : int
|
- luck : int
|
||||||
@ -17,5 +13,9 @@ package com.iluwatar.value.object {
|
|||||||
+ toString() : String
|
+ toString() : String
|
||||||
+ valueOf(strength : int, intelligence : int, luck : int) : HeroStat {static}
|
+ valueOf(strength : int, intelligence : int, luck : int) : HeroStat {static}
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@enduml
|
@enduml
|
@ -1,57 +1,57 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.visitor {
|
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 {
|
class CommanderVisitor {
|
||||||
+ CommanderVisitor()
|
+ CommanderVisitor()
|
||||||
+ visitCommander(commander : Commander)
|
+ visitCommander(commander : Commander)
|
||||||
+ visitSergeant(sergeant : Sergeant)
|
+ visitSergeant(sergeant : Sergeant)
|
||||||
+ visitSoldier(soldier : Soldier)
|
+ visitSoldier(soldier : Soldier)
|
||||||
}
|
}
|
||||||
|
class Soldier {
|
||||||
|
+ Soldier(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 SoldierVisitor {
|
||||||
|
+ SoldierVisitor()
|
||||||
|
+ visitCommander(commander : Commander)
|
||||||
|
+ visitSergeant(sergeant : Sergeant)
|
||||||
|
+ visitSoldier(soldier : Soldier)
|
||||||
|
}
|
||||||
|
class SergeantVisitor {
|
||||||
|
+ SergeantVisitor()
|
||||||
|
+ visitCommander(commander : Commander)
|
||||||
|
+ visitSergeant(sergeant : Sergeant)
|
||||||
|
+ visitSoldier(soldier : Soldier)
|
||||||
|
}
|
||||||
class Sergeant {
|
class Sergeant {
|
||||||
+ Sergeant(children : Unit[])
|
+ Sergeant(children : Unit[])
|
||||||
+ accept(visitor : UnitVisitor)
|
+ accept(visitor : UnitVisitor)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class Commander {
|
|
||||||
+ Commander(children : Unit[])
|
|
||||||
+ accept(visitor : UnitVisitor)
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
abstract class Unit {
|
|
||||||
- children : Unit[]
|
|
||||||
+ Unit(children : Unit[])
|
|
||||||
+ accept(visitor : UnitVisitor)
|
|
||||||
}
|
|
||||||
class Soldier {
|
|
||||||
+ Soldier(children : Unit[])
|
|
||||||
+ accept(visitor : UnitVisitor)
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class SergeantVisitor {
|
|
||||||
+ SergeantVisitor()
|
|
||||||
+ 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()
|
|
||||||
+ visitCommander(commander : Commander)
|
|
||||||
+ visitSergeant(sergeant : Sergeant)
|
|
||||||
+ visitSoldier(soldier : Soldier)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CommanderVisitor ..|> UnitVisitor
|
|
||||||
Sergeant --|> Unit
|
|
||||||
Commander --|> Unit
|
Commander --|> Unit
|
||||||
|
CommanderVisitor ..|> UnitVisitor
|
||||||
Soldier --|> Unit
|
Soldier --|> Unit
|
||||||
SergeantVisitor ..|> UnitVisitor
|
|
||||||
SoldierVisitor ..|> UnitVisitor
|
SoldierVisitor ..|> UnitVisitor
|
||||||
|
SergeantVisitor ..|> UnitVisitor
|
||||||
|
Sergeant --|> Unit
|
||||||
@enduml
|
@enduml
|
Loading…
x
Reference in New Issue
Block a user