/* bounds.c generated by valac 0.56.0, the Vala compiler
 * generated from bounds.vala, do not modify */

#include "livechart.h"
#include <glib.h>
#include <float.h>
#include <math.h>
#include <glib-object.h>

enum  {
	LIVE_CHART_BOUNDS_0_PROPERTY,
	LIVE_CHART_BOUNDS_LOWER_PROPERTY,
	LIVE_CHART_BOUNDS_UPPER_PROPERTY,
	LIVE_CHART_BOUNDS_NUM_PROPERTIES
};
static GParamSpec* live_chart_bounds_properties[LIVE_CHART_BOUNDS_NUM_PROPERTIES];

struct _LiveChartBoundsPrivate {
	gdouble _lower;
	gdouble _upper;
};

static gint LiveChartBounds_private_offset;
static gpointer live_chart_bounds_parent_class = NULL;

static void live_chart_bounds_set_lower (LiveChartBounds* self,
                                  gdouble value);
static void live_chart_bounds_set_upper (LiveChartBounds* self,
                                  gdouble value);
static void live_chart_bounds_finalize (GObject * obj);
static GType live_chart_bounds_get_type_once (void);
static void _vala_live_chart_bounds_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_live_chart_bounds_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec);

static inline gpointer
live_chart_bounds_get_instance_private (LiveChartBounds* self)
{
	return G_STRUCT_MEMBER_P (self, LiveChartBounds_private_offset);
}

LiveChartBounds*
live_chart_bounds_construct (GType object_type,
                             gdouble lower,
                             gdouble upper)
{
	LiveChartBounds * self = NULL;
#line 12 "../src/bounds.vala"
	self = (LiveChartBounds*) g_object_new (object_type, NULL);
#line 13 "../src/bounds.vala"
	live_chart_bounds_set_lower (self, lower);
#line 14 "../src/bounds.vala"
	live_chart_bounds_set_upper (self, upper);
#line 12 "../src/bounds.vala"
	return self;
#line 62 "bounds.c"
}

LiveChartBounds*
live_chart_bounds_new (gdouble lower,
                       gdouble upper)
{
#line 12 "../src/bounds.vala"
	return live_chart_bounds_construct (LIVE_CHART_TYPE_BOUNDS, lower, upper);
#line 71 "bounds.c"
}

gboolean
live_chart_bounds_has_lower (LiveChartBounds* self)
{
	gdouble _tmp0_;
	gboolean result;
#line 17 "../src/bounds.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 18 "../src/bounds.vala"
	_tmp0_ = self->priv->_lower;
#line 18 "../src/bounds.vala"
	result = !isnan (_tmp0_);
#line 18 "../src/bounds.vala"
	return result;
#line 87 "bounds.c"
}

gboolean
live_chart_bounds_has_upper (LiveChartBounds* self)
{
	gdouble _tmp0_;
	gboolean result;
#line 21 "../src/bounds.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 22 "../src/bounds.vala"
	_tmp0_ = self->priv->_upper;
#line 22 "../src/bounds.vala"
	result = !isnan (_tmp0_);
#line 22 "../src/bounds.vala"
	return result;
#line 103 "bounds.c"
}

