// $Id: set.cpp,v 1.3 2008/05/15 15:36:04 post Exp $	


#include "set.h"
using namespace std;

Span& operator+=(Span& span, int val) {
  span.min_ += val;
  span.max_ += val;
  return span;
}

Span& operator-=(Span& span, int val) {
  span.min_ -= val;
  span.max_ -= val;
  return span;
}

Span operator+(const Span& a, const int b) {
  return Span(a.min() + b, a.max() + b);
}
Span operator-(const Span& a, const int b) {
  return Span(a.min() - b, a.max() - b);
}
ostream& operator<<(ostream& out, const Span& span) {
  out << span.str();
  return out;
}

Set& operator+=(Set& set, const Set& other) {
  set.bits |= other.bits;
  return set;
}

Set operator+(const Set& set1, const Set& set2) {
  Set set = set1;
  set.bits |= set2.bits;
  return set;
}

ostream& operator<<(ostream& out, const Set& set) {
  out << "[";
  set.print_elements(out);
  out << "]";
  return out;
}

bool operator==(const Set& set1, const Set& set2) {
  return set1.bits == set2.bits;
}
