#ifndef __X10_LANG_COMPLEX_H
#define __X10_LANG_COMPLEX_H

#include <x10rt.h>


#define X10_LANG_ANY_H_NODEPS
#include <x10/lang/Any.h>
#undef X10_LANG_ANY_H_NODEPS
#define X10_LANG_ANY_H_NODEPS
#include <x10/lang/Any.h>
#undef X10_LANG_ANY_H_NODEPS
#define X10_LANG_DOUBLE_H_NODEPS
#include <x10/lang/Double.h>
#undef X10_LANG_DOUBLE_H_NODEPS
namespace x10 { namespace lang { 
class Double;
} } 
namespace x10 { namespace compiler { 
class Native;
} } 
namespace x10 { namespace compiler { 
class Inline;
} } 
namespace x10 { namespace lang { 
class Boolean;
} } 
namespace x10 { namespace lang { 
class Math;
} } 
namespace x10 { namespace lang { 
class String;
} } 
namespace x10 { namespace compiler { 
class NonEscaping;
} } 
namespace x10 { namespace lang { 
class Int;
} } 
namespace x10 { namespace lang { 

class Complex   {
    public:
    RTT_H_DECLS_STRUCT
    
    x10::lang::Complex* operator->() { return this; }
    
    static x10aux::itable_entry _itables[2];
    
    x10aux::itable_entry* _getITables() { return _itables; }
    
    static x10::lang::Any::itable<x10::lang::Complex > _itable_0;
    
    static x10aux::itable_entry _iboxitables[2];
    
    x10aux::itable_entry* _getIBoxITables() { return _iboxitables; }
    
    static x10::lang::Complex _alloc(){x10::lang::Complex t; return t; }
    
    x10_double FMGL(re);
    
    x10_double FMGL(im);
    
    static x10::lang::Complex FMGL(ZERO);
    
    static void FMGL(ZERO__do_init)();
    static void FMGL(ZERO__init)();
    static volatile x10aux::status FMGL(ZERO__status);
    static x10::lang::Complex FMGL(ZERO__get)();
    static x10aux::ref<x10::lang::Reference> FMGL(ZERO__deserialize)(x10aux::deserialization_buffer &buf);
    static const x10aux::serialization_id_t FMGL(ZERO__id);
    
    static x10::lang::Complex FMGL(ONE);
    
    static void FMGL(ONE__do_init)();
    static void FMGL(ONE__init)();
    static volatile x10aux::status FMGL(ONE__status);
    static x10::lang::Complex FMGL(ONE__get)();
    static x10aux::ref<x10::lang::Reference> FMGL(ONE__deserialize)(x10aux::deserialization_buffer &buf);
    static const x10aux::serialization_id_t FMGL(ONE__id);
    
    static x10::lang::Complex FMGL(I);
    
    static void FMGL(I__do_init)();
    static void FMGL(I__init)();
    static volatile x10aux::status FMGL(I__status);
    static x10::lang::Complex FMGL(I__get)();
    static x10aux::ref<x10::lang::Reference> FMGL(I__deserialize)(x10aux::deserialization_buffer &buf);
    static const x10aux::serialization_id_t FMGL(I__id);
    
    static x10::lang::Complex FMGL(INF);
    
    static void FMGL(INF__do_init)();
    static void FMGL(INF__init)();
    static volatile x10aux::status FMGL(INF__status);
    static x10::lang::Complex FMGL(INF__get)();
    static x10aux::ref<x10::lang::Reference> FMGL(INF__deserialize)(x10aux::deserialization_buffer &buf);
    static const x10aux::serialization_id_t FMGL(INF__id);
    
    static x10::lang::Complex FMGL(NaN);
    
    static void FMGL(NaN__do_init)();
    static void FMGL(NaN__init)();
    static volatile x10aux::status FMGL(NaN__status);
    static x10::lang::Complex FMGL(NaN__get)();
    static x10aux::ref<x10::lang::Reference> FMGL(NaN__deserialize)(x10aux::deserialization_buffer &buf);
    static const x10aux::serialization_id_t FMGL(NaN__id);
    
