package Reldb.RelUserCode;

import org.reldb.rel.v0.types.*;
import org.reldb.rel.v0.types.builtin.*;
import org.reldb.rel.v0.types.userdefined.*;
import org.reldb.rel.v0.values.*;
import org.reldb.rel.v0.vm.Context;

public class op_LAST_INDEX_OF__CHARACTER_CHARACTER_INTEGER {
	private static final ValueInteger do_LAST_INDEX_OF(Context context, ValueCharacter s, ValueCharacter str, ValueInteger fromIndex) {
		
		//          Returns the index within this string of the last occurrence of 
		//          the specified substring, searching backward starting at the specified index.
			return ValueInteger.select(context.getGenerator(), s.stringValue().lastIndexOf(str.stringValue(), (int)fromIndex.longValue()));
	}

	public static final void execute(Context context) {
		ValueInteger p2 = (ValueInteger)context.pop();
		ValueCharacter p1 = (ValueCharacter)context.pop();
		ValueCharacter p0 = (ValueCharacter)context.pop();
		context.push(do_LAST_INDEX_OF(context, p0, p1, p2));
	}
}