#ifndef __X10_UTIL_ARRAYLIST_H
#define __X10_UTIL_ARRAYLIST_H

#include <x10rt.h>


#define X10_UTIL_ABSTRACTCOLLECTION_H_NODEPS
#include <x10/util/AbstractCollection.h>
#undef X10_UTIL_ABSTRACTCOLLECTION_H_NODEPS
#define X10_UTIL_LIST_H_NODEPS
#include <x10/util/List.h>
#undef X10_UTIL_LIST_H_NODEPS
namespace x10 { namespace util { 
template<class TPMGL(T)> class GrowableIndexedMemoryChunk;
} } 
namespace x10 { namespace util { 
template<class TPMGL(T)> class Container;
} } 
namespace x10 { namespace lang { 
class Boolean;
} } 
namespace x10 { namespace lang { 
class Int;
} } 
namespace x10 { namespace lang { 
class Any;
} } 
namespace x10 { namespace array { 
template<class TPMGL(T)> class Array;
} } 
namespace x10 { namespace util { 
template<class TPMGL(T)> class IndexedMemoryChunk;
} } 
namespace x10 { namespace util { 
template<class TPMGL(T)> class ListIterator;
} } 
namespace x10 { namespace util { 
template<class TPMGL(S)> class ArrayList__It;
} } 
namespace x10 { namespace lang { 
template<class TPMGL(T)> class Comparable;
} } 
namespace x10 { namespace lang { 
template<class TPMGL(Z1), class TPMGL(Z2), class TPMGL(U)> class Fun_0_2;
} } 
namespace x10 { namespace lang { 
class String;
} } 
namespace x10 { namespace util { 
class StringBuilder;
} } 
namespace x10 { namespace lang { 
class Math;
} } 
namespace x10 { namespace util { 

template<class TPMGL(T)> class ArrayList;
template <> class ArrayList<void>;
template<class TPMGL(T)> class ArrayList : public x10::util::AbstractCollection<TPMGL(T)>
  {
    public:
    RTT_H_DECLS_CLASS
    
    static x10aux::itable_entry _itables[8];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    static typename x10::util::Container<TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> > _itable_0;
    
    static x10::lang::Any::itable<x10::util::ArrayList<TPMGL(T)> > _itable_1;
    
    static typename x10::lang::Iterable<TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> > _itable_2;
    
    static typename x10::util::Collection<TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> > _itable_3;
    
    static typename x10::util::List<TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> > _itable_4;
    
    static typename x10::util::Indexed<TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> > _itable_5;
    
    static typename x10::lang::Settable<x10_int, TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> > _itable_6;
    
    x10aux::ref<x10::util::GrowableIndexedMemoryChunk<TPMGL(T)> >
      FMGL(a);
    
    virtual x10_boolean contains(TPMGL(T) v);
    virtual x10aux::ref<x10::util::Container<TPMGL(T)> > clone();
    virtual x10_boolean add(TPMGL(T) v);
    virtual x10_boolean remove(TPMGL(T) v);
    virtual void addBefore(x10_int i, TPMGL(T) v);
    virtual TPMGL(T) __set(x10_int i, TPMGL(T) v);
    virtual TPMGL(T) set(TPMGL(T) v, x10_int i);
    virtual TPMGL(T) removeAt(x10_int i);
    virtual TPMGL(T) __apply(x10_int i);
    virtual TPMGL(T) get(x10_int i);
    virtual x10_int size();
    virtual x10_boolean isEmpty();
    virtual x10aux::ref<x10::array::Array<TPMGL(T)> > toArray();
    virtual x10::util::IndexedMemoryChunk<TPMGL(T) > toIndexedMemoryChunk(
      );
    void _constructor();
    
    static x10aux::ref<x10::util::ArrayList<TPMGL(T)> > _make();
    
    void _constructor(x10_int size);
    
    static x10aux::ref<x10::util::ArrayList<TPMGL(T)> > _make(x10_int size);
    
    virtual TPMGL(T) removeFirst();
    virtual TPMGL(T) removeLast();
    virtual TPMGL(T) getFirst();
    virtual TPMGL(T) getLast();
    virtual x10aux::ref<x10::util::List<x10_int> > indices();
    virtual x10aux::ref<x10::util::List<TPMGL(T)> > subList(x10_int begin,
                                                            x10_int end);
    virtual x10_int indexOf(TPMGL(T) v);
    virtual x10_int indexOf(x10_int index, TPMGL(T) v);
    virtual x10_int lastIndexOf(TPMGL(T) v);
    virtual x10_int lastIndexOf(x10_int index, TPMGL(T) v);
    virtual x10aux::ref<x10::array::Array<TPMGL(T)> > moveSectionToArray(
      x10_int i, x10_int j);
    virtual x10aux::ref<x10::lang::Iterator<TPMGL(T)> > iterator(
      );
    virtual x10aux::ref<x10::util::ListIterator<TPMGL(T)> > iteratorFrom(
      x10_int i);
    virtual void reverse();
    virtual void sort();
    virtual void sort(x10aux::ref<x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int> > cmp);
    void qsort(x10aux::ref<x10::util::GrowableIndexedMemoryChunk<TPMGL(T)> > a,
               x10_int lo, x10_int hi, x10aux::ref<x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int> > cmp);
    void exch(x10aux::ref<x10::util::GrowableIndexedMemoryChunk<TPMGL(T)> > a,
              x10_int i, x10_int j);
    virtual x10aux::ref<x10::lang::String> toString();
    virtual x10aux::ref<x10::util::ArrayList<TPMGL(T)> > x10__util__ArrayList____x10__util__ArrayList__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 ArrayList<void> : public x10::util::AbstractCollection<void>
{
    public:
    static x10aux::RuntimeType rtt;
    static const x10aux::RuntimeType* getRTT() { return & rtt; }
    template<class TPMGL(T)> static x10aux::ref<x10::util::ArrayList<TPMGL(T)> >
      make(x10aux::ref<x10::util::Container<TPMGL(T)> > c);
    
    
};

} } 
#endif // X10_UTIL_ARRAYLIST_H

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

#ifndef X10_UTIL_ARRAYLIST_H_NODEPS
#define X10_UTIL_ARRAYLIST_H_NODEPS
#include <x10/util/AbstractCollection.h>
#include <x10/util/List.h>
#include <x10/util/GrowableIndexedMemoryChunk.h>
#include <x10/util/Container.h>
#include <x10/lang/Boolean.h>
#include <x10/lang/Int.h>
#include <x10/lang/Any.h>
#include <x10/array/Array.h>
#include <x10/util/IndexedMemoryChunk.h>
#include <x10/util/ListIterator.h>
#include <x10/util/ArrayList__It.h>
#include <x10/lang/Comparable.h>
#include <x10/lang/Fun_0_2.h>
#include <x10/lang/String.h>
#include <x10/util/StringBuilder.h>
#include <x10/lang/Math.h>
#ifndef X10_UTIL_ARRAYLIST_H_GENERICS
#define X10_UTIL_ARRAYLIST_H_GENERICS
#endif // X10_UTIL_ARRAYLIST_H_GENERICS
#ifndef X10_UTIL_ARRAYLIST_H_IMPLEMENTATION
#define X10_UTIL_ARRAYLIST_H_IMPLEMENTATION
#include <x10/util/ArrayList.h>

#ifndef X10_UTIL_ARRAYLIST__CLOSURE__1_CLOSURE
#define X10_UTIL_ARRAYLIST__CLOSURE__1_CLOSURE
#include <x10/lang/Closure.h>
#include <x10/lang/Fun_0_2.h>
template<class TPMGL(T)> class x10_util_ArrayList__closure__1 : public x10::lang::Closure {
    public:
    
    static typename x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int>::template itable <x10_util_ArrayList__closure__1<TPMGL(T) > > _itable;
    static x10aux::itable_entry _itables[2];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    // closure body
    x10_int __apply(TPMGL(T) x, TPMGL(T) y) {
        
        //#line 216 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
        return x10::lang::Comparable<TPMGL(T) >::compareTo(x10aux::class_cast_unchecked<x10aux::ref<x10::lang::Comparable<TPMGL(T) > > >(x), y);
        
    }
    
    // captured environment
    
    x10aux::serialization_id_t _get_serialization_id() {
        return _serialization_id;
    }
    
    void _serialize_body(x10aux::serialization_buffer &buf) {
        
    }
    
    template<class __T> static x10aux::ref<__T> _deserialize(x10aux::deserialization_buffer &buf) {
        x10_util_ArrayList__closure__1<TPMGL(T) >* storage = x10aux::alloc<x10_util_ArrayList__closure__1<TPMGL(T) > >();
        buf.record_reference(x10aux::ref<x10_util_ArrayList__closure__1<TPMGL(T) > >(storage));
        x10aux::ref<x10_util_ArrayList__closure__1<TPMGL(T) > > this_ = new (storage) x10_util_ArrayList__closure__1<TPMGL(T) >();
        return this_;
    }
    
    x10_util_ArrayList__closure__1() { }
    
    static const x10aux::serialization_id_t _serialization_id;
    
    static const x10aux::RuntimeType* getRTT() { return x10aux::getRTT<x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int> >(); }
    virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int> >(); }
    
