#ifndef __X10_UTIL_HASHSET_H
#define __X10_UTIL_HASHSET_H

#include <x10rt.h>


#define X10_UTIL_MAPSET_H_NODEPS
#include <x10/util/MapSet.h>
#undef X10_UTIL_MAPSET_H_NODEPS
#define X10_IO_CUSTOMSERIALIZATION_H_NODEPS
#include <x10/io/CustomSerialization.h>
#undef X10_IO_CUSTOMSERIALIZATION_H_NODEPS
namespace x10 { namespace util { 
template<class TPMGL(K), class TPMGL(V)> class Map;
} } 
namespace x10 { namespace lang { 
class Boolean;
} } 
namespace x10 { namespace util { 
template<class TPMGL(K), class TPMGL(V)> class HashMap;
} } 
namespace x10 { namespace lang { 
class Int;
} } 
namespace x10 { namespace io { 
class SerialData;
} } 
namespace x10 { namespace util { 

template<class TPMGL(T)> class HashSet;
template <> class HashSet<void>;
template<class TPMGL(T)> class HashSet : public x10::util::MapSet<TPMGL(T)>
  {
    public:
    RTT_H_DECLS_CLASS
    
    static x10aux::itable_entry _itables[7];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    static typename x10::util::Container<TPMGL(T)>::template itable<x10::util::HashSet<TPMGL(T)> > _itable_0;
    
    static x10::lang::Any::itable<x10::util::HashSet<TPMGL(T)> > _itable_1;
    
    static typename x10::lang::Iterable<TPMGL(T)>::template itable<x10::util::HashSet<TPMGL(T)> > _itable_2;
    
    static typename x10::util::Collection<TPMGL(T)>::template itable<x10::util::HashSet<TPMGL(T)> > _itable_3;
    
    static typename x10::util::Set<TPMGL(T)>::template itable<x10::util::HashSet<TPMGL(T)> > _itable_4;
    
    static x10::io::CustomSerialization::itable<x10::util::HashSet<TPMGL(T)> > _itable_5;
    
    void _constructor();
    
    static x10aux::ref<x10::util::HashSet<TPMGL(T)> > _make();
    
    void _constructor(x10_int sz);
    
    static x10aux::ref<x10::util::HashSet<TPMGL(T)> > _make(x10_int sz);
    
    virtual x10aux::ref<x10::io::SerialData> serialize();
    void _constructor(x10aux::ref<x10::io::SerialData> a);
    
    static x10aux::ref<x10::util::HashSet<TPMGL(T)> > _make(x10aux::ref<x10::io::SerialData> a);
    
    virtual x10aux::ref<x10::util::Container<TPMGL(T)> > clone();
    virtual x10aux::ref<x10::util::HashSet<TPMGL(T)> > x10__util__HashSet____x10__util__HashSet__this(
      );
    
    // Serialization
    public: static const x10aux::serialization_id_t _serialization_id;
    
    public: virtual x10aux::serialization_id_t _get_serialization_id() {
         return _serialization_id;
    }
    
    public: virtual void _serialize_body(x10aux::serialization_buffer& buf);
    
    public: static x10aux::ref<x10::lang::Reference> _deserializer(x10aux::deserialization_buffer& buf);
    
    public: void _deserialize_body(x10aux::deserialization_buffer& buf);
    
};
template <> class HashSet<void> : public x10::util::MapSet<void> {
    public:
    static x10aux::RuntimeType rtt;
    static const x10aux::RuntimeType* getRTT() { return & rtt; }
    
};

} } 
#endif // X10_UTIL_HASHSET_H

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

#ifndef X10_UTIL_HASHSET_H_NODEPS
#define X10_UTIL_HASHSET_H_NODEPS
#include <x10/util/MapSet.h>
#include <x10/io/CustomSerialization.h>
#include <x10/util/Map.h>
#include <x10/lang/Boolean.h>
#include <x10/util/HashMap.h>
#include <x10/lang/Int.h>
#include <x10/io/SerialData.h>
#ifndef X10_UTIL_HASHSET_H_GENERICS
#define X10_UTIL_HASHSET_H_GENERICS
#endif // X10_UTIL_HASHSET_H_GENERICS
#ifndef X10_UTIL_HASHSET_H_IMPLEMENTATION
#define X10_UTIL_HASHSET_H_IMPLEMENTATION
#include <x10/util/HashSet.h>

template<class TPMGL(T)> typename x10::util::Container<TPMGL(T)>::template itable<x10::util::HashSet<TPMGL(T)> >  x10::util::HashSet<TPMGL(T)>::_itable_0(&x10::util::HashSet<TPMGL(T)>::clone, &x10::util::HashSet<TPMGL(T)>::contains, &x10::util::HashSet<TPMGL(T)>::containsAll, &x10::util::HashSet<TPMGL(T)>::equals, &x10::util::HashSet<TPMGL(T)>::hashCode, &x10::util::HashSet<TPMGL(T)>::isEmpty, &x10::util::HashSet<TPMGL(T)>::iterator, &x10::util::HashSet<TPMGL(T)>::size, &x10::util::HashSet<TPMGL(T)>::toString, &x10::util::HashSet<TPMGL(T)>::typeName);
template<class TPMGL(T)> x10::lang::Any::itable<x10::util::HashSet<TPMGL(T)> >  x10::util::HashSet<TPMGL(T)>::_itable_1(&x10::util::HashSet<TPMGL(T)>::equals, &x10::util::HashSet<TPMGL(T)>::hashCode, &x10::util::HashSet<TPMGL(T)>::toString, &x10::util::HashSet<TPMGL(T)>::typeName);
template<class TPMGL(T)> typename x10::lang::Iterable<TPMGL(T)>::template itable<x10::util::HashSet<TPMGL(T)> >  x10::util::HashSet<TPMGL(T)>::_itable_2(&x10::util::HashSet<TPMGL(T)>::equals, &x10::util::HashSet<TPMGL(T)>::hashCode, &x10::util::HashSet<TPMGL(T)>::iterator, &x10::util::HashSet<TPMGL(T)>::toString, &x10::util::HashSet<TPMGL(T)>::typeName);
template<class TPMGL(T)> typename x10::util::Collection<TPMGL(T)>::template itable<x10::util::HashSet<TPMGL(T)> >  x10::util::HashSet<TPMGL(T)>::_itable_3(&x10::util::HashSet<TPMGL(T)>::add, &x10::util::HashSet<TPMGL(T)>::addAll, &x10::util::HashSet<TPMGL(T)>::addAllWhere, &x10::util::HashSet<TPMGL(T)>::clear, &x10::util::HashSet<TPMGL(T)>::clone, &x10::util::HashSet<TPMGL(T)>::contains, &x10::util::HashSet<TPMGL(T)>::containsAll, &x10::util::HashSet<TPMGL(T)>::equals, &x10::util::HashSet<TPMGL(T)>::hashCode, &x10::util::HashSet<TPMGL(T)>::isEmpty, &x10::util::HashSet<TPMGL(T)>::iterator, &x10::util::HashSet<TPMGL(T)>::remove, &x10::util::HashSet<TPMGL(T)>::removeAll, &x10::util::HashSet<TPMGL(T)>::removeAllWhere, &x10::util::HashSet<TPMGL(T)>::retainAll, &x10::util::HashSet<TPMGL(T)>::size, &x10::util::HashSet<TPMGL(T)>::toString, &x10::util::HashSet<TPMGL(T)>::typeName);
template<class TPMGL(T)> typename x10::util::Set<TPMGL(T)>::template itable<x10::util::HashSet<TPMGL(T)> >  x10::util::HashSet<TPMGL(T)>::_itable_4(&x10::util::HashSet<TPMGL(T)>::add, &x10::util::HashSet<TPMGL(T)>::addAll, &x10::util::HashSet<TPMGL(T)>::addAllWhere, &x10::util::HashSet<TPMGL(T)>::clear, &x10::util::HashSet<TPMGL(T)>::clone, &x10::util::HashSet<TPMGL(T)>::contains, &x10::util::HashSet<TPMGL(T)>::containsAll, &x10::util::HashSet<TPMGL(T)>::equals, &x10::util::HashSet<TPMGL(T)>::hashCode, &x10::util::HashSet<TPMGL(T)>::isEmpty, &x10::util::HashSet<TPMGL(T)>::iterator, &x10::util::HashSet<TPMGL(T)>::remove, &x10::util::HashSet<TPMGL(T)>::removeAll, &x10::util::HashSet<TPMGL(T)>::removeAllWhere, &x10::util::HashSet<TPMGL(T)>::retainAll, &x10::util::HashSet<TPMGL(T)>::size, &x10::util::HashSet<TPMGL(T)>::toString, &x10::util::HashSet<TPMGL(T)>::typeName);
template<class TPMGL(T)> x10::io::CustomSerialization::itable<x10::util::HashSet<TPMGL(T)> >  x10::util::HashSet<TPMGL(T)>::_itable_5(&x10::util::HashSet<TPMGL(T)>::equals, &x10::util::HashSet<TPMGL(T)>::hashCode, &x10::util::HashSet<TPMGL(T)>::serialize, &x10::util::HashSet<TPMGL(T)>::toString, &x10::util::HashSet<TPMGL(T)>::typeName);
template<class TPMGL(T)> x10aux::itable_entry x10::util::HashSet<TPMGL(T)>::_itables[7] = {x10aux::itable_entry(&x10aux::getRTT<x10::util::Container<TPMGL(T)> >, &_itable_0), x10aux::itable_entry(&x10aux::getRTT<x10::lang::Any>, &_itable_1), x10aux::itable_entry(&x10aux::getRTT<x10::lang::Iterable<TPMGL(T)> >, &_itable_2), x10aux::itable_entry(&x10aux::getRTT<x10::util::Collection<TPMGL(T)> >, &_itable_3), x10aux::itable_entry(&x10aux::getRTT<x10::util::Set<TPMGL(T)> >, &_itable_4), x10aux::itable_entry(&x10aux::getRTT<x10::io::CustomSerialization>, &_itable_5), x10aux::itable_entry(NULL, (void*)x10aux::getRTT<x10::util::HashSet<TPMGL(T)> >())};

//#line 16 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10ConstructorDecl_c
template<class TPMGL(T)> void x10::util::HashSet<TPMGL(T)>::_constructor(
                           ) {
    
    //#line 16 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10ConstructorCall_c
    (this)->::x10::util::MapSet<TPMGL(T)>::_constructor(x10aux::class_cast_unchecked<x10aux::ref<x10::util::Map<TPMGL(T), x10_boolean> > >(x10::util::HashMap<TPMGL(T), x10_boolean>::_make()));
    
    //#line 16 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.AssignPropertyCall_c
    
}
template<class TPMGL(T)> x10aux::ref<x10::util::HashSet<TPMGL(T)> > x10::util::HashSet<TPMGL(T)>::_make(
                           ) {
    x10aux::ref<x10::util::HashSet<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::util::HashSet<TPMGL(T)> >(), 0, sizeof(x10::util::HashSet<TPMGL(T)>))) x10::util::HashSet<TPMGL(T)>();
    this_->_constructor();
    return this_;
}



//#line 17 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10ConstructorDecl_c
template<class TPMGL(T)> void x10::util::HashSet<TPMGL(T)>::_constructor(
                           x10_int sz) {
    
    //#line 17 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10ConstructorCall_c
    (this)->::x10::util::MapSet<TPMGL(T)>::_constructor(x10aux::class_cast_unchecked<x10aux::ref<x10::util::Map<TPMGL(T), x10_boolean> > >(x10::util::HashMap<TPMGL(T), x10_boolean>::_make(sz)));
    
    //#line 17 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.AssignPropertyCall_c
    
}
template<class TPMGL(T)> x10aux::ref<x10::util::HashSet<TPMGL(T)> > x10::util::HashSet<TPMGL(T)>::_make(
                           x10_int sz) {
    x10aux::ref<x10::util::HashSet<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::util::HashSet<TPMGL(T)> >(), 0, sizeof(x10::util::HashSet<TPMGL(T)>))) x10::util::HashSet<TPMGL(T)>();
    this_->_constructor(sz);
    return this_;
}



//#line 18 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::io::SerialData>
  x10::util::HashSet<TPMGL(T)>::serialize() {
    
    //#line 18 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10Return_c
    return x10aux::nullCheck((x10aux::class_cast<x10aux::ref<x10::util::HashMap<TPMGL(T), x10_boolean> > >(((x10aux::ref<x10::util::HashSet<TPMGL(T)> >)this)->
                                                                                                             FMGL(map))))->serialize();
    
}

//#line 19 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10ConstructorDecl_c
template<class TPMGL(T)> void x10::util::HashSet<TPMGL(T)>::_constructor(
                           x10aux::ref<x10::io::SerialData> a) {
    
    //#line 19 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10ConstructorCall_c
    (this)->::x10::util::MapSet<TPMGL(T)>::_constructor(x10aux::class_cast_unchecked<x10aux::ref<x10::util::Map<TPMGL(T), x10_boolean> > >(x10::util::HashMap<TPMGL(T), x10_boolean>::_make(a)));
    
    //#line 19 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.AssignPropertyCall_c
    
}
template<class TPMGL(T)> x10aux::ref<x10::util::HashSet<TPMGL(T)> > x10::util::HashSet<TPMGL(T)>::_make(
                           x10aux::ref<x10::io::SerialData> a)
{
    x10aux::ref<x10::util::HashSet<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::util::HashSet<TPMGL(T)> >(), 0, sizeof(x10::util::HashSet<TPMGL(T)>))) x10::util::HashSet<TPMGL(T)>();
    this_->_constructor(a);
    return this_;
}



//#line 20 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::util::Container<TPMGL(T)> >
  x10::util::HashSet<TPMGL(T)>::clone() {
    
    //#line 20 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10Return_c
    return x10aux::class_cast_unchecked<x10aux::ref<x10::util::Container<TPMGL(T)> > >(x10::util::HashSet<TPMGL(T)>::_make(((x10aux::ref<x10::util::HashSet<TPMGL(T)> >)this)->serialize()));
    
}

//#line 15 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::util::HashSet<TPMGL(T)> >
  x10::util::HashSet<TPMGL(T)>::x10__util__HashSet____x10__util__HashSet__this(
  ) {
    
    //#line 15 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/HashSet.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::util::HashSet<TPMGL(T)> >)this);
    
}
template<class TPMGL(T)> const x10aux::serialization_id_t x10::util::HashSet<TPMGL(T)>::_serialization_id = 
    x10aux::DeserializationDispatcher::addDeserializer(x10::util::HashSet<TPMGL(T)>::_deserializer, x10aux::CLOSURE_KIND_NOT_ASYNC);

template<class TPMGL(T)> void x10::util::HashSet<TPMGL(T)>::_serialize_body(x10aux::serialization_buffer& buf) {
    /* NOTE: Implements x10.io.CustomSerialization */
    buf.write(this->serialize());
    
}

template<class TPMGL(T)> x10aux::ref<x10::lang::Reference> x10::util::HashSet<TPMGL(T)>::_deserializer(x10aux::deserialization_buffer& buf) {
    x10aux::ref<x10::util::HashSet<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::util::HashSet<TPMGL(T)> >(), 0, sizeof(x10::util::HashSet<TPMGL(T)>))) x10::util::HashSet<TPMGL(T)>();
    buf.record_reference(this_);
    this_->_deserialize_body(buf);
    return this_;
}

template<class TPMGL(T)> void x10::util::HashSet<TPMGL(T)>::_deserialize_body(x10aux::deserialization_buffer& buf) {
    /* NOTE: Implements x10.io.CustomSerialization */
    x10aux::ref<x10::io::SerialData>val_ = buf.read<x10aux::ref<x10::io::SerialData> >();
    _constructor(val_);
    
}

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