1
+ @startuml
2
+ package com . iluwatar . promise {
3
+ ~ class PromiseSupport <T > {
4
+ - COMPLETED : int {static}
5
+ - FAILED : int {static}
6
+ - RUNNING : int {static}
7
+ - exception : Exception
8
+ - lock : Object
9
+ - state : int
10
+ - value : T
11
+ ~ PromiseSupport <T >()
12
+ + cancel (mayInterruptIfRunning : boolean ) : boolean
13
+ ~ fulfill (value : T)
14
+ ~ fulfillExceptionally (exception : Exception)
15
+ + get () : T
16
+ + get (timeout : long , unit : TimeUnit ) : T
17
+ + isCancelled () : boolean
18
+ + isDone () : boolean
19
+ }
20
+ - class ConsumeAction {
21
+ - action : Consumer<? super T>
22
+ - dest : Promise<Void>
23
+ - src : Promise<T>
24
+ - ConsumeAction (src : Promise<T>, dest : Promise<T>, action : Consumer<T>)
25
+ + run ()
26
+ }
27
+ - class TransformAction <V > {
28
+ - dest : Promise<V>
29
+ - func : Function<? super T, V>
30
+ - src : Promise<T>
31
+ - TransformAction <V >(src : Promise<T>, dest : Promise<T>, func : Function<T, R>)
32
+ + run ()
33
+ }
34
+ class App {
35
+ - DEFAULT_URL : String {static}
36
+ - executor : ExecutorService
37
+ - stopLatch : CountDownLatch
38
+ - App ()
39
+ - calculateLineCount ()
40
+ - calculateLowestFrequencyChar ()
41
+ - characterFrequency() : Promise<Map<Character, Integer>>
42
+ - countLines() : Promise<Integer>
43
+ - download(urlString : String) : Promise<String>
44
+ - lowestFrequencyChar() : Promise<Character>
45
+ + main(args : String[]) {static}
46
+ - promiseUsage ()
47
+ - stop ()
48
+ - taskCompleted ()
49
+ }
50
+ class Promise <T > {
51
+ - exceptionHandler : Consumer<? super Throwable>
52
+ - fulfillmentAction : Runnable
53
+ + Promise <T >()
54
+ + fulfill (value : T )
55
+ + fulfillExceptionally (exception : Exception )
56
+ + fulfillInAsync (task : Callable <T >, executor : Executor ) : Promise <T >
57
+ - handleException (exception : Exception)
58
+ + onError (exceptionHandler : Consumer <? super Throwable >) : Promise <T >
59
+ - postFulfillment ()
60
+ + thenAccept (action : Consumer <? super T >) : Promise <Void >
61
+ + thenApply (func : Function <? super T , V >) : Promise <V >
62
+ }
63
+ class Utility {
64
+ + Utility ()
65
+ + characterFrequency(fileLocation : String) : Map<Character, Integer> {static}
66
+ + countLines(fileLocation : String) : Integer {static}
67
+ + downloadFile(urlString : String) : String {static}
68
+ + lowestFrequencyChar(charFrequency : Map<Character, Integer>) : Character {static}
69
+ }
70
+ }
71
+ TransformAction --+ Promise
72
+ TransformAction --> "- src " Promise
73
+ ConsumeAction --+ Promise
74
+ ConsumeAction --> "- src " Promise
75
+ Utility --+ Map
76
+ Promise --|> PromiseSupport
77
+ @enduml
0 commit comments