gboolean
live_chart_bounds_update (LiveChartBounds* self,
                          gdouble value)
{
	gboolean updated = FALSE;
	gdouble _tmp0_;
	gdouble _tmp1_;
	gboolean result;
#line 25 "../src/bounds.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 26 "../src/bounds.vala"
	updated = FALSE;
#line 27 "../src/bounds.vala"
	if (!live_chart_bounds_has_lower (self)) {
#line 28 "../src/bounds.vala"
		live_chart_bounds_set_lower (self, value);
#line 29 "../src/bounds.vala"
		updated = TRUE;
#line 124 "bounds.c"
	}
#line 32 "../src/bounds.vala"
	if (!live_chart_bounds_has_upper (self)) {
#line 33 "../src/bounds.vala"
		live_chart_bounds_set_upper (self, value);
#line 34 "../src/bounds.vala"
		updated = TRUE;
#line 132 "bounds.c"
	}
#line 36 "../src/bounds.vala"
	_tmp0_ = self->priv->_lower;
#line 36 "../src/bounds.vala"
	if (value < _tmp0_) {
#line 37 "../src/bounds.vala"
		live_chart_bounds_set_lower (self, value);
#line 38 "../src/bounds.vala"
		updated = TRUE;
#line 142 "bounds.c"
	}
#line 40 "../src/bounds.vala"
	_tmp1_ = self->priv->_upper;
#line 40 "../src/bounds.vala"
	if (value > _tmp1_) {
#line 41 "../src/bounds.vala"
		live_chart_bounds_set_upper (self, value);
#line 42 "../src/bounds.vala"
		updated = TRUE;
#line 152 "bounds.c"
	}
#line 44 "../src/bounds.vala"
	result = updated;
#line 44 "../src/bounds.vala"
	return result;
#line 158 "bounds.c"
}

gdouble
live_chart_bounds_get_lower (LiveChartBounds* self)
{
	gdouble result;
#line 6 "../src/bounds.vala"
	g_return_val_if_fail (self != NULL, 0.0);
#line 6 "../src/bounds.vala"
	result = self->priv->_lower;
#line 6 "../src/bounds.vala"
	return result;
#line 171 "bounds.c"
}

static void
live_chart_bounds_set_lower (LiveChartBounds* self,
                             gdouble value)
{
	gdouble old_value;
#line 6 "../src/bounds.vala"
	g_return_if_fail (self != NULL);
#line 6 "../src/bounds.vala"
	old_value = live_chart_bounds_get_lower (self);
#line 6 "../src/bounds.vala"
	if (old_value != value) {
#line 6 "../src/bounds.vala"
		self->priv->_lower = value;
#line 6 "../src/bounds.vala"
		g_object_notify_by_pspec ((GObject *) self, live_chart_bounds_properties[LIVE_CHART_BOUNDS_LOWER_PROPERTY]);
#line 189 "bounds.c"
	}
}

gdouble
live_chart_bounds_get_upper (LiveChartBounds* self)
{
	gdouble result;
#line 9 "../src/bounds.vala"
	g_return_val_if_fail (self != NULL, 0.0);
#line 9 "../src/bounds.vala"
	result = self->priv->_upper;
#line 9 "../src/bounds.vala"
	return result;
#line 203 "bounds.c"
}

static void
live_chart_bounds_set_upper (LiveChartBounds* self,
                             gdouble value)
{
	gdouble old_value;
#line 9 "../src/bounds.vala"
	g_return_if_fail (self != NULL);
#line 9 "../src/bounds.vala"
	old_value = live_chart_bounds_get_upper (self);
#line 9 "../src/bounds.vala"
	if (old_value != value) {
#line 9 "../src/bounds.vala"
		self->priv->_upper = value;
#line 9 "../src/bounds.vala"
		g_object_notify_by_pspec ((GObject *) self, live_chart_bounds_properties[LIVE_CHART_BOUNDS_UPPER_PROPERTY]);
#line 221 "bounds.c"
	}
}

static void
live_chart_bounds_class_init (LiveChartBoundsClass * klass,
                              gpointer klass_data)
{
#line 3 "../src/bounds.vala"
	live_chart_bounds_parent_class = g_type_class_peek_parent (klass);
#line 3 "../src/bounds.vala"
	g_type_class_adjust_private_offset (klass, &LiveChartBounds_private_offset);
#line 3 "../src/bounds.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_live_chart_bounds_get_property;
#line 3 "../src/bounds.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_live_chart_bounds_set_property;
#line 3 "../src/bounds.vala"
	G_OBJECT_CLASS (klass)->finalize = live_chart_bounds_finalize;
#line 3 "../src/bounds.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_BOUNDS_LOWER_PROPERTY, live_chart_bounds_properties[LIVE_CHART_BOUNDS_LOWER_PROPERTY] = g_param_spec_double ("lower", "lower", "lower", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
#line 3 "../src/bounds.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_BOUNDS_UPPER_PROPERTY, live_chart_bounds_properties[LIVE_CHART_BOUNDS_UPPER_PROPERTY] = g_param_spec_double ("upper", "upper", "upper", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
#line 243 "bounds.c"
}

