background image

Spis treści

 1 Diagram klas.....................................................................................................................................3
 2 Diagramy sekwencji.........................................................................................................................4

 2.1 Kup przedmiot..........................................................................................................................4

 2.1.1 Główny przebieg zdarzeń..................................................................................................4
 2.1.2 Alternatywne przebiegi zdarzeń........................................................................................5

 2.1.2.1 Błędnie wprowadzane dane.......................................................................................5

 2.2 Sprzedaj przedmiot...................................................................................................................6

 2.2.1 Główny przebieg zdarzeń..................................................................................................6
 2.2.2 Alternatywne przebiegi zdarzeń........................................................................................7

 2.2.2.1 Błędne dane...............................................................................................................7
 2.2.2.2 Przedmiot nie znajduje się w magazynie..................................................................8
 2.2.2.3 Przedmiot który chce sprzedaż użytkownik nie ma stanu `nowy`............................9

 2.3 Modyfikuj przedmiot..............................................................................................................10

 2.3.1 Główny przebieg zdarzeń................................................................................................10
 2.3.2 Alternatywne przebiegi zdarzeń......................................................................................11

 2.3.2.1 Błędne dane.............................................................................................................11
 2.3.2.2 Przedmiot który chce zmodyfikować użytkownik nie ma stanu `nowy`................12
 2.3.2.3 Przedmiot nie znajduje się w magazynie................................................................13

 2.4 Generuj raport.........................................................................................................................14

 2.4.1 Główny przebieg zdarzeń................................................................................................14
 2.4.2 Alternatywne przebiegi zdarzeń......................................................................................15

 2.4.2.1 Zły format daty........................................................................................................15

 2.5 Start systemu...........................................................................................................................16
 2.6 Stop systemu...........................................................................................................................17

 3 Mapowanie klas analitycznych na projektowe...............................................................................18

2

background image

 1 Diagram klas

Klasa `fstream` na tym diagramie jest klasą standardową języka C++, która dziedziczy po klasie 
głównej   `ios_base`   służącej   do   obsługi   strumieni   wyjścia   i   wejścia.   Na   diagramie   zostały 
przedstawione tylko te metody klasy `fstream`, które są wykorzystywane na dalszych diagramach.

3

form

main : control

<<static>> mainForm() : void
<<static>> addForm() : void
<<static>> sellForm() : void
<<static>> modForm() : void
<<static>> raportForm() : void
<<static>> start() : void
<<static>> end() : void
<<static>> raportError(errno : int) : void

control

list : productList

checkAdd(name, desc, cost : double, date : int) : int
checkSell(id : int, price : double, date : int) : int
checkRaport(start : int, end : int) : int
checkMod(id : int, newN : int, newD : int) : int
add(name, desc, buyCost : double, buyDate : int) : int
sell(id : int, price : double, sellDate : int) : int
mod(id : int, newName, newDesc) : int
raport(startDate : int, endDate : int) : int
closeMain() : void
control()
startMain() : void

1

1

1

1

productList

list : product *
quantity : int

save() : int
report(start : int, end : int) : int
productList()
~productList()
add(nameP : string, descP : string, addCostP : double, addDateP : double) : int
del(idProduct : int, delDate : int, cost : double) : int
modf(idProduct : int, desc, name) : int
load() : int
search(id : int) : int
add(objekt : product) : int

1

1

1

1

fstream

open(name : const char *, mode : ios_base::openmode) : void
close() : void
is_open() : bool
read(buf : char*, size : streamsize) : istream&
write(buf : const char*, size : streamsize) : ostream&
seekg(off : streamoff, dir : ios_base::seekdir) : istream&
<<creat>> fstream() : fstream

1

1

1

1

<<communicate>>

product

name : string
desc : string
addDate : int
sellDate : int
addCost : double
sellCost : double
state : int

sell(cost : double, date : int) : int
mod(name, desc) : int
product(nameP : string, descP : string, addDateP : int, addCostP : double)
save(file : fstream, id : int) : int
load(file : fstream, id : int) : product
check(start : int, end : int) : int
show() : int
product()
checkState() : int

0..*

1

0..*

1

1

1

1

1

<<communicate>>

background image

 2 Diagramy sekwencji

 2.1 Kup przedmiot

 2.1.1 Główny przebieg zdarzeń

4

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

listP : 

productList

listP : 

productList

new : product

new : product

1: addForm( )

2: add(string, string, double, int)

3: checkAdd(string, string, double, int)

6: mainForm( )

4: product(string, string, int, double)

5: add(product)

background image

 2.1.2 Alternatywne przebiegi zdarzeń

 2.1.2.1 Błędnie wprowadzane dane

5

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

1: addForm( )

2: add(string, string, double, int)

3: checkAdd(string, string, double, int)

5: mainForm( )

4: raportError(int)

background image

 2.2 Sprzedaj przedmiot

 2.2.1 Główny przebieg zdarzeń

6

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

listP : 

productList

listP : 

productList

 : product

 : product

1: sellForm( )

2: sell(int, double, int)