    void _constructor(x10_double real, x10_double imaginary) {
        
        //#line 52 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": polyglot.ast.Empty_c
        ;
        
        //#line 52 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.AssignPropertyCall_c
        
        //#line 53 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": Eval of x10.ast.X10FieldAssign_c
        (*this)->FMGL(re) = real;
        
        //#line 54 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": Eval of x10.ast.X10FieldAssign_c
        (*this)->FMGL(im) = imaginary;
    }
    static x10::lang::Complex _make(x10_double real, x10_double imaginary)
    {
        x10::lang::Complex this_; 
        this_->_constructor(real, imaginary);
        return this_;
    }
    
    x10::lang::Complex __plus(x10::lang::Complex that) {
        
        //#line 61 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return x10::lang::Complex::_make((((*this)->FMGL(re)) + (that->FMGL(re))),
                                         (((*this)->FMGL(im)) + (that->
                                                                   FMGL(im))));
        
    }
    static x10::lang::Complex __plus(x10_double x, x10::lang::Complex y) {
        
        //#line 67 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return y->x10::lang::Complex::__plus(x);
        
    }
    x10::lang::Complex __plus(x10_double that) {
        
        //#line 73 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return x10::lang::Complex::_make((((*this)->FMGL(re)) + (that)),
                                         (*this)->FMGL(im));
        
    }
    x10::lang::Complex __minus(x10::lang::Complex that) {
        
        //#line 80 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return x10::lang::Complex::_make((((*this)->FMGL(re)) - (that->
                                                                   FMGL(re))),
                                         (((*this)->FMGL(im)) - (that->
                                                                   FMGL(im))));
        
    }
    static x10::lang::Complex __minus(x10_double x, x10::lang::Complex y) {
        
        //#line 86 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return x10::lang::Complex::_make(((x) - (y->FMGL(re))), (-(y->
                                                                     FMGL(im))));
        
    }
    x10::lang::Complex __minus(x10_double that) {
        
        //#line 92 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return x10::lang::Complex::_make((((*this)->FMGL(re)) - (that)),
                                         (*this)->FMGL(im));
        
    }
    x10::lang::Complex __times(x10::lang::Complex that) {
        
        //#line 99 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return x10::lang::Complex::_make((((((*this)->FMGL(re)) * (that->
                                                                     FMGL(re)))) - ((((*this)->
                                                                                        FMGL(im)) * (that->
                                                                                                       FMGL(im))))),
                                         (((((*this)->FMGL(re)) * (that->
                                                                     FMGL(im)))) + ((((*this)->
                                                                                        FMGL(im)) * (that->
                                                                                                       FMGL(re))))));
        
    }
    static x10::lang::Complex __times(x10_double x, x10::lang::Complex y) {
        
        //#line 106 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return y->x10::lang::Complex::__times(x);
        
    }
    x10::lang::Complex __times(x10_double that) {
        
        //#line 112 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return x10::lang::Complex::_make((((*this)->FMGL(re)) * (that)),
                                         (((*this)->FMGL(im)) * (that)));
        
    }
    x10::lang::Complex __over(x10::lang::Complex that);
    static x10::lang::Complex __over(x10_double x, x10::lang::Complex y) {
        
        //#line 158 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return (x10::lang::Complex::_make(x, 0.0))->x10::lang::Complex::__over(
                 y);
        
    }
    x10::lang::Complex __over(x10_double that) {
        
        //#line 164 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return x10::lang::Complex::_make((((*this)->FMGL(re)) / (that)),
                                         (((*this)->FMGL(im)) / (that)));
        
    }
    x10::lang::Complex conjugate() {
        
        //#line 170 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return x10::lang::Complex::_make((*this)->FMGL(re),
                                         (-((*this)->FMGL(im))));
        
    }
    x10::lang::Complex __plus() {
        
        //#line 175 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return (*this);
        
    }
    x10::lang::Complex __minus() {
        
        //#line 180 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return (*this)->x10::lang::Complex::isNaN() ? (x10::lang::Complex::_make(x10aux::double_utils::fromLongBits(0x7ff8000000000000LL),x10aux::double_utils::fromLongBits(0x7ff8000000000000LL)))
          : (x10::lang::Complex::_make((-((*this)->FMGL(re))),
                                       (-((*this)->FMGL(im)))));
        
    }
    x10_double abs();
    x10_boolean isNaN() {
        
        //#line 215 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return x10aux::double_utils::isNaN((*this)->FMGL(re)) ||
        x10aux::double_utils::isNaN((*this)->FMGL(im));
        
    }
    x10_boolean isInfinite() {
        
        //#line 223 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return !((*this)->x10::lang::Complex::isNaN()) &&
        (x10aux::double_utils::isInfinite((*this)->FMGL(re)) ||
         x10aux::double_utils::isInfinite((*this)->FMGL(im)));
        
    }
    x10aux::ref<x10::lang::String> toString();
    x10aux::ref<x10::lang::String> typeName();
    x10_int hashCode();
    x10_boolean equals(x10aux::ref<x10::lang::Any> other);
    x10_boolean equals(x10::lang::Complex other) {
        
        //#line 22 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return (x10aux::struct_equals((*this)->FMGL(re), other->
                                                           FMGL(re))) &&
        (x10aux::struct_equals((*this)->FMGL(im), other->
                                                    FMGL(im)));
        
    }
    x10_boolean _struct_equals(x10aux::ref<x10::lang::Any> other);
    x10_boolean _struct_equals(x10::lang::Complex other) {
        
        //#line 22 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return (x10aux::struct_equals((*this)->FMGL(re), other->
                                                           FMGL(re))) &&
        (x10aux::struct_equals((*this)->FMGL(im), other->
                                                    FMGL(im)));
        
    }
    x10::lang::Complex x10__lang__Complex____x10__lang__Complex__this(
      ) {
        
        //#line 22 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Complex.x10": x10.ast.X10Return_c
        return (*this);
        
    }
    
    static void _serialize(x10::lang::Complex this_, x10aux::serialization_buffer& buf);
    
    static x10::lang::Complex _deserialize(x10aux::deserialization_buffer& buf) {
        x10::lang::Complex this_;
        this_->_deserialize_body(buf);
        return this_;
    }
    
    void _deserialize_body(x10aux::deserialization_buffer& buf);
    
};

} } 
#endif // X10_LANG_COMPLEX_H