static void
live_chart_bounds_instance_init (LiveChartBounds * self,
                                 gpointer klass)
{
#line 3 "../src/bounds.vala"
	self->priv = live_chart_bounds_get_instance_private (self);
#line 252 "bounds.c"
}

static void
live_chart_bounds_finalize (GObject * obj)
{
	LiveChartBounds * self;
#line 3 "../src/bounds.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_BOUNDS, LiveChartBounds);
#line 3 "../src/bounds.vala"
	G_OBJECT_CLASS (live_chart_bounds_parent_class)->finalize (obj);
#line 263 "bounds.c"
}

static GType
live_chart_bounds_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LiveChartBoundsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_bounds_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartBounds), 0, (GInstanceInitFunc) live_chart_bounds_instance_init, NULL };
	GType live_chart_bounds_type_id;
	live_chart_bounds_type_id = g_type_register_static (G_TYPE_OBJECT, "LiveChartBounds", &g_define_type_info, 0);
	LiveChartBounds_private_offset = g_type_add_instance_private (live_chart_bounds_type_id, sizeof (LiveChartBoundsPrivate));
	return live_chart_bounds_type_id;
}

GType
live_chart_bounds_get_type (void)
{
	static volatile gsize live_chart_bounds_type_id__once = 0;
	if (g_once_init_enter (&live_chart_bounds_type_id__once)) {
		GType live_chart_bounds_type_id;
		live_chart_bounds_type_id = live_chart_bounds_get_type_once ();
		g_once_init_leave (&live_chart_bounds_type_id__once, live_chart_bounds_type_id);
	}
	return live_chart_bounds_type_id__once;
}

static void
_vala_live_chart_bounds_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	LiveChartBounds * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_BOUNDS, LiveChartBounds);
#line 3 "../src/bounds.vala"
	switch (property_id) {
#line 3 "../src/bounds.vala"
		case LIVE_CHART_BOUNDS_LOWER_PROPERTY:
#line 3 "../src/bounds.vala"
		g_value_set_double (value, live_chart_bounds_get_lower (self));
#line 3 "../src/bounds.vala"
		break;
#line 3 "../src/bounds.vala"
		case LIVE_CHART_BOUNDS_UPPER_PROPERTY:
#line 3 "../src/bounds.vala"
		g_value_set_double (value, live_chart_bounds_get_upper (self));
#line 3 "../src/bounds.vala"
		break;
#line 310 "bounds.c"
		default:
#line 3 "../src/bounds.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 3 "../src/bounds.vala"
		break;
#line 316 "bounds.c"
	}
}

static void
_vala_live_chart_bounds_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec)
{
	LiveChartBounds * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_BOUNDS, LiveChartBounds);
#line 3 "../src/bounds.vala"
	switch (property_id) {
#line 3 "../src/bounds.vala"
		case LIVE_CHART_BOUNDS_LOWER_PROPERTY:
#line 3 "../src/bounds.vala"
		live_chart_bounds_set_lower (self, g_value_get_double (value));
#line 3 "../src/bounds.vala"
		break;
#line 3 "../src/bounds.vala"
		case LIVE_CHART_BOUNDS_UPPER_PROPERTY:
#line 3 "../src/bounds.vala"
		live_chart_bounds_set_upper (self, g_value_get_double (value));
#line 3 "../src/bounds.vala"
		break;
#line 342 "bounds.c"
		default:
#line 3 "../src/bounds.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 3 "../src/bounds.vala"
		break;
#line 348 "bounds.c"
	}
}