    x10aux::ref<x10::lang::String> toString() {
        return x10aux::string_utils::lit(this->toNativeString());
    }
    
    const char* toNativeString() {
        return "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10:216";
    }

};

template<class TPMGL(T)> typename x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int>::template itable <x10_util_ArrayList__closure__1<TPMGL(T) > >x10_util_ArrayList__closure__1<TPMGL(T) >::_itable(&x10::lang::Reference::equals, &x10::lang::Closure::hashCode, &x10_util_ArrayList__closure__1<TPMGL(T) >::__apply, &x10_util_ArrayList__closure__1<TPMGL(T) >::toString, &x10::lang::Closure::typeName);
template<class TPMGL(T)> x10aux::itable_entry x10_util_ArrayList__closure__1<TPMGL(T) >::_itables[2] = {x10aux::itable_entry(&x10aux::getRTT<x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int> >, &x10_util_ArrayList__closure__1<TPMGL(T) >::_itable),x10aux::itable_entry(NULL, NULL)};

template<class TPMGL(T)> const x10aux::serialization_id_t x10_util_ArrayList__closure__1<TPMGL(T) >::_serialization_id = 
    x10aux::DeserializationDispatcher::addDeserializer(x10_util_ArrayList__closure__1<TPMGL(T) >::template _deserialize<x10::lang::Reference>,x10aux::CLOSURE_KIND_NOT_ASYNC);