namespace x10 { namespace lang { 
class Complex;
} } 

#ifndef X10_LANG_COMPLEX_H_NODEPS
#define X10_LANG_COMPLEX_H_NODEPS
#include <x10/lang/Any.h>
#include <x10/lang/Double.h>
#include <x10/compiler/Native.h>
#include <x10/compiler/Inline.h>
#include <x10/lang/Boolean.h>
#include <x10/lang/Math.h>
#include <x10/lang/String.h>
#include <x10/compiler/NonEscaping.h>
#include <x10/lang/Int.h>
#ifndef X10_LANG_COMPLEX_H_GENERICS
#define X10_LANG_COMPLEX_H_GENERICS
inline x10::lang::Complex x10::lang::Complex::FMGL(ZERO__get)() {
    if (FMGL(ZERO__status) != x10aux::INITIALIZED) {
        FMGL(ZERO__init)();
    }
    return x10::lang::Complex::FMGL(ZERO);
}

inline x10::lang::Complex x10::lang::Complex::FMGL(ONE__get)() {
    if (FMGL(ONE__status) != x10aux::INITIALIZED) {
        FMGL(ONE__init)();
    }
    return x10::lang::Complex::FMGL(ONE);
}

inline x10::lang::Complex x10::lang::Complex::FMGL(I__get)() {
    if (FMGL(I__status) != x10aux::INITIALIZED) {
        FMGL(I__init)();
    }
    return x10::lang::Complex::FMGL(I);
}

inline x10::lang::Complex x10::lang::Complex::FMGL(INF__get)() {
    if (FMGL(INF__status) != x10aux::INITIALIZED) {
        FMGL(INF__init)();
    }
    return x10::lang::Complex::FMGL(INF);
}

inline x10::lang::Complex x10::lang::Complex::FMGL(NaN__get)() {
    if (FMGL(NaN__status) != x10aux::INITIALIZED) {
        FMGL(NaN__init)();
    }
    return x10::lang::Complex::FMGL(NaN);
}

#endif // X10_LANG_COMPLEX_H_GENERICS
#endif // __X10_LANG_COMPLEX_H_NODEPS
