/* evaluation-budget.c generated by valac 0.56.19, the Vala compiler
 * generated from evaluation-budget.vala, do not modify */

/*
 * evaluation-budget.vala
 *
 * Copyright 2026 Christian Hergert <christian@sourceandstack.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include "calculator.h"
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	EVALUATION_BUDGET_0_PROPERTY,
	EVALUATION_BUDGET_DEADLINE_USEC_PROPERTY,
	EVALUATION_BUDGET_MAX_INPUT_CHARS_PROPERTY,
	EVALUATION_BUDGET_MAX_TOKENS_PROPERTY,
	EVALUATION_BUDGET_MAX_OUTPUT_DIGITS_PROPERTY,
	EVALUATION_BUDGET_MAX_STEPS_PROPERTY,
	EVALUATION_BUDGET_MAX_FACTORIAL_PROPERTY,
	EVALUATION_BUDGET_MAX_POWER_EXPONENT_PROPERTY,
	EVALUATION_BUDGET_MAX_MODULAR_EXPONENT_PROPERTY,
	EVALUATION_BUDGET_MAX_PERMUTATION_PROPERTY,
	EVALUATION_BUDGET_NUM_PROPERTIES
};
static GParamSpec* evaluation_budget_properties[EVALUATION_BUDGET_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _EvaluationBudgetPrivate {
	gint64 _deadline_usec;
	guint _max_input_chars;
	guint _max_tokens;
	guint _max_output_digits;
	guint64 _max_steps;
	guint64 _max_factorial;
	guint64 _max_power_exponent;
	guint64 _max_modular_exponent;
	guint64 _max_permutation;
	guint64 steps;
	gboolean is_cancelled;
};

static gint EvaluationBudget_private_offset;
static gpointer evaluation_budget_parent_class = NULL;

static void evaluation_budget_finalize (GObject * obj);
static GType evaluation_budget_get_type_once (void);
static void _vala_evaluation_budget_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_evaluation_budget_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec);

static inline gpointer
evaluation_budget_get_instance_private (EvaluationBudget* self)
{
	return G_STRUCT_MEMBER_P (self, EvaluationBudget_private_offset);
}

EvaluationBudget*
evaluation_budget_construct (GType object_type,
                             guint timeout_msec)
{
	EvaluationBudget * self = NULL;
	self = (EvaluationBudget*) g_object_new (object_type, NULL);
	if (timeout_msec > ((guint) 0)) {
		evaluation_budget_set_deadline_usec (self, g_get_monotonic_time () + (((gint64) timeout_msec) * 1000));
	}
	return self;
}

EvaluationBudget*
evaluation_budget_new (guint timeout_msec)
{
	return evaluation_budget_construct (TYPE_EVALUATION_BUDGET, timeout_msec);
}

EvaluationBudget*
evaluation_budget_construct_for_search (GType object_type,
                                        guint timeout_msec)
{
	EvaluationBudget * self = NULL;
	self = (EvaluationBudget*) evaluation_budget_construct (object_type, timeout_msec);
	evaluation_budget_set_max_input_chars (self, (guint) 256);
	evaluation_budget_set_max_tokens (self, (guint) 256);
	evaluation_budget_set_max_output_digits (self, (guint) 256);
	evaluation_budget_set_max_steps (self, (guint64) 100000);
	evaluation_budget_set_max_factorial (self, (guint64) 10000);
	evaluation_budget_set_max_power_exponent (self, (guint64) 100000);
	evaluation_budget_set_max_modular_exponent (self, (guint64) 1000000);
	evaluation_budget_set_max_permutation (self, (guint64) 10000);
	return self;
}

EvaluationBudget*
evaluation_budget_new_for_search (guint timeout_msec)
{
	return evaluation_budget_construct_for_search (TYPE_EVALUATION_BUDGET, timeout_msec);
}

void
evaluation_budget_cancel (EvaluationBudget* self)
{
	g_return_if_fail (self != NULL);
	self->priv->is_cancelled = TRUE;
}

gboolean
evaluation_budget_check (EvaluationBudget* self,
                         ErrorCode* error_code,
                         gchar** message)
{
	ErrorCode _vala_error_code = 0;
	gchar* _vala_message = NULL;
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_vala_error_code = ERROR_CODE_NONE;
	_g_free0 (_vala_message);
	_vala_message = NULL;
	if (self->priv->is_cancelled) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp1_ = FALSE;
		gint64 _tmp2_;
		_tmp2_ = self->priv->_deadline_usec;
		if (_tmp2_ > ((gint64) 0)) {
			gint64 _tmp3_;
			_tmp3_ = self->priv->_deadline_usec;
			_tmp1_ = g_get_monotonic_time () >= _tmp3_;
		} else {
			_tmp1_ = FALSE;
		}
		_tmp0_ = _tmp1_;
	}
	if (_tmp0_) {
		gchar* _tmp4_;
		_vala_error_code = ERROR_CODE_TIMED_OUT;
		_tmp4_ = g_strdup (_ ("Evaluation timed out"));
		_g_free0 (_vala_message);
		_vala_message = _tmp4_;
		result = FALSE;
		if (error_code) {
			*error_code = _vala_error_code;
		}
		if (message) {
			*message = _vala_message;
		} else {
			_g_free0 (_vala_message);
		}
		return result;
	}
	result = TRUE;
	if (error_code) {
		*error_code = _vala_error_code;
	}
	if (message) {
		*message = _vala_message;
	} else {
		_g_free0 (_vala_message);
	}
	return result;
}

gboolean
evaluation_budget_charge (EvaluationBudget* self,
                          guint64 count,
                          ErrorCode* error_code,
                          gchar** message)
{
	ErrorCode _vala_error_code = 0;
	gchar* _vala_message = NULL;
	ErrorCode _tmp0_ = 0;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_;
	guint64 _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp2_ = evaluation_budget_check (self, &_tmp0_, &_tmp1_);
	_vala_error_code = _tmp0_;
	_g_free0 (_vala_message);
	_vala_message = _tmp1_;
	if (!_tmp2_) {
		result = FALSE;
		if (error_code) {
			*error_code = _vala_error_code;
		}
		if (message) {
			*message = _vala_message;
		} else {
			_g_free0 (_vala_message);
		}
		return result;
	}
	_tmp3_ = self->priv->_max_steps;
	if (_tmp3_ > ((guint64) 0)) {
		guint64 _tmp4_;
		self->priv->steps = self->priv->steps + count;
		_tmp4_ = self->priv->_max_steps;
		if (self->priv->steps > _tmp4_) {
			gchar* _tmp5_;
			_vala_error_code = ERROR_CODE_RESOURCE_LIMIT;
			_tmp5_ = g_strdup (_ ("Evaluation requires too many steps"));
			_g_free0 (_vala_message);
			_vala_message = _tmp5_;
			result = FALSE;
			if (error_code) {
				*error_code = _vala_error_code;
			}
			if (message) {
				*message = _vala_message;
			} else {
				_g_free0 (_vala_message);
			}
			return result;
		}
	}
	result = TRUE;
	if (error_code) {
		*error_code = _vala_error_code;
	}
	if (message) {
		*message = _vala_message;
	} else {
		_g_free0 (_vala_message);
	}
	return result;
}

gboolean
evaluation_budget_check_input (EvaluationBudget* self,
                               const gchar* input,
                               ErrorCode* error_code,
                               gchar** message)
{
	ErrorCode _vala_error_code = 0;
	gchar* _vala_message = NULL;
	ErrorCode _tmp0_ = 0;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_;
	gboolean _tmp3_ = FALSE;
	guint _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (input != NULL, FALSE);
	_tmp2_ = evaluation_budget_check (self, &_tmp0_, &_tmp1_);
	_vala_error_code = _tmp0_;
	_g_free0 (_vala_message);
	_vala_message = _tmp1_;
	if (!_tmp2_) {
		result = FALSE;
		if (error_code) {
			*error_code = _vala_error_code;
		}
		if (message) {
			*message = _vala_message;
		} else {
			_g_free0 (_vala_message);
		}
		return result;
	}
	_tmp4_ = self->priv->_max_input_chars;
	if (_tmp4_ > ((guint) 0)) {
		guint _tmp5_;
		_tmp5_ = self->priv->_max_input_chars;
		_tmp3_ = ((guint) g_utf8_strlen (input, (gssize) -1)) > _tmp5_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		gchar* _tmp6_;
		_vala_error_code = ERROR_CODE_RESOURCE_LIMIT;
		_tmp6_ = g_strdup (_ ("Expression is too long"));
		_g_free0 (_vala_message);
		_vala_message = _tmp6_;
		result = FALSE;
		if (error_code) {
			*error_code = _vala_error_code;
		}
		if (message) {
			*message = _vala_message;
		} else {
			_g_free0 (_vala_message);
		}
		return result;
	}
	result = TRUE;
	if (error_code) {
		*error_code = _vala_error_code;
	}
	if (message) {
		*message = _vala_message;
	} else {
		_g_free0 (_vala_message);
	}
	return result;
}

gboolean
evaluation_budget_check_tokens (EvaluationBudget* self,
                                guint tokens,
                                ErrorCode* error_code,
                                gchar** message)
{
	ErrorCode _vala_error_code = 0;
	gchar* _vala_message = NULL;
	ErrorCode _tmp0_ = 0;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_;
	gboolean _tmp3_ = FALSE;
	guint _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp2_ = evaluation_budget_check (self, &_tmp0_, &_tmp1_);
	_vala_error_code = _tmp0_;
	_g_free0 (_vala_message);
	_vala_message = _tmp1_;
	if (!_tmp2_) {
		result = FALSE;
		if (error_code) {
			*error_code = _vala_error_code;
		}
		if (message) {
			*message = _vala_message;
		} else {
			_g_free0 (_vala_message);
		}
		return result;
	}
	_tmp4_ = self->priv->_max_tokens;
	if (_tmp4_ > ((guint) 0)) {
		guint _tmp5_;
		_tmp5_ = self->priv->_max_tokens;
		_tmp3_ = tokens > _tmp5_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		gchar* _tmp6_;
		_vala_error_code = ERROR_CODE_RESOURCE_LIMIT;
		_tmp6_ = g_strdup (_ ("Expression is too complex"));
		_g_free0 (_vala_message);
		_vala_message = _tmp6_;
		result = FALSE;
		if (error_code) {
			*error_code = _vala_error_code;
		}
		if (message) {
			*message = _vala_message;
		} else {
			_g_free0 (_vala_message);
		}
		return result;
	}
	result = TRUE;
	if (error_code) {
		*error_code = _vala_error_code;
	}
	if (message) {
		*message = _vala_message;
	} else {
		_g_free0 (_vala_message);
	}
	return result;
}

gboolean
evaluation_budget_check_output_digits (EvaluationBudget* self,
                                       guint digits,
                                       ErrorCode* error_code,
                                       gchar** message)
{
	ErrorCode _vala_error_code = 0;
	gchar* _vala_message = NULL;
	ErrorCode _tmp0_ = 0;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_;
	gboolean _tmp3_ = FALSE;
	guint _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp2_ = evaluation_budget_check (self, &_tmp0_, &_tmp1_);
	_vala_error_code = _tmp0_;
	_g_free0 (_vala_message);
	_vala_message = _tmp1_;
	if (!_tmp2_) {
		result = FALSE;
		if (error_code) {
			*error_code = _vala_error_code;
		}
		if (message) {
			*message = _vala_message;
		} else {
			_g_free0 (_vala_message);
		}
		return result;
	}
	_tmp4_ = self->priv->_max_output_digits;
	if (_tmp4_ > ((guint) 0)) {
		guint _tmp5_;
		_tmp5_ = self->priv->_max_output_digits;
		_tmp3_ = digits > _tmp5_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		gchar* _tmp6_;
		_vala_error_code = ERROR_CODE_RESOURCE_LIMIT;
		_tmp6_ = g_strdup (_ ("Result is too large"));
		_g_free0 (_vala_message);
		_vala_message = _tmp6_;
		result = FALSE;
		if (error_code) {
			*error_code = _vala_error_code;
		}
		if (message) {
			*message = _vala_message;
		} else {
			_g_free0 (_vala_message);
		}
		return result;
	}
	result = TRUE;
	if (error_code) {
		*error_code = _vala_error_code;
	}
	if (message) {
		*message = _vala_message;
	} else {
		_g_free0 (_vala_message);
	}
	return result;
}

gboolean
evaluation_budget_check_limit (EvaluationBudget* self,
                               guint64 value,
                               guint64 limit,
                               const gchar* limit_message,
                               ErrorCode* error_code,
                               gchar** message)
{
	ErrorCode _vala_error_code = 0;
	gchar* _vala_message = NULL;
	ErrorCode _tmp0_ = 0;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (limit_message != NULL, FALSE);
	_tmp2_ = evaluation_budget_check (self, &_tmp0_, &_tmp1_);
	_vala_error_code = _tmp0_;
	_g_free0 (_vala_message);
	_vala_message = _tmp1_;
	if (!_tmp2_) {
		result = FALSE;
		if (error_code) {
			*error_code = _vala_error_code;
		}
		if (message) {
			*message = _vala_message;
		} else {
			_g_free0 (_vala_message);
		}
		return result;
	}
	if (limit > ((guint64) 0)) {
		_tmp3_ = value > limit;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		gchar* _tmp4_;
		_vala_error_code = ERROR_CODE_RESOURCE_LIMIT;
		_tmp4_ = g_strdup (limit_message);
		_g_free0 (_vala_message);
		_vala_message = _tmp4_;
		result = FALSE;
		if (error_code) {
			*error_code = _vala_error_code;
		}
		if (message) {
			*message = _vala_message;
		} else {
			_g_free0 (_vala_message);
		}
		return result;
	}
	result = TRUE;
	if (error_code) {
		*error_code = _vala_error_code;
	}
	if (message) {
		*message = _vala_message;
	} else {
		_g_free0 (_vala_message);
	}
	return result;
}

gint64
evaluation_budget_get_deadline_usec (EvaluationBudget* self)
{
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	result = self->priv->_deadline_usec;
	return result;
}

void
evaluation_budget_set_deadline_usec (EvaluationBudget* self,
                                     gint64 value)
{
	gint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = evaluation_budget_get_deadline_usec (self);
	if (old_value != value) {
		self->priv->_deadline_usec = value;
		g_object_notify_by_pspec ((GObject *) self, evaluation_budget_properties[EVALUATION_BUDGET_DEADLINE_USEC_PROPERTY]);
	}
}

guint
evaluation_budget_get_max_input_chars (EvaluationBudget* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_max_input_chars;
	return result;
}

void
evaluation_budget_set_max_input_chars (EvaluationBudget* self,
                                       guint value)
{
	guint old_value;
	g_return_if_fail (self != NULL);
	old_value = evaluation_budget_get_max_input_chars (self);
	if (old_value != value) {
		self->priv->_max_input_chars = value;
		g_object_notify_by_pspec ((GObject *) self, evaluation_budget_properties[EVALUATION_BUDGET_MAX_INPUT_CHARS_PROPERTY]);
	}
}

guint
evaluation_budget_get_max_tokens (EvaluationBudget* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_max_tokens;
	return result;
}

void
evaluation_budget_set_max_tokens (EvaluationBudget* self,
                                  guint value)
{
	guint old_value;
	g_return_if_fail (self != NULL);
	old_value = evaluation_budget_get_max_tokens (self);
	if (old_value != value) {
		self->priv->_max_tokens = value;
		g_object_notify_by_pspec ((GObject *) self, evaluation_budget_properties[EVALUATION_BUDGET_MAX_TOKENS_PROPERTY]);
	}
}

guint
evaluation_budget_get_max_output_digits (EvaluationBudget* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_max_output_digits;
	return result;
}

void
evaluation_budget_set_max_output_digits (EvaluationBudget* self,
                                         guint value)
{
	guint old_value;
	g_return_if_fail (self != NULL);
	old_value = evaluation_budget_get_max_output_digits (self);
	if (old_value != value) {
		self->priv->_max_output_digits = value;
		g_object_notify_by_pspec ((GObject *) self, evaluation_budget_properties[EVALUATION_BUDGET_MAX_OUTPUT_DIGITS_PROPERTY]);
	}
}

guint64
evaluation_budget_get_max_steps (EvaluationBudget* self)
{
	guint64 result;
	g_return_val_if_fail (self != NULL, 0ULL);
	result = self->priv->_max_steps;
	return result;
}

void
evaluation_budget_set_max_steps (EvaluationBudget* self,
                                 guint64 value)
{
	guint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = evaluation_budget_get_max_steps (self);
	if (old_value != value) {
		self->priv->_max_steps = value;
		g_object_notify_by_pspec ((GObject *) self, evaluation_budget_properties[EVALUATION_BUDGET_MAX_STEPS_PROPERTY]);
	}
}

guint64
evaluation_budget_get_max_factorial (EvaluationBudget* self)
{
	guint64 result;
	g_return_val_if_fail (self != NULL, 0ULL);
	result = self->priv->_max_factorial;
	return result;
}

void
evaluation_budget_set_max_factorial (EvaluationBudget* self,
                                     guint64 value)
{
	guint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = evaluation_budget_get_max_factorial (self);
	if (old_value != value) {
		self->priv->_max_factorial = value;
		g_object_notify_by_pspec ((GObject *) self, evaluation_budget_properties[EVALUATION_BUDGET_MAX_FACTORIAL_PROPERTY]);
	}
}

guint64
evaluation_budget_get_max_power_exponent (EvaluationBudget* self)
{
	guint64 result;
	g_return_val_if_fail (self != NULL, 0ULL);
	result = self->priv->_max_power_exponent;
	return result;
}

void
evaluation_budget_set_max_power_exponent (EvaluationBudget* self,
                                          guint64 value)
{
	guint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = evaluation_budget_get_max_power_exponent (self);
	if (old_value != value) {
		self->priv->_max_power_exponent = value;
		g_object_notify_by_pspec ((GObject *) self, evaluation_budget_properties[EVALUATION_BUDGET_MAX_POWER_EXPONENT_PROPERTY]);
	}
}

guint64
evaluation_budget_get_max_modular_exponent (EvaluationBudget* self)
{
	guint64 result;
	g_return_val_if_fail (self != NULL, 0ULL);
	result = self->priv->_max_modular_exponent;
	return result;
}

void
evaluation_budget_set_max_modular_exponent (EvaluationBudget* self,
                                            guint64 value)
{
	guint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = evaluation_budget_get_max_modular_exponent (self);
	if (old_value != value) {
		self->priv->_max_modular_exponent = value;
		g_object_notify_by_pspec ((GObject *) self, evaluation_budget_properties[EVALUATION_BUDGET_MAX_MODULAR_EXPONENT_PROPERTY]);
	}
}

guint64
evaluation_budget_get_max_permutation (EvaluationBudget* self)
{
	guint64 result;
	g_return_val_if_fail (self != NULL, 0ULL);
	result = self->priv->_max_permutation;
	return result;
}

void
evaluation_budget_set_max_permutation (EvaluationBudget* self,
                                       guint64 value)
{
	guint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = evaluation_budget_get_max_permutation (self);
	if (old_value != value) {
		self->priv->_max_permutation = value;
		g_object_notify_by_pspec ((GObject *) self, evaluation_budget_properties[EVALUATION_BUDGET_MAX_PERMUTATION_PROPERTY]);
	}
}

static void
evaluation_budget_class_init (EvaluationBudgetClass * klass,
                              gpointer klass_data)
{
	evaluation_budget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &EvaluationBudget_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_evaluation_budget_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_evaluation_budget_set_property;
	G_OBJECT_CLASS (klass)->finalize = evaluation_budget_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), EVALUATION_BUDGET_DEADLINE_USEC_PROPERTY, evaluation_budget_properties[EVALUATION_BUDGET_DEADLINE_USEC_PROPERTY] = g_param_spec_int64 ("deadline-usec", "deadline-usec", "deadline-usec", G_MININT64, G_MAXINT64, (gint64) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), EVALUATION_BUDGET_MAX_INPUT_CHARS_PROPERTY, evaluation_budget_properties[EVALUATION_BUDGET_MAX_INPUT_CHARS_PROPERTY] = g_param_spec_uint ("max-input-chars", "max-input-chars", "max-input-chars", 0, G_MAXUINT, (guint) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), EVALUATION_BUDGET_MAX_TOKENS_PROPERTY, evaluation_budget_properties[EVALUATION_BUDGET_MAX_TOKENS_PROPERTY] = g_param_spec_uint ("max-tokens", "max-tokens", "max-tokens", 0, G_MAXUINT, (guint) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), EVALUATION_BUDGET_MAX_OUTPUT_DIGITS_PROPERTY, evaluation_budget_properties[EVALUATION_BUDGET_MAX_OUTPUT_DIGITS_PROPERTY] = g_param_spec_uint ("max-output-digits", "max-output-digits", "max-output-digits", 0, G_MAXUINT, (guint) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), EVALUATION_BUDGET_MAX_STEPS_PROPERTY, evaluation_budget_properties[EVALUATION_BUDGET_MAX_STEPS_PROPERTY] = g_param_spec_uint64 ("max-steps", "max-steps", "max-steps", 0, G_MAXUINT64, (guint64) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), EVALUATION_BUDGET_MAX_FACTORIAL_PROPERTY, evaluation_budget_properties[EVALUATION_BUDGET_MAX_FACTORIAL_PROPERTY] = g_param_spec_uint64 ("max-factorial", "max-factorial", "max-factorial", 0, G_MAXUINT64, (guint64) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), EVALUATION_BUDGET_MAX_POWER_EXPONENT_PROPERTY, evaluation_budget_properties[EVALUATION_BUDGET_MAX_POWER_EXPONENT_PROPERTY] = g_param_spec_uint64 ("max-power-exponent", "max-power-exponent", "max-power-exponent", 0, G_MAXUINT64, (guint64) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), EVALUATION_BUDGET_MAX_MODULAR_EXPONENT_PROPERTY, evaluation_budget_properties[EVALUATION_BUDGET_MAX_MODULAR_EXPONENT_PROPERTY] = g_param_spec_uint64 ("max-modular-exponent", "max-modular-exponent", "max-modular-exponent", 0, G_MAXUINT64, (guint64) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), EVALUATION_BUDGET_MAX_PERMUTATION_PROPERTY, evaluation_budget_properties[EVALUATION_BUDGET_MAX_PERMUTATION_PROPERTY] = g_param_spec_uint64 ("max-permutation", "max-permutation", "max-permutation", 0, G_MAXUINT64, (guint64) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
evaluation_budget_instance_init (EvaluationBudget * self,
                                 gpointer klass)
{
	self->priv = evaluation_budget_get_instance_private (self);
	self->priv->_deadline_usec = (gint64) 0;
	self->priv->_max_input_chars = (guint) 0;
	self->priv->_max_tokens = (guint) 0;
	self->priv->_max_output_digits = (guint) 0;
	self->priv->_max_steps = (guint64) 0;
	self->priv->_max_factorial = (guint64) 0;
	self->priv->_max_power_exponent = (guint64) 0;
	self->priv->_max_modular_exponent = (guint64) 0;
	self->priv->_max_permutation = (guint64) 0;
}

static void
evaluation_budget_finalize (GObject * obj)
{
	EvaluationBudget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_EVALUATION_BUDGET, EvaluationBudget);
	G_OBJECT_CLASS (evaluation_budget_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
evaluation_budget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (EvaluationBudgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) evaluation_budget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EvaluationBudget), 0, (GInstanceInitFunc) evaluation_budget_instance_init, NULL };
	GType evaluation_budget_type_id;
	evaluation_budget_type_id = g_type_register_static (G_TYPE_OBJECT, "EvaluationBudget", &g_define_type_info, 0);
	EvaluationBudget_private_offset = g_type_add_instance_private (evaluation_budget_type_id, sizeof (EvaluationBudgetPrivate));
	return evaluation_budget_type_id;
}

GType
evaluation_budget_get_type (void)
{
	static gsize evaluation_budget_type_id__once = 0;
	if (g_once_init_enter (&evaluation_budget_type_id__once)) {
		GType evaluation_budget_type_id;
		evaluation_budget_type_id = evaluation_budget_get_type_once ();
		g_once_init_leave (&evaluation_budget_type_id__once, evaluation_budget_type_id);
	}
	return evaluation_budget_type_id__once;
}

static void
_vala_evaluation_budget_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	EvaluationBudget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_EVALUATION_BUDGET, EvaluationBudget);
	switch (property_id) {
		case EVALUATION_BUDGET_DEADLINE_USEC_PROPERTY:
		g_value_set_int64 (value, evaluation_budget_get_deadline_usec (self));
		break;
		case EVALUATION_BUDGET_MAX_INPUT_CHARS_PROPERTY:
		g_value_set_uint (value, evaluation_budget_get_max_input_chars (self));
		break;
		case EVALUATION_BUDGET_MAX_TOKENS_PROPERTY:
		g_value_set_uint (value, evaluation_budget_get_max_tokens (self));
		break;
		case EVALUATION_BUDGET_MAX_OUTPUT_DIGITS_PROPERTY:
		g_value_set_uint (value, evaluation_budget_get_max_output_digits (self));
		break;
		case EVALUATION_BUDGET_MAX_STEPS_PROPERTY:
		g_value_set_uint64 (value, evaluation_budget_get_max_steps (self));
		break;
		case EVALUATION_BUDGET_MAX_FACTORIAL_PROPERTY:
		g_value_set_uint64 (value, evaluation_budget_get_max_factorial (self));
		break;
		case EVALUATION_BUDGET_MAX_POWER_EXPONENT_PROPERTY:
		g_value_set_uint64 (value, evaluation_budget_get_max_power_exponent (self));
		break;
		case EVALUATION_BUDGET_MAX_MODULAR_EXPONENT_PROPERTY:
		g_value_set_uint64 (value, evaluation_budget_get_max_modular_exponent (self));
		break;
		case EVALUATION_BUDGET_MAX_PERMUTATION_PROPERTY:
		g_value_set_uint64 (value, evaluation_budget_get_max_permutation (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_evaluation_budget_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec)
{
	EvaluationBudget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_EVALUATION_BUDGET, EvaluationBudget);
	switch (property_id) {
		case EVALUATION_BUDGET_DEADLINE_USEC_PROPERTY:
		evaluation_budget_set_deadline_usec (self, g_value_get_int64 (value));
		break;
		case EVALUATION_BUDGET_MAX_INPUT_CHARS_PROPERTY:
		evaluation_budget_set_max_input_chars (self, g_value_get_uint (value));
		break;
		case EVALUATION_BUDGET_MAX_TOKENS_PROPERTY:
		evaluation_budget_set_max_tokens (self, g_value_get_uint (value));
		break;
		case EVALUATION_BUDGET_MAX_OUTPUT_DIGITS_PROPERTY:
		evaluation_budget_set_max_output_digits (self, g_value_get_uint (value));
		break;
		case EVALUATION_BUDGET_MAX_STEPS_PROPERTY:
		evaluation_budget_set_max_steps (self, g_value_get_uint64 (value));
		break;
		case EVALUATION_BUDGET_MAX_FACTORIAL_PROPERTY:
		evaluation_budget_set_max_factorial (self, g_value_get_uint64 (value));
		break;
		case EVALUATION_BUDGET_MAX_POWER_EXPONENT_PROPERTY:
		evaluation_budget_set_max_power_exponent (self, g_value_get_uint64 (value));
		break;
		case EVALUATION_BUDGET_MAX_MODULAR_EXPONENT_PROPERTY:
		evaluation_budget_set_max_modular_exponent (self, g_value_get_uint64 (value));
		break;
		case EVALUATION_BUDGET_MAX_PERMUTATION_PROPERTY:
		evaluation_budget_set_max_permutation (self, g_value_get_uint64 (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