#endif // X10_UTIL_ARRAYLIST__CLOSURE__1_CLOSURE
template<class TPMGL(T)> typename x10::util::Container<TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> >  x10::util::ArrayList<TPMGL(T)>::_itable_0(&x10::util::ArrayList<TPMGL(T)>::clone, &x10::util::ArrayList<TPMGL(T)>::contains, &x10::util::ArrayList<TPMGL(T)>::containsAll, &x10::util::ArrayList<TPMGL(T)>::equals, &x10::util::ArrayList<TPMGL(T)>::hashCode, &x10::util::ArrayList<TPMGL(T)>::isEmpty, &x10::util::ArrayList<TPMGL(T)>::iterator, &x10::util::ArrayList<TPMGL(T)>::size, &x10::util::ArrayList<TPMGL(T)>::toString, &x10::util::ArrayList<TPMGL(T)>::typeName);
template<class TPMGL(T)> x10::lang::Any::itable<x10::util::ArrayList<TPMGL(T)> >  x10::util::ArrayList<TPMGL(T)>::_itable_1(&x10::util::ArrayList<TPMGL(T)>::equals, &x10::util::ArrayList<TPMGL(T)>::hashCode, &x10::util::ArrayList<TPMGL(T)>::toString, &x10::util::ArrayList<TPMGL(T)>::typeName);
template<class TPMGL(T)> typename x10::lang::Iterable<TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> >  x10::util::ArrayList<TPMGL(T)>::_itable_2(&x10::util::ArrayList<TPMGL(T)>::equals, &x10::util::ArrayList<TPMGL(T)>::hashCode, &x10::util::ArrayList<TPMGL(T)>::iterator, &x10::util::ArrayList<TPMGL(T)>::toString, &x10::util::ArrayList<TPMGL(T)>::typeName);
template<class TPMGL(T)> typename x10::util::Collection<TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> >  x10::util::ArrayList<TPMGL(T)>::_itable_3(&x10::util::ArrayList<TPMGL(T)>::add, &x10::util::ArrayList<TPMGL(T)>::addAll, &x10::util::ArrayList<TPMGL(T)>::addAllWhere, &x10::util::ArrayList<TPMGL(T)>::clear, &x10::util::ArrayList<TPMGL(T)>::clone, &x10::util::ArrayList<TPMGL(T)>::contains, &x10::util::ArrayList<TPMGL(T)>::containsAll, &x10::util::ArrayList<TPMGL(T)>::equals, &x10::util::ArrayList<TPMGL(T)>::hashCode, &x10::util::ArrayList<TPMGL(T)>::isEmpty, &x10::util::ArrayList<TPMGL(T)>::iterator, &x10::util::ArrayList<TPMGL(T)>::remove, &x10::util::ArrayList<TPMGL(T)>::removeAll, &x10::util::ArrayList<TPMGL(T)>::removeAllWhere, &x10::util::ArrayList<TPMGL(T)>::retainAll, &x10::util::ArrayList<TPMGL(T)>::size, &x10::util::ArrayList<TPMGL(T)>::toString, &x10::util::ArrayList<TPMGL(T)>::typeName);
template<class TPMGL(T)> typename x10::util::List<TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> >  x10::util::ArrayList<TPMGL(T)>::_itable_4(&x10::util::ArrayList<TPMGL(T)>::add, &x10::util::ArrayList<TPMGL(T)>::addAll, &x10::util::ArrayList<TPMGL(T)>::addAllWhere, &x10::util::ArrayList<TPMGL(T)>::addBefore, &x10::util::ArrayList<TPMGL(T)>::clear, &x10::util::ArrayList<TPMGL(T)>::clone, &x10::util::ArrayList<TPMGL(T)>::contains, &x10::util::ArrayList<TPMGL(T)>::containsAll, &x10::util::ArrayList<TPMGL(T)>::equals, &x10::util::ArrayList<TPMGL(T)>::getFirst, &x10::util::ArrayList<TPMGL(T)>::getLast, &x10::util::ArrayList<TPMGL(T)>::hashCode, &x10::util::ArrayList<TPMGL(T)>::indexOf, &x10::util::ArrayList<TPMGL(T)>::indexOf, &x10::util::ArrayList<TPMGL(T)>::indices, &x10::util::ArrayList<TPMGL(T)>::isEmpty, &x10::util::ArrayList<TPMGL(T)>::iterator, &x10::util::ArrayList<TPMGL(T)>::iteratorFrom, &x10::util::ArrayList<TPMGL(T)>::lastIndexOf, &x10::util::ArrayList<TPMGL(T)>::lastIndexOf, &x10::util::ArrayList<TPMGL(T)>::__apply, &x10::util::ArrayList<TPMGL(T)>::__set, &x10::util::ArrayList<TPMGL(T)>::remove, &x10::util::ArrayList<TPMGL(T)>::removeAll, &x10::util::ArrayList<TPMGL(T)>::removeAllWhere, &x10::util::ArrayList<TPMGL(T)>::removeAt, &x10::util::ArrayList<TPMGL(T)>::removeFirst, &x10::util::ArrayList<TPMGL(T)>::removeLast, &x10::util::ArrayList<TPMGL(T)>::retainAll, &x10::util::ArrayList<TPMGL(T)>::reverse, &x10::util::ArrayList<TPMGL(T)>::size, &x10::util::ArrayList<TPMGL(T)>::sort, &x10::util::ArrayList<TPMGL(T)>::sort, &x10::util::ArrayList<TPMGL(T)>::subList, &x10::util::ArrayList<TPMGL(T)>::toString, &x10::util::ArrayList<TPMGL(T)>::typeName);
template<class TPMGL(T)> typename x10::util::Indexed<TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> >  x10::util::ArrayList<TPMGL(T)>::_itable_5(&x10::util::ArrayList<TPMGL(T)>::clone, &x10::util::ArrayList<TPMGL(T)>::contains, &x10::util::ArrayList<TPMGL(T)>::containsAll, &x10::util::ArrayList<TPMGL(T)>::equals, &x10::util::ArrayList<TPMGL(T)>::hashCode, &x10::util::ArrayList<TPMGL(T)>::isEmpty, &x10::util::ArrayList<TPMGL(T)>::iterator, &x10::util::ArrayList<TPMGL(T)>::__apply, &x10::util::ArrayList<TPMGL(T)>::size, &x10::util::ArrayList<TPMGL(T)>::toString, &x10::util::ArrayList<TPMGL(T)>::typeName);
template<class TPMGL(T)> typename x10::lang::Settable<x10_int, TPMGL(T)>::template itable<x10::util::ArrayList<TPMGL(T)> >  x10::util::ArrayList<TPMGL(T)>::_itable_6(&x10::util::ArrayList<TPMGL(T)>::equals, &x10::util::ArrayList<TPMGL(T)>::hashCode, &x10::util::ArrayList<TPMGL(T)>::__set, &x10::util::ArrayList<TPMGL(T)>::toString, &x10::util::ArrayList<TPMGL(T)>::typeName);
template<class TPMGL(T)> x10aux::itable_entry x10::util::ArrayList<TPMGL(T)>::_itables[8] = {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::List<TPMGL(T)> >, &_itable_4), x10aux::itable_entry(&x10aux::getRTT<x10::util::Indexed<TPMGL(T)> >, &_itable_5), x10aux::itable_entry(&x10aux::getRTT<x10::lang::Settable<x10_int, TPMGL(T)> >, &_itable_6), x10aux::itable_entry(NULL, (void*)x10aux::getRTT<x10::util::ArrayList<TPMGL(T)> >())};

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

//#line 18 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c

//#line 24 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_boolean x10::util::ArrayList<TPMGL(T)>::contains(
  TPMGL(T) v) {
    
    //#line 25 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.For_c
    {
        x10_int i;
        for (
             //#line 25 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
             i = ((x10_int)0); ((i) < (x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                           FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length()));
             
             //#line 25 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10LocalAssign_c
             i = ((x10_int) ((i) + (((x10_int)1))))) {
            
            //#line 26 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10If_c
            if ((x10aux::struct_equals(v, X10_NULL)) ? ((x10aux::struct_equals(x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                                                   FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                                                                                 i),
                                                                               X10_NULL)))
                  : (x10aux::equals(v,x10aux::class_cast_unchecked<x10aux::ref<x10::lang::Any> >(x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                                                                     FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                                                                                                   i)))))
            {
                
                //#line 27 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
                return true;
                
            }
            
        }
    }
    
    //#line 30 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return false;
    
}

//#line 33 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::util::Container<TPMGL(T)> >
  x10::util::ArrayList<TPMGL(T)>::clone() {
    
    //#line 34 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    x10aux::ref<x10::util::ArrayList<TPMGL(T)> > a = x10::util::ArrayList<TPMGL(T)>::_make();
    
    //#line 35 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    a->addAll(x10aux::class_cast_unchecked<x10aux::ref<x10::util::Container<TPMGL(T)> > >(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)));
    
    //#line 36 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return x10aux::class_cast_unchecked<x10aux::ref<x10::util::Container<TPMGL(T)> > >(a);
    
}

