Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- note
- description: "Summary description for {ETF_PERSON}."
- author: ""
- date: "$Date$"
- revision: "$Revision$"
- class
- ETF_PERSON
- inherit
- COMPARABLE
- redefine
- is_equal,
- is_less
- end
- create
- make
- feature {ETF_REGISTRY, ETF_CITIZEN, ETF_ALIEN, ANY} -- attributes
- make (id: INTEGER_64 ; name1: STRING ; dob: TUPLE[d: INTEGER_64; m: INTEGER_64; y: INTEGER_64] ; country: STRING)
- do
- person_id := id.as_integer_32
- person_name := name1
- person_dob := dob
- person_country := country
- person_status := "Single"
- person_spouse := person_id
- person_date_of_marriage := [integer64, integer64, integer64]
- end
- person_id : INTEGER
- person_name : attached STRING
- person_dob : TUPLE[d : INTEGER_64; m : INTEGER_64; y : INTEGER_64]
- person_date_of_marriage : attached TUPLE[d : INTEGER_64; m : INTEGER_64; y : INTEGER_64]
- person_country : attached STRING
- person_status : attached STRING assign set_status
- person_spouse : INTEGER assign set_spouse
- integer64 : INTEGER_64
- attribute integer64 := 0 end
- feature -- Access Setter
- set_status (new_status : STRING)
- do
- person_status := new_status
- end
- set_spouse (new_spouse : INTEGER)
- do
- person_spouse := new_spouse
- end
- set_date_of_marriage (new_marriage : TUPLE[d : INTEGER_64; m : INTEGER_64; y : INTEGER_64])
- do
- person_date_of_marriage.d := new_marriage.d
- person_date_of_marriage.m := new_marriage.m
- person_date_of_marriage.y := new_marriage.y
- end
- feature {ANY}
- is_equal (other: like Current): BOOLEAN
- do
- Result := person_id ~ other.person_id
- and person_name ~ other.person_name
- and person_dob ~ other.person_dob
- and person_country ~ other.person_country
- and person_status ~ other.person_status
- and person_spouse ~ other.person_spouse
- end
- is_less alias "<" (other: like Current): BOOLEAN
- do
- if person_name < other.person_name then
- Result := true
- elseif (person_name ~ other.person_name) then
- if person_id < other.person_id then
- Result := true
- end
- else
- Result := false
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement