// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1366
globals
integer array MyInterface_nextFree
integer MyInterface_firstFree=0
integer MyInterface_maxIndex=0
integer array MyInterface_typeId
endglobals
native println takes string s returns nothing
native testSuccess takes nothing returns nothing
function initGlobals takes nothing returns nothing
	set MyInterface_firstFree = 0
	set MyInterface_maxIndex = 0
endfunction

function MyInterfaceAbstract_getSome takes integer this returns string
	return "AAbstract"
endfunction

function error takes string msg returns nothing
	call BJDebugMsg(msg + "\n" + "")
endfunction

function dispatch_MyInterfaceAbstract_Test_MyInterfaceAbstract_getSome takes integer this returns string
	local string Test_MyInterfaceAbstract_getSome_result
	if MyInterface_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling MyInterfaceAbstract.getSome")
		else
			call error("Called MyInterfaceAbstract.getSome on invalid object.")
		endif
	endif
	set Test_MyInterfaceAbstract_getSome_result = MyInterfaceAbstract_getSome(this)
	return Test_MyInterfaceAbstract_getSome_result
endfunction

function MyInterfaceAbstractImpl_getStr takes integer this returns string
	return dispatch_MyInterfaceAbstract_Test_MyInterfaceAbstract_getSome(this)
endfunction

function MyInterfaceImpl_getStr takes integer this returns string
	return "MyInterfaceImpl"
endfunction

function dispatch_MyInterface_Test_MyInterface_getStr takes integer this returns string
	local string Test_MyInterface_getStr_result
	if MyInterface_typeId[this] == 0 then
		if this == 0 then
			call error("Nullpointer exception when calling MyInterface.getStr")
		else
			call error("Called MyInterface.getStr on invalid object.")
		endif
	endif
	if MyInterface_typeId[this] <= 3 then
		set Test_MyInterface_getStr_result = MyInterfaceAbstractImpl_getStr(this)
	else
		set Test_MyInterface_getStr_result = MyInterfaceImpl_getStr(this)
	endif
	return Test_MyInterface_getStr_result
endfunction

function alloc_MyInterfaceAbstractImpl takes nothing returns integer
	local integer this
	if MyInterface_firstFree == 0 then
		if MyInterface_maxIndex < 32768 then
			set MyInterface_maxIndex = MyInterface_maxIndex + 1
			set this = MyInterface_maxIndex
			set MyInterface_typeId[this] = 3
		else
			call error("Out of memory: Could not create MyInterfaceAbstractImpl.")
			set this = 0
		endif
	else
		set MyInterface_firstFree = MyInterface_firstFree - 1
		set this = MyInterface_nextFree[MyInterface_firstFree]
		set MyInterface_typeId[this] = 3
	endif
	return this
endfunction

function MyInterfaceAbstractImpl_init takes integer this returns nothing
endfunction

function MyInterfaceAbstract_init takes integer this returns nothing
endfunction

function construct_MyInterfaceAbstract takes integer this returns nothing
	call MyInterfaceAbstract_init(this)
endfunction

function construct_MyInterfaceAbstractImpl takes integer this returns nothing
	call construct_MyInterfaceAbstract(this)
	call MyInterfaceAbstractImpl_init(this)
endfunction

function new_MyInterfaceAbstractImpl takes nothing returns integer
	local integer this = alloc_MyInterfaceAbstractImpl()
	call construct_MyInterfaceAbstractImpl(this)
	return this
endfunction

function alloc_MyInterfaceImpl takes nothing returns integer
	local integer this
	if MyInterface_firstFree == 0 then
		if MyInterface_maxIndex < 32768 then
			set MyInterface_maxIndex = MyInterface_maxIndex + 1
			set this = MyInterface_maxIndex
			set MyInterface_typeId[this] = 4
		else
			call error("Out of memory: Could not create MyInterfaceImpl.")
			set this = 0
		endif
	else
		set MyInterface_firstFree = MyInterface_firstFree - 1
		set this = MyInterface_nextFree[MyInterface_firstFree]
		set MyInterface_typeId[this] = 4
	endif
	return this
endfunction

function MyInterfaceImpl_init takes integer this returns nothing
endfunction

function construct_MyInterfaceImpl takes integer this returns nothing
	call MyInterfaceImpl_init(this)
endfunction

function new_MyInterfaceImpl takes nothing returns integer
	local integer this = alloc_MyInterfaceImpl()
	call construct_MyInterfaceImpl(this)
	return this
endfunction

function init_Test takes nothing returns nothing
	local integer a = new_MyInterfaceAbstractImpl()
	local integer b = new_MyInterfaceImpl()
	call println(dispatch_MyInterface_Test_MyInterface_getStr(a))
	call println(dispatch_MyInterface_Test_MyInterface_getStr(b))
	if dispatch_MyInterface_Test_MyInterface_getStr(a) == "AAbstract" and dispatch_MyInterface_Test_MyInterface_getStr(b) == "MyInterfaceImpl" then
		call testSuccess()
	endif
endfunction

function main takes nothing returns nothing
	call initGlobals()
	call init_Test()
endfunction

function config takes nothing returns nothing
endfunction