//#line 39 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_boolean x10::util::ArrayList<TPMGL(T)>::add(
  TPMGL(T) v) {
    
    //#line 40 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                        FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::add(
      v);
    
    //#line 41 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return true;
    
}

//#line 44 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_boolean x10::util::ArrayList<TPMGL(T)>::remove(
  TPMGL(T) v) {
    
    //#line 45 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.For_c
    {
        x10_int i;
        for (
             //#line 45 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
             i = ((x10_int)0); ((i) < (x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                           FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length()));
             
             //#line 45 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10LocalAssign_c
             i = ((x10_int) ((i) + (((x10_int)1))))) {
            
            //#line 46 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10If_c
            if ((x10aux::struct_equals(v, X10_NULL)) ? ((x10aux::struct_equals(x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                                                   FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                                                                                 i),
                                                                               X10_NULL)))
                  : (x10aux::equals(v,x10aux::class_cast_unchecked<x10aux::ref<x10::lang::Any> >(x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                                                                     FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                                                                                                   i)))))
            {
                
                //#line 47 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
                ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->removeAt(
                  i);
                
                //#line 48 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
                return true;
                
            }
            
        }
    }
    
    //#line 51 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return false;
    
}

//#line 54 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::addBefore(
  x10_int i, TPMGL(T) v) {
    
    //#line 55 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                        FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::add(
      v);
    
    //#line 56 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.For_c
    {
        x10_int j;
        for (
             //#line 56 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
             j = ((x10_int) ((x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                  FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length()) - (((x10_int)1))));
             ((j) > (i)); 
                          //#line 56 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10LocalAssign_c
                          j = ((x10_int) ((j) - (((x10_int)1)))))
        {
            
            //#line 57 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
            x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__set(
              j, x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                     FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                   ((x10_int) ((j) - (((x10_int)1))))));
        }
    }
    
    //#line 59 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                        FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__set(
      i, v);
}

//#line 62 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> TPMGL(T) x10::util::ArrayList<TPMGL(T)>::__set(
  x10_int i, TPMGL(T) v) {
    
    //#line 62 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->set(
             v, i);
    
}

//#line 64 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> TPMGL(T) x10::util::ArrayList<TPMGL(T)>::set(
  TPMGL(T) v, x10_int i) {
    
    //#line 65 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                        FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__set(
      i, v);
    
    //#line 66 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return v;
    
}

//#line 69 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> TPMGL(T) x10::util::ArrayList<TPMGL(T)>::removeAt(
  x10_int i) {
    
    //#line 70 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    TPMGL(T) v = x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                     FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                   i);
    
    //#line 71 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.For_c
    {
        x10_int j;
        for (
             //#line 71 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
             j = ((x10_int) ((i) + (((x10_int)1)))); ((j) < (x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                                 FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length()));
             
             //#line 71 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10LocalAssign_c
             j = ((x10_int) ((j) + (((x10_int)1))))) {
            
            //#line 72 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
            x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__set(
              ((x10_int) ((j) - (((x10_int)1)))), x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                      FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                                                    j));
        }
    }
    
    //#line 74 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                        FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::removeLast();
    
    //#line 75 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return v;
    
}

//#line 78 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> TPMGL(T) x10::util::ArrayList<TPMGL(T)>::__apply(
  x10_int i) {
    
    //#line 78 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                               FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
             i);
    
}

//#line 80 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> TPMGL(T) x10::util::ArrayList<TPMGL(T)>::get(
  x10_int i) {
    
    //#line 80 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                               FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
             i);
    
}

//#line 82 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_int x10::util::ArrayList<TPMGL(T)>::size(
  ) {
    
    //#line 82 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                               FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length();
    
}

//#line 84 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_boolean x10::util::ArrayList<TPMGL(T)>::isEmpty(
  ) {
    
    //#line 84 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return (x10aux::struct_equals(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->size(),
                                  ((x10_int)0)));
    
}

//#line 86 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::array::Array<TPMGL(T)> >
  x10::util::ArrayList<TPMGL(T)>::toArray() {
    
    //#line 86 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                               FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::toArray();
    
}

//#line 87 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10::util::IndexedMemoryChunk<TPMGL(T) >
  x10::util::ArrayList<TPMGL(T)>::toIndexedMemoryChunk() {
    
    //#line 87 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                               FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::toIndexedMemoryChunk();
    
}

