SHARE
TWEET

Untitled

a guest Feb 6th, 2018 130 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. note
  2.     description: "Summary description for {ETF_PERSON}."
  3.     author: ""
  4.     date: "$Date$"
  5.     revision: "$Revision$"
  6.  
  7. class
  8.     ETF_PERSON
  9.  
  10. inherit
  11.     COMPARABLE
  12.         redefine
  13.             is_equal,
  14.             is_less
  15.         end
  16.  
  17. create
  18.     make
  19.  
  20. feature {ETF_REGISTRY, ETF_CITIZEN, ETF_ALIEN, ANY} -- attributes
  21.  
  22.     make (id: INTEGER_64 ; name1: STRING ; dob: TUPLE[d: INTEGER_64; m: INTEGER_64; y: INTEGER_64] ; country: STRING)
  23.         do
  24.             person_id := id.as_integer_32
  25.             person_name := name1
  26.             person_dob := dob
  27.             person_country := country
  28.             person_status := "Single"
  29.             person_spouse := person_id
  30.             person_date_of_marriage := [integer64, integer64, integer64]
  31.         end
  32.  
  33.     person_id : INTEGER
  34.     person_name : attached STRING
  35.     person_dob :  TUPLE[d : INTEGER_64; m : INTEGER_64; y : INTEGER_64]
  36.     person_date_of_marriage :  attached TUPLE[d : INTEGER_64; m : INTEGER_64; y : INTEGER_64]
  37.     person_country : attached STRING
  38.     person_status : attached STRING assign set_status
  39.     person_spouse : INTEGER assign set_spouse
  40.  
  41.     integer64 : INTEGER_64
  42.         attribute integer64 := 0 end
  43.  
  44. feature -- Access Setter
  45.     set_status (new_status : STRING)
  46.         do
  47.             person_status := new_status
  48.         end
  49.  
  50.     set_spouse (new_spouse : INTEGER)
  51.         do
  52.             person_spouse := new_spouse
  53.         end
  54.  
  55.     set_date_of_marriage (new_marriage : TUPLE[d : INTEGER_64; m : INTEGER_64; y : INTEGER_64])
  56.         do
  57.             person_date_of_marriage.d := new_marriage.d
  58.             person_date_of_marriage.m := new_marriage.m
  59.             person_date_of_marriage.y := new_marriage.y
  60.         end
  61.  
  62. feature {ANY}
  63.     is_equal (other: like Current): BOOLEAN
  64.         do
  65.             Result := person_id ~ other.person_id
  66.                 and person_name ~ other.person_name
  67.                 and person_dob ~ other.person_dob
  68.                 and person_country ~ other.person_country
  69.                 and person_status ~ other.person_status
  70.                 and person_spouse ~ other.person_spouse
  71.         end
  72.  
  73.     is_less alias "<" (other: like Current): BOOLEAN
  74.         do
  75.             if person_name < other.person_name then
  76.                 Result := true
  77.             elseif (person_name ~ other.person_name) then
  78.                 if person_id < other.person_id then
  79.                     Result := true
  80.                 end
  81.             else
  82.                 Result := false
  83.             end
  84.         end
  85.  
  86. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top