// /*-------------------------------------------------------------------*\
// | Concrete Template : Set_Intersect_1
// \*-------------------------------------------------------------------*/
#ifndef CT_SET_INTERSECT_1
#define CT_SET_INTERSECT_1 1
///------------------------------------------------------------------------
/// Global Context --------------------------------------------------------
///------------------------------------------------------------------------
#include "AT/Set/Intersect.h"
///------------------------------------------------------------------------
/// Interface -------------------------------------------------------------
///------------------------------------------------------------------------
concrete_template <
concrete_instance class Item,
concrete_instance class Set_Base
/*!
implements
abstract_instance Set_Kernel <Item>
!*/
>
class Set_Intersect_1 :
implements
abstract_instance Set_Intersect <Item>,
extends
concrete_instance Set_Base
{
public:
procedure_body Intersect (
preserves Set_Intersect <Item>& s
)
{
object catalyst Set_Intersect_1 temp;
while (self.Size () > 0)
/*!
alters self, temp
preserves s
maintains
(self union temp) intersection s =
(#self union #temp) intersection s and
self intersection temp = {}
decreases
|self|
!*/
{
object Item x;
self.Remove_Any (x);
if (s.Is_Member (x))
{
temp.Add (x);
}
}
self &= temp;
}
};
#endif // CT_SET_INTERSECT_1
Last modified: Thu Jan 11 17:05:57 EST 2007