//#line 89 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10ConstructorDecl_c
template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::_constructor(
                           ) {
    
    //#line 89 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10ConstructorCall_c
    (this)->::x10::util::AbstractCollection<TPMGL(T)>::_constructor();
    
    //#line 89 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.AssignPropertyCall_c
    
    //#line 90 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10FieldAssign_c
    ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
      FMGL(a) = x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::_make();
}
template<class TPMGL(T)> x10aux::ref<x10::util::ArrayList<TPMGL(T)> > x10::util::ArrayList<TPMGL(T)>::_make(
                           ) {
    x10aux::ref<x10::util::ArrayList<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::util::ArrayList<TPMGL(T)> >(), 0, sizeof(x10::util::ArrayList<TPMGL(T)>))) x10::util::ArrayList<TPMGL(T)>();
    this_->_constructor();
    return this_;
}



//#line 93 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10ConstructorDecl_c
template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::_constructor(
                           x10_int size) {
    
    //#line 93 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10ConstructorCall_c
    (this)->::x10::util::AbstractCollection<TPMGL(T)>::_constructor();
    
    //#line 93 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.AssignPropertyCall_c
    
    //#line 94 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10FieldAssign_c
    ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
      FMGL(a) = x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::_make(size);
}
template<class TPMGL(T)> x10aux::ref<x10::util::ArrayList<TPMGL(T)> > x10::util::ArrayList<TPMGL(T)>::_make(
                           x10_int size) {
    x10aux::ref<x10::util::ArrayList<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::util::ArrayList<TPMGL(T)> >(), 0, sizeof(x10::util::ArrayList<TPMGL(T)>))) x10::util::ArrayList<TPMGL(T)>();
    this_->_constructor(size);
    return this_;
}



//#line 97 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> TPMGL(T) x10::util::ArrayList<TPMGL(T)>::removeFirst(
  ) {
    
    //#line 97 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->removeAt(
             ((x10_int)0));
    
}

//#line 98 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> TPMGL(T) x10::util::ArrayList<TPMGL(T)>::removeLast(
  ) {
    
    //#line 98 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->removeAt(
             ((x10_int) ((x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                              FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length()) - (((x10_int)1)))));
    
}

//#line 99 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> TPMGL(T) x10::util::ArrayList<TPMGL(T)>::getFirst(
  ) {
    
    //#line 99 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->get(
             ((x10_int)0));
    
}

//#line 100 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> TPMGL(T) x10::util::ArrayList<TPMGL(T)>::getLast(
  ) {
    
    //#line 100 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->get(
             ((x10_int) ((x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                              FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length()) - (((x10_int)1)))));
    
}

//#line 102 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::util::List<x10_int> >
  x10::util::ArrayList<TPMGL(T)>::indices() {
    
    //#line 103 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    x10aux::ref<x10::util::ArrayList<x10_int> > l = x10::util::ArrayList<x10_int>::_make();
    
    //#line 104 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.For_c
    {
        x10_int i;
        for (
             //#line 104 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
             i = ((x10_int)0); ((i) < (x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                           FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length()));
             
             //#line 104 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10LocalAssign_c
             i = ((x10_int) ((i) + (((x10_int)1))))) {
            
            //#line 105 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
            l->add(i);
        }
    }
    
    //#line 107 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return l;
    
}

//#line 110 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::util::List<TPMGL(T)> >
  x10::util::ArrayList<TPMGL(T)>::subList(x10_int begin, x10_int end) {
    
    //#line 111 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    x10aux::ref<x10::util::ArrayList<TPMGL(T)> > l = x10::util::ArrayList<TPMGL(T)>::_make();
    
    //#line 112 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.For_c
    {
        x10_int i;
        for (
             //#line 112 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
             i = begin; ((i) < (x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                    FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length())) &&
                        ((i) < (end)); 
                                       //#line 112 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10LocalAssign_c
                                       i = ((x10_int) ((i) + (((x10_int)1)))))
        {
            
            //#line 113 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
            l->add(x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                       FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                     i));
        }
    }
    
    //#line 115 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return l;
    
}

//#line 118 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_int x10::util::ArrayList<TPMGL(T)>::indexOf(
  TPMGL(T) v) {
    
    //#line 119 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->indexOf(
             ((x10_int)0), v);
    
}

//#line 122 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_int x10::util::ArrayList<TPMGL(T)>::indexOf(
  x10_int index, TPMGL(T) v) {
    
    //#line 123 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.For_c
    {
        x10_int i;
        for (
             //#line 123 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
             i = index; ((i) < (x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                    FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length()));
             
             //#line 123 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10LocalAssign_c
             i = ((x10_int) ((i) + (((x10_int)1))))) {
            
            //#line 124 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10If_c
            if ((x10aux::struct_equals(v, X10_NULL)) ? ((x10aux::struct_equals(x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                                                   FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                                                                                 i),
                                                                               X10_NULL)))
                  : (x10aux::equals(v,x10aux::class_cast_unchecked<x10aux::ref<x10::lang::Any> >(x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                                                                     FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                                                                                                   i)))))
            {
                
                //#line 125 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
                return i;
                
            }
            
        }
    }
    
    //#line 127 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return ((x10_int)-1);
    
}

//#line 130 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_int x10::util::ArrayList<TPMGL(T)>::lastIndexOf(
  TPMGL(T) v) {
    
    //#line 131 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->lastIndexOf(
             ((x10_int) ((x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                              FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length()) - (((x10_int)1)))),
             v);
    
}

