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