tailieunhanh - Reverse Engineering of Object Oriented Code phần 9

(xem ví dụ [75]). Một phân vùng khái niệm bao gồm một tập hợp các khái niệm có mức độ là một phân vùng là một khái niệm phân vùng nếu và chỉ nếu: đối tượng thiết lập khi được đặt bên trong một gói thứ hai cho mình | 170 8 Conclusions no invocation of addReservation neither of the removal methods can ever occur in So due to the checks performed in the code issuing such invocations. Specifically the only invocation to addReservation is inside method reserveDocument of class Library where the call is issued only if the document being reserved is not available. This implies that at least one loan must exist foans s . In state Si loans can be added and removed. In the latter case the new state is So when no loan remains inside the Collection loans. Moreover in state Si reservations can be made since not all documents are available. This leads to state S2 s s . In state S2 loans and reservations can be added and removed. If eventually no reservation remains the new state is Si a state already described above. If method removeLoan is called when exactly one loan is active in the library the new state is a fourth one S3 never encountered before characterized by an empty set of loans and some reservations pending. It should be noted that this state is not reachable directly from the initial state So since reservations cannot be added when no loans are present. Thus the only way to reach it is to go through all the other states So Si S2- If all reservations are cleared in state S3 the final state that is reached is So- On the other side if loans are added the state of the library goes back to s2. State diagrams are useful in understanding how the introduction of the reservation mechanism affects the internal states of the classes. The new attributes reservations and reservation inside the classes User and Document are not influenced by the other class attributes similarly to the original attributes loans and loan in the same classes. On the contrary in the class Library loans and reservations are mutually related. Their joint description given in the state diagram of Fig. highlights the permitted transitions in each state and the possible paths from one state to another one. This is