//#line 134 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10_int x10::util::ArrayList<TPMGL(T)>::lastIndexOf(
  x10_int index, TPMGL(T) v) {
    
    //#line 135 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.For_c
    {
        x10_int i;
        for (
             //#line 135 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
             i = index; ((i) >= (((x10_int)0))); 
                                                 //#line 135 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10LocalAssign_c
                                                 i = ((x10_int) ((i) - (((x10_int)1)))))
        {
            
            //#line 136 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10If_c
            if ((x10aux::struct_equals(v, X10_NULL)) ? ((x10aux::struct_equals(x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                                                   FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                                                                                 i),
                                                                               X10_NULL)))
                  : (x10aux::equals(v,x10aux::class_cast_unchecked<x10aux::ref<x10::lang::Any> >(x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                                                                     FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                                                                                                   i)))))
            {
                
                //#line 137 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
                return i;
                
            }
            
        }
    }
    
    //#line 139 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return ((x10_int)-1);
    
}

//#line 142 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::array::Array<TPMGL(T)> >
  x10::util::ArrayList<TPMGL(T)>::moveSectionToArray(x10_int i,
                                                     x10_int j) {
    
    //#line 142 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                               FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::moveSectionToArray(
             i, j);
    
}

//#line 200 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::lang::Iterator<TPMGL(T)> >
  x10::util::ArrayList<TPMGL(T)>::iterator() {
    
    //#line 201 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return x10aux::class_cast_unchecked<x10aux::ref<x10::lang::Iterator<TPMGL(T)> > >(x10::util::ArrayList__It<TPMGL(T)>::_make(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)));
    
}

//#line 204 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::util::ListIterator<TPMGL(T)> >
  x10::util::ArrayList<TPMGL(T)>::iteratorFrom(x10_int i) {
    
    //#line 205 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return x10::util::ArrayList__It<TPMGL(T)>::_make(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this),
                                                     i);
    
}

//#line 208 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::reverse(
  ) {
    
    //#line 209 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    x10_int length = x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                         FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length();
    
    //#line 210 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.For_c
    {
        x10_int i;
        for (
             //#line 210 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
             i = ((x10_int)0); ((i) < (((x10_int) ((length) / x10aux::zeroCheck(((x10_int)2))))));
             
             //#line 210 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10LocalAssign_c
             i = ((x10_int) ((i) + (((x10_int)1))))) {
            
            //#line 211 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
            ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->exch(
              ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                FMGL(a), i, ((x10_int) ((((x10_int) ((length) - (((x10_int)1))))) - (i))));
        }
    }
    
}

//#line 216 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::sort(
  ) {
    
    //#line 216 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->sort(
      x10aux::ref<x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int> >(x10aux::ref<x10_util_ArrayList__closure__1<TPMGL(T) > >(new (x10aux::alloc<x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int> >(sizeof(x10_util_ArrayList__closure__1<TPMGL(T)>)))x10_util_ArrayList__closure__1<TPMGL(T)>())));
}

//#line 217 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::sort(
  x10aux::ref<x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int> > cmp) {
    
    //#line 217 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->qsort(
      ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
        FMGL(a), ((x10_int)0), ((x10_int) ((x10aux::nullCheck(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->
                                                                FMGL(a))->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::length()) - (((x10_int)1)))),
      cmp);
}

//#line 225 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::qsort(
  x10aux::ref<x10::util::GrowableIndexedMemoryChunk<TPMGL(T)> > a,
  x10_int lo, x10_int hi, x10aux::ref<x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int> > cmp) {
    
    //#line 226 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10If_c
    if (((hi) <= (lo))) {
        
        //#line 226 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
        return;
    }
    
    //#line 227 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    x10_int l = ((x10_int) ((lo) - (((x10_int)1))));
    
    //#line 228 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    x10_int h = hi;
    
    //#line 229 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10While_c
    while (true) {
        
        //#line 230 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10While_c
        while (((x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int>::__apply(x10aux::nullCheck(cmp), 
                 x10aux::nullCheck(a)->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                   l = ((x10_int) ((l) + (((x10_int)1))))),
                 x10aux::nullCheck(a)->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                   hi))) < (((x10_int)0)))) {
            
            //#line 230 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.Empty_c
            ;
        }
        
        //#line 231 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10While_c
        while (((x10::lang::Fun_0_2<TPMGL(T), TPMGL(T), x10_int>::__apply(x10aux::nullCheck(cmp), 
                 x10aux::nullCheck(a)->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                   hi), x10aux::nullCheck(a)->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                          h = ((x10_int) ((h) - (((x10_int)1))))))) < (((x10_int)0))) &&
               ((h) > (lo))) {
            
            //#line 231 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.Empty_c
            ;
        }
        
        //#line 232 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10If_c
        if (((l) >= (h))) {
            
            //#line 232 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.Branch_c
            break;
        }
        
        //#line 233 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
        ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->exch(
          a, l, h);
    }
    
    //#line 235 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->exch(
      a, l, hi);
    
    //#line 236 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->qsort(
      a, lo, ((x10_int) ((l) - (((x10_int)1)))), cmp);
    
    //#line 237 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    ((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->qsort(
      a, ((x10_int) ((l) + (((x10_int)1)))), hi, cmp);
}

