-
Notifications
You must be signed in to change notification settings - Fork 198
/
Copy pathiterator.urm.puml
49 lines (49 loc) · 1.21 KB
/
iterator.urm.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
@startuml
package com.iluwatar.iterator {
class App {
- LOGGER : Logger {static}
+ App()
+ main(args : String[]) {static}
}
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}
+ POTION {static}
+ RING {static}
+ WEAPON {static}
+ valueOf(name : String) : ItemType {static}
+ values() : ItemType[] {static}
}
class TreasureChest {
- items : List<Item>
+ TreasureChest()
+ getItems() : List<Item>
~ iterator(itemType : ItemType) : ItemIterator
}
class TreasureChestItemIterator {
- chest : TreasureChest
- idx : int
- type : ItemType
+ TreasureChestItemIterator(chest : TreasureChest, type : ItemType)
- findNextIdx() : int
+ hasNext() : boolean
+ next() : Item
}
}
Item --> "-type" ItemType
TreasureChest --> "-items" Item
TreasureChestItemIterator --> "-type" ItemType
TreasureChestItemIterator --> "-chest" TreasureChest
TreasureChestItemIterator ..|> ItemIterator
@enduml