3: checkSell(int, double, int)

4: del(int, int, double)

7: sell(double, int)

5: search(int)

8: mainForm( )

6: checkState( )

background image

 2.2.2 Alternatywne przebiegi zdarzeń

 2.2.2.1 Błędne dane

7

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

1: sellForm( )

2: sell(int, double, int)

3: checkSell(int, double, int)

5: mainForm( )

4: raportError(int)

background image

 2.2.2.2 Przedmiot nie znajduje się w magazynie

8

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

listP : 

productList

listP : 

productList

1: sellForm( )

2: sell(int, double, int)

3: checkSell(int, double, int)

4: del(int, int, double)

5: search(int)

7: mainForm( )

6: raportError(int)

background image

 2.2.2.3 Przedmiot który chce sprzedaż użytkownik nie ma stanu `nowy`

9

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

listP : 

productList

listP : 

productList

 : product

 : product

1: sellForm( )

2: sell(int, double, int)

3: checkSell(int, double, int)

4: del(int, int, double)

5: search(int)

8: mainForm( )

7: raportError(int)

6: checkState( )

background image

 2.3 Modyfikuj przedmiot

 2.3.1 Główny przebieg zdarzeń

10

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

listP : 

productList

listP : 

productList

 : product

 : product

1: modForm( )

2: mod(int, string, string)

4: modf(int, string, string)

5: search(int)

7: mod(string, string)

8: mainForm( )

3: checkMod(int, string, string)

6: checkState( )

background image

 2.3.2 Alternatywne przebiegi zdarzeń

 2.3.2.1 Błędne dane

11

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

1: modForm( )

2: mod(int, string, string)

5: mainForm( )

3: checkMod(int, string, string)

4: raportError(int)

background image

 2.3.2.2 Przedmiot który chce zmodyfikować użytkownik nie ma stanu 

`nowy`

12

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

listP : 

productList

listP : 

productList

 : product

 : product

1: modForm( )

2: mod(int, string, string)

3: modf(int, string, string)

4: search(int)

7: mainForm( )

5: checkState( )

6: raportError(int)

background image

 2.3.2.3 Przedmiot nie znajduje się w magazynie

13

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

listP : 

productList

listP : 

productList

1: modForm( )

2: mod(int, string, string)

4: modf(int, string, string)

5: search(int)

7: mainForm( )

6: raportError(int)

3: checkMod(int, string, string)

background image

 2.4 Generuj raport

 2.4.1 Główny przebieg zdarzeń

14

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

listP : 

productList

listP : 

productList

 : product

 : product

1: raportForm( )

2: raport(int, int)

4: report(int, int)

3: checkRaport(int, int)

5: check(int, int)

Dla każdego 
produktu

jeśli spełnia 
kryteria to 
pokazujemy

6: show( )

7: mainForm( )

background image

 2.4.2 Alternatywne przebiegi zdarzeń

 2.4.2.1 Zły format daty

15

 : użytkownik

 : użytkownik

 : form

 : form

 : control

 : control

1: raportForm( )

2: raport(int, int)

3: checkRaport(int, int)

4: raportError(int)

5: mainForm( )

background image

 2.5 Start systemu

16

 : form

 : form

main : control

main : control

listP : 

productList

listP : 

productList

listF : fstream

listF : fstream

 : product

 : product

productF : 

fstream

productF : 

fstream

1: start( )

17: mainForm( )

Metoda jest wywoływana 
automatycznie przy 
starcie systemu

Tyle razy ile jest 
wartość quantity w 
wczytanej productList, 
czyli dla każdego 
produktu z listy

3: productList( )

4: load( )

5: fstream( )

6: open(const char *, ios_base::openmode)

7: is_open( )

8: read(char*, streamsize)

9: close( )

10: fstream( )

11: open(const char *, ios_base::openmode)

12: is_open( )

13: load(fstream, int)

14: seekg(streamoff, ios_base::seekdir)

15: read(char*, streamsize)

16: close( )

2: startMain( )

background image

 2.6 Stop systemu

17

 : użytkownik

 : użytkownik

 : form

 : form

main : control

main : control

listP : 

productList

listP : 

productList

listF : fstream

listF : fstream

 : product

 : product

productF : 

fstream

productF : 

fstream

1: end( )

Dla każdego 
produktu na 
liscie

2: closeMain( )

3: save( )

4: fstream( )

5: open(const char *, ios_base::openmode)

6: is_open( )

7: write(const char*, streamsize)

8: close( )

9: fstream( )

10: open(const char *, ios_base::openmode)

11: is_open( )

12: save(fstream, int)

13: seekg(streamoff, ios_base::seekdir)

14: write(const char*, streamsize)

15: close( )

background image

 3 Mapowanie klas analitycznych na projektowe

Klasa projektowa 

Klasa analityczna

form

formularz modyfikacji

formularz sprzedaży

formularz zakupu
formularz raportu

control

kontrola modyfikacji

kontrola sprzedaży

kontrola zakupu
kontrola raportu

product

produkt

productList

lista produktów

lista raport

18


Document Outline