#ifndef __X10_UTIL_MAPSET_H
#define __X10_UTIL_MAPSET_H

#include <x10rt.h>


#define X10_UTIL_ABSTRACTCOLLECTION_H_NODEPS
#include <x10/util/AbstractCollection.h>
#undef X10_UTIL_ABSTRACTCOLLECTION_H_NODEPS
#define X10_UTIL_SET_H_NODEPS
#include <x10/util/Set.h>
#undef X10_UTIL_SET_H_NODEPS
namespace x10 { namespace util { 
template<class TPMGL(K), class TPMGL(V)> class Map;
} } 
namespace x10 { namespace lang { 
class Boolean;
} } 
namespace x10 { namespace lang { 
class Int;
} } 
namespace x10 { namespace util { 
template<class TPMGL(T)> class Container;
} } 
namespace x10 { namespace lang { 
template<class TPMGL(T)> class Iterator;
} } 
namespace x10 { namespace lang { 
template<class TPMGL(T)> class Iterable;
} } 
namespace x10 { namespace util { 

template<class TPMGL(T)> class MapSet;
template <> class MapSet<void>;
template<class TPMGL(T)> class MapSet : public x10::util::AbstractCollection<TPMGL(T)>
  {
    public:
    RTT_H_DECLS_CLASS
    
    x10aux::ref<x10::util::Map<TPMGL(T), x10_boolean> > FMGL(map);
    
    void _constructor(x10aux::ref<x10::util::Map<TPMGL(T), x10_boolean> > map);
    
    virtual x10_int size();
    virtual x10_boolean contains(TPMGL(T) v);
    virtual x10_boolean add(TPMGL(T) v);
    virtual x10_boolean remove(TPMGL(T) v);
    virtual void clear();
    virtual x10aux::ref<x10::lang::Iterator<TPMGL(T)> > iterator(
      );
    virtual x10aux::ref<x10::util::MapSet<TPMGL(T)> > x10__util__MapSet____x10__util__MapSet__this(
      );
    
    // Serialization
    public: virtual void _serialize_body(x10aux::serialization_buffer& buf);
    
    public: void _deserialize_body(x10aux::deserialization_buffer& buf);
    
};
template <> class MapSet<void> : public x10::util::AbstractCollection<void>
{
    public:
    static x10aux::RuntimeType rtt;
    static const x10aux::RuntimeType* getRTT() { return & rtt; }
    
};

} } 
#endif // X10_UTIL_MAPSET_H

namespace x10 { namespace util { 
template<class TPMGL(T)> class MapSet;
} } 

#ifndef X10_UTIL_MAPSET_H_NODEPS
#define X10_UTIL_MAPSET_H_NODEPS
#include <x10/util/AbstractCollection.h>
#include <x10/util/Set.h>
#include <x10/util/Map.h>
#include <x10/lang/Boolean.h>
#include <x10/lang/Int.h>
#include <x10/util/Container.h>
#include <x10/lang/Iterator.h>
#include <x10/lang/Iterable.h>
#ifndef X10_UTIL_MAPSET_H_GENERICS
#define X10_UTIL_MAPSET_H_GENERICS
#endif // X10_UTIL_MAPSET_H_GENERICS
#ifndef X10_UTIL_MAPSET_H_IMPLEMENTATION
#define X10_UTIL_MAPSET_H_IMPLEMENTATION
#include <x10/util/MapSet.h>


//#line 15 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10FieldDecl_c

//#line 17 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10ConstructorDecl_c
template<class TPMGL(T)> void x10::util::MapSet<TPMGL(T)>::_constructor(x10aux::ref<x10::util::Map<TPMGL(T), x10_boolean> > map) {
    
    //#line 17 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10ConstructorCall_c
    (this)->::x10::util::AbstractCollection<TPMGL(T)>::_constructor();
    
    //#line 17 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.AssignPropertyCall_c
    
    //#line 17 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": Eval of x10.ast.X10FieldAssign_c
    ((x10aux::ref<x10::util::MapSet<TPMGL(T)> >)this)->FMGL(map) = map;
}


//#line 19 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_int x10::util::MapSet<TPMGL(T)>::size() {
    
    //#line 19 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10Return_c
    return x10::util::Set<TPMGL(T)>::size(x10aux::nullCheck(x10::util::Map<TPMGL(T), x10_boolean>::keySet(x10aux::nullCheck(((x10aux::ref<x10::util::MapSet<TPMGL(T)> >)this)->
                                                                                                                              FMGL(map)))));
    
}

