diff --git a/examples/filter/src/database/database_api.e b/examples/filter/src/database/database_api.e index 7d68a518..2eb23793 100644 --- a/examples/filter/src/database/database_api.e +++ b/examples/filter/src/database/database_api.e @@ -18,6 +18,8 @@ feature -- Initialization create users.make (10) create l_user.make (1, "foo", "bar") users.put (l_user, l_user.id) + create l_user.make (2, "demo", "demo") + users.put (l_user, l_user.id) end feature -- Access diff --git a/examples/filter/src/domain/user.e b/examples/filter/src/domain/user.e index 40b40716..527e0afb 100644 --- a/examples/filter/src/domain/user.e +++ b/examples/filter/src/domain/user.e @@ -7,6 +7,12 @@ class USER +inherit + ANY + redefine + is_equal + end + create make @@ -34,6 +40,25 @@ feature -- Access password: STRING -- Password + foo_: STRING + do + ensure + anchor: False + end + +feature -- Comparison + + is_equal (other: like Current): BOOLEAN + -- Is `other' attached to an object considered + -- equal to current object? + do + if Current = other then + Result := True + else + Result := (id = other.id) and (name = other.name) and (password = other.password) + end + end + ;note copyright: "2011-2012, Olivier Ligot, Jocelyn Fiat and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"