//#line 240 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::exch(
  x10aux::ref<x10::util::GrowableIndexedMemoryChunk<TPMGL(T)> > a,
  x10_int i, x10_int j) {
    
    //#line 241 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    TPMGL(T) temp = x10aux::nullCheck(a)->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
                      i);
    
    //#line 242 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    x10aux::nullCheck(a)->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__set(
      i, x10aux::nullCheck(a)->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__apply(
           j));
    
    //#line 243 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    x10aux::nullCheck(a)->x10::util::GrowableIndexedMemoryChunk<TPMGL(T)>::__set(
      j, temp);
}

//#line 251 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::lang::String> x10::util::ArrayList<TPMGL(T)>::toString(
  ) {
    
    //#line 252 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    x10aux::ref<x10::util::StringBuilder> sb = x10::util::StringBuilder::_make();
    
    //#line 253 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    sb->add(x10aux::string_utils::lit("["));
    
    //#line 254 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    x10_int sz = x10::lang::Math::min(((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->size(),
                                      ((x10_int)10));
    
    //#line 255 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": polyglot.ast.For_c
    {
        x10_int i;
        for (
             //#line 255 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
             i = ((x10_int)0); ((i) < (sz)); 
                                             //#line 255 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10LocalAssign_c
                                             i = ((x10_int) ((i) + (((x10_int)1)))))
        {
            
            //#line 256 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10If_c
            if (((i) > (((x10_int)0)))) {
                
                //#line 256 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
                sb->add(x10aux::string_utils::lit(","));
            }
            
            //#line 257 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
            sb->add(((x10aux::string_utils::lit("")) + (((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->__apply(
                                                          i))));
        }
    }
    
    //#line 259 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10If_c
    if (((sz) < (((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->size())))
    {
        
        //#line 259 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
        sb->add(((((x10aux::string_utils::lit("...(omitted ")) + (((x10_int) ((((x10aux::ref<x10::util::ArrayList<TPMGL(T)> >)this)->size()) - (sz)))))) + (x10aux::string_utils::lit(" elements)"))));
    }
    
    //#line 260 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    sb->add(x10aux::string_utils::lit("]"));
    
    //#line 261 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return sb->toString();
    
}

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

template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::_serialize_body(x10aux::serialization_buffer& buf) {
    x10::util::AbstractCollection<TPMGL(T)>::_serialize_body(buf);
    buf.write(this->FMGL(a));
    
}

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

template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::_deserialize_body(x10aux::deserialization_buffer& buf) {
    x10::util::AbstractCollection<TPMGL(T)>::_deserialize_body(buf);
    FMGL(a) = buf.read<x10aux::ref<x10::util::GrowableIndexedMemoryChunk<TPMGL(T)> > >();
}

template<class TPMGL(T)> x10aux::RuntimeType x10::util::ArrayList<TPMGL(T)>::rtt;
template<class TPMGL(T)> void x10::util::ArrayList<TPMGL(T)>::_initRTT() {
    const x10aux::RuntimeType *canonical = x10aux::getRTT<x10::util::ArrayList<void> >();
    if (rtt.initStageOne(canonical)) return;
    const x10aux::RuntimeType* parents[2] = { x10aux::getRTT<x10::util::AbstractCollection<TPMGL(T)> >(), x10aux::getRTT<x10::util::List<TPMGL(T)> >()};
    const x10aux::RuntimeType* params[1] = { x10aux::getRTT<TPMGL(T)>()};
    x10aux::RuntimeType::Variance variances[1] = { x10aux::RuntimeType::invariant};
    const char *baseName = "x10.util.ArrayList";
    rtt.initStageTwo(baseName, x10aux::RuntimeType::class_kind, 2, parents, 1, params, variances);
}
template<class TPMGL(T)> x10aux::ref<x10::util::ArrayList<TPMGL(T)> >
  x10::util::ArrayList<void>::make(x10aux::ref<x10::util::Container<TPMGL(T)> > c)
{
    
    //#line 19 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10LocalDecl_c
    x10aux::ref<x10::util::ArrayList<TPMGL(T)> > a = x10::util::ArrayList<TPMGL(T)>::_make();
    
    //#line 20 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": Eval of x10.ast.X10Call_c
    a->addAll(c);
    
    //#line 21 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/util/ArrayList.x10": x10.ast.X10Return_c
    return a;
    
}
#endif // X10_UTIL_ARRAYLIST_H_IMPLEMENTATION
#endif // __X10_UTIL_ARRAYLIST_H_NODEPS
