Add documentation and contracts for domain types.

This commit is contained in:
Conaclos
2014-06-30 18:32:14 +02:00
parent 052860b62c
commit 361773101e
3 changed files with 66 additions and 39 deletions
+29 -9
View File
@@ -1,40 +1,60 @@
class BOOK
class
BOOK
create
make
feature {NONE} -- Initialization
make (a_title: STRING_32; an_author: AUTHOR; an_isbn: STRING_32)
make (a_title: STRING_32; a_author: AUTHOR; a_isbn: STRING_32)
-- Create a book with `a_title' as `title',
-- `a_author' as `author', and `a_isbn' as `isbn',
do
set_title (a_title)
set_author (an_author)
set_isbn (an_isbn)
set_author (a_author)
set_isbn (a_isbn)
ensure
title_set: title = a_title
author_set: author = a_author
isbn_set: isbn = a_isbn
end
feature -- Access
title: STRING_32
-- Main title.
isbn: STRING_32
-- ISBN.
author: AUTHOR
-- Author.
feature -- Status setting
feature -- Change
set_title (a_title: STRING_32)
-- Set `title' with `a_title'.
do
title := a_title
ensure
title_set: title = a_title
end
set_author (an_author: AUTHOR)
set_author (a_author: AUTHOR)
-- Set `author' with `a_author'.
do
author := an_author
author := a_author
ensure
author_set: author = a_author
end
set_isbn (an_isbn: STRING_32)
set_isbn (a_isbn: STRING_32)
-- Set `isbn' with `a_isbn'.
do
isbn := an_isbn
isbn := a_isbn
ensure
isbn_set: isbn = a_isbn
end
end -- class BOOK