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