//#line 20 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_boolean x10::util::MapSet<TPMGL(T)>::contains(
  TPMGL(T) v) {
    
    //#line 20 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10Return_c
    return x10::util::Map<TPMGL(T), x10_boolean>::containsKey(x10aux::nullCheck(((x10aux::ref<x10::util::MapSet<TPMGL(T)> >)this)->
                                                                                  FMGL(map)), 
             v);
    
}

//#line 22 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_boolean x10::util::MapSet<TPMGL(T)>::add(
  TPMGL(T) v) {
    
    //#line 22 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10Return_c
    return (x10aux::struct_equals(x10::util::Map<TPMGL(T), x10_boolean>::put(x10aux::nullCheck(((x10aux::ref<x10::util::MapSet<TPMGL(T)> >)this)->
                                                                                                 FMGL(map)), 
                                    v, true), X10_NULL));
    
}

//#line 23 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_boolean x10::util::MapSet<TPMGL(T)>::remove(
  TPMGL(T) v) {
    
    //#line 23 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10Return_c
    return (!x10aux::struct_equals(x10::util::Map<TPMGL(T), x10_boolean>::remove(x10aux::nullCheck(((x10aux::ref<x10::util::MapSet<TPMGL(T)> >)this)->
                                                                                                     FMGL(map)), 
                                     v), X10_NULL));
    
}

//#line 24 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> void x10::util::MapSet<TPMGL(T)>::clear(
  ) {
    
    //#line 24 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": Eval of x10.ast.X10Call_c
    x10::util::Map<TPMGL(T), x10_boolean>::clear(x10aux::nullCheck(((x10aux::ref<x10::util::MapSet<TPMGL(T)> >)this)->
                                                                     FMGL(map)));
}

//#line 25 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::lang::Iterator<TPMGL(T)> >
  x10::util::MapSet<TPMGL(T)>::iterator() {
    
    //#line 25 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10Return_c
    return x10::util::Set<TPMGL(T)>::iterator(x10aux::nullCheck(x10::util::Map<TPMGL(T), x10_boolean>::keySet(x10aux::nullCheck(((x10aux::ref<x10::util::MapSet<TPMGL(T)> >)this)->
                                                                                                                                  FMGL(map)))));
    
}

//#line 14 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::util::MapSet<TPMGL(T)> >
  x10::util::MapSet<TPMGL(T)>::x10__util__MapSet____x10__util__MapSet__this(
  ) {
    
    //#line 14 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/MapSet.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::util::MapSet<TPMGL(T)> >)this);
    
}
template<class TPMGL(T)> void x10::util::MapSet<TPMGL(T)>::_serialize_body(x10aux::serialization_buffer& buf) {
    x10::util::AbstractCollection<TPMGL(T)>::_serialize_body(buf);
    buf.write(this->FMGL(map));
    
}

template<class TPMGL(T)> void x10::util::MapSet<TPMGL(T)>::_deserialize_body(x10aux::deserialization_buffer& buf) {
    x10::util::AbstractCollection<TPMGL(T)>::_deserialize_body(buf);
    FMGL(map) = buf.read<x10aux::ref<x10::util::Map<TPMGL(T), x10_boolean> > >();
}

template<class TPMGL(T)> x10aux::RuntimeType x10::util::MapSet<TPMGL(T)>::rtt;
template<class TPMGL(T)> void x10::util::MapSet<TPMGL(T)>::_initRTT() {
    const x10aux::RuntimeType *canonical = x10aux::getRTT<x10::util::MapSet<void> >();
    if (rtt.initStageOne(canonical)) return;
    const x10aux::RuntimeType* parents[2] = { x10aux::getRTT<x10::util::AbstractCollection<TPMGL(T)> >(), x10aux::getRTT<x10::util::Set<TPMGL(T)> >()};
    const x10aux::RuntimeType* params[1] = { x10aux::getRTT<TPMGL(T)>()};
    x10aux::RuntimeType::Variance variances[1] = { x10aux::RuntimeType::invariant};
    const char *baseName = "x10.util.MapSet";
    rtt.initStageTwo(baseName, x10aux::RuntimeType::class_kind, 2, parents, 1, params, variances);
}
#endif // X10_UTIL_MAPSET_H_IMPLEMENTATION
#endif // __X10_UTIL_MAPSET_H_NODEPS
