#ifndef _SET_H_
#define _SET_H_

/*! \file set.h
    \brief A set ADT
 */

/*! \brief set representation */
struct set {
  int size; /*!< maximal size of the set */
  int elements; /*!< the number of elements the set contains */
  int *field;
};

/*! \brief Initializes a set.
    \param size the maximal size of the set
 */
void set_new(struct set *s, int size);

void set_copy(struct set *s, struct set *t);

/*! \brief Allocate and initialize a new set.
    \param size the maximal size of the set
    \return new allocated set */
struct set *set_init(int size);

/*! \brief Tests if set contains the element.
    \param i set index
    \return true, if index in set, false else
 */
int set_contains(struct set *s, int i);

/*! \brief Adds an element to the set
    \param i index of element
 */
void set_add(struct set *s, int i);

/*! \brief Removes an element from the set
    \param i index of element
 */
void set_remove(struct set *s, int i);

/*! \brief Unites two sets
    \return union as new allocated set
 */
struct set *set_union(struct set *s, struct set *t);

/*! \brief Unites two sets in place
    
    size(s) == size(t)
    \param s first set, where the union gets saved */
void set_union_ip(struct set *s, struct set *t);

/*! \brief Intersects two sets in place

    size(s) == size(t)
    \param s first set, where the intersections gets saved */
void set_intersection_ip(struct set *s, struct set *t);

/*! \brief Pretty print the set */
void set_print(struct set *s);

/*! \brief Frees the complete set ADT
 
    Including s */
void set_free(struct set *s);

/*! \brief Frees the memory allocated by this ADT */
void set_delete(struct set *s);

#endif
