Update URM Version to 1.4.4 and regenerated all puml files
This commit is contained in:
parent
8574e06966
commit
7d995056ff
@ -1,33 +1,29 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.abstractdocument.domain {
|
package com.iluwatar.abstractdocument.domain {
|
||||||
class Part {
|
|
||||||
+ Part(properties : Map<String, Object>)
|
|
||||||
}
|
|
||||||
interface HasPrice {
|
|
||||||
+ PROPERTY : String {static}
|
|
||||||
+ getPrice() : Optional<Number>
|
|
||||||
}
|
|
||||||
interface HasParts {
|
|
||||||
+ PROPERTY : String {static}
|
|
||||||
+ getParts() : Stream<Part>
|
|
||||||
}
|
|
||||||
class Car {
|
class Car {
|
||||||
+ Car(properties : Map<String, Object>)
|
+ Car(properties : Map<String, Object>)
|
||||||
}
|
}
|
||||||
interface HasType {
|
|
||||||
+ PROPERTY : String {static}
|
|
||||||
+ getType() : Optional<String>
|
|
||||||
}
|
|
||||||
interface HasModel {
|
interface HasModel {
|
||||||
+ PROPERTY : String {static}
|
+ PROPERTY : String {static}
|
||||||
+ getModel() : Optional<String>
|
+ getModel() : Optional<String>
|
||||||
}
|
}
|
||||||
|
interface HasParts {
|
||||||
|
+ PROPERTY : String {static}
|
||||||
|
+ getParts() : Stream<Part>
|
||||||
|
}
|
||||||
|
interface HasPrice {
|
||||||
|
+ PROPERTY : String {static}
|
||||||
|
+ getPrice() : Optional<Number>
|
||||||
|
}
|
||||||
|
interface HasType {
|
||||||
|
+ PROPERTY : String {static}
|
||||||
|
+ getType() : Optional<String>
|
||||||
|
}
|
||||||
|
class Part {
|
||||||
|
+ Part(properties : Map<String, Object>)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.abstractdocument {
|
package com.iluwatar.abstractdocument {
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
abstract class AbstractDocument {
|
abstract class AbstractDocument {
|
||||||
- properties : Map<String, Object>
|
- properties : Map<String, Object>
|
||||||
# AbstractDocument(properties : Map<String, Object>)
|
# AbstractDocument(properties : Map<String, Object>)
|
||||||
@ -36,24 +32,28 @@ package com.iluwatar.abstractdocument {
|
|||||||
+ put(key : String, value : Object)
|
+ put(key : String, value : Object)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
interface Document {
|
interface Document {
|
||||||
+ children(String, Function<Map<String, Object>, T>) : Stream<T> {abstract}
|
+ children(String, Function<Map<String, Object>, T>) : Stream<T> {abstract}
|
||||||
+ get(String) : Object {abstract}
|
+ get(String) : Object {abstract}
|
||||||
+ put(String, Object) {abstract}
|
+ put(String, Object) {abstract}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AbstractDocument --+ Map
|
|
||||||
Part ..|> HasType
|
|
||||||
Part ..|> HasModel
|
|
||||||
Part ..|> HasPrice
|
|
||||||
Part --|> AbstractDocument
|
|
||||||
AbstractDocument ..|> Document
|
AbstractDocument ..|> Document
|
||||||
HasPrice --|> Document
|
|
||||||
HasParts --|> Document
|
|
||||||
Car ..|> HasModel
|
Car ..|> HasModel
|
||||||
Car ..|> HasPrice
|
Car ..|> HasPrice
|
||||||
Car ..|> HasParts
|
Car ..|> HasParts
|
||||||
Car --|> AbstractDocument
|
Car --|> AbstractDocument
|
||||||
HasType --|> Document
|
|
||||||
HasModel --|> Document
|
HasModel --|> Document
|
||||||
|
HasParts --|> Document
|
||||||
|
HasPrice --|> Document
|
||||||
|
HasType --|> Document
|
||||||
|
Part ..|> HasType
|
||||||
|
Part ..|> HasModel
|
||||||
|
Part ..|> HasPrice
|
||||||
|
Part --|> AbstractDocument
|
||||||
@enduml
|
@enduml
|
@ -1,6 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.abstractfactory {
|
package com.iluwatar.abstractfactory {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- army : Army
|
- army : Army
|
||||||
- castle : Castle
|
- castle : Castle
|
||||||
- king : King
|
- king : King
|
||||||
@ -17,58 +18,58 @@ package com.iluwatar.abstractfactory {
|
|||||||
- setCastle(castle : Castle)
|
- setCastle(castle : Castle)
|
||||||
- setKing(king : King)
|
- setKing(king : King)
|
||||||
}
|
}
|
||||||
class OrcKingdomFactory {
|
interface Army {
|
||||||
+ OrcKingdomFactory()
|
+ getDescription() : String {abstract}
|
||||||
+ createArmy() : Army
|
}
|
||||||
+ createCastle() : Castle
|
interface Castle {
|
||||||
+ createKing() : King
|
+ getDescription() : String {abstract}
|
||||||
|
}
|
||||||
|
class ElfArmy {
|
||||||
|
~ DESCRIPTION : String {static}
|
||||||
|
+ ElfArmy()
|
||||||
|
+ getDescription() : String
|
||||||
}
|
}
|
||||||
class ElfCastle {
|
class ElfCastle {
|
||||||
~ DESCRIPTION : String {static}
|
~ DESCRIPTION : String {static}
|
||||||
+ ElfCastle()
|
+ ElfCastle()
|
||||||
+ getDescription() : String
|
+ getDescription() : String
|
||||||
}
|
}
|
||||||
|
class ElfKing {
|
||||||
|
~ DESCRIPTION : String {static}
|
||||||
|
+ ElfKing()
|
||||||
|
+ getDescription() : String
|
||||||
|
}
|
||||||
|
class ElfKingdomFactory {
|
||||||
|
+ ElfKingdomFactory()
|
||||||
|
+ createArmy() : Army
|
||||||
|
+ createCastle() : Castle
|
||||||
|
+ createKing() : King
|
||||||
|
}
|
||||||
|
interface King {
|
||||||
|
+ getDescription() : String {abstract}
|
||||||
|
}
|
||||||
|
interface KingdomFactory {
|
||||||
|
+ createArmy() : Army {abstract}
|
||||||
|
+ createCastle() : Castle {abstract}
|
||||||
|
+ createKing() : King {abstract}
|
||||||
|
}
|
||||||
|
class OrcArmy {
|
||||||
|
~ DESCRIPTION : String {static}
|
||||||
|
+ OrcArmy()
|
||||||
|
+ getDescription() : String
|
||||||
|
}
|
||||||
class OrcCastle {
|
class OrcCastle {
|
||||||
~ DESCRIPTION : String {static}
|
~ DESCRIPTION : String {static}
|
||||||
+ 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 {
|
class OrcKing {
|
||||||
~ DESCRIPTION : String {static}
|
~ DESCRIPTION : String {static}
|
||||||
+ OrcKing()
|
+ OrcKing()
|
||||||
+ getDescription() : String
|
+ getDescription() : String
|
||||||
}
|
}
|
||||||
class OrcArmy {
|
class OrcKingdomFactory {
|
||||||
~ DESCRIPTION : String {static}
|
+ OrcKingdomFactory()
|
||||||
+ OrcArmy()
|
|
||||||
+ getDescription() : String
|
|
||||||
}
|
|
||||||
interface King {
|
|
||||||
+ getDescription() : String {abstract}
|
|
||||||
}
|
|
||||||
class ElfKingdomFactory {
|
|
||||||
+ ElfKingdomFactory()
|
|
||||||
+ createArmy() : Army
|
+ createArmy() : Army
|
||||||
+ createCastle() : Castle
|
+ createCastle() : Castle
|
||||||
+ createKing() : King
|
+ createKing() : King
|
||||||
@ -77,12 +78,12 @@ package com.iluwatar.abstractfactory {
|
|||||||
App --> "-castle" Castle
|
App --> "-castle" Castle
|
||||||
App --> "-king" King
|
App --> "-king" King
|
||||||
App --> "-army" Army
|
App --> "-army" Army
|
||||||
OrcKingdomFactory ..|> KingdomFactory
|
|
||||||
ElfCastle ..|> Castle
|
|
||||||
OrcCastle ..|> Castle
|
|
||||||
ElfKing ..|> King
|
|
||||||
ElfArmy ..|> Army
|
ElfArmy ..|> Army
|
||||||
OrcKing ..|> King
|
ElfCastle ..|> Castle
|
||||||
OrcArmy ..|> Army
|
ElfKing ..|> King
|
||||||
ElfKingdomFactory ..|> KingdomFactory
|
ElfKingdomFactory ..|> KingdomFactory
|
||||||
|
OrcArmy ..|> Army
|
||||||
|
OrcCastle ..|> Castle
|
||||||
|
OrcKing ..|> King
|
||||||
|
OrcKingdomFactory ..|> KingdomFactory
|
||||||
@enduml
|
@enduml
|
@ -1,18 +1,19 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.adapter {
|
package com.iluwatar.adapter {
|
||||||
interface BattleShip {
|
class App {
|
||||||
+ fire() {abstract}
|
+ App()
|
||||||
+ move() {abstract}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class BattleFishingBoat {
|
class BattleFishingBoat {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- boat : FishingBoat
|
- boat : FishingBoat
|
||||||
+ BattleFishingBoat()
|
+ BattleFishingBoat()
|
||||||
+ fire()
|
+ fire()
|
||||||
+ move()
|
+ move()
|
||||||
}
|
}
|
||||||
class App {
|
interface BattleShip {
|
||||||
+ App()
|
+ fire() {abstract}
|
||||||
+ main(args : String[]) {static}
|
+ move() {abstract}
|
||||||
}
|
}
|
||||||
class Captain {
|
class Captain {
|
||||||
- battleship : BattleShip
|
- battleship : BattleShip
|
||||||
@ -23,6 +24,7 @@ package com.iluwatar.adapter {
|
|||||||
+ setBattleship(battleship : BattleShip)
|
+ setBattleship(battleship : BattleShip)
|
||||||
}
|
}
|
||||||
class FishingBoat {
|
class FishingBoat {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ FishingBoat()
|
+ FishingBoat()
|
||||||
+ fish()
|
+ fish()
|
||||||
+ sail()
|
+ sail()
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.aggregator.microservices {
|
package com.iluwatar.aggregator.microservices {
|
||||||
class ProductInventoryClientImpl {
|
class Aggregator {
|
||||||
+ ProductInventoryClientImpl()
|
- informationClient : ProductInformationClient
|
||||||
+ getProductInventories() : int
|
- inventoryClient : ProductInventoryClient
|
||||||
|
+ Aggregator()
|
||||||
|
+ getProduct() : Product
|
||||||
}
|
}
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
interface ProductInventoryClient {
|
|
||||||
+ getProductInventories() : int {abstract}
|
|
||||||
}
|
|
||||||
class Product {
|
class Product {
|
||||||
- productInventories : int
|
- productInventories : int
|
||||||
- title : String
|
- title : String
|
||||||
@ -20,22 +19,25 @@ package com.iluwatar.aggregator.microservices {
|
|||||||
+ setProductInventories(productInventories : int)
|
+ setProductInventories(productInventories : int)
|
||||||
+ setTitle(title : String)
|
+ setTitle(title : String)
|
||||||
}
|
}
|
||||||
class Aggregator {
|
|
||||||
- informationClient : ProductInformationClient
|
|
||||||
- inventoryClient : ProductInventoryClient
|
|
||||||
+ Aggregator()
|
|
||||||
+ getProduct() : Product
|
|
||||||
}
|
|
||||||
class ProductInformationClientImpl {
|
|
||||||
+ ProductInformationClientImpl()
|
|
||||||
+ getProductTitle() : String
|
|
||||||
}
|
|
||||||
interface ProductInformationClient {
|
interface ProductInformationClient {
|
||||||
+ getProductTitle() : String {abstract}
|
+ getProductTitle() : String {abstract}
|
||||||
}
|
}
|
||||||
|
class ProductInformationClientImpl {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ ProductInformationClientImpl()
|
||||||
|
+ getProductTitle() : String
|
||||||
|
}
|
||||||
|
interface ProductInventoryClient {
|
||||||
|
+ getProductInventories() : int {abstract}
|
||||||
|
}
|
||||||
|
class ProductInventoryClientImpl {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ ProductInventoryClientImpl()
|
||||||
|
+ getProductInventories() : int
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Aggregator --> "-inventoryClient" ProductInventoryClient
|
|
||||||
Aggregator --> "-informationClient" ProductInformationClient
|
Aggregator --> "-informationClient" ProductInformationClient
|
||||||
ProductInventoryClientImpl ..|> ProductInventoryClient
|
Aggregator --> "-inventoryClient" ProductInventoryClient
|
||||||
ProductInformationClientImpl ..|> ProductInformationClient
|
ProductInformationClientImpl ..|> ProductInformationClient
|
||||||
|
ProductInventoryClientImpl ..|> ProductInventoryClient
|
||||||
@enduml
|
@enduml
|
@ -1,12 +1,12 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.inventory.microservice {
|
package com.iluwatar.inventory.microservice {
|
||||||
class InventoryController {
|
|
||||||
+ InventoryController()
|
|
||||||
+ getProductInventories() : int
|
|
||||||
}
|
|
||||||
class InventoryApplication {
|
class InventoryApplication {
|
||||||
+ InventoryApplication()
|
+ InventoryApplication()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
class InventoryController {
|
||||||
|
+ InventoryController()
|
||||||
|
+ getProductInventories() : int
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@enduml
|
@enduml
|
@ -1,12 +1,27 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.api.gateway {
|
package com.iluwatar.api.gateway {
|
||||||
|
class ApiGateway {
|
||||||
|
- imageClient : ImageClient
|
||||||
|
- priceClient : PriceClient
|
||||||
|
+ ApiGateway()
|
||||||
|
+ getProductDesktop() : DesktopProduct
|
||||||
|
+ getProductMobile() : MobileProduct
|
||||||
|
}
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class PriceClientImpl {
|
class DesktopProduct {
|
||||||
+ PriceClientImpl()
|
- imagePath : String
|
||||||
|
- price : String
|
||||||
|
+ DesktopProduct()
|
||||||
|
+ getImagePath() : String
|
||||||
+ getPrice() : String
|
+ getPrice() : String
|
||||||
|
+ setImagePath(imagePath : String)
|
||||||
|
+ setPrice(price : String)
|
||||||
|
}
|
||||||
|
interface ImageClient {
|
||||||
|
+ getImagePath() : String {abstract}
|
||||||
}
|
}
|
||||||
class ImageClientImpl {
|
class ImageClientImpl {
|
||||||
+ ImageClientImpl()
|
+ ImageClientImpl()
|
||||||
@ -18,31 +33,16 @@ package com.iluwatar.api.gateway {
|
|||||||
+ getPrice() : String
|
+ getPrice() : String
|
||||||
+ setPrice(price : String)
|
+ setPrice(price : String)
|
||||||
}
|
}
|
||||||
interface ImageClient {
|
|
||||||
+ getImagePath() : String {abstract}
|
|
||||||
}
|
|
||||||
class ApiGateway {
|
|
||||||
- imageClient : ImageClient
|
|
||||||
- priceClient : PriceClient
|
|
||||||
+ ApiGateway()
|
|
||||||
+ getProductDesktop() : DesktopProduct
|
|
||||||
+ getProductMobile() : MobileProduct
|
|
||||||
}
|
|
||||||
class DesktopProduct {
|
|
||||||
- imagePath : String
|
|
||||||
- price : String
|
|
||||||
+ DesktopProduct()
|
|
||||||
+ getImagePath() : String
|
|
||||||
+ getPrice() : String
|
|
||||||
+ setImagePath(imagePath : String)
|
|
||||||
+ setPrice(price : String)
|
|
||||||
}
|
|
||||||
interface PriceClient {
|
interface PriceClient {
|
||||||
+ getPrice() : String {abstract}
|
+ getPrice() : String {abstract}
|
||||||
}
|
}
|
||||||
|
class PriceClientImpl {
|
||||||
|
+ PriceClientImpl()
|
||||||
|
+ getPrice() : String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ApiGateway --> "-imageClient" ImageClient
|
ApiGateway --> "-imageClient" ImageClient
|
||||||
ApiGateway --> "-priceClient" PriceClient
|
ApiGateway --> "-priceClient" PriceClient
|
||||||
PriceClientImpl ..|> PriceClient
|
|
||||||
ImageClientImpl ..|> ImageClient
|
ImageClientImpl ..|> ImageClient
|
||||||
|
PriceClientImpl ..|> PriceClient
|
||||||
@enduml
|
@enduml
|
@ -1,22 +1,26 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.async.method.invocation {
|
package com.iluwatar.async.method.invocation {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
- callback(name : String) : AsyncCallback<T> {static}
|
- callback(name : String) : AsyncCallback<T> {static}
|
||||||
- lazyval(value : T, delayMillis : long) : Callable<T> {static}
|
- lazyval(value : T, delayMillis : long) : Callable<T> {static}
|
||||||
- log(msg : String) {static}
|
- log(msg : String) {static}
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
interface AsyncResult<T> {
|
interface AsyncCallback<T> {
|
||||||
+ await() {abstract}
|
+ onComplete(T, Optional<Exception>) {abstract}
|
||||||
+ getValue() : T {abstract}
|
|
||||||
+ isCompleted() : boolean {abstract}
|
|
||||||
}
|
}
|
||||||
interface AsyncExecutor {
|
interface AsyncExecutor {
|
||||||
+ endProcess(AsyncResult<T>) : T {abstract}
|
+ endProcess(AsyncResult<T>) : T {abstract}
|
||||||
+ startProcess(Callable<T>) : AsyncResult<T> {abstract}
|
+ startProcess(Callable<T>) : AsyncResult<T> {abstract}
|
||||||
+ startProcess(Callable<T>, AsyncCallback<T>) : AsyncResult<T> {abstract}
|
+ startProcess(Callable<T>, AsyncCallback<T>) : AsyncResult<T> {abstract}
|
||||||
}
|
}
|
||||||
|
interface AsyncResult<T> {
|
||||||
|
+ await() {abstract}
|
||||||
|
+ getValue() : T {abstract}
|
||||||
|
+ isCompleted() : boolean {abstract}
|
||||||
|
}
|
||||||
class ThreadAsyncExecutor {
|
class ThreadAsyncExecutor {
|
||||||
- idx : AtomicInteger
|
- idx : AtomicInteger
|
||||||
+ ThreadAsyncExecutor()
|
+ ThreadAsyncExecutor()
|
||||||
@ -24,9 +28,6 @@ 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>
|
||||||
}
|
}
|
||||||
interface AsyncCallback<T> {
|
|
||||||
+ onComplete(T, Optional<Exception>) {abstract}
|
|
||||||
}
|
|
||||||
-class CompletableResult<T> {
|
-class CompletableResult<T> {
|
||||||
~ COMPLETED : int {static}
|
~ COMPLETED : int {static}
|
||||||
~ FAILED : int {static}
|
~ FAILED : int {static}
|
||||||
|
@ -1,72 +1,9 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.bridge {
|
package com.iluwatar.bridge {
|
||||||
class FlyingMagicWeapon {
|
|
||||||
+ FlyingMagicWeapon(imp : FlyingMagicWeaponImpl)
|
|
||||||
+ fly()
|
|
||||||
+ getImp() : FlyingMagicWeaponImpl
|
|
||||||
+ swing()
|
|
||||||
+ unwield()
|
|
||||||
+ wield()
|
|
||||||
}
|
|
||||||
class Stormbringer {
|
|
||||||
+ Stormbringer()
|
|
||||||
+ eatSoulImp()
|
|
||||||
+ swingImp()
|
|
||||||
+ unwieldImp()
|
|
||||||
+ wieldImp()
|
|
||||||
}
|
|
||||||
abstract class FlyingMagicWeaponImpl {
|
|
||||||
+ FlyingMagicWeaponImpl()
|
|
||||||
+ flyImp() {abstract}
|
|
||||||
}
|
|
||||||
class SoulEatingMagicWeapon {
|
|
||||||
+ SoulEatingMagicWeapon(imp : SoulEatingMagicWeaponImpl)
|
|
||||||
+ eatSoul()
|
|
||||||
+ getImp() : SoulEatingMagicWeaponImpl
|
|
||||||
+ swing()
|
|
||||||
+ unwield()
|
|
||||||
+ wield()
|
|
||||||
}
|
|
||||||
abstract class MagicWeaponImpl {
|
|
||||||
+ MagicWeaponImpl()
|
|
||||||
+ swingImp() {abstract}
|
|
||||||
+ unwieldImp() {abstract}
|
|
||||||
+ wieldImp() {abstract}
|
|
||||||
}
|
|
||||||
abstract class SoulEatingMagicWeaponImpl {
|
|
||||||
+ SoulEatingMagicWeaponImpl()
|
|
||||||
+ eatSoulImp() {abstract}
|
|
||||||
}
|
|
||||||
class Excalibur {
|
|
||||||
+ Excalibur()
|
|
||||||
+ blindImp()
|
|
||||||
+ swingImp()
|
|
||||||
+ unwieldImp()
|
|
||||||
+ wieldImp()
|
|
||||||
}
|
|
||||||
class Mjollnir {
|
|
||||||
+ Mjollnir()
|
|
||||||
+ flyImp()
|
|
||||||
+ swingImp()
|
|
||||||
+ unwieldImp()
|
|
||||||
+ wieldImp()
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ 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 {
|
class BlindingMagicWeapon {
|
||||||
+ BlindingMagicWeapon(imp : BlindingMagicWeaponImpl)
|
+ BlindingMagicWeapon(imp : BlindingMagicWeaponImpl)
|
||||||
+ blind()
|
+ blind()
|
||||||
@ -75,15 +12,81 @@ package com.iluwatar.bridge {
|
|||||||
+ unwield()
|
+ unwield()
|
||||||
+ wield()
|
+ wield()
|
||||||
}
|
}
|
||||||
|
abstract class BlindingMagicWeaponImpl {
|
||||||
|
+ BlindingMagicWeaponImpl()
|
||||||
|
+ blindImp() {abstract}
|
||||||
|
}
|
||||||
|
class Excalibur {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ Excalibur()
|
||||||
|
+ blindImp()
|
||||||
|
+ swingImp()
|
||||||
|
+ unwieldImp()
|
||||||
|
+ wieldImp()
|
||||||
|
}
|
||||||
|
class FlyingMagicWeapon {
|
||||||
|
+ FlyingMagicWeapon(imp : FlyingMagicWeaponImpl)
|
||||||
|
+ fly()
|
||||||
|
+ getImp() : FlyingMagicWeaponImpl
|
||||||
|
+ swing()
|
||||||
|
+ unwield()
|
||||||
|
+ wield()
|
||||||
|
}
|
||||||
|
abstract class FlyingMagicWeaponImpl {
|
||||||
|
+ FlyingMagicWeaponImpl()
|
||||||
|
+ flyImp() {abstract}
|
||||||
|
}
|
||||||
|
abstract class MagicWeapon {
|
||||||
|
# imp : MagicWeaponImpl
|
||||||
|
+ MagicWeapon(imp : MagicWeaponImpl)
|
||||||
|
+ getImp() : MagicWeaponImpl
|
||||||
|
+ swing() {abstract}
|
||||||
|
+ unwield() {abstract}
|
||||||
|
+ wield() {abstract}
|
||||||
|
}
|
||||||
|
abstract class MagicWeaponImpl {
|
||||||
|
+ MagicWeaponImpl()
|
||||||
|
+ swingImp() {abstract}
|
||||||
|
+ unwieldImp() {abstract}
|
||||||
|
+ wieldImp() {abstract}
|
||||||
|
}
|
||||||
|
class Mjollnir {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ Mjollnir()
|
||||||
|
+ flyImp()
|
||||||
|
+ swingImp()
|
||||||
|
+ unwieldImp()
|
||||||
|
+ wieldImp()
|
||||||
|
}
|
||||||
|
class SoulEatingMagicWeapon {
|
||||||
|
+ SoulEatingMagicWeapon(imp : SoulEatingMagicWeaponImpl)
|
||||||
|
+ eatSoul()
|
||||||
|
+ getImp() : SoulEatingMagicWeaponImpl
|
||||||
|
+ swing()
|
||||||
|
+ unwield()
|
||||||
|
+ wield()
|
||||||
|
}
|
||||||
|
abstract class SoulEatingMagicWeaponImpl {
|
||||||
|
+ SoulEatingMagicWeaponImpl()
|
||||||
|
+ eatSoulImp() {abstract}
|
||||||
|
}
|
||||||
|
class Stormbringer {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ Stormbringer()
|
||||||
|
+ eatSoulImp()
|
||||||
|
+ swingImp()
|
||||||
|
+ unwieldImp()
|
||||||
|
+ wieldImp()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MagicWeapon --> "-imp" MagicWeaponImpl
|
MagicWeapon --> "-imp" MagicWeaponImpl
|
||||||
|
BlindingMagicWeapon --|> MagicWeapon
|
||||||
|
BlindingMagicWeaponImpl --|> MagicWeaponImpl
|
||||||
|
Excalibur --|> BlindingMagicWeaponImpl
|
||||||
FlyingMagicWeapon --|> MagicWeapon
|
FlyingMagicWeapon --|> MagicWeapon
|
||||||
Stormbringer --|> SoulEatingMagicWeaponImpl
|
|
||||||
FlyingMagicWeaponImpl --|> MagicWeaponImpl
|
FlyingMagicWeaponImpl --|> MagicWeaponImpl
|
||||||
|
Mjollnir --|> FlyingMagicWeaponImpl
|
||||||
SoulEatingMagicWeapon --|> MagicWeapon
|
SoulEatingMagicWeapon --|> MagicWeapon
|
||||||
SoulEatingMagicWeaponImpl --|> MagicWeaponImpl
|
SoulEatingMagicWeaponImpl --|> MagicWeaponImpl
|
||||||
Excalibur --|> BlindingMagicWeaponImpl
|
Stormbringer --|> SoulEatingMagicWeaponImpl
|
||||||
Mjollnir --|> FlyingMagicWeaponImpl
|
|
||||||
BlindingMagicWeaponImpl --|> MagicWeaponImpl
|
|
||||||
BlindingMagicWeapon --|> MagicWeapon
|
|
||||||
@enduml
|
@enduml
|
@ -1,23 +1,41 @@
|
|||||||
@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 {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
enum Armor {
|
||||||
|
+ CHAIN_MAIL {static}
|
||||||
|
+ CLOTHES {static}
|
||||||
|
+ LEATHER {static}
|
||||||
|
+ PLATE_MAIL {static}
|
||||||
|
- title : String
|
||||||
|
+ toString() : String
|
||||||
|
+ valueOf(name : String) : Armor {static}
|
||||||
|
+ values() : Armor[] {static}
|
||||||
|
}
|
||||||
|
enum HairColor {
|
||||||
|
+ BLACK {static}
|
||||||
|
+ BLOND {static}
|
||||||
|
+ BROWN {static}
|
||||||
|
+ RED {static}
|
||||||
|
+ WHITE {static}
|
||||||
|
+ toString() : String
|
||||||
|
+ valueOf(name : String) : HairColor {static}
|
||||||
|
+ values() : HairColor[] {static}
|
||||||
|
}
|
||||||
|
enum HairType {
|
||||||
|
+ BALD {static}
|
||||||
|
+ CURLY {static}
|
||||||
|
+ LONG_CURLY {static}
|
||||||
|
+ LONG_STRAIGHT {static}
|
||||||
|
+ SHORT {static}
|
||||||
|
- title : String
|
||||||
|
+ toString() : String
|
||||||
|
+ valueOf(name : String) : HairType {static}
|
||||||
|
+ values() : HairType[] {static}
|
||||||
|
}
|
||||||
class Hero {
|
class Hero {
|
||||||
- armor : Armor
|
- armor : Armor
|
||||||
- hairColor : HairColor
|
- hairColor : HairColor
|
||||||
@ -34,25 +52,19 @@ package com.iluwatar.builder {
|
|||||||
+ getWeapon() : Weapon
|
+ getWeapon() : Weapon
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
enum Weapon {
|
class Builder {
|
||||||
+ AXE {static}
|
- armor : Armor
|
||||||
+ BOW {static}
|
- hairColor : HairColor
|
||||||
+ DAGGER {static}
|
- hairType : HairType
|
||||||
+ SWORD {static}
|
- name : String
|
||||||
+ WARHAMMER {static}
|
- profession : Profession
|
||||||
+ toString() : String
|
- weapon : Weapon
|
||||||
+ valueOf(name : String) : Weapon {static}
|
+ Builder(profession : Profession, name : String)
|
||||||
+ values() : Weapon[] {static}
|
+ build() : Hero
|
||||||
}
|
+ withArmor(armor : Armor) : Builder
|
||||||
enum HairColor {
|
+ withHairColor(hairColor : HairColor) : Builder
|
||||||
+ BLACK {static}
|
+ withHairType(hairType : HairType) : Builder
|
||||||
+ BLOND {static}
|
+ withWeapon(weapon : Weapon) : Builder
|
||||||
+ BROWN {static}
|
|
||||||
+ RED {static}
|
|
||||||
+ WHITE {static}
|
|
||||||
+ toString() : String
|
|
||||||
+ valueOf(name : String) : HairColor {static}
|
|
||||||
+ values() : HairColor[] {static}
|
|
||||||
}
|
}
|
||||||
enum Profession {
|
enum Profession {
|
||||||
+ MAGE {static}
|
+ MAGE {static}
|
||||||
@ -63,35 +75,23 @@ package com.iluwatar.builder {
|
|||||||
+ valueOf(name : String) : Profession {static}
|
+ valueOf(name : String) : Profession {static}
|
||||||
+ values() : Profession[] {static}
|
+ values() : Profession[] {static}
|
||||||
}
|
}
|
||||||
enum Armor {
|
enum Weapon {
|
||||||
+ CHAIN_MAIL {static}
|
+ AXE {static}
|
||||||
+ CLOTHES {static}
|
+ BOW {static}
|
||||||
+ LEATHER {static}
|
+ DAGGER {static}
|
||||||
+ PLATE_MAIL {static}
|
+ SWORD {static}
|
||||||
- title : String
|
+ WARHAMMER {static}
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
+ valueOf(name : String) : Armor {static}
|
+ valueOf(name : String) : Weapon {static}
|
||||||
+ values() : Armor[] {static}
|
+ values() : Weapon[] {static}
|
||||||
}
|
|
||||||
enum HairType {
|
|
||||||
+ BALD {static}
|
|
||||||
+ CURLY {static}
|
|
||||||
+ LONG_CURLY {static}
|
|
||||||
+ LONG_STRAIGHT {static}
|
|
||||||
+ SHORT {static}
|
|
||||||
- title : String
|
|
||||||
+ toString() : String
|
|
||||||
+ valueOf(name : String) : HairType {static}
|
|
||||||
+ values() : HairType[] {static}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Hero --> "-profession" Profession
|
Hero --> "-profession" Profession
|
||||||
Builder ..+ Hero
|
Builder ..+ Hero
|
||||||
Hero --> "-armor" Armor
|
Hero --> "-armor" Armor
|
||||||
App --+ Hero
|
|
||||||
Builder --> "-weapon" Weapon
|
Builder --> "-weapon" Weapon
|
||||||
Builder --> "-hairColor" HairColor
|
|
||||||
Builder --> "-hairType" HairType
|
Builder --> "-hairType" HairType
|
||||||
|
Builder --> "-hairColor" HairColor
|
||||||
Hero --> "-hairColor" HairColor
|
Hero --> "-hairColor" HairColor
|
||||||
Builder --> "-profession" Profession
|
Builder --> "-profession" Profession
|
||||||
Hero --> "-weapon" Weapon
|
Hero --> "-weapon" Weapon
|
||||||
|
@ -1,29 +1,9 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.business.delegate {
|
package com.iluwatar.business.delegate {
|
||||||
class EjbService {
|
|
||||||
+ EjbService()
|
|
||||||
+ doProcessing()
|
|
||||||
}
|
|
||||||
class BusinessLookup {
|
|
||||||
- ejbService : EjbService
|
|
||||||
- jmsService : JmsService
|
|
||||||
+ BusinessLookup()
|
|
||||||
+ getBusinessService(serviceType : ServiceType) : BusinessService
|
|
||||||
+ setEjbService(ejbService : EjbService)
|
|
||||||
+ setJmsService(jmsService : JmsService)
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
interface BusinessService {
|
|
||||||
+ doProcessing() {abstract}
|
|
||||||
}
|
|
||||||
class Client {
|
|
||||||
- businessDelegate : BusinessDelegate
|
|
||||||
+ Client(businessDelegate : BusinessDelegate)
|
|
||||||
+ doTask()
|
|
||||||
}
|
|
||||||
class BusinessDelegate {
|
class BusinessDelegate {
|
||||||
- businessService : BusinessService
|
- businessService : BusinessService
|
||||||
- lookupService : BusinessLookup
|
- lookupService : BusinessLookup
|
||||||
@ -33,7 +13,29 @@ package com.iluwatar.business.delegate {
|
|||||||
+ setLookupService(businessLookup : BusinessLookup)
|
+ setLookupService(businessLookup : BusinessLookup)
|
||||||
+ setServiceType(serviceType : ServiceType)
|
+ setServiceType(serviceType : ServiceType)
|
||||||
}
|
}
|
||||||
|
class BusinessLookup {
|
||||||
|
- ejbService : EjbService
|
||||||
|
- jmsService : JmsService
|
||||||
|
+ BusinessLookup()
|
||||||
|
+ getBusinessService(serviceType : ServiceType) : BusinessService
|
||||||
|
+ setEjbService(ejbService : EjbService)
|
||||||
|
+ setJmsService(jmsService : JmsService)
|
||||||
|
}
|
||||||
|
interface BusinessService {
|
||||||
|
+ doProcessing() {abstract}
|
||||||
|
}
|
||||||
|
class Client {
|
||||||
|
- businessDelegate : BusinessDelegate
|
||||||
|
+ Client(businessDelegate : BusinessDelegate)
|
||||||
|
+ doTask()
|
||||||
|
}
|
||||||
|
class EjbService {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ EjbService()
|
||||||
|
+ doProcessing()
|
||||||
|
}
|
||||||
class JmsService {
|
class JmsService {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ JmsService()
|
+ JmsService()
|
||||||
+ doProcessing()
|
+ doProcessing()
|
||||||
}
|
}
|
||||||
|
@ -1,56 +1,68 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.caching {
|
package com.iluwatar.caching {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
|
+ useCacheAsideStategy()
|
||||||
+ useReadAndWriteThroughStrategy()
|
+ useReadAndWriteThroughStrategy()
|
||||||
+ useReadThroughAndWriteAroundStrategy()
|
+ useReadThroughAndWriteAroundStrategy()
|
||||||
+ useReadThroughAndWriteBehindStrategy()
|
+ useReadThroughAndWriteBehindStrategy()
|
||||||
}
|
}
|
||||||
~class Node {
|
|
||||||
~ next : Node
|
|
||||||
~ previous : Node
|
|
||||||
~ userAccount : UserAccount
|
|
||||||
~ userId : String
|
|
||||||
+ Node(this$0 : String, userId : UserAccount)
|
|
||||||
}
|
|
||||||
class CacheStore {
|
|
||||||
~ cache : LruCache {static}
|
|
||||||
- CacheStore()
|
|
||||||
+ clearCache() {static}
|
|
||||||
+ flushCache() {static}
|
|
||||||
+ initCapacity(capacity : int) {static}
|
|
||||||
+ print() : String {static}
|
|
||||||
+ readThrough(userId : String) : UserAccount {static}
|
|
||||||
+ readThroughWithWriteBackPolicy(userId : String) : UserAccount {static}
|
|
||||||
+ writeAround(userAccount : UserAccount) {static}
|
|
||||||
+ writeBehind(userAccount : UserAccount) {static}
|
|
||||||
+ writeThrough(userAccount : UserAccount) {static}
|
|
||||||
}
|
|
||||||
class AppManager {
|
class AppManager {
|
||||||
- cachingPolicy : CachingPolicy {static}
|
- cachingPolicy : CachingPolicy {static}
|
||||||
- AppManager()
|
- AppManager()
|
||||||
+ find(userId : String) : UserAccount {static}
|
+ find(userId : String) : UserAccount {static}
|
||||||
|
- findAside(userId : String) : UserAccount {static}
|
||||||
+ initCacheCapacity(capacity : int) {static}
|
+ initCacheCapacity(capacity : int) {static}
|
||||||
+ initCachingPolicy(policy : CachingPolicy) {static}
|
+ initCachingPolicy(policy : CachingPolicy) {static}
|
||||||
+ initDb(useMongoDb : boolean) {static}
|
+ initDb(useMongoDb : boolean) {static}
|
||||||
+ printCacheContent() : String {static}
|
+ printCacheContent() : String {static}
|
||||||
+ save(userAccount : UserAccount) {static}
|
+ save(userAccount : UserAccount) {static}
|
||||||
|
- saveAside(userAccount : UserAccount) {static}
|
||||||
}
|
}
|
||||||
class UserAccount {
|
class CacheStore {
|
||||||
- additionalInfo : String
|
- LOGGER : Logger {static}
|
||||||
- userId : String
|
~ cache : LruCache {static}
|
||||||
- userName : String
|
- CacheStore()
|
||||||
+ UserAccount(userId : String, userName : String, additionalInfo : String)
|
+ clearCache() {static}
|
||||||
+ getAdditionalInfo() : String
|
+ flushCache() {static}
|
||||||
+ getUserId() : String
|
+ get(userId : String) : UserAccount {static}
|
||||||
+ getUserName() : String
|
+ initCapacity(capacity : int) {static}
|
||||||
+ setAdditionalInfo(additionalInfo : String)
|
+ invalidate(userId : String) {static}
|
||||||
+ setUserId(userId : String)
|
+ print() : String {static}
|
||||||
+ setUserName(userName : String)
|
+ readThrough(userId : String) : UserAccount {static}
|
||||||
+ toString() : String
|
+ readThroughWithWriteBackPolicy(userId : String) : UserAccount {static}
|
||||||
|
+ set(userId : String, userAccount : UserAccount) {static}
|
||||||
|
+ writeAround(userAccount : UserAccount) {static}
|
||||||
|
+ writeBehind(userAccount : UserAccount) {static}
|
||||||
|
+ writeThrough(userAccount : UserAccount) {static}
|
||||||
|
}
|
||||||
|
enum CachingPolicy {
|
||||||
|
+ AROUND {static}
|
||||||
|
+ ASIDE {static}
|
||||||
|
+ BEHIND {static}
|
||||||
|
+ THROUGH {static}
|
||||||
|
- policy : String
|
||||||
|
+ getPolicy() : String
|
||||||
|
+ valueOf(name : String) : CachingPolicy {static}
|
||||||
|
+ values() : CachingPolicy[] {static}
|
||||||
|
}
|
||||||
|
class DbManager {
|
||||||
|
- db : MongoDatabase {static}
|
||||||
|
- mongoClient : MongoClient {static}
|
||||||
|
- useMongoDB : boolean {static}
|
||||||
|
- virtualDB : Map<String, UserAccount> {static}
|
||||||
|
- DbManager()
|
||||||
|
+ connect() {static}
|
||||||
|
+ createVirtualDb() {static}
|
||||||
|
+ readFromDb(userId : String) : UserAccount {static}
|
||||||
|
+ updateDb(userAccount : UserAccount) {static}
|
||||||
|
+ upsertDb(userAccount : UserAccount) {static}
|
||||||
|
+ writeToDb(userAccount : UserAccount) {static}
|
||||||
}
|
}
|
||||||
class LruCache {
|
class LruCache {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
~ cache : Map<String, Node>
|
~ cache : Map<String, Node>
|
||||||
~ capacity : int
|
~ capacity : int
|
||||||
~ end : Node
|
~ end : Node
|
||||||
@ -68,31 +80,29 @@ package com.iluwatar.caching {
|
|||||||
+ setCapacity(newCapacity : int)
|
+ setCapacity(newCapacity : int)
|
||||||
+ setHead(node : Node)
|
+ setHead(node : Node)
|
||||||
}
|
}
|
||||||
class DbManager {
|
~class Node {
|
||||||
- db : MongoDatabase {static}
|
~ next : Node
|
||||||
- mongoClient : MongoClient {static}
|
~ previous : Node
|
||||||
- useMongoDB : boolean {static}
|
~ userAccount : UserAccount
|
||||||
- virtualDB : Map<String, UserAccount> {static}
|
~ userId : String
|
||||||
- DbManager()
|
+ Node(this$0 : String, userId : UserAccount)
|
||||||
+ connect() {static}
|
|
||||||
+ createVirtualDb() {static}
|
|
||||||
+ readFromDb(userId : String) : UserAccount {static}
|
|
||||||
+ updateDb(userAccount : UserAccount) {static}
|
|
||||||
+ upsertDb(userAccount : UserAccount) {static}
|
|
||||||
+ writeToDb(userAccount : UserAccount) {static}
|
|
||||||
}
|
}
|
||||||
enum CachingPolicy {
|
class UserAccount {
|
||||||
+ AROUND {static}
|
- additionalInfo : String
|
||||||
+ BEHIND {static}
|
- userId : String
|
||||||
+ THROUGH {static}
|
- userName : String
|
||||||
- policy : String
|
+ UserAccount(userId : String, userName : String, additionalInfo : String)
|
||||||
+ getPolicy() : String
|
+ getAdditionalInfo() : String
|
||||||
+ valueOf(name : String) : CachingPolicy {static}
|
+ getUserId() : String
|
||||||
+ values() : CachingPolicy[] {static}
|
+ getUserName() : String
|
||||||
|
+ setAdditionalInfo(additionalInfo : String)
|
||||||
|
+ setUserId(userId : String)
|
||||||
|
+ setUserName(userName : String)
|
||||||
|
+ toString() : String
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Node --+ LruCache
|
|
||||||
LruCache --> "-head" Node
|
LruCache --> "-head" Node
|
||||||
|
Node --+ LruCache
|
||||||
Node --> "-previous" Node
|
Node --> "-previous" Node
|
||||||
AppManager --> "-cachingPolicy" CachingPolicy
|
AppManager --> "-cachingPolicy" CachingPolicy
|
||||||
Node --> "-userAccount" UserAccount
|
Node --> "-userAccount" UserAccount
|
||||||
|
@ -1,25 +1,28 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.callback {
|
package com.iluwatar.callback {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
interface Callback {
|
interface Callback {
|
||||||
+ call() {abstract}
|
+ call() {abstract}
|
||||||
}
|
}
|
||||||
|
class LambdasApp {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ LambdasApp()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class SimpleTask {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ SimpleTask()
|
||||||
|
+ execute()
|
||||||
|
}
|
||||||
abstract class Task {
|
abstract class Task {
|
||||||
+ Task()
|
+ Task()
|
||||||
+ execute() {abstract}
|
+ execute() {abstract}
|
||||||
+ executeWith(callback : Callback)
|
+ executeWith(callback : Callback)
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class SimpleTask {
|
|
||||||
+ SimpleTask()
|
|
||||||
+ execute()
|
|
||||||
}
|
|
||||||
class LambdasApp {
|
|
||||||
+ LambdasApp()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SimpleTask --|> Task
|
SimpleTask --|> Task
|
||||||
@enduml
|
@enduml
|
@ -1,9 +1,8 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.chain {
|
package com.iluwatar.chain {
|
||||||
class OrcSoldier {
|
class App {
|
||||||
+ OrcSoldier(handler : RequestHandler)
|
+ App()
|
||||||
+ handleRequest(req : Request)
|
+ main(args : String[]) {static}
|
||||||
+ toString() : String
|
|
||||||
}
|
}
|
||||||
class OrcCommander {
|
class OrcCommander {
|
||||||
+ OrcCommander(handler : RequestHandler)
|
+ OrcCommander(handler : RequestHandler)
|
||||||
@ -16,6 +15,16 @@ package com.iluwatar.chain {
|
|||||||
- buildChain()
|
- buildChain()
|
||||||
+ makeRequest(req : Request)
|
+ makeRequest(req : Request)
|
||||||
}
|
}
|
||||||
|
class OrcOfficer {
|
||||||
|
+ OrcOfficer(handler : RequestHandler)
|
||||||
|
+ handleRequest(req : Request)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class OrcSoldier {
|
||||||
|
+ OrcSoldier(handler : RequestHandler)
|
||||||
|
+ handleRequest(req : Request)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
class Request {
|
class Request {
|
||||||
- handled : boolean
|
- handled : boolean
|
||||||
- requestDescription : String
|
- requestDescription : String
|
||||||
@ -27,22 +36,14 @@ package com.iluwatar.chain {
|
|||||||
+ markHandled()
|
+ markHandled()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
abstract class RequestHandler {
|
abstract class RequestHandler {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- next : RequestHandler
|
- next : RequestHandler
|
||||||
+ RequestHandler(next : RequestHandler)
|
+ RequestHandler(next : RequestHandler)
|
||||||
+ handleRequest(req : Request)
|
+ handleRequest(req : Request)
|
||||||
# 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 +53,9 @@ package com.iluwatar.chain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RequestHandler --> "-next" RequestHandler
|
RequestHandler --> "-next" RequestHandler
|
||||||
Request --> "-requestType" RequestType
|
|
||||||
OrcKing --> "-chain" RequestHandler
|
OrcKing --> "-chain" RequestHandler
|
||||||
OrcSoldier --|> RequestHandler
|
Request --> "-requestType" RequestType
|
||||||
OrcCommander --|> RequestHandler
|
OrcCommander --|> RequestHandler
|
||||||
OrcOfficer --|> RequestHandler
|
OrcOfficer --|> RequestHandler
|
||||||
|
OrcSoldier --|> RequestHandler
|
||||||
@enduml
|
@enduml
|
@ -1,13 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.command {
|
package com.iluwatar.command {
|
||||||
class InvisibilitySpell {
|
|
||||||
- target : Target
|
|
||||||
+ InvisibilitySpell()
|
|
||||||
+ execute(target : Target)
|
|
||||||
+ redo()
|
|
||||||
+ toString() : String
|
|
||||||
+ undo()
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
@ -23,25 +15,13 @@ package com.iluwatar.command {
|
|||||||
+ Goblin()
|
+ Goblin()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
abstract class Target {
|
class InvisibilitySpell {
|
||||||
- size : Size
|
- target : Target
|
||||||
- visibility : Visibility
|
+ InvisibilitySpell()
|
||||||
+ Target()
|
+ execute(target : Target)
|
||||||
+ getSize() : Size
|
+ redo()
|
||||||
+ 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
|
+ toString() : String
|
||||||
+ undoLastSpell()
|
+ undo()
|
||||||
}
|
}
|
||||||
class ShrinkSpell {
|
class ShrinkSpell {
|
||||||
- oldSize : Size
|
- oldSize : Size
|
||||||
@ -62,6 +42,18 @@ package com.iluwatar.command {
|
|||||||
+ valueOf(name : String) : Size {static}
|
+ valueOf(name : String) : Size {static}
|
||||||
+ values() : Size[] {static}
|
+ values() : Size[] {static}
|
||||||
}
|
}
|
||||||
|
abstract class Target {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- size : Size
|
||||||
|
- visibility : Visibility
|
||||||
|
+ Target()
|
||||||
|
+ getSize() : Size
|
||||||
|
+ getVisibility() : Visibility
|
||||||
|
+ printStatus()
|
||||||
|
+ setSize(size : Size)
|
||||||
|
+ setVisibility(visibility : Visibility)
|
||||||
|
+ toString() : String {abstract}
|
||||||
|
}
|
||||||
enum Visibility {
|
enum Visibility {
|
||||||
+ INVISIBLE {static}
|
+ INVISIBLE {static}
|
||||||
+ UNDEFINED {static}
|
+ UNDEFINED {static}
|
||||||
@ -71,6 +63,16 @@ package com.iluwatar.command {
|
|||||||
+ valueOf(name : String) : Visibility {static}
|
+ valueOf(name : String) : Visibility {static}
|
||||||
+ values() : Visibility[] {static}
|
+ values() : Visibility[] {static}
|
||||||
}
|
}
|
||||||
|
class Wizard {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- redoStack : Deque<Command>
|
||||||
|
- undoStack : Deque<Command>
|
||||||
|
+ Wizard()
|
||||||
|
+ castSpell(command : Command, target : Target)
|
||||||
|
+ redoLastSpell()
|
||||||
|
+ toString() : String
|
||||||
|
+ undoLastSpell()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Target --> "-size" Size
|
Target --> "-size" Size
|
||||||
Wizard --> "-undoStack" Command
|
Wizard --> "-undoStack" Command
|
||||||
@ -78,7 +80,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
|
||||||
|
InvisibilitySpell --|> Command
|
||||||
ShrinkSpell --|> Command
|
ShrinkSpell --|> Command
|
||||||
@enduml
|
@enduml
|
@ -1,30 +1,16 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.composite {
|
package com.iluwatar.composite {
|
||||||
class Word {
|
|
||||||
+ Word(letters : List<Letter>)
|
|
||||||
# printThisAfter()
|
|
||||||
# printThisBefore()
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ 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)
|
||||||
# printThisAfter()
|
# printThisAfter()
|
||||||
# printThisBefore()
|
# printThisBefore()
|
||||||
}
|
}
|
||||||
class Sentence {
|
|
||||||
+ Sentence(words : List<Word>)
|
|
||||||
# printThisAfter()
|
|
||||||
# printThisBefore()
|
|
||||||
}
|
|
||||||
abstract class LetterComposite {
|
abstract class LetterComposite {
|
||||||
- children : List<LetterComposite>
|
- children : List<LetterComposite>
|
||||||
+ LetterComposite()
|
+ LetterComposite()
|
||||||
@ -34,9 +20,24 @@ package com.iluwatar.composite {
|
|||||||
# printThisAfter() {abstract}
|
# printThisAfter() {abstract}
|
||||||
# printThisBefore() {abstract}
|
# printThisBefore() {abstract}
|
||||||
}
|
}
|
||||||
|
class Messenger {
|
||||||
|
+ Messenger()
|
||||||
|
~ messageFromElves() : LetterComposite
|
||||||
|
~ messageFromOrcs() : LetterComposite
|
||||||
|
}
|
||||||
|
class Sentence {
|
||||||
|
+ Sentence(words : List<Word>)
|
||||||
|
# printThisAfter()
|
||||||
|
# printThisBefore()
|
||||||
|
}
|
||||||
|
class Word {
|
||||||
|
+ Word(letters : List<Letter>)
|
||||||
|
# printThisAfter()
|
||||||
|
# printThisBefore()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LetterComposite --> "-children" LetterComposite
|
LetterComposite --> "-children" LetterComposite
|
||||||
Word --|> LetterComposite
|
|
||||||
Letter --|> LetterComposite
|
Letter --|> LetterComposite
|
||||||
Sentence --|> LetterComposite
|
Sentence --|> LetterComposite
|
||||||
|
Word --|> LetterComposite
|
||||||
@enduml
|
@enduml
|
@ -1,25 +1,5 @@
|
|||||||
@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 {
|
class App {
|
||||||
- DB_URL : String {static}
|
- DB_URL : String {static}
|
||||||
- log : Logger {static}
|
- log : Logger {static}
|
||||||
@ -32,18 +12,6 @@ package com.iluwatar.dao {
|
|||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
- performOperationsUsing(customerDao : CustomerDao) {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
|
||||||
@ -59,7 +27,39 @@ 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}
|
||||||
|
}
|
||||||
|
interface CustomerSchemaSql {
|
||||||
|
+ CREATE_SCHEMA_SQL : String {static}
|
||||||
|
+ DELETE_SCHEMA_SQL : String {static}
|
||||||
|
}
|
||||||
|
class DbCustomerDao {
|
||||||
|
- dataSource : DataSource
|
||||||
|
+ DbCustomerDao(dataSource : DataSource)
|
||||||
|
+ add(customer : Customer) : boolean
|
||||||
|
- createCustomer(resultSet : ResultSet) : Customer
|
||||||
|
+ delete(customer : Customer) : boolean
|
||||||
|
+ getAll() : Stream<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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
InMemoryCustomerDao ..|> CustomerDao
|
|
||||||
DbCustomerDao ..|> CustomerDao
|
DbCustomerDao ..|> CustomerDao
|
||||||
|
InMemoryCustomerDao ..|> CustomerDao
|
||||||
@enduml
|
@enduml
|
@ -1,11 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.datamapper {
|
package com.iluwatar.datamapper {
|
||||||
interface StudentDataMapper {
|
|
||||||
+ delete(Student) {abstract}
|
|
||||||
+ find(int) : Optional<Student> {abstract}
|
|
||||||
+ insert(Student) {abstract}
|
|
||||||
+ update(Student) {abstract}
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
- log : Logger {static}
|
- log : Logger {static}
|
||||||
- App()
|
- App()
|
||||||
@ -27,6 +21,12 @@ package com.iluwatar.datamapper {
|
|||||||
+ setStudentId(studentId : int)
|
+ setStudentId(studentId : int)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
interface StudentDataMapper {
|
||||||
|
+ delete(Student) {abstract}
|
||||||
|
+ find(int) : Optional<Student> {abstract}
|
||||||
|
+ insert(Student) {abstract}
|
||||||
|
+ update(Student) {abstract}
|
||||||
|
}
|
||||||
class StudentDataMapperImpl {
|
class StudentDataMapperImpl {
|
||||||
- students : List<Student>
|
- students : List<Student>
|
||||||
+ StudentDataMapperImpl()
|
+ StudentDataMapperImpl()
|
||||||
|
@ -1,29 +1,38 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.decorator {
|
package com.iluwatar.decorator {
|
||||||
interface Hostile {
|
|
||||||
+ attack() {abstract}
|
|
||||||
+ fleeBattle() {abstract}
|
|
||||||
+ getAttackPower() : int {abstract}
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class Troll {
|
class ClubbedTroll {
|
||||||
+ Troll()
|
- LOGGER : Logger {static}
|
||||||
|
+ ClubbedTroll(decorated : Troll)
|
||||||
|
+ attack()
|
||||||
|
+ getAttackPower() : int
|
||||||
|
}
|
||||||
|
class SimpleTroll {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ SimpleTroll()
|
||||||
+ attack()
|
+ attack()
|
||||||
+ fleeBattle()
|
+ fleeBattle()
|
||||||
+ getAttackPower() : int
|
+ getAttackPower() : int
|
||||||
}
|
}
|
||||||
class SmartHostile {
|
interface Troll {
|
||||||
- decorated : Hostile
|
+ attack() {abstract}
|
||||||
+ SmartHostile(decorated : Hostile)
|
+ fleeBattle() {abstract}
|
||||||
|
+ getAttackPower() : int {abstract}
|
||||||
|
}
|
||||||
|
class TrollDecorator {
|
||||||
|
- decorated : Troll
|
||||||
|
+ TrollDecorator(decorated : Troll)
|
||||||
+ attack()
|
+ attack()
|
||||||
+ fleeBattle()
|
+ fleeBattle()
|
||||||
+ getAttackPower() : int
|
+ getAttackPower() : int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SmartHostile --> "-decorated" Hostile
|
TrollDecorator --> "-decorated" Troll
|
||||||
Troll ..|> Hostile
|
ClubbedTroll --|> TrollDecorator
|
||||||
SmartHostile ..|> Hostile
|
SimpleTroll ..|> Troll
|
||||||
|
TrollDecorator ..|> Troll
|
||||||
@enduml
|
@enduml
|
@ -1,15 +1,18 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.delegation.simple.printers {
|
package com.iluwatar.delegation.simple.printers {
|
||||||
class HpPrinter {
|
class CanonPrinter {
|
||||||
+ HpPrinter()
|
- LOGGER : Logger {static}
|
||||||
|
+ CanonPrinter()
|
||||||
+ print(message : String)
|
+ print(message : String)
|
||||||
}
|
}
|
||||||
class EpsonPrinter {
|
class EpsonPrinter {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ EpsonPrinter()
|
+ EpsonPrinter()
|
||||||
+ print(message : String)
|
+ print(message : String)
|
||||||
}
|
}
|
||||||
class CanonPrinter {
|
class HpPrinter {
|
||||||
+ CanonPrinter()
|
- LOGGER : Logger {static}
|
||||||
|
+ HpPrinter()
|
||||||
+ print(message : String)
|
+ print(message : String)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,18 +22,18 @@ package com.iluwatar.delegation.simple {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
interface Printer {
|
||||||
|
+ print(String) {abstract}
|
||||||
|
}
|
||||||
class PrinterController {
|
class PrinterController {
|
||||||
- printer : Printer
|
- printer : Printer
|
||||||
+ PrinterController(printer : Printer)
|
+ PrinterController(printer : Printer)
|
||||||
+ print(message : String)
|
+ print(message : String)
|
||||||
}
|
}
|
||||||
interface Printer {
|
|
||||||
+ print(String) {abstract}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PrinterController --> "-printer" Printer
|
PrinterController --> "-printer" Printer
|
||||||
HpPrinter ..|> Printer
|
|
||||||
PrinterController ..|> Printer
|
PrinterController ..|> Printer
|
||||||
EpsonPrinter ..|> Printer
|
|
||||||
CanonPrinter ..|> Printer
|
CanonPrinter ..|> Printer
|
||||||
|
EpsonPrinter ..|> Printer
|
||||||
|
HpPrinter ..|> Printer
|
||||||
@enduml
|
@enduml
|
@ -5,44 +5,45 @@ package com.iluwatar.dependency.injection {
|
|||||||
+ AdvancedWizard(tobacco : Tobacco)
|
+ AdvancedWizard(tobacco : Tobacco)
|
||||||
+ smoke()
|
+ smoke()
|
||||||
}
|
}
|
||||||
interface Wizard {
|
|
||||||
+ smoke() {abstract}
|
|
||||||
}
|
|
||||||
class RivendellTobacco {
|
|
||||||
+ RivendellTobacco()
|
|
||||||
}
|
|
||||||
class SimpleWizard {
|
|
||||||
- tobacco : OldTobyTobacco
|
|
||||||
+ SimpleWizard()
|
|
||||||
+ smoke()
|
|
||||||
}
|
|
||||||
class OldTobyTobacco {
|
|
||||||
+ OldTobyTobacco()
|
|
||||||
}
|
|
||||||
class SecondBreakfastTobacco {
|
|
||||||
+ SecondBreakfastTobacco()
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
abstract class Tobacco {
|
|
||||||
+ Tobacco()
|
|
||||||
+ smoke(wizard : Wizard)
|
|
||||||
}
|
|
||||||
class GuiceWizard {
|
class GuiceWizard {
|
||||||
- tobacco : Tobacco
|
- tobacco : Tobacco
|
||||||
+ GuiceWizard(tobacco : Tobacco)
|
+ GuiceWizard(tobacco : Tobacco)
|
||||||
+ smoke()
|
+ smoke()
|
||||||
}
|
}
|
||||||
|
class OldTobyTobacco {
|
||||||
|
+ OldTobyTobacco()
|
||||||
|
}
|
||||||
|
class RivendellTobacco {
|
||||||
|
+ RivendellTobacco()
|
||||||
|
}
|
||||||
|
class SecondBreakfastTobacco {
|
||||||
|
+ SecondBreakfastTobacco()
|
||||||
|
}
|
||||||
|
class SimpleWizard {
|
||||||
|
- tobacco : OldTobyTobacco
|
||||||
|
+ SimpleWizard()
|
||||||
|
+ smoke()
|
||||||
|
}
|
||||||
|
abstract class Tobacco {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ Tobacco()
|
||||||
|
+ smoke(wizard : Wizard)
|
||||||
|
}
|
||||||
|
interface Wizard {
|
||||||
|
+ smoke() {abstract}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SimpleWizard --> "-tobacco" OldTobyTobacco
|
SimpleWizard --> "-tobacco" OldTobyTobacco
|
||||||
AdvancedWizard --> "-tobacco" Tobacco
|
AdvancedWizard --> "-tobacco" Tobacco
|
||||||
GuiceWizard --> "-tobacco" Tobacco
|
GuiceWizard --> "-tobacco" Tobacco
|
||||||
AdvancedWizard ..|> Wizard
|
AdvancedWizard ..|> Wizard
|
||||||
RivendellTobacco --|> Tobacco
|
|
||||||
SimpleWizard ..|> Wizard
|
|
||||||
OldTobyTobacco --|> Tobacco
|
|
||||||
SecondBreakfastTobacco --|> Tobacco
|
|
||||||
GuiceWizard ..|> Wizard
|
GuiceWizard ..|> Wizard
|
||||||
|
OldTobyTobacco --|> Tobacco
|
||||||
|
RivendellTobacco --|> Tobacco
|
||||||
|
SecondBreakfastTobacco --|> Tobacco
|
||||||
|
SimpleWizard ..|> Wizard
|
||||||
@enduml
|
@enduml
|
@ -1,10 +1,12 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.doublechecked.locking {
|
package com.iluwatar.doublechecked.locking {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class Inventory {
|
class Inventory {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- inventorySize : int
|
- inventorySize : int
|
||||||
- items : List<Item>
|
- items : List<Item>
|
||||||
- lock : Lock
|
- lock : Lock
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.doubledispatch {
|
package com.iluwatar.doubledispatch {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class FlamingAsteroid {
|
||||||
|
+ FlamingAsteroid(left : int, top : int, right : int, bottom : int)
|
||||||
|
+ collision(gameObject : GameObject)
|
||||||
|
}
|
||||||
abstract class GameObject {
|
abstract class GameObject {
|
||||||
- damaged : boolean
|
- damaged : boolean
|
||||||
- onFire : boolean
|
- onFire : boolean
|
||||||
@ -15,23 +24,8 @@ 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 {
|
|
||||||
+ SpaceStationMir(left : int, top : int, right : int, bottom : int)
|
|
||||||
+ collision(gameObject : GameObject)
|
|
||||||
+ collisionResolve(asteroid : FlamingAsteroid)
|
|
||||||
+ collisionResolve(iss : SpaceStationIss)
|
|
||||||
+ collisionResolve(meteoroid : Meteoroid)
|
|
||||||
+ collisionResolve(mir : SpaceStationMir)
|
|
||||||
}
|
|
||||||
class Meteoroid {
|
class Meteoroid {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ Meteoroid(left : int, top : int, right : int, bottom : int)
|
+ Meteoroid(left : int, top : int, right : int, bottom : int)
|
||||||
+ collision(gameObject : GameObject)
|
+ collision(gameObject : GameObject)
|
||||||
+ collisionResolve(asteroid : FlamingAsteroid)
|
+ collisionResolve(asteroid : FlamingAsteroid)
|
||||||
@ -52,14 +46,23 @@ package com.iluwatar.doubledispatch {
|
|||||||
~ intersectsWith(r : Rectangle) : boolean
|
~ intersectsWith(r : Rectangle) : boolean
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class App {
|
class SpaceStationIss {
|
||||||
+ App()
|
+ SpaceStationIss(left : int, top : int, right : int, bottom : int)
|
||||||
+ main(args : String[]) {static}
|
+ collision(gameObject : GameObject)
|
||||||
|
}
|
||||||
|
class SpaceStationMir {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ SpaceStationMir(left : int, top : int, right : int, bottom : int)
|
||||||
|
+ collision(gameObject : GameObject)
|
||||||
|
+ collisionResolve(asteroid : FlamingAsteroid)
|
||||||
|
+ collisionResolve(iss : SpaceStationIss)
|
||||||
|
+ collisionResolve(meteoroid : Meteoroid)
|
||||||
|
+ collisionResolve(mir : SpaceStationMir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GameObject --|> Rectangle
|
|
||||||
SpaceStationIss --|> SpaceStationMir
|
|
||||||
FlamingAsteroid --|> Meteoroid
|
FlamingAsteroid --|> Meteoroid
|
||||||
SpaceStationMir --|> GameObject
|
GameObject --|> Rectangle
|
||||||
Meteoroid --|> GameObject
|
Meteoroid --|> GameObject
|
||||||
|
SpaceStationIss --|> SpaceStationMir
|
||||||
|
SpaceStationMir --|> GameObject
|
||||||
@enduml
|
@enduml
|
@ -1,9 +1,17 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.event.aggregator {
|
package com.iluwatar.event.aggregator {
|
||||||
class LordVarys {
|
class App {
|
||||||
+ LordVarys()
|
+ App()
|
||||||
+ LordVarys(obs : EventObserver)
|
+ main(args : String[]) {static}
|
||||||
+ timePasses(day : Weekday)
|
}
|
||||||
|
enum Event {
|
||||||
|
+ STARK_SIGHTED {static}
|
||||||
|
+ TRAITOR_DETECTED {static}
|
||||||
|
+ WARSHIPS_APPROACHING {static}
|
||||||
|
- description : String
|
||||||
|
+ toString() : String
|
||||||
|
+ valueOf(name : String) : Event {static}
|
||||||
|
+ values() : Event[] {static}
|
||||||
}
|
}
|
||||||
abstract class EventEmitter {
|
abstract class EventEmitter {
|
||||||
- observers : List<EventObserver>
|
- observers : List<EventObserver>
|
||||||
@ -13,33 +21,35 @@ 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 KingJoffrey {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ KingJoffrey()
|
||||||
|
+ onEvent(e : Event)
|
||||||
|
}
|
||||||
class KingsHand {
|
class KingsHand {
|
||||||
+ KingsHand()
|
+ KingsHand()
|
||||||
+ KingsHand(obs : EventObserver)
|
+ KingsHand(obs : EventObserver)
|
||||||
+ onEvent(e : Event)
|
+ onEvent(e : Event)
|
||||||
+ timePasses(day : Weekday)
|
+ timePasses(day : Weekday)
|
||||||
}
|
}
|
||||||
|
class LordBaelish {
|
||||||
|
+ LordBaelish()
|
||||||
|
+ LordBaelish(obs : EventObserver)
|
||||||
|
+ timePasses(day : Weekday)
|
||||||
|
}
|
||||||
|
class LordVarys {
|
||||||
|
+ LordVarys()
|
||||||
|
+ LordVarys(obs : EventObserver)
|
||||||
|
+ timePasses(day : Weekday)
|
||||||
|
}
|
||||||
class Scout {
|
class Scout {
|
||||||
+ Scout()
|
+ Scout()
|
||||||
+ Scout(obs : EventObserver)
|
+ Scout(obs : EventObserver)
|
||||||
+ timePasses(day : Weekday)
|
+ timePasses(day : Weekday)
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
enum Weekday {
|
enum Weekday {
|
||||||
+ FRIDAY {static}
|
+ FRIDAY {static}
|
||||||
+ MONDAY {static}
|
+ MONDAY {static}
|
||||||
@ -53,21 +63,12 @@ package com.iluwatar.event.aggregator {
|
|||||||
+ valueOf(name : String) : Weekday {static}
|
+ valueOf(name : String) : Weekday {static}
|
||||||
+ values() : Weekday[] {static}
|
+ values() : Weekday[] {static}
|
||||||
}
|
}
|
||||||
enum Event {
|
|
||||||
+ STARK_SIGHTED {static}
|
|
||||||
+ TRAITOR_DETECTED {static}
|
|
||||||
+ WARSHIPS_APPROACHING {static}
|
|
||||||
- description : String
|
|
||||||
+ toString() : String
|
|
||||||
+ valueOf(name : String) : Event {static}
|
|
||||||
+ values() : Event[] {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
EventEmitter --> "-observers" EventObserver
|
EventEmitter --> "-observers" EventObserver
|
||||||
LordVarys --|> EventEmitter
|
|
||||||
KingJoffrey ..|> EventObserver
|
KingJoffrey ..|> EventObserver
|
||||||
LordBaelish --|> EventEmitter
|
|
||||||
KingsHand ..|> EventObserver
|
KingsHand ..|> EventObserver
|
||||||
KingsHand --|> EventEmitter
|
KingsHand --|> EventEmitter
|
||||||
|
LordBaelish --|> EventEmitter
|
||||||
|
LordVarys --|> EventEmitter
|
||||||
Scout --|> EventEmitter
|
Scout --|> EventEmitter
|
||||||
@enduml
|
@enduml
|
@ -1,6 +1,18 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.event.asynchronous {
|
package com.iluwatar.event.asynchronous {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ PROP_FILE_NAME : String {static}
|
||||||
|
~ interactiveMode : boolean
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
+ quickRun()
|
||||||
|
+ run()
|
||||||
|
+ runInteractiveMode()
|
||||||
|
+ setUp()
|
||||||
|
}
|
||||||
class Event {
|
class Event {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- eventId : int
|
- eventId : int
|
||||||
- eventListener : ThreadCompleteListener
|
- eventListener : ThreadCompleteListener
|
||||||
- eventTime : int
|
- eventTime : int
|
||||||
@ -17,9 +29,6 @@ package com.iluwatar.event.asynchronous {
|
|||||||
+ status()
|
+ status()
|
||||||
+ stop()
|
+ stop()
|
||||||
}
|
}
|
||||||
interface ThreadCompleteListener {
|
|
||||||
+ completedEventHandler(int) {abstract}
|
|
||||||
}
|
|
||||||
class EventManager {
|
class EventManager {
|
||||||
+ MAX_EVENT_TIME : int {static}
|
+ MAX_EVENT_TIME : int {static}
|
||||||
+ MAX_ID : int {static}
|
+ MAX_ID : int {static}
|
||||||
@ -42,24 +51,16 @@ package com.iluwatar.event.asynchronous {
|
|||||||
+ status(eventId : int)
|
+ status(eventId : int)
|
||||||
+ statusOfAllEvents()
|
+ statusOfAllEvents()
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ PROP_FILE_NAME : String {static}
|
|
||||||
~ interactiveMode : boolean
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
+ quickRun()
|
|
||||||
+ run()
|
|
||||||
+ runInteractiveMode()
|
|
||||||
+ setUp()
|
|
||||||
}
|
|
||||||
interface IEvent {
|
interface IEvent {
|
||||||
+ start() {abstract}
|
+ start() {abstract}
|
||||||
+ status() {abstract}
|
+ status() {abstract}
|
||||||
+ stop() {abstract}
|
+ stop() {abstract}
|
||||||
}
|
}
|
||||||
|
interface ThreadCompleteListener {
|
||||||
|
+ completedEventHandler(int) {abstract}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Event --> "-eventListener" ThreadCompleteListener
|
Event --> "-eventListener" ThreadCompleteListener
|
||||||
EventManager --+ Map
|
|
||||||
Event ..|> IEvent
|
Event ..|> IEvent
|
||||||
EventManager ..|> ThreadCompleteListener
|
EventManager ..|> ThreadCompleteListener
|
||||||
@enduml
|
@enduml
|
@ -1,10 +1,12 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.eda.handler {
|
package com.iluwatar.eda.handler {
|
||||||
class UserCreatedEventHandler {
|
class UserCreatedEventHandler {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ UserCreatedEventHandler()
|
+ UserCreatedEventHandler()
|
||||||
+ onEvent(event : UserCreatedEvent)
|
+ onEvent(event : UserCreatedEvent)
|
||||||
}
|
}
|
||||||
class UserUpdatedEventHandler {
|
class UserUpdatedEventHandler {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ UserUpdatedEventHandler()
|
+ UserUpdatedEventHandler()
|
||||||
+ onEvent(event : UserUpdatedEvent)
|
+ onEvent(event : UserUpdatedEvent)
|
||||||
}
|
}
|
||||||
@ -26,8 +28,8 @@ package com.iluwatar.eda.event {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.eda.framework {
|
package com.iluwatar.eda.framework {
|
||||||
interface Handler<E extends Event> {
|
interface Event {
|
||||||
+ onEvent(E extends Event) {abstract}
|
+ getType() : Class<? extends Event> {abstract}
|
||||||
}
|
}
|
||||||
class EventDispatcher {
|
class EventDispatcher {
|
||||||
- handlers : Map<Class<? extends Event>, Handler<? extends Event>>
|
- handlers : Map<Class<? extends Event>, Handler<? extends Event>>
|
||||||
@ -35,8 +37,8 @@ package com.iluwatar.eda.framework {
|
|||||||
+ dispatch(event : E extends Event)
|
+ dispatch(event : E extends Event)
|
||||||
+ registerHandler(eventType : Class<E extends Event>, handler : Handler<E extends Event>)
|
+ registerHandler(eventType : Class<E extends Event>, handler : Handler<E extends Event>)
|
||||||
}
|
}
|
||||||
interface Event {
|
interface Handler<E extends Event> {
|
||||||
+ getType() : Class<? extends Event> {abstract}
|
+ onEvent(E extends Event) {abstract}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.eda.model {
|
package com.iluwatar.eda.model {
|
||||||
@ -52,11 +54,11 @@ package com.iluwatar.eda {
|
|||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UserUpdatedEvent --> "-user" User
|
|
||||||
UserCreatedEvent --> "-user" User
|
UserCreatedEvent --> "-user" User
|
||||||
|
UserUpdatedEvent --> "-user" User
|
||||||
AbstractEvent ..|> Event
|
AbstractEvent ..|> Event
|
||||||
UserCreatedEvent --|> AbstractEvent
|
UserCreatedEvent --|> AbstractEvent
|
||||||
UserCreatedEventHandler ..|> Handler
|
|
||||||
UserUpdatedEvent --|> AbstractEvent
|
UserUpdatedEvent --|> AbstractEvent
|
||||||
|
UserCreatedEventHandler ..|> Handler
|
||||||
UserUpdatedEventHandler ..|> Handler
|
UserUpdatedEventHandler ..|> Handler
|
||||||
@enduml
|
@enduml
|
@ -1,8 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.execute.around {
|
package com.iluwatar.execute.around {
|
||||||
class SimpleFileWriter {
|
|
||||||
+ SimpleFileWriter(filename : String, action : FileWriterAction)
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
@ -10,5 +7,8 @@ package com.iluwatar.execute.around {
|
|||||||
interface FileWriterAction {
|
interface FileWriterAction {
|
||||||
+ writeFile(FileWriter) {abstract}
|
+ writeFile(FileWriter) {abstract}
|
||||||
}
|
}
|
||||||
|
class SimpleFileWriter {
|
||||||
|
+ SimpleFileWriter(filename : String, action : FileWriterAction)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@enduml
|
@enduml
|
@ -1,6 +1,17 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.facade {
|
package com.iluwatar.facade {
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class DwarvenCartOperator {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ DwarvenCartOperator()
|
||||||
|
+ name() : String
|
||||||
|
+ work()
|
||||||
|
}
|
||||||
class DwarvenGoldDigger {
|
class DwarvenGoldDigger {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ DwarvenGoldDigger()
|
+ DwarvenGoldDigger()
|
||||||
+ name() : String
|
+ name() : String
|
||||||
+ work()
|
+ work()
|
||||||
@ -13,12 +24,8 @@ package com.iluwatar.facade {
|
|||||||
- makeActions(workers : Collection<DwarvenMineWorker>, actions : Action[]) {static}
|
- makeActions(workers : Collection<DwarvenMineWorker>, actions : Action[]) {static}
|
||||||
+ startNewDay()
|
+ startNewDay()
|
||||||
}
|
}
|
||||||
class DwarvenTunnelDigger {
|
|
||||||
+ DwarvenTunnelDigger()
|
|
||||||
+ name() : String
|
|
||||||
+ work()
|
|
||||||
}
|
|
||||||
abstract class DwarvenMineWorker {
|
abstract class DwarvenMineWorker {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ DwarvenMineWorker()
|
+ DwarvenMineWorker()
|
||||||
- action(action : Action)
|
- action(action : Action)
|
||||||
+ action(actions : Action[])
|
+ action(actions : Action[])
|
||||||
@ -29,15 +36,6 @@ package com.iluwatar.facade {
|
|||||||
+ wakeUp()
|
+ wakeUp()
|
||||||
+ work() {abstract}
|
+ work() {abstract}
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class DwarvenCartOperator {
|
|
||||||
+ DwarvenCartOperator()
|
|
||||||
+ name() : String
|
|
||||||
+ work()
|
|
||||||
}
|
|
||||||
~enum Action {
|
~enum Action {
|
||||||
+ GO_HOME {static}
|
+ GO_HOME {static}
|
||||||
+ GO_TO_MINE {static}
|
+ GO_TO_MINE {static}
|
||||||
@ -47,11 +45,16 @@ package com.iluwatar.facade {
|
|||||||
+ valueOf(name : String) : Action {static}
|
+ valueOf(name : String) : Action {static}
|
||||||
+ values() : Action[] {static}
|
+ values() : Action[] {static}
|
||||||
}
|
}
|
||||||
|
class DwarvenTunnelDigger {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ DwarvenTunnelDigger()
|
||||||
|
+ name() : String
|
||||||
|
+ work()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DwarvenGoldmineFacade --+ DwarvenMineWorker
|
|
||||||
DwarvenGoldmineFacade --> "-workers" DwarvenMineWorker
|
DwarvenGoldmineFacade --> "-workers" DwarvenMineWorker
|
||||||
Action ..+ DwarvenMineWorker
|
Action ..+ DwarvenMineWorker
|
||||||
|
DwarvenCartOperator --|> DwarvenMineWorker
|
||||||
DwarvenGoldDigger --|> DwarvenMineWorker
|
DwarvenGoldDigger --|> DwarvenMineWorker
|
||||||
DwarvenTunnelDigger --|> DwarvenMineWorker
|
DwarvenTunnelDigger --|> DwarvenMineWorker
|
||||||
DwarvenCartOperator --|> DwarvenMineWorker
|
|
||||||
@enduml
|
@enduml
|
@ -1,27 +1,14 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.factorykit {
|
package com.iluwatar.factorykit {
|
||||||
class Spear {
|
|
||||||
+ Spear()
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
interface Weapon {
|
|
||||||
}
|
|
||||||
interface WeaponFactory {
|
|
||||||
+ create(WeaponType) : Weapon {abstract}
|
|
||||||
+ factory(consumer : Consumer<Builder>) : WeaponFactory {static}
|
|
||||||
}
|
|
||||||
class Axe {
|
class Axe {
|
||||||
+ Axe()
|
+ Axe()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class Sword {
|
|
||||||
+ Sword()
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class Bow {
|
class Bow {
|
||||||
+ Bow()
|
+ Bow()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
@ -29,6 +16,20 @@ package com.iluwatar.factorykit {
|
|||||||
interface Builder {
|
interface Builder {
|
||||||
+ add(WeaponType, Supplier<Weapon>) {abstract}
|
+ add(WeaponType, Supplier<Weapon>) {abstract}
|
||||||
}
|
}
|
||||||
|
class Spear {
|
||||||
|
+ Spear()
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class Sword {
|
||||||
|
+ Sword()
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
interface Weapon {
|
||||||
|
}
|
||||||
|
interface WeaponFactory {
|
||||||
|
+ create(WeaponType) : Weapon {abstract}
|
||||||
|
+ factory(consumer : Consumer<Builder>) : WeaponFactory {static}
|
||||||
|
}
|
||||||
enum WeaponType {
|
enum WeaponType {
|
||||||
+ AXE {static}
|
+ AXE {static}
|
||||||
+ BOW {static}
|
+ BOW {static}
|
||||||
@ -38,8 +39,8 @@ package com.iluwatar.factorykit {
|
|||||||
+ values() : WeaponType[] {static}
|
+ values() : WeaponType[] {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Spear ..|> Weapon
|
|
||||||
Axe ..|> Weapon
|
Axe ..|> Weapon
|
||||||
Sword ..|> Weapon
|
|
||||||
Bow ..|> Weapon
|
Bow ..|> Weapon
|
||||||
|
Spear ..|> Weapon
|
||||||
|
Sword ..|> Weapon
|
||||||
@enduml
|
@enduml
|
@ -1,33 +1,34 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.factory.method {
|
package com.iluwatar.factory.method {
|
||||||
class OrcBlacksmith {
|
class App {
|
||||||
+ OrcBlacksmith()
|
- LOGGER : Logger {static}
|
||||||
+ manufactureWeapon(weaponType : WeaponType) : Weapon
|
- blacksmith : Blacksmith
|
||||||
|
+ App(blacksmith : Blacksmith)
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
- manufactureWeapons()
|
||||||
|
}
|
||||||
|
interface Blacksmith {
|
||||||
|
+ manufactureWeapon(WeaponType) : Weapon {abstract}
|
||||||
}
|
}
|
||||||
class ElfBlacksmith {
|
class ElfBlacksmith {
|
||||||
+ ElfBlacksmith()
|
+ ElfBlacksmith()
|
||||||
+ manufactureWeapon(weaponType : WeaponType) : Weapon
|
+ manufactureWeapon(weaponType : WeaponType) : Weapon
|
||||||
}
|
}
|
||||||
class OrcWeapon {
|
|
||||||
- weaponType : WeaponType
|
|
||||||
+ OrcWeapon(weaponType : WeaponType)
|
|
||||||
+ getWeaponType() : WeaponType
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
interface Blacksmith {
|
|
||||||
+ manufactureWeapon(WeaponType) : Weapon {abstract}
|
|
||||||
}
|
|
||||||
class ElfWeapon {
|
class ElfWeapon {
|
||||||
- weaponType : WeaponType
|
- weaponType : WeaponType
|
||||||
+ ElfWeapon(weaponType : WeaponType)
|
+ ElfWeapon(weaponType : WeaponType)
|
||||||
+ getWeaponType() : WeaponType
|
+ getWeaponType() : WeaponType
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class App {
|
class OrcBlacksmith {
|
||||||
- blacksmith : Blacksmith
|
+ OrcBlacksmith()
|
||||||
+ App(blacksmith : Blacksmith)
|
+ manufactureWeapon(weaponType : WeaponType) : Weapon
|
||||||
+ main(args : String[]) {static}
|
}
|
||||||
- manufactureWeapons()
|
class OrcWeapon {
|
||||||
|
- weaponType : WeaponType
|
||||||
|
+ OrcWeapon(weaponType : WeaponType)
|
||||||
|
+ getWeaponType() : WeaponType
|
||||||
|
+ toString() : String
|
||||||
}
|
}
|
||||||
interface Weapon {
|
interface Weapon {
|
||||||
+ getWeaponType() : WeaponType {abstract}
|
+ getWeaponType() : WeaponType {abstract}
|
||||||
@ -46,8 +47,8 @@ package com.iluwatar.factory.method {
|
|||||||
ElfWeapon --> "-weaponType" WeaponType
|
ElfWeapon --> "-weaponType" WeaponType
|
||||||
OrcWeapon --> "-weaponType" WeaponType
|
OrcWeapon --> "-weaponType" WeaponType
|
||||||
App --> "-blacksmith" Blacksmith
|
App --> "-blacksmith" Blacksmith
|
||||||
OrcBlacksmith ..|> Blacksmith
|
|
||||||
ElfBlacksmith ..|> Blacksmith
|
ElfBlacksmith ..|> Blacksmith
|
||||||
OrcWeapon ..|> Weapon
|
|
||||||
ElfWeapon ..|> Weapon
|
ElfWeapon ..|> Weapon
|
||||||
|
OrcBlacksmith ..|> Blacksmith
|
||||||
|
OrcWeapon ..|> Weapon
|
||||||
@enduml
|
@enduml
|
@ -37,6 +37,7 @@ package com.iluwatar.featuretoggle.pattern.propertiesversion {
|
|||||||
}
|
}
|
||||||
package com.iluwatar.featuretoggle {
|
package com.iluwatar.featuretoggle {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ package com.iluwatar.fluentinterface.fluentiterable.simple {
|
|||||||
}
|
}
|
||||||
package com.iluwatar.fluentinterface.app {
|
package com.iluwatar.fluentinterface.app {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
- negatives() : Predicate<? super Integer> {static}
|
- negatives() : Predicate<? super Integer> {static}
|
||||||
|
@ -1,34 +1,26 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.flux.view {
|
package com.iluwatar.flux.view {
|
||||||
interface View {
|
class ContentView {
|
||||||
+ render() {abstract}
|
- LOGGER : Logger {static}
|
||||||
+ storeChanged(Store) {abstract}
|
- content : Content
|
||||||
|
+ ContentView()
|
||||||
|
+ render()
|
||||||
|
+ storeChanged(store : Store)
|
||||||
}
|
}
|
||||||
class MenuView {
|
class MenuView {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- selected : MenuItem
|
- selected : MenuItem
|
||||||
+ MenuView()
|
+ MenuView()
|
||||||
+ itemClicked(item : MenuItem)
|
+ itemClicked(item : MenuItem)
|
||||||
+ render()
|
+ render()
|
||||||
+ storeChanged(store : Store)
|
+ storeChanged(store : Store)
|
||||||
}
|
}
|
||||||
class ContentView {
|
interface View {
|
||||||
- content : Content
|
+ render() {abstract}
|
||||||
+ ContentView()
|
+ storeChanged(Store) {abstract}
|
||||||
+ render()
|
|
||||||
+ storeChanged(store : Store)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.flux.action {
|
package com.iluwatar.flux.action {
|
||||||
class MenuAction {
|
|
||||||
- menuItem : MenuItem
|
|
||||||
+ MenuAction(menuItem : MenuItem)
|
|
||||||
+ getMenuItem() : MenuItem
|
|
||||||
}
|
|
||||||
class ContentAction {
|
|
||||||
- content : Content
|
|
||||||
+ ContentAction(content : Content)
|
|
||||||
+ getContent() : Content
|
|
||||||
}
|
|
||||||
abstract class Action {
|
abstract class Action {
|
||||||
- type : ActionType
|
- type : ActionType
|
||||||
+ Action(type : ActionType)
|
+ Action(type : ActionType)
|
||||||
@ -40,6 +32,24 @@ package com.iluwatar.flux.action {
|
|||||||
+ valueOf(name : String) : ActionType {static}
|
+ valueOf(name : String) : ActionType {static}
|
||||||
+ values() : ActionType[] {static}
|
+ values() : ActionType[] {static}
|
||||||
}
|
}
|
||||||
|
enum Content {
|
||||||
|
+ COMPANY {static}
|
||||||
|
+ PRODUCTS {static}
|
||||||
|
- title : String
|
||||||
|
+ toString() : String
|
||||||
|
+ valueOf(name : String) : Content {static}
|
||||||
|
+ values() : Content[] {static}
|
||||||
|
}
|
||||||
|
class ContentAction {
|
||||||
|
- content : Content
|
||||||
|
+ ContentAction(content : Content)
|
||||||
|
+ getContent() : Content
|
||||||
|
}
|
||||||
|
class MenuAction {
|
||||||
|
- menuItem : MenuItem
|
||||||
|
+ MenuAction(menuItem : MenuItem)
|
||||||
|
+ getMenuItem() : MenuItem
|
||||||
|
}
|
||||||
enum MenuItem {
|
enum MenuItem {
|
||||||
+ COMPANY {static}
|
+ COMPANY {static}
|
||||||
+ HOME {static}
|
+ HOME {static}
|
||||||
@ -49,14 +59,6 @@ package com.iluwatar.flux.action {
|
|||||||
+ valueOf(name : String) : MenuItem {static}
|
+ valueOf(name : String) : MenuItem {static}
|
||||||
+ values() : MenuItem[] {static}
|
+ values() : MenuItem[] {static}
|
||||||
}
|
}
|
||||||
enum Content {
|
|
||||||
+ COMPANY {static}
|
|
||||||
+ PRODUCTS {static}
|
|
||||||
- title : String
|
|
||||||
+ toString() : String
|
|
||||||
+ valueOf(name : String) : Content {static}
|
|
||||||
+ values() : Content[] {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
package com.iluwatar.flux.app {
|
package com.iluwatar.flux.app {
|
||||||
class App {
|
class App {
|
||||||
@ -64,17 +66,6 @@ package com.iluwatar.flux.app {
|
|||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.flux.dispatcher {
|
|
||||||
class Dispatcher {
|
|
||||||
- instance : Dispatcher {static}
|
|
||||||
- stores : List<Store>
|
|
||||||
- Dispatcher()
|
|
||||||
- dispatchAction(action : Action)
|
|
||||||
+ getInstance() : Dispatcher {static}
|
|
||||||
+ menuItemSelected(menuItem : MenuItem)
|
|
||||||
+ registerStore(store : Store)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
package com.iluwatar.flux.store {
|
package com.iluwatar.flux.store {
|
||||||
class ContentStore {
|
class ContentStore {
|
||||||
- content : Content
|
- content : Content
|
||||||
@ -96,20 +87,31 @@ package com.iluwatar.flux.store {
|
|||||||
+ registerView(view : View)
|
+ registerView(view : View)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
package com.iluwatar.flux.dispatcher {
|
||||||
|
class Dispatcher {
|
||||||
|
- instance : Dispatcher {static}
|
||||||
|
- stores : List<Store>
|
||||||
|
- Dispatcher()
|
||||||
|
- dispatchAction(action : Action)
|
||||||
|
+ getInstance() : Dispatcher {static}
|
||||||
|
+ menuItemSelected(menuItem : MenuItem)
|
||||||
|
+ registerStore(store : Store)
|
||||||
|
}
|
||||||
|
}
|
||||||
MenuAction --> "-menuItem" MenuItem
|
MenuAction --> "-menuItem" MenuItem
|
||||||
Action --> "-type" ActionType
|
|
||||||
MenuStore --> "-selected" MenuItem
|
MenuStore --> "-selected" MenuItem
|
||||||
|
Action --> "-type" ActionType
|
||||||
Dispatcher --> "-instance" Dispatcher
|
Dispatcher --> "-instance" Dispatcher
|
||||||
ContentView --> "-content" Content
|
ContentView --> "-content" Content
|
||||||
Dispatcher --> "-stores" Store
|
Dispatcher --> "-stores" Store
|
||||||
MenuView --> "-selected" MenuItem
|
MenuView --> "-selected" MenuItem
|
||||||
Store --> "-views" View
|
Store --> "-views" View
|
||||||
ContentAction --> "-content" Content
|
|
||||||
ContentStore --> "-content" Content
|
ContentStore --> "-content" Content
|
||||||
ContentStore --|> Store
|
ContentAction --> "-content" Content
|
||||||
MenuAction --|> Action
|
|
||||||
MenuStore --|> Store
|
|
||||||
ContentAction --|> Action
|
ContentAction --|> Action
|
||||||
MenuView ..|> View
|
MenuAction --|> Action
|
||||||
|
ContentStore --|> Store
|
||||||
|
MenuStore --|> Store
|
||||||
ContentView ..|> View
|
ContentView ..|> View
|
||||||
|
MenuView ..|> View
|
||||||
@enduml
|
@enduml
|
@ -1,19 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.flyweight {
|
package com.iluwatar.flyweight {
|
||||||
class PotionFactory {
|
|
||||||
- potions : Map<PotionType, Potion>
|
|
||||||
+ PotionFactory()
|
|
||||||
~ createPotion(type : PotionType) : Potion
|
|
||||||
}
|
|
||||||
class HealingPotion {
|
|
||||||
+ HealingPotion()
|
|
||||||
+ drink()
|
|
||||||
}
|
|
||||||
class InvisibilityPotion {
|
|
||||||
+ InvisibilityPotion()
|
|
||||||
+ drink()
|
|
||||||
}
|
|
||||||
class AlchemistShop {
|
class AlchemistShop {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- bottomShelf : List<Potion>
|
- bottomShelf : List<Potion>
|
||||||
- topShelf : List<Potion>
|
- topShelf : List<Potion>
|
||||||
+ AlchemistShop()
|
+ AlchemistShop()
|
||||||
@ -26,21 +14,34 @@ package com.iluwatar.flyweight {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
interface Potion {
|
class HealingPotion {
|
||||||
+ drink() {abstract}
|
- LOGGER : Logger {static}
|
||||||
}
|
+ HealingPotion()
|
||||||
class PoisonPotion {
|
|
||||||
+ PoisonPotion()
|
|
||||||
+ drink()
|
|
||||||
}
|
|
||||||
class StrengthPotion {
|
|
||||||
+ StrengthPotion()
|
|
||||||
+ drink()
|
+ drink()
|
||||||
}
|
}
|
||||||
class HolyWaterPotion {
|
class HolyWaterPotion {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ HolyWaterPotion()
|
+ HolyWaterPotion()
|
||||||
+ drink()
|
+ drink()
|
||||||
}
|
}
|
||||||
|
class InvisibilityPotion {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ InvisibilityPotion()
|
||||||
|
+ drink()
|
||||||
|
}
|
||||||
|
class PoisonPotion {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ PoisonPotion()
|
||||||
|
+ drink()
|
||||||
|
}
|
||||||
|
interface Potion {
|
||||||
|
+ drink() {abstract}
|
||||||
|
}
|
||||||
|
class PotionFactory {
|
||||||
|
- potions : Map<PotionType, Potion>
|
||||||
|
+ PotionFactory()
|
||||||
|
~ createPotion(type : PotionType) : Potion
|
||||||
|
}
|
||||||
enum PotionType {
|
enum PotionType {
|
||||||
+ HEALING {static}
|
+ HEALING {static}
|
||||||
+ HOLY_WATER {static}
|
+ HOLY_WATER {static}
|
||||||
@ -50,11 +51,16 @@ package com.iluwatar.flyweight {
|
|||||||
+ valueOf(name : String) : PotionType {static}
|
+ valueOf(name : String) : PotionType {static}
|
||||||
+ values() : PotionType[] {static}
|
+ values() : PotionType[] {static}
|
||||||
}
|
}
|
||||||
|
class StrengthPotion {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ StrengthPotion()
|
||||||
|
+ drink()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AlchemistShop --> "-topShelf" Potion
|
AlchemistShop --> "-topShelf" Potion
|
||||||
HealingPotion ..|> Potion
|
HealingPotion ..|> Potion
|
||||||
|
HolyWaterPotion ..|> Potion
|
||||||
InvisibilityPotion ..|> Potion
|
InvisibilityPotion ..|> Potion
|
||||||
PoisonPotion ..|> Potion
|
PoisonPotion ..|> Potion
|
||||||
StrengthPotion ..|> Potion
|
StrengthPotion ..|> Potion
|
||||||
HolyWaterPotion ..|> Potion
|
|
||||||
@enduml
|
@enduml
|
@ -1,23 +1,34 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.front.controller {
|
package com.iluwatar.front.controller {
|
||||||
class ArcherView {
|
class App {
|
||||||
+ ArcherView()
|
+ App()
|
||||||
+ display()
|
+ main(args : String[]) {static}
|
||||||
}
|
|
||||||
interface View {
|
|
||||||
+ display() {abstract}
|
|
||||||
}
|
|
||||||
class CatapultView {
|
|
||||||
+ CatapultView()
|
|
||||||
+ display()
|
|
||||||
}
|
}
|
||||||
class ArcherCommand {
|
class ArcherCommand {
|
||||||
+ ArcherCommand()
|
+ ArcherCommand()
|
||||||
+ process()
|
+ process()
|
||||||
}
|
}
|
||||||
class App {
|
class ArcherView {
|
||||||
+ App()
|
- LOGGER : Logger {static}
|
||||||
+ main(args : String[]) {static}
|
+ ArcherView()
|
||||||
|
+ display()
|
||||||
|
}
|
||||||
|
class CatapultCommand {
|
||||||
|
+ CatapultCommand()
|
||||||
|
+ process()
|
||||||
|
}
|
||||||
|
class CatapultView {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ CatapultView()
|
||||||
|
+ display()
|
||||||
|
}
|
||||||
|
interface Command {
|
||||||
|
+ process() {abstract}
|
||||||
|
}
|
||||||
|
class ErrorView {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ ErrorView()
|
||||||
|
+ display()
|
||||||
}
|
}
|
||||||
class FrontController {
|
class FrontController {
|
||||||
+ FrontController()
|
+ FrontController()
|
||||||
@ -29,22 +40,14 @@ package com.iluwatar.front.controller {
|
|||||||
+ UnknownCommand()
|
+ UnknownCommand()
|
||||||
+ process()
|
+ process()
|
||||||
}
|
}
|
||||||
class ErrorView {
|
interface View {
|
||||||
+ ErrorView()
|
+ display() {abstract}
|
||||||
+ display()
|
|
||||||
}
|
|
||||||
class CatapultCommand {
|
|
||||||
+ CatapultCommand()
|
|
||||||
+ process()
|
|
||||||
}
|
|
||||||
interface Command {
|
|
||||||
+ process() {abstract}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ArcherView ..|> View
|
|
||||||
CatapultView ..|> View
|
|
||||||
ArcherCommand ..|> Command
|
ArcherCommand ..|> Command
|
||||||
UnknownCommand ..|> Command
|
ArcherView ..|> View
|
||||||
ErrorView ..|> View
|
|
||||||
CatapultCommand ..|> Command
|
CatapultCommand ..|> Command
|
||||||
|
CatapultView ..|> View
|
||||||
|
ErrorView ..|> View
|
||||||
|
UnknownCommand ..|> Command
|
||||||
@enduml
|
@enduml
|
@ -1,9 +1,10 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.halfsynchalfasync {
|
package com.iluwatar.halfsynchalfasync {
|
||||||
class AsynchronousService {
|
class App {
|
||||||
- service : ExecutorService
|
- LOGGER : Logger {static}
|
||||||
+ AsynchronousService(workQueue : BlockingQueue<Runnable>)
|
+ App()
|
||||||
+ execute(task : AsyncTask<T>)
|
- ap(i : long) : long {static}
|
||||||
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
~class ArithmeticSumTask {
|
~class ArithmeticSumTask {
|
||||||
- n : long
|
- n : long
|
||||||
@ -13,17 +14,17 @@ package com.iluwatar.halfsynchalfasync {
|
|||||||
+ onPostCall(result : Long)
|
+ onPostCall(result : Long)
|
||||||
+ onPreCall()
|
+ onPreCall()
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
- ap(i : long) : long {static}
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
interface AsyncTask<O> {
|
interface AsyncTask<O> {
|
||||||
+ call() : O {abstract}
|
+ call() : O {abstract}
|
||||||
+ onError(Throwable) {abstract}
|
+ onError(Throwable) {abstract}
|
||||||
+ onPostCall(O) {abstract}
|
+ onPostCall(O) {abstract}
|
||||||
+ onPreCall() {abstract}
|
+ onPreCall() {abstract}
|
||||||
}
|
}
|
||||||
|
class AsynchronousService {
|
||||||
|
- service : ExecutorService
|
||||||
|
+ AsynchronousService(workQueue : BlockingQueue<Runnable>)
|
||||||
|
+ execute(task : AsyncTask<T>)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ArithmeticSumTask ..+ App
|
ArithmeticSumTask ..+ App
|
||||||
ArithmeticSumTask ..|> AsyncTask
|
ArithmeticSumTask ..|> AsyncTask
|
||||||
|
@ -9,6 +9,7 @@ package com.iluwatar.hexagonal.sampledata {
|
|||||||
}
|
}
|
||||||
package com.iluwatar.hexagonal.service {
|
package com.iluwatar.hexagonal.service {
|
||||||
class ConsoleLottery {
|
class ConsoleLottery {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ ConsoleLottery()
|
+ ConsoleLottery()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
- printMainMenu() {static}
|
- printMainMenu() {static}
|
||||||
@ -24,16 +25,6 @@ package com.iluwatar.hexagonal.mongo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.hexagonal.domain {
|
package com.iluwatar.hexagonal.domain {
|
||||||
class LotteryTicketId {
|
|
||||||
- id : int
|
|
||||||
- numAllocated : int {static}
|
|
||||||
+ LotteryTicketId()
|
|
||||||
+ LotteryTicketId(id : int)
|
|
||||||
+ equals(o : Object) : boolean
|
|
||||||
+ getId() : int
|
|
||||||
+ hashCode() : int
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class LotteryAdministration {
|
class LotteryAdministration {
|
||||||
- notifications : LotteryEventLog
|
- notifications : LotteryEventLog
|
||||||
- repository : LotteryTicketRepository
|
- repository : LotteryTicketRepository
|
||||||
@ -43,6 +34,14 @@ package com.iluwatar.hexagonal.domain {
|
|||||||
+ performLottery() : LotteryNumbers
|
+ performLottery() : LotteryNumbers
|
||||||
+ resetLottery()
|
+ resetLottery()
|
||||||
}
|
}
|
||||||
|
class LotteryConstants {
|
||||||
|
+ PLAYER_MAX_SALDO : int {static}
|
||||||
|
+ PRIZE_AMOUNT : int {static}
|
||||||
|
+ SERVICE_BANK_ACCOUNT : String {static}
|
||||||
|
+ SERVICE_BANK_ACCOUNT_SALDO : int {static}
|
||||||
|
+ TICKET_PRIZE : int {static}
|
||||||
|
- LotteryConstants()
|
||||||
|
}
|
||||||
class LotteryNumbers {
|
class LotteryNumbers {
|
||||||
+ MAX_NUMBER : int {static}
|
+ MAX_NUMBER : int {static}
|
||||||
+ MIN_NUMBER : int {static}
|
+ MIN_NUMBER : int {static}
|
||||||
@ -59,6 +58,11 @@ package com.iluwatar.hexagonal.domain {
|
|||||||
+ hashCode() : int
|
+ hashCode() : int
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
-class RandomNumberGenerator {
|
||||||
|
- randomIterator : OfInt
|
||||||
|
+ RandomNumberGenerator(min : int, max : int)
|
||||||
|
+ nextInt() : int
|
||||||
|
}
|
||||||
class LotteryService {
|
class LotteryService {
|
||||||
- notifications : LotteryEventLog
|
- notifications : LotteryEventLog
|
||||||
- repository : LotteryTicketRepository
|
- repository : LotteryTicketRepository
|
||||||
@ -67,41 +71,6 @@ package com.iluwatar.hexagonal.domain {
|
|||||||
+ checkTicketForPrize(id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult
|
+ checkTicketForPrize(id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult
|
||||||
+ submitTicket(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
+ submitTicket(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
||||||
}
|
}
|
||||||
-class RandomNumberGenerator {
|
|
||||||
- randomIterator : OfInt
|
|
||||||
+ RandomNumberGenerator(min : int, max : int)
|
|
||||||
+ nextInt() : int
|
|
||||||
}
|
|
||||||
class PlayerDetails {
|
|
||||||
- bankAccountNumber : String
|
|
||||||
- emailAddress : String
|
|
||||||
- phoneNumber : String
|
|
||||||
+ PlayerDetails(email : String, bankAccount : String, phone : String)
|
|
||||||
+ equals(obj : Object) : boolean
|
|
||||||
+ getBankAccount() : String
|
|
||||||
+ getEmail() : String
|
|
||||||
+ getPhoneNumber() : String
|
|
||||||
+ hashCode() : int
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class LotteryTicketCheckResult {
|
|
||||||
- checkResult : CheckResult
|
|
||||||
- prizeAmount : int
|
|
||||||
+ LotteryTicketCheckResult(result : CheckResult)
|
|
||||||
+ LotteryTicketCheckResult(result : CheckResult, amount : int)
|
|
||||||
+ equals(obj : Object) : boolean
|
|
||||||
+ getPrizeAmount() : int
|
|
||||||
+ getResult() : CheckResult
|
|
||||||
+ hashCode() : int
|
|
||||||
}
|
|
||||||
class LotteryConstants {
|
|
||||||
+ PLAYER_MAX_SALDO : int {static}
|
|
||||||
+ PRIZE_AMOUNT : int {static}
|
|
||||||
+ SERVICE_BANK_ACCOUNT : String {static}
|
|
||||||
+ SERVICE_BANK_ACCOUNT_SALDO : int {static}
|
|
||||||
+ TICKET_PRIZE : int {static}
|
|
||||||
- LotteryConstants()
|
|
||||||
}
|
|
||||||
class LotteryTicket {
|
class LotteryTicket {
|
||||||
- id : LotteryTicketId
|
- id : LotteryTicketId
|
||||||
- lotteryNumbers : LotteryNumbers
|
- lotteryNumbers : LotteryNumbers
|
||||||
@ -115,9 +84,15 @@ package com.iluwatar.hexagonal.domain {
|
|||||||
+ setId(id : LotteryTicketId)
|
+ setId(id : LotteryTicketId)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class LotteryUtils {
|
class LotteryTicketCheckResult {
|
||||||
- LotteryUtils()
|
- checkResult : CheckResult
|
||||||
+ checkTicketForPrize(repository : LotteryTicketRepository, id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult {static}
|
- prizeAmount : int
|
||||||
|
+ LotteryTicketCheckResult(result : CheckResult)
|
||||||
|
+ LotteryTicketCheckResult(result : CheckResult, amount : int)
|
||||||
|
+ equals(obj : Object) : boolean
|
||||||
|
+ getPrizeAmount() : int
|
||||||
|
+ getResult() : CheckResult
|
||||||
|
+ hashCode() : int
|
||||||
}
|
}
|
||||||
enum CheckResult {
|
enum CheckResult {
|
||||||
+ NO_PRIZE {static}
|
+ NO_PRIZE {static}
|
||||||
@ -126,12 +101,40 @@ package com.iluwatar.hexagonal.domain {
|
|||||||
+ valueOf(name : String) : CheckResult {static}
|
+ valueOf(name : String) : CheckResult {static}
|
||||||
+ values() : CheckResult[] {static}
|
+ values() : CheckResult[] {static}
|
||||||
}
|
}
|
||||||
|
class LotteryTicketId {
|
||||||
|
- id : int
|
||||||
|
- numAllocated : int {static}
|
||||||
|
+ LotteryTicketId()
|
||||||
|
+ LotteryTicketId(id : int)
|
||||||
|
+ equals(o : Object) : boolean
|
||||||
|
+ getId() : int
|
||||||
|
+ hashCode() : int
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class LotteryUtils {
|
||||||
|
- LotteryUtils()
|
||||||
|
+ checkTicketForPrize(repository : LotteryTicketRepository, id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult {static}
|
||||||
|
}
|
||||||
|
class PlayerDetails {
|
||||||
|
- bankAccountNumber : String
|
||||||
|
- emailAddress : String
|
||||||
|
- phoneNumber : String
|
||||||
|
+ PlayerDetails(email : String, bankAccount : String, phone : String)
|
||||||
|
+ equals(obj : Object) : boolean
|
||||||
|
+ getBankAccount() : String
|
||||||
|
+ getEmail() : String
|
||||||
|
+ getPhoneNumber() : String
|
||||||
|
+ hashCode() : int
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.hexagonal.banking {
|
package com.iluwatar.hexagonal.banking {
|
||||||
interface WireTransfers {
|
class InMemoryBank {
|
||||||
+ getFunds(String) : int {abstract}
|
- accounts : Map<String, Integer> {static}
|
||||||
+ setFunds(String, int) {abstract}
|
+ InMemoryBank()
|
||||||
+ transferFunds(int, String, String) : boolean {abstract}
|
+ getFunds(bankAccount : String) : int
|
||||||
|
+ setFunds(bankAccount : String, amount : int)
|
||||||
|
+ transferFunds(amount : int, sourceBackAccount : String, destinationBankAccount : String) : boolean
|
||||||
}
|
}
|
||||||
class MongoBank {
|
class MongoBank {
|
||||||
- DEFAULT_ACCOUNTS_COLLECTION : String {static}
|
- DEFAULT_ACCOUNTS_COLLECTION : String {static}
|
||||||
@ -150,15 +153,27 @@ package com.iluwatar.hexagonal.banking {
|
|||||||
+ setFunds(bankAccount : String, amount : int)
|
+ setFunds(bankAccount : String, amount : int)
|
||||||
+ transferFunds(amount : int, sourceBackAccount : String, destinationBankAccount : String) : boolean
|
+ transferFunds(amount : int, sourceBackAccount : String, destinationBankAccount : String) : boolean
|
||||||
}
|
}
|
||||||
class InMemoryBank {
|
interface WireTransfers {
|
||||||
- accounts : Map<String, Integer> {static}
|
+ getFunds(String) : int {abstract}
|
||||||
+ InMemoryBank()
|
+ setFunds(String, int) {abstract}
|
||||||
+ getFunds(bankAccount : String) : int
|
+ transferFunds(int, String, String) : boolean {abstract}
|
||||||
+ setFunds(bankAccount : String, amount : int)
|
|
||||||
+ transferFunds(amount : int, sourceBackAccount : String, destinationBankAccount : String) : boolean
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.hexagonal.database {
|
package com.iluwatar.hexagonal.database {
|
||||||
|
class InMemoryTicketRepository {
|
||||||
|
- tickets : Map<LotteryTicketId, LotteryTicket> {static}
|
||||||
|
+ InMemoryTicketRepository()
|
||||||
|
+ deleteAll()
|
||||||
|
+ findAll() : Map<LotteryTicketId, LotteryTicket>
|
||||||
|
+ findById(id : LotteryTicketId) : Optional<LotteryTicket>
|
||||||
|
+ save(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
||||||
|
}
|
||||||
|
interface LotteryTicketRepository {
|
||||||
|
+ deleteAll() {abstract}
|
||||||
|
+ findAll() : Map<LotteryTicketId, LotteryTicket> {abstract}
|
||||||
|
+ findById(LotteryTicketId) : Optional<LotteryTicket> {abstract}
|
||||||
|
+ save(LotteryTicket) : Optional<LotteryTicketId> {abstract}
|
||||||
|
}
|
||||||
class MongoTicketRepository {
|
class MongoTicketRepository {
|
||||||
- DEFAULT_COUNTERS_COLLECTION : String {static}
|
- DEFAULT_COUNTERS_COLLECTION : String {static}
|
||||||
- DEFAULT_DB : String {static}
|
- DEFAULT_DB : String {static}
|
||||||
@ -183,20 +198,6 @@ package com.iluwatar.hexagonal.database {
|
|||||||
- initCounters()
|
- initCounters()
|
||||||
+ save(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
+ save(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
||||||
}
|
}
|
||||||
class InMemoryTicketRepository {
|
|
||||||
- tickets : Map<LotteryTicketId, LotteryTicket> {static}
|
|
||||||
+ InMemoryTicketRepository()
|
|
||||||
+ deleteAll()
|
|
||||||
+ findAll() : Map<LotteryTicketId, LotteryTicket>
|
|
||||||
+ findById(id : LotteryTicketId) : Optional<LotteryTicket>
|
|
||||||
+ save(ticket : LotteryTicket) : Optional<LotteryTicketId>
|
|
||||||
}
|
|
||||||
interface LotteryTicketRepository {
|
|
||||||
+ deleteAll() {abstract}
|
|
||||||
+ findAll() : Map<LotteryTicketId, LotteryTicket> {abstract}
|
|
||||||
+ findById(LotteryTicketId) : Optional<LotteryTicket> {abstract}
|
|
||||||
+ save(LotteryTicket) : Optional<LotteryTicketId> {abstract}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
package com.iluwatar.hexagonal {
|
package com.iluwatar.hexagonal {
|
||||||
class App {
|
class App {
|
||||||
@ -206,6 +207,7 @@ package com.iluwatar.hexagonal {
|
|||||||
}
|
}
|
||||||
package com.iluwatar.hexagonal.administration {
|
package com.iluwatar.hexagonal.administration {
|
||||||
class ConsoleAdministration {
|
class ConsoleAdministration {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ ConsoleAdministration()
|
+ ConsoleAdministration()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
- printMainMenu() {static}
|
- printMainMenu() {static}
|
||||||
@ -220,14 +222,6 @@ package com.iluwatar.hexagonal.eventlog {
|
|||||||
+ ticketSubmitted(PlayerDetails) {abstract}
|
+ ticketSubmitted(PlayerDetails) {abstract}
|
||||||
+ ticketWon(PlayerDetails, int) {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 {
|
class MongoEventLog {
|
||||||
- DEFAULT_DB : String {static}
|
- DEFAULT_DB : String {static}
|
||||||
- DEFAULT_EVENTS_COLLECTION : String {static}
|
- DEFAULT_EVENTS_COLLECTION : String {static}
|
||||||
@ -248,29 +242,34 @@ package com.iluwatar.hexagonal.eventlog {
|
|||||||
+ ticketSubmitted(details : PlayerDetails)
|
+ ticketSubmitted(details : PlayerDetails)
|
||||||
+ ticketWon(details : PlayerDetails, prizeAmount : int)
|
+ ticketWon(details : PlayerDetails, prizeAmount : int)
|
||||||
}
|
}
|
||||||
|
class StdOutEventLog {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ StdOutEventLog()
|
||||||
|
+ prizeError(details : PlayerDetails, prizeAmount : int)
|
||||||
|
+ ticketDidNotWin(details : PlayerDetails)
|
||||||
|
+ ticketSubmitError(details : PlayerDetails)
|
||||||
|
+ ticketSubmitted(details : PlayerDetails)
|
||||||
|
+ ticketWon(details : PlayerDetails, prizeAmount : int)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LotteryAdministration --+ LotteryTicketCheckResult
|
|
||||||
LotteryTicket --> "-playerDetails" PlayerDetails
|
|
||||||
MongoEventLog --> "-stdOutEventLog" StdOutEventLog
|
|
||||||
LotteryService --> "-wireTransfers" WireTransfers
|
|
||||||
LotteryAdministration --> "-notifications" LotteryEventLog
|
|
||||||
RandomNumberGenerator ..+ PrimitiveIterator
|
|
||||||
LotteryAdministration --> "-wireTransfers" WireTransfers
|
LotteryAdministration --> "-wireTransfers" WireTransfers
|
||||||
LotteryTicket --> "-id" LotteryTicketId
|
LotteryTicket --> "-id" LotteryTicketId
|
||||||
|
LotteryTicket --> "-playerDetails" PlayerDetails
|
||||||
LotteryService --> "-notifications" LotteryEventLog
|
LotteryService --> "-notifications" LotteryEventLog
|
||||||
LotteryAdministration --> "-repository" LotteryTicketRepository
|
LotteryAdministration --> "-repository" LotteryTicketRepository
|
||||||
LotteryTicket --> "-lotteryNumbers" LotteryNumbers
|
LotteryTicket --> "-lotteryNumbers" LotteryNumbers
|
||||||
|
MongoEventLog --> "-stdOutEventLog" StdOutEventLog
|
||||||
|
LotteryService --> "-wireTransfers" WireTransfers
|
||||||
SampleData --> "-PLAYERS" PlayerDetails
|
SampleData --> "-PLAYERS" PlayerDetails
|
||||||
ConsoleLottery --+ LotteryTicketCheckResult
|
LotteryAdministration --> "-notifications" LotteryEventLog
|
||||||
RandomNumberGenerator ..+ LotteryNumbers
|
RandomNumberGenerator ..+ LotteryNumbers
|
||||||
LotteryService --> "-repository" LotteryTicketRepository
|
LotteryService --> "-repository" LotteryTicketRepository
|
||||||
LotteryUtils --+ LotteryTicketCheckResult
|
|
||||||
LotteryTicketCheckResult --> "-checkResult" CheckResult
|
|
||||||
CheckResult ..+ LotteryTicketCheckResult
|
CheckResult ..+ LotteryTicketCheckResult
|
||||||
MongoTicketRepository ..|> LotteryTicketRepository
|
LotteryTicketCheckResult --> "-checkResult" CheckResult
|
||||||
MongoBank ..|> WireTransfers
|
|
||||||
InMemoryBank ..|> WireTransfers
|
InMemoryBank ..|> WireTransfers
|
||||||
StdOutEventLog ..|> LotteryEventLog
|
MongoBank ..|> WireTransfers
|
||||||
InMemoryTicketRepository ..|> LotteryTicketRepository
|
InMemoryTicketRepository ..|> LotteryTicketRepository
|
||||||
|
MongoTicketRepository ..|> LotteryTicketRepository
|
||||||
MongoEventLog ..|> LotteryEventLog
|
MongoEventLog ..|> LotteryEventLog
|
||||||
|
StdOutEventLog ..|> LotteryEventLog
|
||||||
@enduml
|
@enduml
|
@ -1,8 +1,13 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.intercepting.filter {
|
package com.iluwatar.intercepting.filter {
|
||||||
class DepositFilter {
|
abstract class AbstractFilter {
|
||||||
+ DepositFilter()
|
- next : Filter
|
||||||
|
+ AbstractFilter()
|
||||||
|
+ AbstractFilter(next : Filter)
|
||||||
+ execute(order : Order) : String
|
+ execute(order : Order) : String
|
||||||
|
+ getLast() : Filter
|
||||||
|
+ getNext() : Filter
|
||||||
|
+ setNext(filter : Filter)
|
||||||
}
|
}
|
||||||
class AddressFilter {
|
class AddressFilter {
|
||||||
+ AddressFilter()
|
+ AddressFilter()
|
||||||
@ -12,14 +17,35 @@ package com.iluwatar.intercepting.filter {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
abstract class AbstractFilter {
|
class ContactFilter {
|
||||||
- next : Filter
|
+ ContactFilter()
|
||||||
+ AbstractFilter()
|
+ execute(order : Order) : String
|
||||||
+ AbstractFilter(next : Filter)
|
}
|
||||||
|
class DepositFilter {
|
||||||
|
+ DepositFilter()
|
||||||
|
+ execute(order : Order) : String
|
||||||
|
}
|
||||||
|
interface Filter {
|
||||||
|
+ execute(Order) : String {abstract}
|
||||||
|
+ getLast() : Filter {abstract}
|
||||||
|
+ getNext() : Filter {abstract}
|
||||||
|
+ setNext(Filter) {abstract}
|
||||||
|
}
|
||||||
|
class FilterChain {
|
||||||
|
- chain : Filter
|
||||||
|
+ FilterChain()
|
||||||
|
+ addFilter(filter : Filter)
|
||||||
|
+ execute(order : Order) : String
|
||||||
|
}
|
||||||
|
class FilterManager {
|
||||||
|
- filterChain : FilterChain
|
||||||
|
+ FilterManager()
|
||||||
|
+ addFilter(filter : Filter)
|
||||||
|
+ filterRequest(order : Order) : String
|
||||||
|
}
|
||||||
|
class NameFilter {
|
||||||
|
+ NameFilter()
|
||||||
+ execute(order : Order) : String
|
+ execute(order : Order) : String
|
||||||
+ getLast() : Filter
|
|
||||||
+ getNext() : Filter
|
|
||||||
+ setNext(filter : Filter)
|
|
||||||
}
|
}
|
||||||
class Order {
|
class Order {
|
||||||
- address : String
|
- address : String
|
||||||
@ -40,49 +66,23 @@ package com.iluwatar.intercepting.filter {
|
|||||||
+ setName(name : String)
|
+ setName(name : String)
|
||||||
+ setOrder(order : String)
|
+ setOrder(order : String)
|
||||||
}
|
}
|
||||||
class FilterManager {
|
class OrderFilter {
|
||||||
- filterChain : FilterChain
|
+ OrderFilter()
|
||||||
+ FilterManager()
|
|
||||||
+ addFilter(filter : Filter)
|
|
||||||
+ filterRequest(order : Order) : String
|
|
||||||
}
|
|
||||||
class NameFilter {
|
|
||||||
+ NameFilter()
|
|
||||||
+ execute(order : Order) : String
|
+ 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 {
|
~class DListener {
|
||||||
~ DListener()
|
~ DListener()
|
||||||
+ actionPerformed(e : ActionEvent)
|
+ actionPerformed(e : ActionEvent)
|
||||||
}
|
}
|
||||||
class OrderFilter {
|
|
||||||
+ OrderFilter()
|
|
||||||
+ execute(order : Order) : String
|
|
||||||
}
|
|
||||||
class FilterChain {
|
|
||||||
- chain : Filter
|
|
||||||
+ FilterChain()
|
|
||||||
+ addFilter(filter : Filter)
|
|
||||||
+ execute(order : Order) : String
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AbstractFilter --> "-next" Filter
|
AbstractFilter --> "-next" Filter
|
||||||
DListener --+ Target
|
DListener --+ Target
|
||||||
FilterChain --> "-chain" Filter
|
|
||||||
FilterManager --> "-filterChain" FilterChain
|
FilterManager --> "-filterChain" FilterChain
|
||||||
DepositFilter --|> AbstractFilter
|
FilterChain --> "-chain" Filter
|
||||||
AddressFilter --|> AbstractFilter
|
|
||||||
AbstractFilter ..|> Filter
|
AbstractFilter ..|> Filter
|
||||||
NameFilter --|> AbstractFilter
|
AddressFilter --|> AbstractFilter
|
||||||
ContactFilter --|> AbstractFilter
|
ContactFilter --|> AbstractFilter
|
||||||
|
DepositFilter --|> AbstractFilter
|
||||||
|
NameFilter --|> AbstractFilter
|
||||||
OrderFilter --|> AbstractFilter
|
OrderFilter --|> AbstractFilter
|
||||||
@enduml
|
@enduml
|
@ -1,20 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.interpreter {
|
package com.iluwatar.interpreter {
|
||||||
class NumberExpression {
|
|
||||||
- number : int
|
|
||||||
+ NumberExpression(number : int)
|
|
||||||
+ NumberExpression(s : String)
|
|
||||||
+ interpret() : int
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class MinusExpression {
|
|
||||||
- leftExpression : Expression
|
|
||||||
- rightExpression : Expression
|
|
||||||
+ MinusExpression(leftExpression : Expression, rightExpression : Expression)
|
|
||||||
+ interpret() : int
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ getOperatorInstance(s : String, left : Expression, right : Expression) : Expression {static}
|
+ getOperatorInstance(s : String, left : Expression, right : Expression) : Expression {static}
|
||||||
+ isOperator(s : String) : boolean {static}
|
+ isOperator(s : String) : boolean {static}
|
||||||
@ -25,6 +12,13 @@ package com.iluwatar.interpreter {
|
|||||||
+ interpret() : int {abstract}
|
+ interpret() : int {abstract}
|
||||||
+ toString() : String {abstract}
|
+ toString() : String {abstract}
|
||||||
}
|
}
|
||||||
|
class MinusExpression {
|
||||||
|
- leftExpression : Expression
|
||||||
|
- rightExpression : Expression
|
||||||
|
+ MinusExpression(leftExpression : Expression, rightExpression : Expression)
|
||||||
|
+ interpret() : int
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
class MultiplyExpression {
|
class MultiplyExpression {
|
||||||
- leftExpression : Expression
|
- leftExpression : Expression
|
||||||
- rightExpression : Expression
|
- rightExpression : Expression
|
||||||
@ -32,6 +26,13 @@ package com.iluwatar.interpreter {
|
|||||||
+ interpret() : int
|
+ interpret() : int
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
class NumberExpression {
|
||||||
|
- number : int
|
||||||
|
+ NumberExpression(number : int)
|
||||||
|
+ NumberExpression(s : String)
|
||||||
|
+ interpret() : int
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
class PlusExpression {
|
class PlusExpression {
|
||||||
- leftExpression : Expression
|
- leftExpression : Expression
|
||||||
- rightExpression : Expression
|
- rightExpression : Expression
|
||||||
@ -43,8 +44,8 @@ package com.iluwatar.interpreter {
|
|||||||
MultiplyExpression --> "-leftExpression" Expression
|
MultiplyExpression --> "-leftExpression" Expression
|
||||||
MinusExpression --> "-leftExpression" Expression
|
MinusExpression --> "-leftExpression" Expression
|
||||||
PlusExpression --> "-leftExpression" Expression
|
PlusExpression --> "-leftExpression" Expression
|
||||||
NumberExpression --|> Expression
|
|
||||||
MinusExpression --|> Expression
|
MinusExpression --|> Expression
|
||||||
MultiplyExpression --|> Expression
|
MultiplyExpression --|> Expression
|
||||||
|
NumberExpression --|> Expression
|
||||||
PlusExpression --|> Expression
|
PlusExpression --|> Expression
|
||||||
@enduml
|
@enduml
|
@ -1,6 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.iterator {
|
package com.iluwatar.iterator {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
@ -12,21 +13,6 @@ package com.iluwatar.iterator {
|
|||||||
+ setType(type : ItemType)
|
+ setType(type : ItemType)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class TreasureChestItemIterator {
|
|
||||||
- chest : TreasureChest
|
|
||||||
- idx : int
|
|
||||||
- type : ItemType
|
|
||||||
+ TreasureChestItemIterator(chest : TreasureChest, type : ItemType)
|
|
||||||
- findNextIdx() : int
|
|
||||||
+ hasNext() : boolean
|
|
||||||
+ next() : Item
|
|
||||||
}
|
|
||||||
class TreasureChest {
|
|
||||||
- items : List<Item>
|
|
||||||
+ TreasureChest()
|
|
||||||
+ getItems() : List<Item>
|
|
||||||
~ iterator(itemType : ItemType) : ItemIterator
|
|
||||||
}
|
|
||||||
interface ItemIterator {
|
interface ItemIterator {
|
||||||
+ hasNext() : boolean {abstract}
|
+ hasNext() : boolean {abstract}
|
||||||
+ next() : Item {abstract}
|
+ next() : Item {abstract}
|
||||||
@ -39,6 +25,21 @@ package com.iluwatar.iterator {
|
|||||||
+ valueOf(name : String) : ItemType {static}
|
+ valueOf(name : String) : ItemType {static}
|
||||||
+ values() : ItemType[] {static}
|
+ values() : ItemType[] {static}
|
||||||
}
|
}
|
||||||
|
class TreasureChest {
|
||||||
|
- items : List<Item>
|
||||||
|
+ TreasureChest()
|
||||||
|
+ getItems() : List<Item>
|
||||||
|
~ iterator(itemType : ItemType) : ItemIterator
|
||||||
|
}
|
||||||
|
class TreasureChestItemIterator {
|
||||||
|
- chest : TreasureChest
|
||||||
|
- idx : int
|
||||||
|
- type : ItemType
|
||||||
|
+ TreasureChestItemIterator(chest : TreasureChest, type : ItemType)
|
||||||
|
- findNextIdx() : int
|
||||||
|
+ hasNext() : boolean
|
||||||
|
+ next() : Item
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Item --> "-type" ItemType
|
Item --> "-type" ItemType
|
||||||
TreasureChest --> "-items" Item
|
TreasureChest --> "-items" Item
|
||||||
|
@ -1,14 +1,54 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.layers {
|
package com.iluwatar.layers {
|
||||||
interface View {
|
class App {
|
||||||
+ render() {abstract}
|
- cakeBakingService : CakeBakingService {static}
|
||||||
|
+ App()
|
||||||
|
- initializeData(cakeBakingService : CakeBakingService) {static}
|
||||||
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class CakeToppingInfo {
|
class Cake {
|
||||||
+ calories : int
|
- 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 CakeBakingService {
|
||||||
|
+ bakeNewCake(CakeInfo) {abstract}
|
||||||
|
+ getAllCakes() : List<CakeInfo> {abstract}
|
||||||
|
+ getAvailableLayers() : List<CakeLayerInfo> {abstract}
|
||||||
|
+ getAvailableToppings() : List<CakeToppingInfo> {abstract}
|
||||||
|
+ saveNewLayer(CakeLayerInfo) {abstract}
|
||||||
|
+ saveNewTopping(CakeToppingInfo) {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 CakeInfo {
|
||||||
|
+ cakeLayerInfos : List<CakeLayerInfo>
|
||||||
|
+ cakeToppingInfo : CakeToppingInfo
|
||||||
+ id : Optional<Long>
|
+ id : Optional<Long>
|
||||||
+ name : String
|
+ CakeInfo(cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List<CakeLayerInfo>)
|
||||||
+ CakeToppingInfo(id : Long, name : String, calories : int)
|
+ CakeInfo(id : Long, cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List<CakeLayerInfo>)
|
||||||
+ CakeToppingInfo(name : String, calories : int)
|
+ calculateTotalCalories() : int
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class CakeLayer {
|
class CakeLayer {
|
||||||
@ -28,6 +68,8 @@ package com.iluwatar.layers {
|
|||||||
+ setName(name : String)
|
+ setName(name : String)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
interface CakeLayerDao {
|
||||||
|
}
|
||||||
class CakeLayerInfo {
|
class CakeLayerInfo {
|
||||||
+ calories : int
|
+ calories : int
|
||||||
+ id : Optional<Long>
|
+ id : Optional<Long>
|
||||||
@ -36,23 +78,6 @@ package com.iluwatar.layers {
|
|||||||
+ CakeLayerInfo(name : String, calories : int)
|
+ CakeLayerInfo(name : String, calories : int)
|
||||||
+ toString() : String
|
+ 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 {
|
class CakeTopping {
|
||||||
- cake : Cake
|
- cake : Cake
|
||||||
- calories : int
|
- calories : int
|
||||||
@ -70,49 +95,25 @@ package com.iluwatar.layers {
|
|||||||
+ setName(name : String)
|
+ setName(name : String)
|
||||||
+ toString() : 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 CakeToppingDao {
|
||||||
}
|
}
|
||||||
interface CakeBakingService {
|
class CakeToppingInfo {
|
||||||
+ bakeNewCake(CakeInfo) {abstract}
|
+ calories : int
|
||||||
+ 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>
|
+ id : Optional<Long>
|
||||||
+ CakeInfo(cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List<CakeLayerInfo>)
|
+ name : String
|
||||||
+ CakeInfo(id : Long, cakeToppingInfo : CakeToppingInfo, cakeLayerInfos : List<CakeLayerInfo>)
|
+ CakeToppingInfo(id : Long, name : String, calories : int)
|
||||||
+ calculateTotalCalories() : int
|
+ CakeToppingInfo(name : String, calories : int)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
class CakeViewImpl {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- cakeBakingService : CakeBakingService
|
||||||
|
+ CakeViewImpl(cakeBakingService : CakeBakingService)
|
||||||
|
+ render()
|
||||||
|
}
|
||||||
|
interface View {
|
||||||
|
+ render() {abstract}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CakeViewImpl --> "-cakeBakingService" CakeBakingService
|
CakeViewImpl --> "-cakeBakingService" CakeBakingService
|
||||||
CakeInfo --> "-cakeToppingInfo" CakeToppingInfo
|
CakeInfo --> "-cakeToppingInfo" CakeToppingInfo
|
||||||
@ -120,6 +121,6 @@ CakeInfo --> "-cakeLayerInfos" CakeLayerInfo
|
|||||||
App --> "-cakeBakingService" CakeBakingService
|
App --> "-cakeBakingService" CakeBakingService
|
||||||
CakeLayer --> "-cake" Cake
|
CakeLayer --> "-cake" Cake
|
||||||
Cake --> "-topping" CakeTopping
|
Cake --> "-topping" CakeTopping
|
||||||
CakeViewImpl ..|> View
|
|
||||||
CakeBakingServiceImpl ..|> CakeBakingService
|
CakeBakingServiceImpl ..|> CakeBakingService
|
||||||
|
CakeViewImpl ..|> View
|
||||||
@enduml
|
@enduml
|
@ -1,33 +1,38 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.lazy.loading {
|
package com.iluwatar.lazy.loading {
|
||||||
~class HeavyFactory {
|
|
||||||
- heavyInstance : Heavy
|
|
||||||
~ HeavyFactory()
|
|
||||||
+ get() : Heavy
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class HolderThreadSafe {
|
|
||||||
- heavy : Heavy
|
|
||||||
+ HolderThreadSafe()
|
|
||||||
+ getHeavy() : Heavy
|
|
||||||
}
|
|
||||||
class Heavy {
|
class Heavy {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ Heavy()
|
+ Heavy()
|
||||||
}
|
}
|
||||||
class HolderNaive {
|
class HolderNaive {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- heavy : Heavy
|
- heavy : Heavy
|
||||||
+ HolderNaive()
|
+ HolderNaive()
|
||||||
+ getHeavy() : Heavy
|
+ getHeavy() : Heavy
|
||||||
}
|
}
|
||||||
|
class HolderThreadSafe {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- heavy : Heavy
|
||||||
|
+ HolderThreadSafe()
|
||||||
|
+ getHeavy() : Heavy
|
||||||
|
}
|
||||||
class Java8Holder {
|
class Java8Holder {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- heavy : Supplier<Heavy>
|
- heavy : Supplier<Heavy>
|
||||||
+ Java8Holder()
|
+ Java8Holder()
|
||||||
- createAndCacheHeavy() : Heavy
|
- createAndCacheHeavy() : Heavy
|
||||||
+ getHeavy() : Heavy
|
+ getHeavy() : Heavy
|
||||||
}
|
}
|
||||||
|
~class HeavyFactory {
|
||||||
|
- heavyInstance : Heavy
|
||||||
|
~ HeavyFactory()
|
||||||
|
+ get() : Heavy
|
||||||
|
}
|
||||||
}
|
}
|
||||||
HolderNaive --> "-heavy" Heavy
|
HolderNaive --> "-heavy" Heavy
|
||||||
HolderThreadSafe --> "-heavy" Heavy
|
HolderThreadSafe --> "-heavy" Heavy
|
||||||
|
@ -1,48 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.mediator {
|
package com.iluwatar.mediator {
|
||||||
interface Party {
|
|
||||||
+ act(PartyMember, Action) {abstract}
|
|
||||||
+ addMember(PartyMember) {abstract}
|
|
||||||
}
|
|
||||||
interface PartyMember {
|
|
||||||
+ act(Action) {abstract}
|
|
||||||
+ joinedParty(Party) {abstract}
|
|
||||||
+ partyAction(Action) {abstract}
|
|
||||||
}
|
|
||||||
class Rogue {
|
|
||||||
+ Rogue()
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class Hunter {
|
|
||||||
+ Hunter()
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class PartyImpl {
|
|
||||||
- members : List<PartyMember>
|
|
||||||
+ PartyImpl()
|
|
||||||
+ act(actor : PartyMember, action : Action)
|
|
||||||
+ addMember(member : PartyMember)
|
|
||||||
}
|
|
||||||
class Hobbit {
|
|
||||||
+ Hobbit()
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class Wizard {
|
|
||||||
+ Wizard()
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
abstract class PartyMemberBase {
|
|
||||||
# party : Party
|
|
||||||
+ PartyMemberBase()
|
|
||||||
+ act(action : Action)
|
|
||||||
+ joinedParty(party : Party)
|
|
||||||
+ partyAction(action : Action)
|
|
||||||
+ toString() : String {abstract}
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
enum Action {
|
enum Action {
|
||||||
+ ENEMY {static}
|
+ ENEMY {static}
|
||||||
+ GOLD {static}
|
+ GOLD {static}
|
||||||
@ -56,13 +13,57 @@ package com.iluwatar.mediator {
|
|||||||
+ valueOf(name : String) : Action {static}
|
+ valueOf(name : String) : Action {static}
|
||||||
+ values() : Action[] {static}
|
+ values() : Action[] {static}
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class Hobbit {
|
||||||
|
+ Hobbit()
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class Hunter {
|
||||||
|
+ Hunter()
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
interface Party {
|
||||||
|
+ act(PartyMember, Action) {abstract}
|
||||||
|
+ addMember(PartyMember) {abstract}
|
||||||
|
}
|
||||||
|
class PartyImpl {
|
||||||
|
- members : List<PartyMember>
|
||||||
|
+ PartyImpl()
|
||||||
|
+ act(actor : PartyMember, action : Action)
|
||||||
|
+ addMember(member : PartyMember)
|
||||||
|
}
|
||||||
|
interface PartyMember {
|
||||||
|
+ act(Action) {abstract}
|
||||||
|
+ joinedParty(Party) {abstract}
|
||||||
|
+ partyAction(Action) {abstract}
|
||||||
|
}
|
||||||
|
abstract class PartyMemberBase {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
# party : Party
|
||||||
|
+ PartyMemberBase()
|
||||||
|
+ act(action : Action)
|
||||||
|
+ joinedParty(party : Party)
|
||||||
|
+ partyAction(action : Action)
|
||||||
|
+ toString() : String {abstract}
|
||||||
|
}
|
||||||
|
class Rogue {
|
||||||
|
+ Rogue()
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class Wizard {
|
||||||
|
+ Wizard()
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PartyImpl --> "-members" PartyMember
|
PartyImpl --> "-members" PartyMember
|
||||||
PartyMemberBase --> "-party" Party
|
PartyMemberBase --> "-party" Party
|
||||||
Rogue --|> PartyMemberBase
|
Hobbit --|> PartyMemberBase
|
||||||
Hunter --|> PartyMemberBase
|
Hunter --|> PartyMemberBase
|
||||||
PartyImpl ..|> Party
|
PartyImpl ..|> Party
|
||||||
Hobbit --|> PartyMemberBase
|
|
||||||
Wizard --|> PartyMemberBase
|
|
||||||
PartyMemberBase ..|> PartyMember
|
PartyMemberBase ..|> PartyMember
|
||||||
|
Rogue --|> PartyMemberBase
|
||||||
|
Wizard --|> PartyMemberBase
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,20 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.memento {
|
package com.iluwatar.memento {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class Star {
|
||||||
|
- ageYears : int
|
||||||
|
- massTons : int
|
||||||
|
- type : StarType
|
||||||
|
+ Star(startType : StarType, startAge : int, startMass : int)
|
||||||
|
~ getMemento() : StarMemento
|
||||||
|
~ setMemento(memento : StarMemento)
|
||||||
|
+ timePasses()
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
-class StarMementoInternal {
|
-class StarMementoInternal {
|
||||||
- ageYears : int
|
- ageYears : int
|
||||||
- massTons : int
|
- massTons : int
|
||||||
@ -12,22 +27,8 @@ package com.iluwatar.memento {
|
|||||||
+ setMassTons(massTons : int)
|
+ setMassTons(massTons : int)
|
||||||
+ setType(type : StarType)
|
+ setType(type : StarType)
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
interface StarMemento {
|
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}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.message.channel {
|
package com.iluwatar.message.channel {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.model.view.controller {
|
package com.iluwatar.model.view.controller {
|
||||||
class GiantModel {
|
class App {
|
||||||
- fatigue : Fatigue
|
+ App()
|
||||||
- health : Health
|
+ main(args : String[]) {static}
|
||||||
- nourishment : Nourishment
|
}
|
||||||
~ GiantModel(health : Health, fatigue : Fatigue, nourishment : Nourishment)
|
enum Fatigue {
|
||||||
+ getFatigue() : Fatigue
|
+ ALERT {static}
|
||||||
+ getHealth() : Health
|
+ SLEEPING {static}
|
||||||
+ getNourishment() : Nourishment
|
+ TIRED {static}
|
||||||
+ setFatigue(fatigue : Fatigue)
|
- title : String
|
||||||
+ setHealth(health : Health)
|
|
||||||
+ setNourishment(nourishment : Nourishment)
|
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
|
+ valueOf(name : String) : Fatigue {static}
|
||||||
|
+ values() : Fatigue[] {static}
|
||||||
}
|
}
|
||||||
class GiantController {
|
class GiantController {
|
||||||
- giant : GiantModel
|
- giant : GiantModel
|
||||||
@ -25,14 +25,24 @@ package com.iluwatar.model.view.controller {
|
|||||||
+ setNourishment(nourishment : Nourishment)
|
+ setNourishment(nourishment : Nourishment)
|
||||||
+ updateView()
|
+ updateView()
|
||||||
}
|
}
|
||||||
|
class GiantModel {
|
||||||
|
- fatigue : Fatigue
|
||||||
|
- health : Health
|
||||||
|
- nourishment : Nourishment
|
||||||
|
~ GiantModel(health : Health, fatigue : Fatigue, nourishment : Nourishment)
|
||||||
|
+ getFatigue() : Fatigue
|
||||||
|
+ getHealth() : Health
|
||||||
|
+ getNourishment() : Nourishment
|
||||||
|
+ setFatigue(fatigue : Fatigue)
|
||||||
|
+ setHealth(health : Health)
|
||||||
|
+ setNourishment(nourishment : Nourishment)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
class GiantView {
|
class GiantView {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ GiantView()
|
+ GiantView()
|
||||||
+ displayGiant(giant : GiantModel)
|
+ displayGiant(giant : GiantModel)
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
enum Health {
|
enum Health {
|
||||||
+ DEAD {static}
|
+ DEAD {static}
|
||||||
+ HEALTHY {static}
|
+ HEALTHY {static}
|
||||||
@ -51,15 +61,6 @@ package com.iluwatar.model.view.controller {
|
|||||||
+ valueOf(name : String) : Nourishment {static}
|
+ valueOf(name : String) : Nourishment {static}
|
||||||
+ values() : Nourishment[] {static}
|
+ values() : Nourishment[] {static}
|
||||||
}
|
}
|
||||||
enum Fatigue {
|
|
||||||
+ ALERT {static}
|
|
||||||
+ SLEEPING {static}
|
|
||||||
+ TIRED {static}
|
|
||||||
- title : String
|
|
||||||
+ toString() : String
|
|
||||||
+ valueOf(name : String) : Fatigue {static}
|
|
||||||
+ values() : Fatigue[] {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
GiantModel --> "-nourishment" Nourishment
|
GiantModel --> "-nourishment" Nourishment
|
||||||
GiantController --> "-giant" GiantModel
|
GiantController --> "-giant" GiantModel
|
||||||
|
@ -1,34 +1,8 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.model.view.presenter {
|
package com.iluwatar.model.view.presenter {
|
||||||
interface FileSelectorView {
|
class App {
|
||||||
+ close() {abstract}
|
+ App()
|
||||||
+ displayData(String) {abstract}
|
+ main(args : String[]) {static}
|
||||||
+ getFileName() : String {abstract}
|
|
||||||
+ getPresenter() : FileSelectorPresenter {abstract}
|
|
||||||
+ isOpened() : boolean {abstract}
|
|
||||||
+ open() {abstract}
|
|
||||||
+ setFileName(String) {abstract}
|
|
||||||
+ setPresenter(FileSelectorPresenter) {abstract}
|
|
||||||
+ showMessage(String) {abstract}
|
|
||||||
}
|
|
||||||
class FileSelectorStub {
|
|
||||||
- dataDisplayed : boolean
|
|
||||||
- name : String
|
|
||||||
- numOfMessageSent : int
|
|
||||||
- opened : boolean
|
|
||||||
- presenter : FileSelectorPresenter
|
|
||||||
+ FileSelectorStub()
|
|
||||||
+ close()
|
|
||||||
+ dataDisplayed() : boolean
|
|
||||||
+ displayData(data : String)
|
|
||||||
+ getFileName() : String
|
|
||||||
+ getMessagesSent() : int
|
|
||||||
+ getPresenter() : FileSelectorPresenter
|
|
||||||
+ isOpened() : boolean
|
|
||||||
+ open()
|
|
||||||
+ setFileName(name : String)
|
|
||||||
+ setPresenter(presenter : FileSelectorPresenter)
|
|
||||||
+ showMessage(message : String)
|
|
||||||
}
|
}
|
||||||
class FileLoader {
|
class FileLoader {
|
||||||
- fileName : String
|
- fileName : String
|
||||||
@ -40,20 +14,6 @@ package com.iluwatar.model.view.presenter {
|
|||||||
+ loadData() : String
|
+ loadData() : String
|
||||||
+ setFileName(fileName : String)
|
+ setFileName(fileName : String)
|
||||||
}
|
}
|
||||||
class FileSelectorPresenter {
|
|
||||||
- loader : FileLoader
|
|
||||||
- view : FileSelectorView
|
|
||||||
+ FileSelectorPresenter(view : FileSelectorView)
|
|
||||||
+ cancelled()
|
|
||||||
+ confirmed()
|
|
||||||
+ fileNameChanged()
|
|
||||||
+ setLoader(loader : FileLoader)
|
|
||||||
+ start()
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class FileSelectorJFrame {
|
class FileSelectorJFrame {
|
||||||
- area : JTextArea
|
- area : JTextArea
|
||||||
- cancel : JButton
|
- cancel : JButton
|
||||||
@ -77,11 +37,51 @@ package com.iluwatar.model.view.presenter {
|
|||||||
+ setPresenter(presenter : FileSelectorPresenter)
|
+ setPresenter(presenter : FileSelectorPresenter)
|
||||||
+ showMessage(message : String)
|
+ showMessage(message : String)
|
||||||
}
|
}
|
||||||
|
class FileSelectorPresenter {
|
||||||
|
- loader : FileLoader
|
||||||
|
- view : FileSelectorView
|
||||||
|
+ FileSelectorPresenter(view : FileSelectorView)
|
||||||
|
+ cancelled()
|
||||||
|
+ confirmed()
|
||||||
|
+ fileNameChanged()
|
||||||
|
+ setLoader(loader : FileLoader)
|
||||||
|
+ start()
|
||||||
|
}
|
||||||
|
class FileSelectorStub {
|
||||||
|
- dataDisplayed : boolean
|
||||||
|
- name : String
|
||||||
|
- numOfMessageSent : int
|
||||||
|
- opened : boolean
|
||||||
|
- presenter : FileSelectorPresenter
|
||||||
|
+ FileSelectorStub()
|
||||||
|
+ close()
|
||||||
|
+ dataDisplayed() : boolean
|
||||||
|
+ displayData(data : String)
|
||||||
|
+ getFileName() : String
|
||||||
|
+ getMessagesSent() : int
|
||||||
|
+ getPresenter() : FileSelectorPresenter
|
||||||
|
+ isOpened() : boolean
|
||||||
|
+ open()
|
||||||
|
+ setFileName(name : String)
|
||||||
|
+ setPresenter(presenter : FileSelectorPresenter)
|
||||||
|
+ showMessage(message : String)
|
||||||
|
}
|
||||||
|
interface FileSelectorView {
|
||||||
|
+ close() {abstract}
|
||||||
|
+ displayData(String) {abstract}
|
||||||
|
+ getFileName() : String {abstract}
|
||||||
|
+ getPresenter() : FileSelectorPresenter {abstract}
|
||||||
|
+ isOpened() : boolean {abstract}
|
||||||
|
+ open() {abstract}
|
||||||
|
+ setFileName(String) {abstract}
|
||||||
|
+ setPresenter(FileSelectorPresenter) {abstract}
|
||||||
|
+ showMessage(String) {abstract}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FileSelectorJFrame --> "-presenter" FileSelectorPresenter
|
|
||||||
FileSelectorStub --> "-presenter" FileSelectorPresenter
|
FileSelectorStub --> "-presenter" FileSelectorPresenter
|
||||||
|
FileSelectorJFrame --> "-presenter" FileSelectorPresenter
|
||||||
FileSelectorPresenter --> "-loader" FileLoader
|
FileSelectorPresenter --> "-loader" FileLoader
|
||||||
FileSelectorPresenter --> "-view" FileSelectorView
|
FileSelectorPresenter --> "-view" FileSelectorView
|
||||||
FileSelectorStub ..|> FileSelectorView
|
|
||||||
FileSelectorJFrame ..|> FileSelectorView
|
FileSelectorJFrame ..|> FileSelectorView
|
||||||
|
FileSelectorStub ..|> FileSelectorView
|
||||||
@enduml
|
@enduml
|
@ -1,18 +1,16 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.monad {
|
package com.iluwatar.monad {
|
||||||
class Validator<T> {
|
|
||||||
- exceptions : List<Throwable>
|
|
||||||
- t : T
|
|
||||||
- Validator<T>(t : T)
|
|
||||||
+ get() : T
|
|
||||||
+ of(t : T) : Validator<T> {static}
|
|
||||||
+ validate(projection : Function<T, U>, validation : Predicate<U>, message : String) : Validator<T>
|
|
||||||
+ validate(validation : Predicate<T>, message : String) : Validator<T>
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
enum Sex {
|
||||||
|
+ FEMALE {static}
|
||||||
|
+ MALE {static}
|
||||||
|
+ valueOf(name : String) : Sex {static}
|
||||||
|
+ values() : Sex[] {static}
|
||||||
|
}
|
||||||
class User {
|
class User {
|
||||||
- age : int
|
- age : int
|
||||||
- email : String
|
- email : String
|
||||||
@ -24,11 +22,14 @@ package com.iluwatar.monad {
|
|||||||
+ getName() : String
|
+ getName() : String
|
||||||
+ getSex() : Sex
|
+ getSex() : Sex
|
||||||
}
|
}
|
||||||
enum Sex {
|
class Validator<T> {
|
||||||
+ FEMALE {static}
|
- exceptions : List<Throwable>
|
||||||
+ MALE {static}
|
- t : T
|
||||||
+ valueOf(name : String) : Sex {static}
|
- Validator<T>(t : T)
|
||||||
+ values() : Sex[] {static}
|
+ get() : T
|
||||||
|
+ of(t : T) : Validator<T> {static}
|
||||||
|
+ validate(projection : Function<T, U>, validation : Predicate<U>, message : String) : Validator<T>
|
||||||
|
+ validate(validation : Predicate<T>, message : String) : Validator<T>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
User --> "-sex" Sex
|
User --> "-sex" Sex
|
||||||
|
@ -4,10 +4,6 @@ package com.iluwatar.monostate {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ 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}
|
||||||
@ -18,7 +14,12 @@ package com.iluwatar.monostate {
|
|||||||
+ getNoOfServers() : int
|
+ getNoOfServers() : int
|
||||||
+ serverRequest(request : Request)
|
+ serverRequest(request : Request)
|
||||||
}
|
}
|
||||||
|
class Request {
|
||||||
|
+ value : String
|
||||||
|
+ Request(value : String)
|
||||||
|
}
|
||||||
class Server {
|
class Server {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ host : String
|
+ host : String
|
||||||
+ id : int
|
+ id : int
|
||||||
+ port : int
|
+ port : int
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.multiton {
|
package com.iluwatar.multiton {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.mute {
|
package com.iluwatar.mute {
|
||||||
interface CheckedRunnable {
|
|
||||||
+ run() {abstract}
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
- acquireResource() : Resource {static}
|
- acquireResource() : Resource {static}
|
||||||
- closeResource(resource : Resource) {static}
|
- closeResource(resource : Resource) {static}
|
||||||
@ -12,6 +10,9 @@ package com.iluwatar.mute {
|
|||||||
- useOfMute() {static}
|
- useOfMute() {static}
|
||||||
- utilizeResource(resource : Resource) {static}
|
- utilizeResource(resource : Resource) {static}
|
||||||
}
|
}
|
||||||
|
interface CheckedRunnable {
|
||||||
|
+ run() {abstract}
|
||||||
|
}
|
||||||
class Mute {
|
class Mute {
|
||||||
- Mute()
|
- Mute()
|
||||||
+ loggedMute(runnable : CheckedRunnable) {static}
|
+ loggedMute(runnable : CheckedRunnable) {static}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.mutex {
|
package com.iluwatar.mutex {
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class Jar {
|
class Jar {
|
||||||
- beans : int
|
- beans : int
|
||||||
- lock : Lock
|
- lock : Lock
|
||||||
@ -17,10 +21,6 @@ package com.iluwatar.mutex {
|
|||||||
+ getOwner() : Object
|
+ getOwner() : Object
|
||||||
+ release()
|
+ release()
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Jar --> "-lock" Lock
|
Jar --> "-lock" Lock
|
||||||
Mutex ..|> Lock
|
Mutex ..|> Lock
|
||||||
|
@ -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
|
||||||
- name : String
|
- name : String
|
||||||
@ -34,6 +26,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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
HomePageViewModel --> "-simpleObjects" SimpleObjects
|
HomePageViewModel --> "-simpleObjects" SimpleObjects
|
||||||
@enduml
|
@enduml
|
@ -86,7 +86,8 @@ package domainapp.fixture {
|
|||||||
+ getSpecification() : FixtureScriptsSpecification
|
+ getSpecification() : FixtureScriptsSpecification
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DomainAppFixturesProvider --+ FixtureScripts
|
Builder ..+ FixtureScriptsSpecification
|
||||||
DomainAppFixturesProvider --+ FixtureScriptsSpecification
|
DropDownPolicy ..+ FixtureScriptsSpecification
|
||||||
|
MultipleExecutionStrategy ..+ FixtureScripts
|
||||||
HomePageViewModel --> "-simpleObjects" SimpleObjects
|
HomePageViewModel --> "-simpleObjects" SimpleObjects
|
||||||
@enduml
|
@enduml
|
@ -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 {
|
||||||
@ -86,7 +86,8 @@ package domainapp.fixture {
|
|||||||
+ getSpecification() : FixtureScriptsSpecification
|
+ getSpecification() : FixtureScriptsSpecification
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DomainAppFixturesProvider --+ FixtureScripts
|
Builder ..+ FixtureScriptsSpecification
|
||||||
DomainAppFixturesProvider --+ FixtureScriptsSpecification
|
DropDownPolicy ..+ FixtureScriptsSpecification
|
||||||
|
MultipleExecutionStrategy ..+ FixtureScripts
|
||||||
HomePageViewModel --> "-simpleObjects" SimpleObjects
|
HomePageViewModel --> "-simpleObjects" SimpleObjects
|
||||||
@enduml
|
@enduml
|
@ -4,7 +4,15 @@ package com.iluwatar.nullobject {
|
|||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
interface Node {
|
||||||
|
+ getLeft() : Node {abstract}
|
||||||
|
+ getName() : String {abstract}
|
||||||
|
+ getRight() : Node {abstract}
|
||||||
|
+ getTreeSize() : int {abstract}
|
||||||
|
+ walk() {abstract}
|
||||||
|
}
|
||||||
class NodeImpl {
|
class NodeImpl {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- left : Node
|
- left : Node
|
||||||
- name : String
|
- name : String
|
||||||
- right : Node
|
- right : Node
|
||||||
@ -15,13 +23,6 @@ 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 {
|
class NullNode {
|
||||||
- instance : NullNode {static}
|
- instance : NullNode {static}
|
||||||
- NullNode()
|
- NullNode()
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.object.pool {
|
package com.iluwatar.object.pool {
|
||||||
class OliphauntPool {
|
class App {
|
||||||
+ OliphauntPool()
|
- LOGGER : Logger {static}
|
||||||
# create() : Oliphaunt
|
+ App()
|
||||||
}
|
+ main(args : String[]) {static}
|
||||||
class Oliphaunt {
|
|
||||||
- counter : int {static}
|
|
||||||
- id : int
|
|
||||||
+ Oliphaunt()
|
|
||||||
+ getId() : int
|
|
||||||
+ toString() : String
|
|
||||||
}
|
}
|
||||||
abstract class ObjectPool<T> {
|
abstract class ObjectPool<T> {
|
||||||
- available : HashSet<T>
|
- available : HashSet<T>
|
||||||
@ -20,9 +14,16 @@ package com.iluwatar.object.pool {
|
|||||||
# create() : T {abstract}
|
# create() : T {abstract}
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class App {
|
class Oliphaunt {
|
||||||
+ App()
|
- counter : int {static}
|
||||||
+ main(args : String[]) {static}
|
- id : int
|
||||||
|
+ Oliphaunt()
|
||||||
|
+ getId() : int
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class OliphauntPool {
|
||||||
|
+ OliphauntPool()
|
||||||
|
# create() : Oliphaunt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OliphauntPool --|> ObjectPool
|
OliphauntPool --|> ObjectPool
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.observer {
|
package com.iluwatar.observer {
|
||||||
class Orcs {
|
|
||||||
+ Orcs()
|
|
||||||
+ update(currentWeather : WeatherType)
|
|
||||||
}
|
|
||||||
interface WeatherObserver {
|
|
||||||
+ update(WeatherType) {abstract}
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
class Hobbits {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ Hobbits()
|
||||||
|
+ update(currentWeather : WeatherType)
|
||||||
|
}
|
||||||
|
class Orcs {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ Orcs()
|
||||||
|
+ update(currentWeather : WeatherType)
|
||||||
|
}
|
||||||
class Weather {
|
class Weather {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- currentWeather : WeatherType
|
- currentWeather : WeatherType
|
||||||
- observers : List<WeatherObserver>
|
- observers : List<WeatherObserver>
|
||||||
+ Weather()
|
+ Weather()
|
||||||
@ -20,9 +25,8 @@ package com.iluwatar.observer {
|
|||||||
+ removeObserver(obs : WeatherObserver)
|
+ removeObserver(obs : WeatherObserver)
|
||||||
+ timePasses()
|
+ timePasses()
|
||||||
}
|
}
|
||||||
class Hobbits {
|
interface WeatherObserver {
|
||||||
+ Hobbits()
|
+ update(WeatherType) {abstract}
|
||||||
+ update(currentWeather : WeatherType)
|
|
||||||
}
|
}
|
||||||
enum WeatherType {
|
enum WeatherType {
|
||||||
+ COLD {static}
|
+ COLD {static}
|
||||||
@ -35,13 +39,18 @@ package com.iluwatar.observer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.observer.generic {
|
package com.iluwatar.observer.generic {
|
||||||
|
class GHobbits {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ GHobbits()
|
||||||
|
+ update(weather : GWeather, weatherType : WeatherType)
|
||||||
|
}
|
||||||
class GOrcs {
|
class GOrcs {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ GOrcs()
|
+ GOrcs()
|
||||||
+ update(weather : GWeather, weatherType : WeatherType)
|
+ update(weather : GWeather, weatherType : WeatherType)
|
||||||
}
|
}
|
||||||
interface Race {
|
|
||||||
}
|
|
||||||
class GWeather {
|
class GWeather {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- currentWeather : WeatherType
|
- currentWeather : WeatherType
|
||||||
+ GWeather()
|
+ GWeather()
|
||||||
+ timePasses()
|
+ timePasses()
|
||||||
@ -53,21 +62,19 @@ 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 GHobbits {
|
|
||||||
+ GHobbits()
|
|
||||||
+ update(weather : GWeather, weatherType : WeatherType)
|
|
||||||
}
|
|
||||||
interface Observer<S extends Observable<S, O, A>, O extends Observer, A> {
|
interface Observer<S extends Observable<S, O, A>, O extends Observer, A> {
|
||||||
+ update(S extends Observable<S, O, A>, A) {abstract}
|
+ update(S extends Observable<S, O, A>, A) {abstract}
|
||||||
}
|
}
|
||||||
|
interface Race {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Weather --> "-currentWeather" WeatherType
|
Weather --> "-currentWeather" WeatherType
|
||||||
GWeather --> "-currentWeather" WeatherType
|
GWeather --> "-currentWeather" WeatherType
|
||||||
Weather --> "-observers" WeatherObserver
|
Weather --> "-observers" WeatherObserver
|
||||||
GOrcs ..|> Race
|
|
||||||
Orcs ..|> WeatherObserver
|
|
||||||
Race --|> Observer
|
|
||||||
GWeather --|> Observable
|
|
||||||
GHobbits ..|> Race
|
|
||||||
Hobbits ..|> WeatherObserver
|
Hobbits ..|> WeatherObserver
|
||||||
|
Orcs ..|> WeatherObserver
|
||||||
|
GHobbits ..|> Race
|
||||||
|
GOrcs ..|> Race
|
||||||
|
GWeather --|> Observable
|
||||||
|
Race --|> Observer
|
||||||
@enduml
|
@enduml
|
@ -1,7 +1,15 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.poison.pill {
|
package com.iluwatar.poison.pill {
|
||||||
interface MqPublishPoint {
|
class App {
|
||||||
+ put(Message) {abstract}
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class Consumer {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- name : String
|
||||||
|
- queue : MqSubscribePoint
|
||||||
|
+ Consumer(name : String, queue : MqSubscribePoint)
|
||||||
|
+ consume()
|
||||||
}
|
}
|
||||||
interface Message {
|
interface Message {
|
||||||
+ POISON_PILL : Message {static}
|
+ POISON_PILL : Message {static}
|
||||||
@ -11,13 +19,22 @@ package com.iluwatar.poison.pill {
|
|||||||
+ getHeaders() : Map<Headers, String> {abstract}
|
+ getHeaders() : Map<Headers, String> {abstract}
|
||||||
+ setBody(String) {abstract}
|
+ setBody(String) {abstract}
|
||||||
}
|
}
|
||||||
class App {
|
enum Headers {
|
||||||
+ App()
|
+ DATE {static}
|
||||||
+ main(args : String[]) {static}
|
+ SENDER {static}
|
||||||
|
+ valueOf(name : String) : Headers {static}
|
||||||
|
+ values() : Headers[] {static}
|
||||||
}
|
}
|
||||||
interface MessageQueue {
|
interface MessageQueue {
|
||||||
}
|
}
|
||||||
|
interface MqPublishPoint {
|
||||||
|
+ put(Message) {abstract}
|
||||||
|
}
|
||||||
|
interface MqSubscribePoint {
|
||||||
|
+ take() : Message {abstract}
|
||||||
|
}
|
||||||
class Producer {
|
class Producer {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- isStopped : boolean
|
- isStopped : boolean
|
||||||
- name : String
|
- name : String
|
||||||
- queue : MqPublishPoint
|
- queue : MqPublishPoint
|
||||||
@ -25,21 +42,6 @@ package com.iluwatar.poison.pill {
|
|||||||
+ send(body : String)
|
+ send(body : String)
|
||||||
+ stop()
|
+ stop()
|
||||||
}
|
}
|
||||||
class Consumer {
|
|
||||||
- name : String
|
|
||||||
- queue : MqSubscribePoint
|
|
||||||
+ Consumer(name : String, queue : MqSubscribePoint)
|
|
||||||
+ consume()
|
|
||||||
}
|
|
||||||
class SimpleMessageQueue {
|
|
||||||
- queue : BlockingQueue<Message>
|
|
||||||
+ SimpleMessageQueue(bound : int)
|
|
||||||
+ put(msg : Message)
|
|
||||||
+ take() : Message
|
|
||||||
}
|
|
||||||
interface MqSubscribePoint {
|
|
||||||
+ take() : Message {abstract}
|
|
||||||
}
|
|
||||||
class SimpleMessage {
|
class SimpleMessage {
|
||||||
- body : String
|
- body : String
|
||||||
- headers : Map<Headers, String>
|
- headers : Map<Headers, String>
|
||||||
@ -50,23 +52,20 @@ package com.iluwatar.poison.pill {
|
|||||||
+ getHeaders() : Map<Headers, String>
|
+ getHeaders() : Map<Headers, String>
|
||||||
+ setBody(body : String)
|
+ setBody(body : String)
|
||||||
}
|
}
|
||||||
enum Headers {
|
class SimpleMessageQueue {
|
||||||
+ DATE {static}
|
- queue : BlockingQueue<Message>
|
||||||
+ SENDER {static}
|
+ SimpleMessageQueue(bound : int)
|
||||||
+ valueOf(name : String) : Headers {static}
|
+ put(msg : Message)
|
||||||
+ values() : Headers[] {static}
|
+ take() : Message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SimpleMessageQueue --> "-queue" Message
|
SimpleMessageQueue --> "-queue" Message
|
||||||
Headers ..+ Message
|
Headers ..+ Message
|
||||||
Consumer --> "-queue" MqSubscribePoint
|
Consumer --> "-queue" MqSubscribePoint
|
||||||
Producer --> "-queue" MqPublishPoint
|
Producer --> "-queue" MqPublishPoint
|
||||||
SimpleMessage --+ Message
|
|
||||||
Producer --+ Message
|
|
||||||
Message --> "-POISON_PILL" Message
|
Message --> "-POISON_PILL" Message
|
||||||
Consumer --+ Message
|
|
||||||
MessageQueue --|> MqPublishPoint
|
MessageQueue --|> MqPublishPoint
|
||||||
MessageQueue --|> MqSubscribePoint
|
MessageQueue --|> MqSubscribePoint
|
||||||
SimpleMessageQueue ..|> MessageQueue
|
|
||||||
SimpleMessage ..|> Message
|
SimpleMessage ..|> Message
|
||||||
|
SimpleMessageQueue ..|> MessageQueue
|
||||||
@enduml
|
@enduml
|
2
pom.xml
2
pom.xml
@ -44,7 +44,7 @@
|
|||||||
<hierarchical-junit-runner-version>4.12.1</hierarchical-junit-runner-version>
|
<hierarchical-junit-runner-version>4.12.1</hierarchical-junit-runner-version>
|
||||||
<apache-httpcomponents.version>4.5.2</apache-httpcomponents.version>
|
<apache-httpcomponents.version>4.5.2</apache-httpcomponents.version>
|
||||||
<htmlunit.version>2.22</htmlunit.version>
|
<htmlunit.version>2.22</htmlunit.version>
|
||||||
<urm.version>1.4.1</urm.version>
|
<urm.version>1.4.4</urm.version>
|
||||||
<guice.version>4.0</guice.version>
|
<guice.version>4.0</guice.version>
|
||||||
<mongo-java-driver.version>3.3.0</mongo-java-driver.version>
|
<mongo-java-driver.version>3.3.0</mongo-java-driver.version>
|
||||||
<slf4j.version>1.7.21</slf4j.version>
|
<slf4j.version>1.7.21</slf4j.version>
|
||||||
|
@ -1,5 +1,25 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.privateclassdata {
|
package com.iluwatar.privateclassdata {
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class ImmutableStew {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- data : StewData
|
||||||
|
+ ImmutableStew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int)
|
||||||
|
+ mix()
|
||||||
|
}
|
||||||
|
class Stew {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- numCarrots : int
|
||||||
|
- numMeat : int
|
||||||
|
- numPeppers : int
|
||||||
|
- numPotatoes : int
|
||||||
|
+ Stew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int)
|
||||||
|
+ mix()
|
||||||
|
+ taste()
|
||||||
|
}
|
||||||
class StewData {
|
class StewData {
|
||||||
- numCarrots : int
|
- numCarrots : int
|
||||||
- numMeat : int
|
- numMeat : int
|
||||||
@ -11,24 +31,6 @@ 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 {
|
|
||||||
- data : StewData
|
|
||||||
+ ImmutableStew(numPotatoes : int, numCarrots : int, numMeat : int, numPeppers : int)
|
|
||||||
+ mix()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ImmutableStew --> "-data" StewData
|
ImmutableStew --> "-data" StewData
|
||||||
@enduml
|
@enduml
|
@ -1,6 +1,12 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.producer.consumer {
|
package com.iluwatar.producer.consumer {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class Consumer {
|
class Consumer {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- name : String
|
- name : String
|
||||||
- queue : ItemQueue
|
- queue : ItemQueue
|
||||||
+ Consumer(name : String, queue : ItemQueue)
|
+ Consumer(name : String, queue : ItemQueue)
|
||||||
@ -13,9 +19,11 @@ package com.iluwatar.producer.consumer {
|
|||||||
+ getId() : int
|
+ getId() : int
|
||||||
+ getProducer() : String
|
+ getProducer() : String
|
||||||
}
|
}
|
||||||
class App {
|
class ItemQueue {
|
||||||
+ App()
|
- queue : BlockingQueue<Item>
|
||||||
+ main(args : String[]) {static}
|
+ ItemQueue()
|
||||||
|
+ put(item : Item)
|
||||||
|
+ take() : Item
|
||||||
}
|
}
|
||||||
class Producer {
|
class Producer {
|
||||||
- itemId : int
|
- itemId : int
|
||||||
@ -24,12 +32,6 @@ package com.iluwatar.producer.consumer {
|
|||||||
+ Producer(name : String, queue : ItemQueue)
|
+ Producer(name : String, queue : ItemQueue)
|
||||||
+ produce()
|
+ produce()
|
||||||
}
|
}
|
||||||
class ItemQueue {
|
|
||||||
- queue : BlockingQueue<Item>
|
|
||||||
+ ItemQueue()
|
|
||||||
+ put(item : Item)
|
|
||||||
+ take() : Item
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Consumer --> "-queue" ItemQueue
|
Consumer --> "-queue" ItemQueue
|
||||||
Producer --> "-queue" ItemQueue
|
Producer --> "-queue" ItemQueue
|
||||||
|
@ -1,5 +1,49 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.promise {
|
package com.iluwatar.promise {
|
||||||
|
class App {
|
||||||
|
- DEFAULT_URL : String {static}
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- executor : ExecutorService
|
||||||
|
- stopLatch : CountDownLatch
|
||||||
|
- App()
|
||||||
|
- calculateLineCount()
|
||||||
|
- calculateLowestFrequencyChar()
|
||||||
|
- characterFrequency() : Promise<Map<Character, Integer>>
|
||||||
|
- countLines() : Promise<Integer>
|
||||||
|
- download(urlString : String) : Promise<String>
|
||||||
|
- lowestFrequencyChar() : Promise<Character>
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
- promiseUsage()
|
||||||
|
- stop()
|
||||||
|
- taskCompleted()
|
||||||
|
}
|
||||||
|
class Promise<T> {
|
||||||
|
- exceptionHandler : Consumer<? super Throwable>
|
||||||
|
- fulfillmentAction : Runnable
|
||||||
|
+ Promise<T>()
|
||||||
|
+ fulfill(value : T)
|
||||||
|
+ 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 ConsumeAction {
|
||||||
|
- action : Consumer<? super T>
|
||||||
|
- dest : Promise<Void>
|
||||||
|
- src : Promise<T>
|
||||||
|
- ConsumeAction(src : Promise<T>, dest : Promise<T>, action : Consumer<T>)
|
||||||
|
+ run()
|
||||||
|
}
|
||||||
|
-class TransformAction<V> {
|
||||||
|
- dest : Promise<V>
|
||||||
|
- func : Function<? super T, V>
|
||||||
|
- src : Promise<T>
|
||||||
|
- TransformAction<V>(src : Promise<T>, dest : Promise<T>, func : Function<T, R>)
|
||||||
|
+ run()
|
||||||
|
}
|
||||||
~class PromiseSupport<T> {
|
~class PromiseSupport<T> {
|
||||||
- COMPLETED : int {static}
|
- COMPLETED : int {static}
|
||||||
- FAILED : int {static}
|
- FAILED : int {static}
|
||||||
@ -17,50 +61,8 @@ package com.iluwatar.promise {
|
|||||||
+ isCancelled() : boolean
|
+ isCancelled() : boolean
|
||||||
+ isDone() : boolean
|
+ isDone() : boolean
|
||||||
}
|
}
|
||||||
-class ConsumeAction {
|
|
||||||
- action : Consumer<? super T>
|
|
||||||
- dest : Promise<Void>
|
|
||||||
- src : Promise<T>
|
|
||||||
- ConsumeAction(src : Promise<T>, dest : Promise<T>, action : Consumer<T>)
|
|
||||||
+ run()
|
|
||||||
}
|
|
||||||
class Promise<T> {
|
|
||||||
- exceptionHandler : Consumer<? super Throwable>
|
|
||||||
- fulfillmentAction : Runnable
|
|
||||||
+ Promise<T>()
|
|
||||||
+ fulfill(value : T)
|
|
||||||
+ 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 {
|
|
||||||
- DEFAULT_URL : String {static}
|
|
||||||
- executor : ExecutorService
|
|
||||||
- stopLatch : CountDownLatch
|
|
||||||
- App()
|
|
||||||
- calculateLineCount()
|
|
||||||
- calculateLowestFrequencyChar()
|
|
||||||
- characterFrequency() : Promise<Map<Character, Integer>>
|
|
||||||
- countLines() : Promise<Integer>
|
|
||||||
- download(urlString : String) : Promise<String>
|
|
||||||
- lowestFrequencyChar() : Promise<Character>
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
- promiseUsage()
|
|
||||||
- stop()
|
|
||||||
- taskCompleted()
|
|
||||||
}
|
|
||||||
-class TransformAction<V> {
|
|
||||||
- dest : Promise<V>
|
|
||||||
- func : Function<? super T, V>
|
|
||||||
- src : Promise<T>
|
|
||||||
- TransformAction<V>(src : Promise<T>, dest : Promise<T>, func : Function<T, R>)
|
|
||||||
+ run()
|
|
||||||
}
|
|
||||||
class Utility {
|
class Utility {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ Utility()
|
+ Utility()
|
||||||
+ characterFrequency(fileLocation : String) : Map<Character, Integer> {static}
|
+ characterFrequency(fileLocation : String) : Map<Character, Integer> {static}
|
||||||
+ countLines(fileLocation : String) : Integer {static}
|
+ countLines(fileLocation : String) : Integer {static}
|
||||||
@ -68,10 +70,9 @@ package com.iluwatar.promise {
|
|||||||
+ lowestFrequencyChar(charFrequency : Map<Character, Integer>) : Character {static}
|
+ lowestFrequencyChar(charFrequency : Map<Character, Integer>) : Character {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TransformAction --+ Promise
|
|
||||||
TransformAction --> "-src" Promise
|
TransformAction --> "-src" Promise
|
||||||
ConsumeAction --+ Promise
|
TransformAction --+ Promise
|
||||||
ConsumeAction --> "-src" Promise
|
ConsumeAction --> "-src" Promise
|
||||||
Utility --+ Map
|
ConsumeAction --+ Promise
|
||||||
Promise --|> PromiseSupport
|
Promise --|> PromiseSupport
|
||||||
@enduml
|
@enduml
|
@ -1,15 +1,10 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.property {
|
package com.iluwatar.property {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ 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>
|
||||||
@ -33,6 +28,12 @@ package com.iluwatar.property {
|
|||||||
+ valueOf(name : String) : Type {static}
|
+ valueOf(name : String) : Type {static}
|
||||||
+ values() : Type[] {static}
|
+ values() : Type[] {static}
|
||||||
}
|
}
|
||||||
|
interface Prototype {
|
||||||
|
+ get(Stats) : Integer {abstract}
|
||||||
|
+ has(Stats) : boolean {abstract}
|
||||||
|
+ remove(Stats) {abstract}
|
||||||
|
+ set(Stats, Integer) {abstract}
|
||||||
|
}
|
||||||
enum Stats {
|
enum Stats {
|
||||||
+ AGILITY {static}
|
+ AGILITY {static}
|
||||||
+ ARMOR {static}
|
+ ARMOR {static}
|
||||||
@ -46,9 +47,8 @@ package com.iluwatar.property {
|
|||||||
+ values() : Stats[] {static}
|
+ values() : Stats[] {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
App --+ Character
|
|
||||||
Character --> "-prototype" Prototype
|
Character --> "-prototype" Prototype
|
||||||
Character --> "-type" Type
|
|
||||||
Type ..+ Character
|
Type ..+ Character
|
||||||
|
Character --> "-type" Type
|
||||||
Character ..|> Prototype
|
Character ..|> Prototype
|
||||||
@enduml
|
@enduml
|
@ -1,55 +1,33 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.prototype {
|
package com.iluwatar.prototype {
|
||||||
class OrcWarlord {
|
class App {
|
||||||
+ OrcWarlord()
|
- LOGGER : Logger {static}
|
||||||
+ clone() : Warlord
|
+ App()
|
||||||
+ toString() : String
|
+ main(args : String[]) {static}
|
||||||
}
|
|
||||||
class OrcBeast {
|
|
||||||
+ OrcBeast()
|
|
||||||
+ clone() : Beast
|
|
||||||
+ toString() : String
|
|
||||||
}
|
}
|
||||||
abstract class Beast {
|
abstract class Beast {
|
||||||
+ Beast()
|
+ Beast()
|
||||||
+ clone() : Beast {abstract}
|
+ clone() : Beast {abstract}
|
||||||
}
|
}
|
||||||
class ElfMage {
|
|
||||||
+ ElfMage()
|
|
||||||
+ clone() : Mage
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
abstract class Mage {
|
|
||||||
+ Mage()
|
|
||||||
+ clone() : Mage {abstract}
|
|
||||||
}
|
|
||||||
abstract class Prototype {
|
|
||||||
+ Prototype()
|
|
||||||
+ clone() : Object {abstract}
|
|
||||||
}
|
|
||||||
interface HeroFactory {
|
|
||||||
+ createBeast() : Beast {abstract}
|
|
||||||
+ createMage() : Mage {abstract}
|
|
||||||
+ createWarlord() : Warlord {abstract}
|
|
||||||
}
|
|
||||||
class ElfWarlord {
|
|
||||||
+ ElfWarlord()
|
|
||||||
+ clone() : Warlord
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class OrcMage {
|
|
||||||
+ OrcMage()
|
|
||||||
+ clone() : Mage
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class ElfBeast {
|
class ElfBeast {
|
||||||
+ ElfBeast()
|
+ ElfBeast()
|
||||||
+ clone() : Beast
|
+ clone() : Beast
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
abstract class Warlord {
|
class ElfMage {
|
||||||
+ Warlord()
|
+ ElfMage()
|
||||||
+ clone() : Warlord {abstract}
|
+ clone() : Mage
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class ElfWarlord {
|
||||||
|
+ ElfWarlord()
|
||||||
|
+ clone() : Warlord
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
interface HeroFactory {
|
||||||
|
+ createBeast() : Beast {abstract}
|
||||||
|
+ createMage() : Mage {abstract}
|
||||||
|
+ createWarlord() : Warlord {abstract}
|
||||||
}
|
}
|
||||||
class HeroFactoryImpl {
|
class HeroFactoryImpl {
|
||||||
- beast : Beast
|
- beast : Beast
|
||||||
@ -60,22 +38,45 @@ package com.iluwatar.prototype {
|
|||||||
+ createMage() : Mage
|
+ createMage() : Mage
|
||||||
+ createWarlord() : Warlord
|
+ createWarlord() : Warlord
|
||||||
}
|
}
|
||||||
class App {
|
abstract class Mage {
|
||||||
+ App()
|
+ Mage()
|
||||||
+ main(args : String[]) {static}
|
+ clone() : Mage {abstract}
|
||||||
|
}
|
||||||
|
class OrcBeast {
|
||||||
|
+ OrcBeast()
|
||||||
|
+ clone() : Beast
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class OrcMage {
|
||||||
|
+ OrcMage()
|
||||||
|
+ clone() : Mage
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class OrcWarlord {
|
||||||
|
+ OrcWarlord()
|
||||||
|
+ clone() : Warlord
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
abstract class Prototype {
|
||||||
|
+ Prototype()
|
||||||
|
+ clone() : Object {abstract}
|
||||||
|
}
|
||||||
|
abstract class Warlord {
|
||||||
|
+ Warlord()
|
||||||
|
+ clone() : Warlord {abstract}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HeroFactoryImpl --> "-beast" Beast
|
HeroFactoryImpl --> "-beast" Beast
|
||||||
HeroFactoryImpl --> "-warlord" Warlord
|
HeroFactoryImpl --> "-warlord" Warlord
|
||||||
HeroFactoryImpl --> "-mage" Mage
|
HeroFactoryImpl --> "-mage" Mage
|
||||||
OrcWarlord --|> Warlord
|
|
||||||
OrcBeast --|> Beast
|
|
||||||
Beast --|> Prototype
|
Beast --|> Prototype
|
||||||
ElfMage --|> Mage
|
|
||||||
Mage --|> Prototype
|
|
||||||
ElfWarlord --|> Warlord
|
|
||||||
OrcMage --|> Mage
|
|
||||||
ElfBeast --|> Beast
|
ElfBeast --|> Beast
|
||||||
Warlord --|> Prototype
|
ElfMage --|> Mage
|
||||||
|
ElfWarlord --|> Warlord
|
||||||
HeroFactoryImpl ..|> HeroFactory
|
HeroFactoryImpl ..|> HeroFactory
|
||||||
|
Mage --|> Prototype
|
||||||
|
OrcBeast --|> Beast
|
||||||
|
OrcMage --|> Mage
|
||||||
|
OrcWarlord --|> Warlord
|
||||||
|
Warlord --|> Prototype
|
||||||
@enduml
|
@enduml
|
@ -1,24 +1,32 @@
|
|||||||
@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 {
|
|
||||||
+ WizardTower()
|
|
||||||
+ enter(wizard : Wizard)
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
class IvoryTower {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ IvoryTower()
|
||||||
|
+ enter(wizard : Wizard)
|
||||||
|
}
|
||||||
class Wizard {
|
class Wizard {
|
||||||
- name : String
|
- name : String
|
||||||
+ Wizard(name : String)
|
+ Wizard(name : String)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
interface WizardTower {
|
||||||
|
+ enter(Wizard) {abstract}
|
||||||
|
}
|
||||||
|
class WizardTowerProxy {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- NUM_WIZARDS_ALLOWED : int {static}
|
||||||
|
- numWizards : int
|
||||||
|
- tower : WizardTower
|
||||||
|
+ WizardTowerProxy(tower : WizardTower)
|
||||||
|
+ enter(wizard : Wizard)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
WizardTowerProxy --|> WizardTower
|
WizardTowerProxy --> "-tower" WizardTower
|
||||||
|
IvoryTower ..|> WizardTower
|
||||||
|
WizardTowerProxy ..|> WizardTower
|
||||||
@enduml
|
@enduml
|
@ -1,6 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.publish.subscribe {
|
package com.iluwatar.publish.subscribe {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,4 @@
|
|||||||
@startuml
|
@startuml
|
||||||
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 {
|
|
||||||
- clientName : String
|
|
||||||
- serverPort : int
|
|
||||||
+ TcpLoggingClient(clientName : String, serverPort : int)
|
|
||||||
+ run()
|
|
||||||
- sendLogRequests(writer : PrintWriter, inputStream : InputStream)
|
|
||||||
}
|
|
||||||
~class UdpLoggingClient {
|
|
||||||
- clientName : String
|
|
||||||
- remoteAddress : InetSocketAddress
|
|
||||||
+ UdpLoggingClient(clientName : String, port : int)
|
|
||||||
+ run()
|
|
||||||
}
|
|
||||||
class AppClient {
|
|
||||||
- service : ExecutorService
|
|
||||||
+ AppClient()
|
|
||||||
- artificialDelayOf(millis : long) {static}
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
+ start()
|
|
||||||
+ stop()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
package com.iluwatar.reactor.framework {
|
package com.iluwatar.reactor.framework {
|
||||||
abstract class AbstractNioChannel {
|
abstract class AbstractNioChannel {
|
||||||
- channel : SelectableChannel
|
- channel : SelectableChannel
|
||||||
@ -58,17 +16,15 @@ 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 {
|
interface ChannelHandler {
|
||||||
+ handleChannelRead(AbstractNioChannel, Object, SelectionKey) {abstract}
|
+ handleChannelRead(AbstractNioChannel, Object, SelectionKey) {abstract}
|
||||||
}
|
}
|
||||||
|
interface Dispatcher {
|
||||||
|
+ onChannelReadEvent(AbstractNioChannel, Object, SelectionKey) {abstract}
|
||||||
|
+ stop() {abstract}
|
||||||
|
}
|
||||||
class NioDatagramChannel {
|
class NioDatagramChannel {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- port : int
|
- port : int
|
||||||
+ NioDatagramChannel(port : int, handler : ChannelHandler)
|
+ NioDatagramChannel(port : int, handler : ChannelHandler)
|
||||||
+ bind()
|
+ bind()
|
||||||
@ -78,30 +34,6 @@ package com.iluwatar.reactor.framework {
|
|||||||
+ read(key : SelectionKey) : DatagramPacket
|
+ read(key : SelectionKey) : DatagramPacket
|
||||||
+ write(data : Object, key : SelectionKey)
|
+ write(data : Object, key : SelectionKey)
|
||||||
}
|
}
|
||||||
class ThreadPoolDispatcher {
|
|
||||||
- executorService : ExecutorService
|
|
||||||
+ ThreadPoolDispatcher(poolSize : int)
|
|
||||||
+ onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey)
|
|
||||||
+ stop()
|
|
||||||
}
|
|
||||||
class NioServerSocketChannel {
|
|
||||||
- port : int
|
|
||||||
+ NioServerSocketChannel(port : int, handler : ChannelHandler)
|
|
||||||
+ bind()
|
|
||||||
# doWrite(pendingWrite : Object, key : SelectionKey)
|
|
||||||
+ getInterestedOps() : int
|
|
||||||
+ getJavaChannel() : ServerSocketChannel
|
|
||||||
+ read(key : SelectionKey) : ByteBuffer
|
|
||||||
}
|
|
||||||
class SameThreadDispatcher {
|
|
||||||
+ SameThreadDispatcher()
|
|
||||||
+ onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey)
|
|
||||||
+ stop()
|
|
||||||
}
|
|
||||||
interface Dispatcher {
|
|
||||||
+ onChannelReadEvent(AbstractNioChannel, Object, SelectionKey) {abstract}
|
|
||||||
+ stop() {abstract}
|
|
||||||
}
|
|
||||||
class DatagramPacket {
|
class DatagramPacket {
|
||||||
- data : ByteBuffer
|
- data : ByteBuffer
|
||||||
- receiver : SocketAddress
|
- receiver : SocketAddress
|
||||||
@ -114,6 +46,7 @@ package com.iluwatar.reactor.framework {
|
|||||||
+ setSender(sender : SocketAddress)
|
+ setSender(sender : SocketAddress)
|
||||||
}
|
}
|
||||||
class NioReactor {
|
class NioReactor {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- dispatcher : Dispatcher
|
- dispatcher : Dispatcher
|
||||||
- pendingCommands : Queue<Runnable>
|
- pendingCommands : Queue<Runnable>
|
||||||
- reactorMain : ExecutorService
|
- reactorMain : ExecutorService
|
||||||
@ -131,6 +64,78 @@ package com.iluwatar.reactor.framework {
|
|||||||
+ start()
|
+ start()
|
||||||
+ stop()
|
+ stop()
|
||||||
}
|
}
|
||||||
|
~class ChangeKeyOpsCommand {
|
||||||
|
- interestedOps : int
|
||||||
|
- key : SelectionKey
|
||||||
|
+ ChangeKeyOpsCommand(this$0 : SelectionKey, key : int)
|
||||||
|
+ run()
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class NioServerSocketChannel {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- port : int
|
||||||
|
+ NioServerSocketChannel(port : int, handler : ChannelHandler)
|
||||||
|
+ bind()
|
||||||
|
# doWrite(pendingWrite : Object, key : SelectionKey)
|
||||||
|
+ getInterestedOps() : int
|
||||||
|
+ getJavaChannel() : ServerSocketChannel
|
||||||
|
+ read(key : SelectionKey) : ByteBuffer
|
||||||
|
}
|
||||||
|
class SameThreadDispatcher {
|
||||||
|
+ SameThreadDispatcher()
|
||||||
|
+ onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey)
|
||||||
|
+ stop()
|
||||||
|
}
|
||||||
|
class ThreadPoolDispatcher {
|
||||||
|
- executorService : ExecutorService
|
||||||
|
+ ThreadPoolDispatcher(poolSize : int)
|
||||||
|
+ onChannelReadEvent(channel : AbstractNioChannel, readObject : Object, key : SelectionKey)
|
||||||
|
+ stop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
package com.iluwatar.reactor.app {
|
||||||
|
class App {
|
||||||
|
- channels : List<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 AppClient {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- service : ExecutorService
|
||||||
|
+ AppClient()
|
||||||
|
- artificialDelayOf(millis : long) {static}
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
+ start()
|
||||||
|
+ stop()
|
||||||
|
}
|
||||||
|
~class TcpLoggingClient {
|
||||||
|
- clientName : String
|
||||||
|
- serverPort : int
|
||||||
|
+ TcpLoggingClient(clientName : String, serverPort : int)
|
||||||
|
+ run()
|
||||||
|
- sendLogRequests(writer : PrintWriter, inputStream : InputStream)
|
||||||
|
}
|
||||||
|
~class UdpLoggingClient {
|
||||||
|
- clientName : String
|
||||||
|
- remoteAddress : InetSocketAddress
|
||||||
|
+ UdpLoggingClient(clientName : String, port : int)
|
||||||
|
+ run()
|
||||||
|
}
|
||||||
|
class LoggingHandler {
|
||||||
|
- ACK : byte[] {static}
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ LoggingHandler()
|
||||||
|
- doLogging(data : ByteBuffer) {static}
|
||||||
|
+ handleChannelRead(channel : AbstractNioChannel, readObject : Object, key : SelectionKey)
|
||||||
|
- sendReply(channel : AbstractNioChannel, incomingPacket : DatagramPacket, key : SelectionKey) {static}
|
||||||
|
- sendReply(channel : AbstractNioChannel, key : SelectionKey) {static}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AbstractNioChannel --> "-handler" ChannelHandler
|
AbstractNioChannel --> "-handler" ChannelHandler
|
||||||
UdpLoggingClient ..+ AppClient
|
UdpLoggingClient ..+ AppClient
|
||||||
@ -140,12 +145,11 @@ NioReactor --> "-dispatcher" Dispatcher
|
|||||||
App --> "-reactor" NioReactor
|
App --> "-reactor" NioReactor
|
||||||
App --> "-channels" AbstractNioChannel
|
App --> "-channels" AbstractNioChannel
|
||||||
DatagramPacket ..+ NioDatagramChannel
|
DatagramPacket ..+ NioDatagramChannel
|
||||||
LoggingHandler --+ NioDatagramChannel
|
|
||||||
App --> "-dispatcher" Dispatcher
|
App --> "-dispatcher" Dispatcher
|
||||||
ChangeKeyOpsCommand --+ NioReactor
|
ChangeKeyOpsCommand --+ NioReactor
|
||||||
NioDatagramChannel --|> AbstractNioChannel
|
|
||||||
LoggingHandler ..|> ChannelHandler
|
LoggingHandler ..|> ChannelHandler
|
||||||
ThreadPoolDispatcher ..|> Dispatcher
|
NioDatagramChannel --|> AbstractNioChannel
|
||||||
NioServerSocketChannel --|> AbstractNioChannel
|
NioServerSocketChannel --|> AbstractNioChannel
|
||||||
SameThreadDispatcher ..|> Dispatcher
|
SameThreadDispatcher ..|> Dispatcher
|
||||||
|
ThreadPoolDispatcher ..|> Dispatcher
|
||||||
@enduml
|
@enduml
|
@ -1,5 +1,18 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.reader.writer.lock {
|
package com.iluwatar.reader.writer.lock {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class Reader {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- name : String
|
||||||
|
- readLock : Lock
|
||||||
|
+ Reader(name : String, readLock : Lock)
|
||||||
|
+ read()
|
||||||
|
+ run()
|
||||||
|
}
|
||||||
class ReaderWriterLock {
|
class ReaderWriterLock {
|
||||||
- currentReaderCount : int
|
- currentReaderCount : int
|
||||||
- globalMutex : Set<Object>
|
- globalMutex : Set<Object>
|
||||||
@ -14,19 +27,6 @@ package com.iluwatar.reader.writer.lock {
|
|||||||
- waitUninterruptibly(o : Object) {static}
|
- waitUninterruptibly(o : Object) {static}
|
||||||
+ writeLock() : Lock
|
+ writeLock() : Lock
|
||||||
}
|
}
|
||||||
-class WriteLock {
|
|
||||||
- WriteLock()
|
|
||||||
+ lock()
|
|
||||||
+ lockInterruptibly()
|
|
||||||
+ newCondition() : Condition
|
|
||||||
+ tryLock() : boolean
|
|
||||||
+ tryLock(time : long, unit : TimeUnit) : boolean
|
|
||||||
+ unlock()
|
|
||||||
}
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
-class ReadLock {
|
-class ReadLock {
|
||||||
- ReadLock()
|
- ReadLock()
|
||||||
+ lock()
|
+ lock()
|
||||||
@ -36,20 +36,23 @@ package com.iluwatar.reader.writer.lock {
|
|||||||
+ tryLock(time : long, unit : TimeUnit) : boolean
|
+ tryLock(time : long, unit : TimeUnit) : boolean
|
||||||
+ unlock()
|
+ unlock()
|
||||||
}
|
}
|
||||||
|
-class WriteLock {
|
||||||
|
- WriteLock()
|
||||||
|
+ lock()
|
||||||
|
+ lockInterruptibly()
|
||||||
|
+ newCondition() : Condition
|
||||||
|
+ tryLock() : boolean
|
||||||
|
+ tryLock(time : long, unit : TimeUnit) : boolean
|
||||||
|
+ unlock()
|
||||||
|
}
|
||||||
class Writer {
|
class Writer {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- name : String
|
- name : String
|
||||||
- writeLock : Lock
|
- writeLock : Lock
|
||||||
+ Writer(name : String, writeLock : Lock)
|
+ Writer(name : String, writeLock : Lock)
|
||||||
+ run()
|
+ run()
|
||||||
+ write()
|
+ write()
|
||||||
}
|
}
|
||||||
class Reader {
|
|
||||||
- name : String
|
|
||||||
- readLock : Lock
|
|
||||||
+ Reader(name : String, readLock : Lock)
|
|
||||||
+ read()
|
|
||||||
+ run()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ReaderWriterLock --> "-readerLock" ReadLock
|
ReaderWriterLock --> "-readerLock" ReadLock
|
||||||
ReadLock --+ ReaderWriterLock
|
ReadLock --+ ReaderWriterLock
|
||||||
|
@ -1,27 +1,12 @@
|
|||||||
@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 {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ 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 {
|
class AppConfig {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ AppConfig()
|
+ AppConfig()
|
||||||
+ dataSource() : DataSource
|
+ dataSource() : DataSource
|
||||||
+ entityManagerFactory() : LocalContainerEntityManagerFactoryBean
|
+ entityManagerFactory() : LocalContainerEntityManagerFactoryBean
|
||||||
@ -48,9 +33,24 @@ package com.iluwatar.repository {
|
|||||||
+ setSurname(surname : String)
|
+ setSurname(surname : String)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
interface PersonRepository {
|
||||||
|
+ findByName(String) : Person {abstract}
|
||||||
|
}
|
||||||
|
class PersonSpecifications {
|
||||||
|
+ PersonSpecifications()
|
||||||
|
}
|
||||||
|
class AgeBetweenSpec {
|
||||||
|
- from : int
|
||||||
|
- to : int
|
||||||
|
+ AgeBetweenSpec(from : int, to : int)
|
||||||
|
+ toPredicate(root : Root<Person>, query : CriteriaQuery<?>, cb : CriteriaBuilder) : Predicate
|
||||||
|
}
|
||||||
|
class NameEqualSpec {
|
||||||
|
+ name : String
|
||||||
|
+ NameEqualSpec(name : String)
|
||||||
|
+ toPredicate(root : Root<Person>, query : CriteriaQuery<?>, cb : CriteriaBuilder) : Predicate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
App --+ PersonSpecifications
|
|
||||||
AppConfig --+ PersonSpecifications
|
|
||||||
NameEqualSpec ..+ PersonSpecifications
|
NameEqualSpec ..+ PersonSpecifications
|
||||||
AgeBetweenSpec ..+ PersonSpecifications
|
AgeBetweenSpec ..+ PersonSpecifications
|
||||||
@enduml
|
@enduml
|
@ -1,14 +1,17 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.resource.acquisition.is.initialization {
|
package com.iluwatar.resource.acquisition.is.initialization {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class SlidingDoor {
|
class SlidingDoor {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ SlidingDoor()
|
+ SlidingDoor()
|
||||||
+ close()
|
+ close()
|
||||||
}
|
}
|
||||||
class TreasureChest {
|
class TreasureChest {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ TreasureChest()
|
+ TreasureChest()
|
||||||
+ close()
|
+ close()
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,29 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.semaphore {
|
package com.iluwatar.semaphore {
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class Fruit {
|
class Fruit {
|
||||||
- type : FruitType
|
- type : FruitType
|
||||||
+ Fruit(type : FruitType)
|
+ Fruit(type : FruitType)
|
||||||
+ getType() : FruitType
|
+ getType() : FruitType
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class App {
|
enum FruitType {
|
||||||
+ App()
|
+ APPLE {static}
|
||||||
+ main(args : String[]) {static}
|
+ LEMON {static}
|
||||||
|
+ ORANGE {static}
|
||||||
|
+ valueOf(name : String) : FruitType {static}
|
||||||
|
+ values() : FruitType[] {static}
|
||||||
}
|
}
|
||||||
class Semaphore {
|
class FruitBowl {
|
||||||
- counter : int
|
- fruit : ArrayList<Fruit>
|
||||||
- licenses : int
|
+ FruitBowl()
|
||||||
+ Semaphore(licenses : int)
|
+ countFruit() : int
|
||||||
+ acquire()
|
+ put(f : Fruit)
|
||||||
+ getAvailableLicenses() : int
|
+ take() : Fruit
|
||||||
+ getNumLicenses() : int
|
+ toString() : String
|
||||||
+ release()
|
|
||||||
}
|
}
|
||||||
class FruitShop {
|
class FruitShop {
|
||||||
- available : boolean[]
|
- available : boolean[]
|
||||||
@ -32,27 +38,19 @@ package com.iluwatar.semaphore {
|
|||||||
+ acquire() {abstract}
|
+ acquire() {abstract}
|
||||||
+ release() {abstract}
|
+ release() {abstract}
|
||||||
}
|
}
|
||||||
class FruitBowl {
|
class Semaphore {
|
||||||
- fruit : ArrayList<Fruit>
|
- counter : int
|
||||||
+ FruitBowl()
|
- licenses : int
|
||||||
+ countFruit() : int
|
+ Semaphore(licenses : int)
|
||||||
+ put(f : Fruit)
|
+ acquire()
|
||||||
+ take() : Fruit
|
+ getAvailableLicenses() : int
|
||||||
+ toString() : String
|
+ getNumLicenses() : int
|
||||||
}
|
+ release()
|
||||||
enum FruitType {
|
|
||||||
+ APPLE {static}
|
|
||||||
+ LEMON {static}
|
|
||||||
+ ORANGE {static}
|
|
||||||
+ valueOf(name : String) : FruitType {static}
|
|
||||||
+ values() : FruitType[] {static}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FruitShop --+ Fruit
|
|
||||||
Fruit --> "-type" FruitType
|
Fruit --> "-type" FruitType
|
||||||
FruitType ..+ Fruit
|
FruitType ..+ Fruit
|
||||||
FruitBowl --+ Fruit
|
|
||||||
FruitBowl --> "-fruit" Fruit
|
|
||||||
FruitShop --> "-semaphore" Semaphore
|
FruitShop --> "-semaphore" Semaphore
|
||||||
|
FruitBowl --> "-fruit" Fruit
|
||||||
Semaphore ..|> Lock
|
Semaphore ..|> Lock
|
||||||
@enduml
|
@enduml
|
@ -1,28 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.servant {
|
package com.iluwatar.servant {
|
||||||
class Servant {
|
|
||||||
+ name : String
|
|
||||||
+ Servant(name : String)
|
|
||||||
+ checkIfYouWillBeHanged(tableGuests : List<Royalty>) : boolean
|
|
||||||
+ feed(r : Royalty)
|
|
||||||
+ giveCompliments(r : Royalty)
|
|
||||||
+ giveWine(r : Royalty)
|
|
||||||
}
|
|
||||||
class Queen {
|
|
||||||
- complimentReceived : boolean
|
|
||||||
- isDrunk : boolean
|
|
||||||
- isFlirty : boolean
|
|
||||||
- isHappy : boolean
|
|
||||||
- isHungry : boolean
|
|
||||||
+ Queen()
|
|
||||||
+ changeMood()
|
|
||||||
+ getDrink()
|
|
||||||
+ getFed()
|
|
||||||
+ getMood() : boolean
|
|
||||||
+ receiveCompliments()
|
|
||||||
+ setFlirtiness(f : boolean)
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
~ jenkins : Servant {static}
|
~ jenkins : Servant {static}
|
||||||
~ travis : Servant {static}
|
~ travis : Servant {static}
|
||||||
+ App()
|
+ App()
|
||||||
@ -41,6 +20,20 @@ package com.iluwatar.servant {
|
|||||||
+ getMood() : boolean
|
+ getMood() : boolean
|
||||||
+ receiveCompliments()
|
+ receiveCompliments()
|
||||||
}
|
}
|
||||||
|
class Queen {
|
||||||
|
- complimentReceived : boolean
|
||||||
|
- isDrunk : boolean
|
||||||
|
- isFlirty : boolean
|
||||||
|
- isHappy : boolean
|
||||||
|
- isHungry : boolean
|
||||||
|
+ Queen()
|
||||||
|
+ changeMood()
|
||||||
|
+ getDrink()
|
||||||
|
+ getFed()
|
||||||
|
+ getMood() : boolean
|
||||||
|
+ receiveCompliments()
|
||||||
|
+ setFlirtiness(f : boolean)
|
||||||
|
}
|
||||||
~interface Royalty {
|
~interface Royalty {
|
||||||
+ changeMood() {abstract}
|
+ changeMood() {abstract}
|
||||||
+ getDrink() {abstract}
|
+ getDrink() {abstract}
|
||||||
@ -48,8 +41,16 @@ package com.iluwatar.servant {
|
|||||||
+ getMood() : boolean {abstract}
|
+ getMood() : boolean {abstract}
|
||||||
+ receiveCompliments() {abstract}
|
+ receiveCompliments() {abstract}
|
||||||
}
|
}
|
||||||
|
class Servant {
|
||||||
|
+ name : String
|
||||||
|
+ Servant(name : String)
|
||||||
|
+ checkIfYouWillBeHanged(tableGuests : List<Royalty>) : boolean
|
||||||
|
+ feed(r : Royalty)
|
||||||
|
+ giveCompliments(r : Royalty)
|
||||||
|
+ giveWine(r : Royalty)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
App --> "-jenkins" Servant
|
App --> "-jenkins" Servant
|
||||||
Queen ..|> Royalty
|
|
||||||
King ..|> Royalty
|
King ..|> Royalty
|
||||||
|
Queen ..|> Royalty
|
||||||
@enduml
|
@enduml
|
@ -1,6 +1,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.servicelayer.hibernate {
|
package com.iluwatar.servicelayer.hibernate {
|
||||||
class HibernateUtil {
|
class HibernateUtil {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- sessionFactory : SessionFactory {static}
|
- sessionFactory : SessionFactory {static}
|
||||||
- HibernateUtil()
|
- HibernateUtil()
|
||||||
+ dropSession() {static}
|
+ dropSession() {static}
|
||||||
@ -55,9 +56,6 @@ 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
|
||||||
@ -73,27 +71,15 @@ package com.iluwatar.servicelayer.wizard {
|
|||||||
+ setSpellbooks(spellbooks : Set<Spellbook>)
|
+ setSpellbooks(spellbooks : Set<Spellbook>)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
interface WizardDao {
|
||||||
|
+ findByName(String) : Wizard {abstract}
|
||||||
|
}
|
||||||
class WizardDaoImpl {
|
class WizardDaoImpl {
|
||||||
+ WizardDaoImpl()
|
+ WizardDaoImpl()
|
||||||
+ findByName(name : String) : Wizard
|
+ findByName(name : String) : Wizard
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.servicelayer.app {
|
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ initData() {static}
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
+ queryData() {static}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
package com.iluwatar.servicelayer.spellbook {
|
package com.iluwatar.servicelayer.spellbook {
|
||||||
interface SpellbookDao {
|
|
||||||
+ findByName(String) : Spellbook {abstract}
|
|
||||||
}
|
|
||||||
class SpellbookDaoImpl {
|
|
||||||
+ SpellbookDaoImpl()
|
|
||||||
+ findByName(name : String) : Spellbook
|
|
||||||
}
|
|
||||||
class Spellbook {
|
class Spellbook {
|
||||||
- id : Long
|
- id : Long
|
||||||
- name : String
|
- name : String
|
||||||
@ -112,15 +98,15 @@ package com.iluwatar.servicelayer.spellbook {
|
|||||||
+ setWizards(wizards : Set<Wizard>)
|
+ setWizards(wizards : Set<Wizard>)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
interface SpellbookDao {
|
||||||
|
+ findByName(String) : Spellbook {abstract}
|
||||||
|
}
|
||||||
|
class SpellbookDaoImpl {
|
||||||
|
+ SpellbookDaoImpl()
|
||||||
|
+ findByName(name : String) : Spellbook
|
||||||
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.servicelayer.spell {
|
package com.iluwatar.servicelayer.spell {
|
||||||
class SpellDaoImpl {
|
|
||||||
+ SpellDaoImpl()
|
|
||||||
+ findByName(name : String) : Spell
|
|
||||||
}
|
|
||||||
interface SpellDao {
|
|
||||||
+ findByName(String) : Spell {abstract}
|
|
||||||
}
|
|
||||||
class Spell {
|
class Spell {
|
||||||
- id : Long
|
- id : Long
|
||||||
- name : String
|
- name : String
|
||||||
@ -135,24 +121,40 @@ package com.iluwatar.servicelayer.spell {
|
|||||||
+ setSpellbook(spellbook : Spellbook)
|
+ setSpellbook(spellbook : Spellbook)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
interface SpellDao {
|
||||||
|
+ findByName(String) : Spell {abstract}
|
||||||
|
}
|
||||||
|
class SpellDaoImpl {
|
||||||
|
+ SpellDaoImpl()
|
||||||
|
+ findByName(name : String) : Spell
|
||||||
|
}
|
||||||
|
}
|
||||||
|
package com.iluwatar.servicelayer.app {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ initData() {static}
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
+ queryData() {static}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MagicServiceImpl --> "-wizardDao" WizardDao
|
MagicServiceImpl --> "-wizardDao" WizardDao
|
||||||
MagicServiceImpl --> "-spellbookDao" SpellbookDao
|
MagicServiceImpl --> "-spellbookDao" SpellbookDao
|
||||||
MagicServiceImpl --> "-spellDao" SpellDao
|
MagicServiceImpl --> "-spellDao" SpellDao
|
||||||
Spellbook --> "-spells" Spell
|
Spellbook --> "-spells" Spell
|
||||||
Spellbook --> "-wizards" Wizard
|
Spellbook --> "-wizards" Wizard
|
||||||
|
DaoBaseImpl ..|> Dao
|
||||||
|
MagicServiceImpl ..|> MagicService
|
||||||
|
Spell --|> BaseEntity
|
||||||
|
SpellDao --|> Dao
|
||||||
SpellDaoImpl ..|> SpellDao
|
SpellDaoImpl ..|> SpellDao
|
||||||
SpellDaoImpl --|> DaoBaseImpl
|
SpellDaoImpl --|> DaoBaseImpl
|
||||||
|
Spellbook --|> BaseEntity
|
||||||
SpellbookDao --|> Dao
|
SpellbookDao --|> Dao
|
||||||
WizardDao --|> Dao
|
|
||||||
SpellbookDaoImpl ..|> SpellbookDao
|
SpellbookDaoImpl ..|> SpellbookDao
|
||||||
SpellbookDaoImpl --|> DaoBaseImpl
|
SpellbookDaoImpl --|> DaoBaseImpl
|
||||||
MagicServiceImpl ..|> MagicService
|
|
||||||
SpellDao --|> Dao
|
|
||||||
Spell --|> BaseEntity
|
|
||||||
Spellbook --|> BaseEntity
|
|
||||||
Wizard --|> BaseEntity
|
Wizard --|> BaseEntity
|
||||||
|
WizardDao --|> Dao
|
||||||
WizardDaoImpl ..|> WizardDao
|
WizardDaoImpl ..|> WizardDao
|
||||||
WizardDaoImpl --|> DaoBaseImpl
|
WizardDaoImpl --|> DaoBaseImpl
|
||||||
DaoBaseImpl ..|> Dao
|
|
||||||
@enduml
|
@enduml
|
@ -1,15 +1,28 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.servicelocator {
|
package com.iluwatar.servicelocator {
|
||||||
class ServiceLocator {
|
|
||||||
- serviceCache : ServiceCache {static}
|
|
||||||
- ServiceLocator()
|
|
||||||
+ getService(serviceJndiName : String) : Service {static}
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
|
class InitContext {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ InitContext()
|
||||||
|
+ lookup(serviceName : String) : Object
|
||||||
|
}
|
||||||
|
interface Service {
|
||||||
|
+ execute() {abstract}
|
||||||
|
+ getId() : int {abstract}
|
||||||
|
+ getName() : String {abstract}
|
||||||
|
}
|
||||||
|
class ServiceCache {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- serviceCache : Map<String, Service>
|
||||||
|
+ ServiceCache()
|
||||||
|
+ addService(newService : Service)
|
||||||
|
+ getService(serviceName : String) : Service
|
||||||
|
}
|
||||||
class ServiceImpl {
|
class ServiceImpl {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- id : int
|
- id : int
|
||||||
- serviceName : String
|
- serviceName : String
|
||||||
+ ServiceImpl(serviceName : String)
|
+ ServiceImpl(serviceName : String)
|
||||||
@ -17,20 +30,10 @@ package com.iluwatar.servicelocator {
|
|||||||
+ getId() : int
|
+ getId() : int
|
||||||
+ getName() : String
|
+ getName() : String
|
||||||
}
|
}
|
||||||
class InitContext {
|
class ServiceLocator {
|
||||||
+ InitContext()
|
- serviceCache : ServiceCache {static}
|
||||||
+ lookup(serviceName : String) : Object
|
- ServiceLocator()
|
||||||
}
|
+ getService(serviceJndiName : String) : Service {static}
|
||||||
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
|
||||||
|
@ -1,38 +1,39 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.singleton {
|
package com.iluwatar.singleton {
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class ThreadSafeLazyLoadedIvoryTower {
|
|
||||||
- instance : ThreadSafeLazyLoadedIvoryTower {static}
|
|
||||||
- ThreadSafeLazyLoadedIvoryTower()
|
|
||||||
+ getInstance() : ThreadSafeLazyLoadedIvoryTower {static}
|
|
||||||
}
|
|
||||||
class InitializingOnDemandHolderIdiom {
|
|
||||||
- InitializingOnDemandHolderIdiom()
|
|
||||||
+ getInstance() : InitializingOnDemandHolderIdiom {static}
|
|
||||||
}
|
|
||||||
class ThreadSafeDoubleCheckLocking {
|
|
||||||
- instance : ThreadSafeDoubleCheckLocking {static}
|
|
||||||
- ThreadSafeDoubleCheckLocking()
|
|
||||||
+ getInstance() : ThreadSafeDoubleCheckLocking {static}
|
|
||||||
}
|
|
||||||
class IvoryTower {
|
|
||||||
- INSTANCE : IvoryTower {static}
|
|
||||||
- IvoryTower()
|
|
||||||
+ getInstance() : IvoryTower {static}
|
|
||||||
}
|
|
||||||
-class HelperHolder {
|
|
||||||
- INSTANCE : InitializingOnDemandHolderIdiom {static}
|
|
||||||
- HelperHolder()
|
|
||||||
}
|
|
||||||
enum EnumIvoryTower {
|
enum EnumIvoryTower {
|
||||||
+ INSTANCE {static}
|
+ INSTANCE {static}
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
+ valueOf(name : String) : EnumIvoryTower {static}
|
+ valueOf(name : String) : EnumIvoryTower {static}
|
||||||
+ values() : EnumIvoryTower[] {static}
|
+ values() : EnumIvoryTower[] {static}
|
||||||
}
|
}
|
||||||
|
class InitializingOnDemandHolderIdiom {
|
||||||
|
- InitializingOnDemandHolderIdiom()
|
||||||
|
+ getInstance() : InitializingOnDemandHolderIdiom {static}
|
||||||
|
}
|
||||||
|
-class HelperHolder {
|
||||||
|
- INSTANCE : InitializingOnDemandHolderIdiom {static}
|
||||||
|
- HelperHolder()
|
||||||
|
}
|
||||||
|
class IvoryTower {
|
||||||
|
- INSTANCE : IvoryTower {static}
|
||||||
|
- IvoryTower()
|
||||||
|
+ getInstance() : IvoryTower {static}
|
||||||
|
}
|
||||||
|
class ThreadSafeDoubleCheckLocking {
|
||||||
|
- instance : ThreadSafeDoubleCheckLocking {static}
|
||||||
|
- ThreadSafeDoubleCheckLocking()
|
||||||
|
+ getInstance() : ThreadSafeDoubleCheckLocking {static}
|
||||||
|
}
|
||||||
|
class ThreadSafeLazyLoadedIvoryTower {
|
||||||
|
- instance : ThreadSafeLazyLoadedIvoryTower {static}
|
||||||
|
- ThreadSafeLazyLoadedIvoryTower()
|
||||||
|
+ getInstance() : ThreadSafeLazyLoadedIvoryTower {static}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
IvoryTower --> "-INSTANCE" IvoryTower
|
IvoryTower --> "-INSTANCE" IvoryTower
|
||||||
ThreadSafeDoubleCheckLocking --> "-instance" ThreadSafeDoubleCheckLocking
|
ThreadSafeDoubleCheckLocking --> "-instance" ThreadSafeDoubleCheckLocking
|
||||||
|
@ -12,21 +12,6 @@ package com.iluwatar.specification.creature {
|
|||||||
+ getSize() : Size
|
+ getSize() : Size
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class Troll {
|
|
||||||
+ Troll()
|
|
||||||
}
|
|
||||||
class Octopus {
|
|
||||||
+ Octopus()
|
|
||||||
}
|
|
||||||
class Shark {
|
|
||||||
+ Shark()
|
|
||||||
}
|
|
||||||
class Goblin {
|
|
||||||
+ Goblin()
|
|
||||||
}
|
|
||||||
class KillerBee {
|
|
||||||
+ KillerBee()
|
|
||||||
}
|
|
||||||
interface Creature {
|
interface Creature {
|
||||||
+ getColor() : Color {abstract}
|
+ getColor() : Color {abstract}
|
||||||
+ getMovement() : Movement {abstract}
|
+ getMovement() : Movement {abstract}
|
||||||
@ -36,17 +21,23 @@ package com.iluwatar.specification.creature {
|
|||||||
class Dragon {
|
class Dragon {
|
||||||
+ Dragon()
|
+ Dragon()
|
||||||
}
|
}
|
||||||
|
class Goblin {
|
||||||
|
+ Goblin()
|
||||||
|
}
|
||||||
|
class KillerBee {
|
||||||
|
+ KillerBee()
|
||||||
|
}
|
||||||
|
class Octopus {
|
||||||
|
+ Octopus()
|
||||||
|
}
|
||||||
|
class Shark {
|
||||||
|
+ Shark()
|
||||||
|
}
|
||||||
|
class Troll {
|
||||||
|
+ Troll()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
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}
|
||||||
@ -66,30 +57,40 @@ package com.iluwatar.specification.property {
|
|||||||
+ valueOf(name : String) : Movement {static}
|
+ valueOf(name : String) : Movement {static}
|
||||||
+ values() : Movement[] {static}
|
+ values() : Movement[] {static}
|
||||||
}
|
}
|
||||||
}
|
enum Size {
|
||||||
package com.iluwatar.specification.app {
|
+ LARGE {static}
|
||||||
class App {
|
+ NORMAL {static}
|
||||||
+ App()
|
+ SMALL {static}
|
||||||
+ main(args : String[]) {static}
|
- title : String
|
||||||
|
+ toString() : String
|
||||||
|
+ valueOf(name : String) : Size {static}
|
||||||
|
+ values() : Size[] {static}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
package com.iluwatar.specification.selector {
|
package com.iluwatar.specification.selector {
|
||||||
class MovementSelector {
|
|
||||||
- m : Movement
|
|
||||||
+ MovementSelector(m : Movement)
|
|
||||||
+ test(t : Creature) : boolean
|
|
||||||
}
|
|
||||||
class ColorSelector {
|
class ColorSelector {
|
||||||
- c : Color
|
- c : Color
|
||||||
+ ColorSelector(c : Color)
|
+ ColorSelector(c : Color)
|
||||||
+ test(t : Creature) : boolean
|
+ test(t : Creature) : boolean
|
||||||
}
|
}
|
||||||
|
class MovementSelector {
|
||||||
|
- m : Movement
|
||||||
|
+ MovementSelector(m : Movement)
|
||||||
|
+ test(t : Creature) : boolean
|
||||||
|
}
|
||||||
class SizeSelector {
|
class SizeSelector {
|
||||||
- s : Size
|
- s : Size
|
||||||
+ SizeSelector(s : Size)
|
+ SizeSelector(s : Size)
|
||||||
+ test(t : Creature) : boolean
|
+ test(t : Creature) : boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
package com.iluwatar.specification.app {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
}
|
||||||
SizeSelector --> "-s" Size
|
SizeSelector --> "-s" Size
|
||||||
AbstractCreature --> "-color" Color
|
AbstractCreature --> "-color" Color
|
||||||
MovementSelector --> "-m" Movement
|
MovementSelector --> "-m" Movement
|
||||||
@ -97,10 +98,10 @@ AbstractCreature --> "-movement" Movement
|
|||||||
AbstractCreature --> "-size" Size
|
AbstractCreature --> "-size" Size
|
||||||
ColorSelector --> "-c" Color
|
ColorSelector --> "-c" Color
|
||||||
AbstractCreature ..|> Creature
|
AbstractCreature ..|> Creature
|
||||||
Troll --|> AbstractCreature
|
Dragon --|> AbstractCreature
|
||||||
Octopus --|> AbstractCreature
|
|
||||||
Shark --|> AbstractCreature
|
|
||||||
Goblin --|> AbstractCreature
|
Goblin --|> AbstractCreature
|
||||||
KillerBee --|> AbstractCreature
|
KillerBee --|> AbstractCreature
|
||||||
Dragon --|> AbstractCreature
|
Octopus --|> AbstractCreature
|
||||||
|
Shark --|> AbstractCreature
|
||||||
|
Troll --|> AbstractCreature
|
||||||
@enduml
|
@enduml
|
@ -1,25 +1,16 @@
|
|||||||
@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 {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- mammoth : Mammoth
|
- mammoth : Mammoth
|
||||||
+ AngryState(mammoth : Mammoth)
|
+ AngryState(mammoth : Mammoth)
|
||||||
+ observe()
|
+ observe()
|
||||||
+ onEnterState()
|
+ onEnterState()
|
||||||
}
|
}
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class Mammoth {
|
class Mammoth {
|
||||||
- state : State
|
- state : State
|
||||||
+ Mammoth()
|
+ Mammoth()
|
||||||
@ -28,10 +19,21 @@ package com.iluwatar.state {
|
|||||||
+ timePasses()
|
+ timePasses()
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
|
class PeacefulState {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
- mammoth : Mammoth
|
||||||
|
+ PeacefulState(mammoth : Mammoth)
|
||||||
|
+ observe()
|
||||||
|
+ onEnterState()
|
||||||
|
}
|
||||||
|
interface State {
|
||||||
|
+ observe() {abstract}
|
||||||
|
+ onEnterState() {abstract}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AngryState --> "-mammoth" Mammoth
|
AngryState --> "-mammoth" Mammoth
|
||||||
PeacefulState --> "-mammoth" Mammoth
|
PeacefulState --> "-mammoth" Mammoth
|
||||||
Mammoth --> "-state" State
|
Mammoth --> "-state" State
|
||||||
PeacefulState ..|> State
|
|
||||||
AngryState ..|> State
|
AngryState ..|> State
|
||||||
|
PeacefulState ..|> State
|
||||||
@enduml
|
@enduml
|
@ -1,44 +1,10 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.stepbuilder {
|
package com.iluwatar.stepbuilder {
|
||||||
interface AbilityStep {
|
|
||||||
+ noAbilities() : BuildStep {abstract}
|
|
||||||
+ noMoreAbilities() : BuildStep {abstract}
|
|
||||||
+ withAbility(String) : AbilityStep {abstract}
|
|
||||||
}
|
|
||||||
interface BuildStep {
|
|
||||||
+ build() : Character {abstract}
|
|
||||||
}
|
|
||||||
interface NameStep {
|
|
||||||
+ name(String) : ClassStep {abstract}
|
|
||||||
}
|
|
||||||
-class CharacterSteps {
|
|
||||||
- abilities : List<String>
|
|
||||||
- fighterClass : String
|
|
||||||
- name : String
|
|
||||||
- spell : String
|
|
||||||
- weapon : String
|
|
||||||
- wizardClass : String
|
|
||||||
- CharacterSteps()
|
|
||||||
+ build() : Character
|
|
||||||
+ fighterClass(fighterClass : String) : WeaponStep
|
|
||||||
+ name(name : String) : ClassStep
|
|
||||||
+ noAbilities() : BuildStep
|
|
||||||
+ noMoreAbilities() : BuildStep
|
|
||||||
+ noSpell() : BuildStep
|
|
||||||
+ noWeapon() : BuildStep
|
|
||||||
+ withAbility(ability : String) : AbilityStep
|
|
||||||
+ withSpell(spell : String) : AbilityStep
|
|
||||||
+ withWeapon(weapon : String) : AbilityStep
|
|
||||||
+ wizardClass(wizardClass : String) : SpellStep
|
|
||||||
}
|
|
||||||
class App {
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ App()
|
+ App()
|
||||||
+ main(args : String[]) {static}
|
+ main(args : String[]) {static}
|
||||||
}
|
}
|
||||||
class CharacterStepBuilder {
|
|
||||||
- CharacterStepBuilder()
|
|
||||||
+ newBuilder() : NameStep {static}
|
|
||||||
}
|
|
||||||
class Character {
|
class Character {
|
||||||
- abilities : List<String>
|
- abilities : List<String>
|
||||||
- fighterClass : String
|
- fighterClass : String
|
||||||
@ -61,24 +27,58 @@ package com.iluwatar.stepbuilder {
|
|||||||
+ setWizardClass(wizardClass : String)
|
+ setWizardClass(wizardClass : String)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
interface SpellStep {
|
class CharacterStepBuilder {
|
||||||
+ noSpell() : BuildStep {abstract}
|
- CharacterStepBuilder()
|
||||||
+ withSpell(String) : AbilityStep {abstract}
|
+ newBuilder() : NameStep {static}
|
||||||
|
}
|
||||||
|
interface AbilityStep {
|
||||||
|
+ noAbilities() : BuildStep {abstract}
|
||||||
|
+ noMoreAbilities() : BuildStep {abstract}
|
||||||
|
+ withAbility(String) : AbilityStep {abstract}
|
||||||
|
}
|
||||||
|
interface BuildStep {
|
||||||
|
+ build() : Character {abstract}
|
||||||
|
}
|
||||||
|
-class CharacterSteps {
|
||||||
|
- abilities : List<String>
|
||||||
|
- fighterClass : String
|
||||||
|
- name : String
|
||||||
|
- spell : String
|
||||||
|
- weapon : String
|
||||||
|
- wizardClass : String
|
||||||
|
- CharacterSteps()
|
||||||
|
+ build() : Character
|
||||||
|
+ fighterClass(fighterClass : String) : WeaponStep
|
||||||
|
+ name(name : String) : ClassStep
|
||||||
|
+ noAbilities() : BuildStep
|
||||||
|
+ noMoreAbilities() : BuildStep
|
||||||
|
+ noSpell() : BuildStep
|
||||||
|
+ noWeapon() : BuildStep
|
||||||
|
+ withAbility(ability : String) : AbilityStep
|
||||||
|
+ withSpell(spell : String) : AbilityStep
|
||||||
|
+ withWeapon(weapon : String) : AbilityStep
|
||||||
|
+ wizardClass(wizardClass : String) : SpellStep
|
||||||
}
|
}
|
||||||
interface ClassStep {
|
interface ClassStep {
|
||||||
+ fighterClass(String) : WeaponStep {abstract}
|
+ fighterClass(String) : WeaponStep {abstract}
|
||||||
+ wizardClass(String) : SpellStep {abstract}
|
+ wizardClass(String) : SpellStep {abstract}
|
||||||
}
|
}
|
||||||
|
interface NameStep {
|
||||||
|
+ name(String) : ClassStep {abstract}
|
||||||
|
}
|
||||||
|
interface SpellStep {
|
||||||
|
+ noSpell() : BuildStep {abstract}
|
||||||
|
+ withSpell(String) : AbilityStep {abstract}
|
||||||
|
}
|
||||||
interface WeaponStep {
|
interface WeaponStep {
|
||||||
+ noWeapon() : BuildStep {abstract}
|
+ noWeapon() : BuildStep {abstract}
|
||||||
+ withWeapon(String) : AbilityStep {abstract}
|
+ withWeapon(String) : AbilityStep {abstract}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
App --+ CharacterStepBuilder
|
|
||||||
WeaponStep ..+ CharacterStepBuilder
|
WeaponStep ..+ CharacterStepBuilder
|
||||||
ClassStep ..+ CharacterStepBuilder
|
|
||||||
SpellStep ..+ CharacterStepBuilder
|
SpellStep ..+ CharacterStepBuilder
|
||||||
CharacterSteps ..+ CharacterStepBuilder
|
CharacterSteps ..+ CharacterStepBuilder
|
||||||
|
ClassStep ..+ CharacterStepBuilder
|
||||||
AbilityStep ..+ CharacterStepBuilder
|
AbilityStep ..+ CharacterStepBuilder
|
||||||
NameStep ..+ CharacterStepBuilder
|
NameStep ..+ CharacterStepBuilder
|
||||||
BuildStep ..+ CharacterStepBuilder
|
BuildStep ..+ CharacterStepBuilder
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.strategy {
|
package com.iluwatar.strategy {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class DragonSlayer {
|
class DragonSlayer {
|
||||||
- strategy : DragonSlayingStrategy
|
- strategy : DragonSlayingStrategy
|
||||||
+ DragonSlayer(strategy : DragonSlayingStrategy)
|
+ DragonSlayer(strategy : DragonSlayingStrategy)
|
||||||
@ -9,19 +14,18 @@ package com.iluwatar.strategy {
|
|||||||
interface DragonSlayingStrategy {
|
interface DragonSlayingStrategy {
|
||||||
+ execute() {abstract}
|
+ execute() {abstract}
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
class MeleeStrategy {
|
class MeleeStrategy {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ MeleeStrategy()
|
+ MeleeStrategy()
|
||||||
+ execute()
|
+ execute()
|
||||||
}
|
}
|
||||||
class ProjectileStrategy {
|
class ProjectileStrategy {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ ProjectileStrategy()
|
+ ProjectileStrategy()
|
||||||
+ execute()
|
+ execute()
|
||||||
}
|
}
|
||||||
class SpellStrategy {
|
class SpellStrategy {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ SpellStrategy()
|
+ SpellStrategy()
|
||||||
+ execute()
|
+ execute()
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.templatemethod {
|
package com.iluwatar.templatemethod {
|
||||||
class HitAndRunMethod {
|
class App {
|
||||||
+ HitAndRunMethod()
|
+ App()
|
||||||
# confuseTarget(target : String)
|
+ main(args : String[]) {static}
|
||||||
# pickTarget() : String
|
|
||||||
# stealTheItem(target : String)
|
|
||||||
}
|
}
|
||||||
class HalflingThief {
|
class HalflingThief {
|
||||||
- method : StealingMethod
|
- method : StealingMethod
|
||||||
@ -12,7 +10,15 @@ package com.iluwatar.templatemethod {
|
|||||||
+ changeMethod(method : StealingMethod)
|
+ changeMethod(method : StealingMethod)
|
||||||
+ steal()
|
+ steal()
|
||||||
}
|
}
|
||||||
|
class HitAndRunMethod {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ HitAndRunMethod()
|
||||||
|
# confuseTarget(target : String)
|
||||||
|
# pickTarget() : String
|
||||||
|
# stealTheItem(target : String)
|
||||||
|
}
|
||||||
abstract class StealingMethod {
|
abstract class StealingMethod {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ StealingMethod()
|
+ StealingMethod()
|
||||||
# confuseTarget(String) {abstract}
|
# confuseTarget(String) {abstract}
|
||||||
# pickTarget() : String {abstract}
|
# pickTarget() : String {abstract}
|
||||||
@ -20,15 +26,12 @@ package com.iluwatar.templatemethod {
|
|||||||
# stealTheItem(String) {abstract}
|
# stealTheItem(String) {abstract}
|
||||||
}
|
}
|
||||||
class SubtleMethod {
|
class SubtleMethod {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ SubtleMethod()
|
+ SubtleMethod()
|
||||||
# confuseTarget(target : String)
|
# confuseTarget(target : String)
|
||||||
# pickTarget() : String
|
# pickTarget() : String
|
||||||
# stealTheItem(target : String)
|
# stealTheItem(target : String)
|
||||||
}
|
}
|
||||||
class App {
|
|
||||||
+ App()
|
|
||||||
+ main(args : String[]) {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
HalflingThief --> "-method" StealingMethod
|
HalflingThief --> "-method" StealingMethod
|
||||||
HitAndRunMethod --|> StealingMethod
|
HitAndRunMethod --|> StealingMethod
|
||||||
|
@ -1,5 +1,20 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.threadpool {
|
package com.iluwatar.threadpool {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
|
class CoffeeMakingTask {
|
||||||
|
- TIME_PER_CUP : int {static}
|
||||||
|
+ CoffeeMakingTask(numCups : int)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class PotatoPeelingTask {
|
||||||
|
- TIME_PER_POTATO : int {static}
|
||||||
|
+ PotatoPeelingTask(numPotatoes : int)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
abstract class Task {
|
abstract class Task {
|
||||||
- ID_GENERATOR : AtomicInteger {static}
|
- ID_GENERATOR : AtomicInteger {static}
|
||||||
- id : int
|
- id : int
|
||||||
@ -9,25 +24,12 @@ package com.iluwatar.threadpool {
|
|||||||
+ getTimeMs() : int
|
+ getTimeMs() : int
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
class CoffeeMakingTask {
|
|
||||||
- TIME_PER_CUP : int {static}
|
|
||||||
+ CoffeeMakingTask(numCups : int)
|
|
||||||
+ toString() : String
|
|
||||||
}
|
|
||||||
class Worker {
|
class Worker {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- task : Task
|
- task : Task
|
||||||
+ Worker(task : Task)
|
+ Worker(task : Task)
|
||||||
+ run()
|
+ 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
|
||||||
CoffeeMakingTask --|> Task
|
CoffeeMakingTask --|> Task
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.tolerantreader {
|
package com.iluwatar.tolerantreader {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class RainbowFish {
|
class RainbowFish {
|
||||||
- age : int
|
- age : int
|
||||||
- lengthMeters : int
|
- lengthMeters : int
|
||||||
@ -12,9 +17,11 @@ package com.iluwatar.tolerantreader {
|
|||||||
+ getName() : String
|
+ getName() : String
|
||||||
+ getWeightTons() : int
|
+ getWeightTons() : int
|
||||||
}
|
}
|
||||||
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}
|
||||||
}
|
}
|
||||||
class RainbowFishV2 {
|
class RainbowFishV2 {
|
||||||
- angry : boolean
|
- angry : boolean
|
||||||
@ -27,12 +34,6 @@ package com.iluwatar.tolerantreader {
|
|||||||
+ getHungry() : boolean
|
+ getHungry() : boolean
|
||||||
+ getSleeping() : boolean
|
+ getSleeping() : boolean
|
||||||
}
|
}
|
||||||
class RainbowFishSerializer {
|
|
||||||
- RainbowFishSerializer()
|
|
||||||
+ readV1(filename : String) : RainbowFish {static}
|
|
||||||
+ writeV1(rainbowFish : RainbowFish, filename : String) {static}
|
|
||||||
+ writeV2(rainbowFish : RainbowFishV2, filename : String) {static}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RainbowFishV2 --|> RainbowFish
|
RainbowFishV2 --|> RainbowFish
|
||||||
@enduml
|
@enduml
|
@ -1,12 +1,12 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.twin {
|
package com.iluwatar.twin {
|
||||||
abstract class GameItem {
|
class App {
|
||||||
+ GameItem()
|
+ App()
|
||||||
+ click() {abstract}
|
+ main(args : String[]) {static}
|
||||||
+ doDraw() {abstract}
|
- waiting() {static}
|
||||||
+ draw()
|
|
||||||
}
|
}
|
||||||
class BallItem {
|
class BallItem {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
- isSuspended : boolean
|
- isSuspended : boolean
|
||||||
- twin : BallThread
|
- twin : BallThread
|
||||||
+ BallItem()
|
+ BallItem()
|
||||||
@ -15,10 +15,12 @@ package com.iluwatar.twin {
|
|||||||
+ move()
|
+ move()
|
||||||
+ setTwin(twin : BallThread)
|
+ setTwin(twin : BallThread)
|
||||||
}
|
}
|
||||||
class App {
|
abstract class GameItem {
|
||||||
+ App()
|
- LOGGER : Logger {static}
|
||||||
+ main(args : String[]) {static}
|
+ GameItem()
|
||||||
- waiting() {static}
|
+ click() {abstract}
|
||||||
|
+ doDraw() {abstract}
|
||||||
|
+ draw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BallItem --|> GameItem
|
BallItem --|> GameItem
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.value.object {
|
package com.iluwatar.value.object {
|
||||||
|
class App {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class HeroStat {
|
class HeroStat {
|
||||||
- intelligence : int
|
- intelligence : int
|
||||||
- luck : int
|
- luck : int
|
||||||
@ -13,9 +18,5 @@ 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,60 @@
|
|||||||
@startuml
|
@startuml
|
||||||
package com.iluwatar.visitor {
|
package com.iluwatar.visitor {
|
||||||
|
class App {
|
||||||
|
+ App()
|
||||||
|
+ main(args : String[]) {static}
|
||||||
|
}
|
||||||
class Commander {
|
class Commander {
|
||||||
+ Commander(children : Unit[])
|
+ Commander(children : Unit[])
|
||||||
+ accept(visitor : UnitVisitor)
|
+ accept(visitor : UnitVisitor)
|
||||||
+ toString() : String
|
+ toString() : String
|
||||||
}
|
}
|
||||||
interface UnitVisitor {
|
|
||||||
+ visitCommander(Commander) {abstract}
|
|
||||||
+ visitSergeant(Sergeant) {abstract}
|
|
||||||
+ visitSoldier(Soldier) {abstract}
|
|
||||||
}
|
|
||||||
class CommanderVisitor {
|
class CommanderVisitor {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
+ 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 SergeantVisitor {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ SergeantVisitor()
|
||||||
|
+ visitCommander(commander : Commander)
|
||||||
|
+ visitSergeant(sergeant : Sergeant)
|
||||||
|
+ visitSoldier(soldier : Soldier)
|
||||||
|
}
|
||||||
|
class Soldier {
|
||||||
|
+ Soldier(children : Unit[])
|
||||||
|
+ accept(visitor : UnitVisitor)
|
||||||
|
+ toString() : String
|
||||||
|
}
|
||||||
|
class SoldierVisitor {
|
||||||
|
- LOGGER : Logger {static}
|
||||||
|
+ SoldierVisitor()
|
||||||
|
+ visitCommander(commander : Commander)
|
||||||
|
+ visitSergeant(sergeant : Sergeant)
|
||||||
|
+ visitSoldier(soldier : Soldier)
|
||||||
|
}
|
||||||
|
abstract class Unit {
|
||||||
|
- children : Unit[]
|
||||||
|
+ Unit(children : Unit[])
|
||||||
|
+ accept(visitor : UnitVisitor)
|
||||||
|
}
|
||||||
|
interface UnitVisitor {
|
||||||
|
+ visitCommander(Commander) {abstract}
|
||||||
|
+ visitSergeant(Sergeant) {abstract}
|
||||||
|
+ visitSoldier(Soldier) {abstract}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Commander --|> Unit
|
Commander --|> Unit
|
||||||
CommanderVisitor ..|> UnitVisitor
|
CommanderVisitor ..|> UnitVisitor
|
||||||
|
Sergeant --|> Unit
|
||||||
|
SergeantVisitor ..|> UnitVisitor
|
||||||
Soldier --|> Unit
|
Soldier --|> Unit
|
||||||
SoldierVisitor ..|> UnitVisitor
|
SoldierVisitor ..|> UnitVisitor
|
||||||
SergeantVisitor ..|> UnitVisitor
|
|
||||||
Sergeant --|> Unit
|
|
||||||
@enduml
|
@enduml
|
Loading…
x
Reference in New Issue
Block a user