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

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/*
 * HashThreeMap.vala
 *
 * Copyright (C) 2016  Daniel Espinosa <esodan@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Daniel Espinosa <esodan@gmail.com>
 */

#include "gxml/gxml.h"
#include <glib.h>
#include <gee.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include "gxml.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  {
	GXML_HASH_THREE_MAP_0_PROPERTY,
	GXML_HASH_THREE_MAP_ATTRIBUTE_PRIMARY_KEY_PROPERTY,
	GXML_HASH_THREE_MAP_ATTRIBUTE_SECONDARY_KEY_PROPERTY,
	GXML_HASH_THREE_MAP_ATTRIBUTE_THIRD_KEY_PROPERTY,
	GXML_HASH_THREE_MAP_PRIMARY_KEYS_SET_PROPERTY,
	GXML_HASH_THREE_MAP_NUM_PROPERTIES
};
static GParamSpec* gxml_hash_three_map_properties[GXML_HASH_THREE_MAP_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

static gpointer gxml_hash_three_map_parent_class = NULL;
static GXmlThreeMapIface * gxml_hash_three_map_gxml_three_map_parent_iface = NULL;

static gboolean gxml_hash_three_map_real_has_primary_key (GXmlThreeMap* base,
                                                   const gchar* key);
static gboolean gxml_hash_three_map_real_has_secondary_key (GXmlThreeMap* base,
                                                     const gchar* pkey,
                                                     const gchar* key);
static gboolean gxml_hash_three_map_real_has_third_key (GXmlThreeMap* base,
                                                 const gchar* pkey,
                                                 const gchar* skey,
                                                 const gchar* key);
static gboolean gxml_hash_three_map_real_validate_append (GXmlBaseCollection* base,
                                                   gint index,
                                                   GXmlDomElement* element,
                                                   GError** error);
static void gxml_hash_three_map_real_clear (GXmlBaseCollection* base,
                                     GError** error);
static GXmlDomElement* gxml_hash_three_map_real_item (GXmlThreeMap* base,
                                               const gchar* primary_key,
                                               const gchar* secondary_key,
                                               const gchar* third_key);
static GeeSet* gxml_hash_three_map_real_secondary_keys_set (GXmlThreeMap* base,
                                                     const gchar* pkey);
static GeeSet* gxml_hash_three_map_real_third_keys_set (GXmlThreeMap* base,
                                                 const gchar* pkey,
                                                 const gchar* skey);
static void gxml_hash_three_map_finalize (GObject * obj);
static GType gxml_hash_three_map_get_type_once (void);
static void _vala_gxml_hash_three_map_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_gxml_hash_three_map_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const gchar*
gxml_hash_three_map_real_get_attribute_primary_key (GXmlThreeMap* base)
{
	const gchar* result;
	GXmlHashThreeMap* self;
	const gchar* _tmp0_;
	self = (GXmlHashThreeMap*) base;
	_tmp0_ = self->_attribute_primary_key;
	result = _tmp0_;
	return result;
}

static void
gxml_hash_three_map_real_set_attribute_primary_key (GXmlThreeMap* base,
                                                    const gchar* value)
{
	GXmlHashThreeMap* self;
	gchar* _tmp0_;
	self = (GXmlHashThreeMap*) base;
	_tmp0_ = g_strdup (value);
	_g_free0 (self->_attribute_primary_key);
	self->_attribute_primary_key = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, gxml_hash_three_map_properties[GXML_HASH_THREE_MAP_ATTRIBUTE_PRIMARY_KEY_PROPERTY]);
}

static const gchar*
gxml_hash_three_map_real_get_attribute_secondary_key (GXmlThreeMap* base)
{
	const gchar* result;
	GXmlHashThreeMap* self;
	const gchar* _tmp0_;
	self = (GXmlHashThreeMap*) base;
	_tmp0_ = self->_attribute_secondary_key;
	result = _tmp0_;
	return result;
}

static void
gxml_hash_three_map_real_set_attribute_secondary_key (GXmlThreeMap* base,
                                                      const gchar* value)
{
	GXmlHashThreeMap* self;
	gchar* _tmp0_;
	self = (GXmlHashThreeMap*) base;
	_tmp0_ = g_strdup (value);
	_g_free0 (self->_attribute_secondary_key);
	self->_attribute_secondary_key = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, gxml_hash_three_map_properties[GXML_HASH_THREE_MAP_ATTRIBUTE_SECONDARY_KEY_PROPERTY]);
}

static const gchar*
gxml_hash_three_map_real_get_attribute_third_key (GXmlThreeMap* base)
{
	const gchar* result;
	GXmlHashThreeMap* self;
	const gchar* _tmp0_;
	self = (GXmlHashThreeMap*) base;
	_tmp0_ = self->_attribute_third_key;
	result = _tmp0_;
	return result;
}

static void
gxml_hash_three_map_real_set_attribute_third_key (GXmlThreeMap* base,
                                                  const gchar* value)
{
	GXmlHashThreeMap* self;
	gchar* _tmp0_;
	self = (GXmlHashThreeMap*) base;
	_tmp0_ = g_strdup (value);
	_g_free0 (self->_attribute_third_key);
	self->_attribute_third_key = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, gxml_hash_three_map_properties[GXML_HASH_THREE_MAP_ATTRIBUTE_THIRD_KEY_PROPERTY]);
}

/**
   * Convenient function to initialize a {@link GXml.HashMap} collection, using
   * given element, items' type and name.
   */
void
gxml_hash_three_map_initialize_element_with_keys (GXmlHashThreeMap* self,
                                                  GXmlElement* element,
                                                  GType items_type,
                                                  const gchar* attribute_primary_key,
                                                  const gchar* attribute_secondary_key,
                                                  const gchar* attribute_third_key,
                                                  GError** error)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (element != NULL);
	g_return_if_fail (attribute_primary_key != NULL);
	g_return_if_fail (attribute_secondary_key != NULL);
	g_return_if_fail (attribute_third_key != NULL);
	gxml_collection_initialize ((GXmlCollection*) self, items_type, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	gxml_base_collection_initialize_element ((GXmlBaseCollection*) self, element, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup (attribute_primary_key);
	_g_free0 (self->_attribute_primary_key);
	self->_attribute_primary_key = _tmp0_;
	_tmp1_ = g_strdup (attribute_secondary_key);
	_g_free0 (self->_attribute_secondary_key);
	self->_attribute_secondary_key = _tmp1_;
	_tmp2_ = g_strdup (attribute_third_key);
	_g_free0 (self->_attribute_third_key);
	self->_attribute_third_key = _tmp2_;
}

/**
   * Convenient function to initialize a {@link GXml.HashMap} collection, using
   * given element, items' type and name.
   *
   * Using this method at construction time of derived classes.
   */
void
gxml_hash_three_map_initialize_with_keys (GXmlHashThreeMap* self,
                                          GType items_type,
                                          const gchar* attribute_primary_key,
                                          const gchar* attribute_secondary_key,
                                          const gchar* attribute_third_key,
                                          GError** error)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (attribute_primary_key != NULL);
	g_return_if_fail (attribute_secondary_key != NULL);
	g_return_if_fail (attribute_third_key != NULL);
	gxml_collection_initialize ((GXmlCollection*) self, items_type, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup (attribute_primary_key);
	_g_free0 (self->_attribute_primary_key);
	self->_attribute_primary_key = _tmp0_;
	_tmp1_ = g_strdup (attribute_secondary_key);
	_g_free0 (self->_attribute_secondary_key);
	self->_attribute_secondary_key = _tmp1_;
	_tmp2_ = g_strdup (attribute_third_key);
	_g_free0 (self->_attribute_third_key);
	self->_attribute_third_key = _tmp2_;
}

/**
   * Returns an {@link DomElement} in the collection using given string keys.
   */
GXmlDomElement*
gxml_hash_three_map_get (GXmlHashThreeMap* self,
                         const gchar* primary_key,
                         const gchar* secondary_key,
                         const gchar* third_key)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* ht = NULL;
	GeeHashMap* _tmp1_;
	gpointer _tmp2_;
	GeeHashMap* _tmp3_;
	GeeHashMap* _tmp4_;
	GeeHashMap* hte = NULL;
	GeeHashMap* _tmp5_;
	gpointer _tmp6_;
	GeeHashMap* _tmp7_;
	GeeHashMap* _tmp8_;
	gint i = 0;
	GeeHashMap* _tmp9_;
	gpointer _tmp10_;
	GXmlElement* _tmp11_;
	GXmlDomNodeList* _tmp12_;
	GXmlDomNodeList* _tmp13_;
	GXmlDomNodeList* _tmp14_;
	gpointer _tmp15_;
	GXmlDomNode* _tmp16_;
	GXmlDomElement* _tmp17_;
	GXmlDomElement* _tmp18_;
	GXmlDomElement* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (primary_key != NULL, NULL);
	g_return_val_if_fail (secondary_key != NULL, NULL);
	g_return_val_if_fail (third_key != NULL, NULL);
	_tmp0_ = self->_hashtable;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, primary_key)) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->_hashtable;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, primary_key);
	ht = (GeeHashMap*) _tmp2_;
	_tmp3_ = ht;
	if (_tmp3_ == NULL) {
		result = NULL;
		_g_object_unref0 (ht);
		return result;
	}
	_tmp4_ = ht;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp4_, secondary_key)) {
		result = NULL;
		_g_object_unref0 (ht);
		return result;
	}
	_tmp5_ = ht;
	_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp5_, secondary_key);
	hte = (GeeHashMap*) _tmp6_;
	_tmp7_ = hte;
	if (_tmp7_ == NULL) {
		result = NULL;
		_g_object_unref0 (hte);
		_g_object_unref0 (ht);
		return result;
	}
	_tmp8_ = hte;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp8_, third_key)) {
		result = NULL;
		_g_object_unref0 (hte);
		_g_object_unref0 (ht);
		return result;
	}
	_tmp9_ = hte;
	_tmp10_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp9_, third_key);
	i = (gint) ((gintptr) _tmp10_);
	_tmp11_ = ((GXmlBaseCollection*) self)->_element;
	_tmp12_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) _tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = _tmp13_;
	_tmp15_ = gee_list_get ((GeeList*) _tmp14_, i);
	_tmp16_ = (GXmlDomNode*) _tmp15_;
	_tmp17_ = GXML_IS_DOM_ELEMENT (_tmp16_) ? ((GXmlDomElement*) _tmp16_) : NULL;
	if (_tmp17_ == NULL) {
		_g_object_unref0 (_tmp16_);
	}
	_tmp18_ = _tmp17_;
	_g_object_unref0 (_tmp14_);
	result = _tmp18_;
	_g_object_unref0 (hte);
	_g_object_unref0 (ht);
	return result;
}

/**
   * Returns true if @key is used in collection as primary key.
   */
static gboolean
gxml_hash_three_map_real_has_primary_key (GXmlThreeMap* base,
                                          const gchar* key)
{
	GXmlHashThreeMap * self;
	GeeHashMap* _tmp0_;
	gboolean result;
	self = (GXmlHashThreeMap*) base;
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = self->_hashtable;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, key)) {
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

/**
   * Returns true if @key is used in collection as secondary key
   * with @pkey as primary.
   */
static gboolean
gxml_hash_three_map_real_has_secondary_key (GXmlThreeMap* base,
                                            const gchar* pkey,
                                            const gchar* key)
{
	GXmlHashThreeMap * self;
	GeeHashMap* _tmp0_;
	GeeHashMap* ht = NULL;
	GeeHashMap* _tmp1_;
	gpointer _tmp2_;
	GeeHashMap* _tmp3_;
	GeeHashMap* _tmp4_;
	gboolean result;
	self = (GXmlHashThreeMap*) base;
	g_return_val_if_fail (pkey != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = self->_hashtable;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, pkey)) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->_hashtable;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, pkey);
	ht = (GeeHashMap*) _tmp2_;
	_tmp3_ = ht;
	if (_tmp3_ == NULL) {
		result = FALSE;
		_g_object_unref0 (ht);
		return result;
	}
	_tmp4_ = ht;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp4_, key)) {
		result = TRUE;
		_g_object_unref0 (ht);
		return result;
	}
	result = FALSE;
	_g_object_unref0 (ht);
	return result;
}

/**
   * Returns true if @key is used in collection as third key with secondary key
   * and pkey as primary.
   */
static gboolean
gxml_hash_three_map_real_has_third_key (GXmlThreeMap* base,
                                        const gchar* pkey,
                                        const gchar* skey,
                                        const gchar* key)
{
	GXmlHashThreeMap * self;
	GeeHashMap* _tmp0_;
	GeeHashMap* ht = NULL;
	GeeHashMap* _tmp1_;
	gpointer _tmp2_;
	GeeHashMap* _tmp3_;
	GeeHashMap* hte = NULL;
	GeeHashMap* _tmp4_;
	gpointer _tmp5_;
	GeeHashMap* _tmp6_;
	GeeHashMap* _tmp7_;
	gboolean result;
	self = (GXmlHashThreeMap*) base;
	g_return_val_if_fail (pkey != NULL, FALSE);
	g_return_val_if_fail (skey != NULL, FALSE);
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = self->_hashtable;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, pkey)) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->_hashtable;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, pkey);
	ht = (GeeHashMap*) _tmp2_;
	_tmp3_ = ht;
	if (_tmp3_ == NULL) {
		result = FALSE;
		_g_object_unref0 (ht);
		return result;
	}
	_tmp4_ = ht;
	_tmp5_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp4_, skey);
	hte = (GeeHashMap*) _tmp5_;
	_tmp6_ = hte;
	if (_tmp6_ == NULL) {
		result = FALSE;
		_g_object_unref0 (hte);
		_g_object_unref0 (ht);
		return result;
	}
	_tmp7_ = hte;
	if (gee_abstract_map_has_key ((GeeAbstractMap*) _tmp7_, key)) {
		result = TRUE;
		_g_object_unref0 (hte);
		_g_object_unref0 (ht);
		return result;
	}
	result = FALSE;
	_g_object_unref0 (hte);
	_g_object_unref0 (ht);
	return result;
}

/**
   * Returns list of primary keys used in collection.
   */
GList*
gxml_hash_three_map_get_primary_keys (GXmlHashThreeMap* self)
{
	GList* l = NULL;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	l = NULL;
	{
		GeeIterator* _k_it = NULL;
		GeeHashMap* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->_hashtable;
		_tmp1_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_k_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			gchar* k = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			const gchar* _tmp9_;
			gchar* _tmp10_;
			_tmp6_ = _k_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _k_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			k = (gchar*) _tmp8_;
			_tmp9_ = k;
			_tmp10_ = g_strdup (_tmp9_);
			l = g_list_append (l, _tmp10_);
			_g_free0 (k);
		}
		_g_object_unref0 (_k_it);
	}
	result = l;
	return result;
}

/**
   * Returns list of secondary keys used in collection with pkey as primary key.
   */
GList*
gxml_hash_three_map_get_secondary_keys (GXmlHashThreeMap* self,
                                        const gchar* pkey)
{
	GList* l = NULL;
	GeeHashMap* _tmp0_;
	GeeHashMap* ht = NULL;
	GeeHashMap* _tmp1_;
	gpointer _tmp2_;
	GeeHashMap* _tmp3_;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (pkey != NULL, NULL);
	l = NULL;
	_tmp0_ = self->_hashtable;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, pkey)) {
		result = l;
		return result;
	}
	_tmp1_ = self->_hashtable;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, pkey);
	ht = (GeeHashMap*) _tmp2_;
	_tmp3_ = ht;
	if (_tmp3_ == NULL) {
		result = l;
		_g_object_unref0 (ht);
		return result;
	}
	{
		GeeIterator* _k_it = NULL;
		GeeHashMap* _tmp4_;
		GeeSet* _tmp5_;
		GeeSet* _tmp6_;
		GeeSet* _tmp7_;
		GeeIterator* _tmp8_;
		GeeIterator* _tmp9_;
		_tmp4_ = ht;
		_tmp5_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp8_ = gee_iterable_iterator ((GeeIterable*) _tmp7_);
		_tmp9_ = _tmp8_;
		_g_object_unref0 (_tmp7_);
		_k_it = _tmp9_;
		while (TRUE) {
			GeeIterator* _tmp10_;
			gchar* k = NULL;
			GeeIterator* _tmp11_;
			gpointer _tmp12_;
			const gchar* _tmp13_;
			gchar* _tmp14_;
			_tmp10_ = _k_it;
			if (!gee_iterator_next (_tmp10_)) {
				break;
			}
			_tmp11_ = _k_it;
			_tmp12_ = gee_iterator_get (_tmp11_);
			k = (gchar*) _tmp12_;
			_tmp13_ = k;
			_tmp14_ = g_strdup (_tmp13_);
			l = g_list_append (l, _tmp14_);
			_g_free0 (k);
		}
		_g_object_unref0 (_k_it);
	}
	result = l;
	_g_object_unref0 (ht);
	return result;
}

/**
   * Returns list of third keys used in collection with pkey as primary key
   * and skey as secondary key.
   */
GList*
gxml_hash_three_map_get_third_keys (GXmlHashThreeMap* self,
                                    const gchar* pkey,
                                    const gchar* skey)
{
	GList* l = NULL;
	GeeHashMap* _tmp0_;
	GeeHashMap* ht = NULL;
	GeeHashMap* _tmp1_;
	gpointer _tmp2_;
	GeeHashMap* _tmp3_;
	GeeHashMap* hte = NULL;
	GeeHashMap* _tmp4_;
	gpointer _tmp5_;
	GeeHashMap* _tmp6_;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (pkey != NULL, NULL);
	g_return_val_if_fail (skey != NULL, NULL);
	l = NULL;
	_tmp0_ = self->_hashtable;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, pkey)) {
		result = l;
		return result;
	}
	_tmp1_ = self->_hashtable;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, pkey);
	ht = (GeeHashMap*) _tmp2_;
	_tmp3_ = ht;
	if (_tmp3_ == NULL) {
		result = l;
		_g_object_unref0 (ht);
		return result;
	}
	_tmp4_ = ht;
	_tmp5_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp4_, skey);
	hte = (GeeHashMap*) _tmp5_;
	_tmp6_ = hte;
	if (_tmp6_ == NULL) {
		result = l;
		_g_object_unref0 (hte);
		_g_object_unref0 (ht);
		return result;
	}
	{
		GeeIterator* _k_it = NULL;
		GeeHashMap* _tmp7_;
		GeeSet* _tmp8_;
		GeeSet* _tmp9_;
		GeeSet* _tmp10_;
		GeeIterator* _tmp11_;
		GeeIterator* _tmp12_;
		_tmp7_ = hte;
		_tmp8_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = _tmp9_;
		_tmp11_ = gee_iterable_iterator ((GeeIterable*) _tmp10_);
		_tmp12_ = _tmp11_;
		_g_object_unref0 (_tmp10_);
		_k_it = _tmp12_;
		while (TRUE) {
			GeeIterator* _tmp13_;
			gchar* k = NULL;
			GeeIterator* _tmp14_;
			gpointer _tmp15_;
			const gchar* _tmp16_;
			gchar* _tmp17_;
			_tmp13_ = _k_it;
			if (!gee_iterator_next (_tmp13_)) {
				break;
			}
			_tmp14_ = _k_it;
			_tmp15_ = gee_iterator_get (_tmp14_);
			k = (gchar*) _tmp15_;
			_tmp16_ = k;
			_tmp17_ = g_strdup (_tmp16_);
			l = g_list_append (l, _tmp17_);
			_g_free0 (k);
		}
		_g_object_unref0 (_k_it);
	}
	result = l;
	_g_object_unref0 (hte);
	_g_object_unref0 (ht);
	return result;
}

/**
   * Validates if given element has a {@link attribute_primary_key},
   * {@link attribute_secondary_key} and
   * {@link attribute_third_key} set,
   * if so adds a new keys pointing to given index and returns true.
   *
   * Attribute should be a valid {@link DomElement} attribute or
   * a {@link GXml.Object} property identified using a nick with a '::' prefix.
   *
   * If there are more elements with same keys, they are kept as child nodes
   * but the one in collection will be the last one to be found.
   *
   * Return: false if element should not be added to collection.
   */
static gboolean
gxml_hash_three_map_real_validate_append (GXmlBaseCollection* base,
                                          gint index,
                                          GXmlDomElement* element,
                                          GError** error)
{
	GXmlHashThreeMap * self;
	gchar* pkey = NULL;
	gchar* skey = NULL;
	gchar* tkey = NULL;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp42_ = FALSE;
	gboolean _tmp43_ = FALSE;
	const gchar* _tmp44_;
	GeeHashMap* ht = NULL;
	GeeHashMap* _tmp47_;
	const gchar* _tmp48_;
	gpointer _tmp49_;
	GeeHashMap* _tmp50_;
	GeeHashMap* hte = NULL;
	GeeHashMap* _tmp52_;
	const gchar* _tmp53_;
	gpointer _tmp54_;
	GeeHashMap* _tmp55_;
	GeeHashMap* _tmp57_;
	const gchar* _tmp58_;
	GeeHashMap* _tmp62_;
	const gchar* _tmp63_;
	GeeHashMap* _tmp67_;
	const gchar* _tmp68_;
	gboolean result;
	self = (GXmlHashThreeMap*) base;
	g_return_val_if_fail (element != NULL, FALSE);
	if (!GXML_IS_ELEMENT (element)) {
		result = FALSE;
		return result;
	}
	pkey = NULL;
	skey = NULL;
	tkey = NULL;
	_tmp2_ = gxml_three_map_get_attribute_primary_key ((GXmlThreeMap*) self);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != NULL) {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = gxml_three_map_get_attribute_secondary_key ((GXmlThreeMap*) self);
		_tmp5_ = _tmp4_;
		_tmp1_ = _tmp5_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp6_ = gxml_three_map_get_attribute_third_key ((GXmlThreeMap*) self);
		_tmp7_ = _tmp6_;
		_tmp0_ = _tmp7_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		gboolean _tmp17_ = FALSE;
		gboolean _tmp18_ = FALSE;
		const gchar* _tmp19_;
		_tmp8_ = gxml_three_map_get_attribute_primary_key ((GXmlThreeMap*) self);
		_tmp9_ = _tmp8_;
		_tmp10_ = gxml_dom_element_get_attribute (G_TYPE_CHECK_INSTANCE_CAST (element, GXML_TYPE_DOM_ELEMENT, GXmlDomElement), _tmp9_);
		_g_free0 (pkey);
		pkey = _tmp10_;
		_tmp11_ = gxml_three_map_get_attribute_secondary_key ((GXmlThreeMap*) self);
		_tmp12_ = _tmp11_;
		_tmp13_ = gxml_dom_element_get_attribute (G_TYPE_CHECK_INSTANCE_CAST (element, GXML_TYPE_DOM_ELEMENT, GXmlDomElement), _tmp12_);
		_g_free0 (skey);
		skey = _tmp13_;
		_tmp14_ = gxml_three_map_get_attribute_third_key ((GXmlThreeMap*) self);
		_tmp15_ = _tmp14_;
		_tmp16_ = gxml_dom_element_get_attribute (G_TYPE_CHECK_INSTANCE_CAST (element, GXML_TYPE_DOM_ELEMENT, GXmlDomElement), _tmp15_);
		_g_free0 (tkey);
		tkey = _tmp16_;
		_tmp19_ = pkey;
		if (_tmp19_ == NULL) {
			_tmp18_ = TRUE;
		} else {
			const gchar* _tmp20_;
			_tmp20_ = skey;
			_tmp18_ = _tmp20_ == NULL;
		}
		if (_tmp18_) {
			_tmp17_ = TRUE;
		} else {
			const gchar* _tmp21_;
			_tmp21_ = tkey;
			_tmp17_ = _tmp21_ == NULL;
		}
		if (_tmp17_) {
			const gchar* _tmp22_;
			const gchar* _tmp23_;
			gchar* _tmp24_;
			gchar* _tmp25_;
			gchar* _tmp26_;
			const gchar* _tmp27_;
			const gchar* _tmp28_;
			gchar* _tmp29_;
			gchar* _tmp30_;
			gchar* _tmp31_;
			const gchar* _tmp32_;
			const gchar* _tmp33_;
			gchar* _tmp34_;
			gchar* _tmp35_;
			gchar* _tmp36_;
			_tmp22_ = gxml_three_map_get_attribute_primary_key ((GXmlThreeMap*) self);
			_tmp23_ = _tmp22_;
			_tmp24_ = g_utf8_strdown (_tmp23_, (gssize) -1);
			_tmp25_ = _tmp24_;
			_tmp26_ = gxml_dom_element_get_attribute (G_TYPE_CHECK_INSTANCE_CAST (element, GXML_TYPE_DOM_ELEMENT, GXmlDomElement), _tmp25_);
			_g_free0 (pkey);
			pkey = _tmp26_;
			_g_free0 (_tmp25_);
			_tmp27_ = gxml_three_map_get_attribute_secondary_key ((GXmlThreeMap*) self);
			_tmp28_ = _tmp27_;
			_tmp29_ = g_utf8_strdown (_tmp28_, (gssize) -1);
			_tmp30_ = _tmp29_;
			_tmp31_ = gxml_dom_element_get_attribute (G_TYPE_CHECK_INSTANCE_CAST (element, GXML_TYPE_DOM_ELEMENT, GXmlDomElement), _tmp30_);
			_g_free0 (skey);
			skey = _tmp31_;
			_g_free0 (_tmp30_);
			_tmp32_ = gxml_three_map_get_attribute_third_key ((GXmlThreeMap*) self);
			_tmp33_ = _tmp32_;
			_tmp34_ = g_utf8_strdown (_tmp33_, (gssize) -1);
			_tmp35_ = _tmp34_;
			_tmp36_ = gxml_dom_element_get_attribute (G_TYPE_CHECK_INSTANCE_CAST (element, GXML_TYPE_DOM_ELEMENT, GXmlDomElement), _tmp35_);
			_g_free0 (tkey);
			tkey = _tmp36_;
			_g_free0 (_tmp35_);
		}
	} else {
		GType _tmp37_;
		GType _tmp38_;
		_tmp37_ = gxml_collection_get_items_type ((GXmlCollection*) self);
		_tmp38_ = _tmp37_;
		if (g_type_is_a (_tmp38_, GXML_TYPE_MAPPEABLE_ELEMENT_THREE_KEY)) {
			gchar* _tmp39_;
			gchar* _tmp40_;
			gchar* _tmp41_;
			if (!GXML_IS_MAPPEABLE_ELEMENT_THREE_KEY (element)) {
				result = FALSE;
				_g_free0 (tkey);
				_g_free0 (skey);
				_g_free0 (pkey);
				return result;
			}
			_tmp39_ = gxml_mappeable_element_three_key_get_map_pkey (G_TYPE_CHECK_INSTANCE_CAST (element, GXML_TYPE_MAPPEABLE_ELEMENT_THREE_KEY, GXmlMappeableElementThreeKey));
			_g_free0 (pkey);
			pkey = _tmp39_;
			_tmp40_ = gxml_mappeable_element_three_key_get_map_skey (G_TYPE_CHECK_INSTANCE_CAST (element, GXML_TYPE_MAPPEABLE_ELEMENT_THREE_KEY, GXmlMappeableElementThreeKey));
			_g_free0 (skey);
			skey = _tmp40_;
			_tmp41_ = gxml_mappeable_element_three_key_get_map_tkey (G_TYPE_CHECK_INSTANCE_CAST (element, GXML_TYPE_MAPPEABLE_ELEMENT_THREE_KEY, GXmlMappeableElementThreeKey));
			_g_free0 (tkey);
			tkey = _tmp41_;
		}
	}
	_tmp44_ = pkey;
	if (_tmp44_ == NULL) {
		_tmp43_ = TRUE;
	} else {
		const gchar* _tmp45_;
		_tmp45_ = skey;
		_tmp43_ = _tmp45_ == NULL;
	}
	if (_tmp43_) {
		_tmp42_ = TRUE;
	} else {
		const gchar* _tmp46_;
		_tmp46_ = tkey;
		_tmp42_ = _tmp46_ == NULL;
	}
	if (_tmp42_) {
		result = FALSE;
		_g_free0 (tkey);
		_g_free0 (skey);
		_g_free0 (pkey);
		return result;
	}
	_tmp47_ = self->_hashtable;
	_tmp48_ = pkey;
	_tmp49_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp47_, _tmp48_);
	ht = (GeeHashMap*) _tmp49_;
	_tmp50_ = ht;
	if (_tmp50_ == NULL) {
		GeeHashMap* _tmp51_;
		_tmp51_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GEE_TYPE_HASH_MAP, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (ht);
		ht = _tmp51_;
	}
	_tmp52_ = ht;
	_tmp53_ = skey;
	_tmp54_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp52_, _tmp53_);
	hte = (GeeHashMap*) _tmp54_;
	_tmp55_ = hte;
	if (_tmp55_ == NULL) {
		GeeHashMap* _tmp56_;
		_tmp56_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_INT, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (hte);
		hte = _tmp56_;
	}
	_tmp57_ = self->_hashtable;
	_tmp58_ = pkey;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp57_, _tmp58_)) {
		GeeHashMap* _tmp59_;
		const gchar* _tmp60_;
		GeeHashMap* _tmp61_;
		_tmp59_ = self->_hashtable;
		_tmp60_ = pkey;
		_tmp61_ = ht;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp59_, _tmp60_, _tmp61_);
	}
	_tmp62_ = ht;
	_tmp63_ = skey;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp62_, _tmp63_)) {
		GeeHashMap* _tmp64_;
		const gchar* _tmp65_;
		GeeHashMap* _tmp66_;
		_tmp64_ = ht;
		_tmp65_ = skey;
		_tmp66_ = hte;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp64_, _tmp65_, _tmp66_);
	}
	_tmp67_ = hte;
	_tmp68_ = tkey;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp67_, _tmp68_, (gpointer) ((gintptr) index));
	result = TRUE;
	_g_object_unref0 (hte);
	_g_object_unref0 (ht);
	_g_free0 (tkey);
	_g_free0 (skey);
	_g_free0 (pkey);
	return result;
}

static void
gxml_hash_three_map_real_clear (GXmlBaseCollection* base,
                                GError** error)
{
	GXmlHashThreeMap * self;
	GeeHashMap* _tmp0_;
	self = (GXmlHashThreeMap*) base;
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GEE_TYPE_HASH_MAP, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->_hashtable);
	self->_hashtable = _tmp0_;
}

static GXmlDomElement*
gxml_hash_three_map_real_item (GXmlThreeMap* base,
                               const gchar* primary_key,
                               const gchar* secondary_key,
                               const gchar* third_key)
{
	GXmlHashThreeMap * self;
	GXmlDomElement* _tmp0_;
	GXmlDomElement* result;
	self = (GXmlHashThreeMap*) base;
	g_return_val_if_fail (primary_key != NULL, NULL);
	g_return_val_if_fail (secondary_key != NULL, NULL);
	g_return_val_if_fail (third_key != NULL, NULL);
	_tmp0_ = gxml_hash_three_map_get (self, primary_key, secondary_key, third_key);
	result = _tmp0_;
	return result;
}

static GeeSet*
gxml_hash_three_map_real_get_primary_keys_set (GXmlThreeMap* base)
{
	GeeSet* result;
	GXmlHashThreeMap* self;
	GeeHashSet* l = NULL;
	GeeHashSet* _tmp0_;
	self = (GXmlHashThreeMap*) base;
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	l = _tmp0_;
	{
		GeeIterator* _k_it = NULL;
		GeeHashMap* _tmp1_;
		GeeSet* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeIterator* _tmp5_;
		GeeIterator* _tmp6_;
		_tmp1_ = self->_hashtable;
		_tmp2_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_k_it = _tmp6_;
		while (TRUE) {
			GeeIterator* _tmp7_;
			gchar* k = NULL;
			GeeIterator* _tmp8_;
			gpointer _tmp9_;
			GeeHashSet* _tmp10_;
			const gchar* _tmp11_;
			_tmp7_ = _k_it;
			if (!gee_iterator_next (_tmp7_)) {
				break;
			}
			_tmp8_ = _k_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			k = (gchar*) _tmp9_;
			_tmp10_ = l;
			_tmp11_ = k;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, _tmp11_);
			_g_free0 (k);
		}
		_g_object_unref0 (_k_it);
	}
	result = (GeeSet*) l;
	return result;
}

static GeeSet*
gxml_hash_three_map_real_secondary_keys_set (GXmlThreeMap* base,
                                             const gchar* pkey)
{
	GXmlHashThreeMap * self;
	GeeHashSet* l = NULL;
	GeeHashSet* _tmp0_;
	GeeHashMap* _tmp1_;
	GeeHashMap* ht = NULL;
	GeeHashMap* _tmp2_;
	gpointer _tmp3_;
	GeeHashMap* _tmp4_;
	GeeSet* result;
	self = (GXmlHashThreeMap*) base;
	g_return_val_if_fail (pkey != NULL, NULL);
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	l = _tmp0_;
	_tmp1_ = self->_hashtable;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp1_, pkey)) {
		result = (GeeSet*) l;
		return result;
	}
	_tmp2_ = self->_hashtable;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, pkey);
	ht = (GeeHashMap*) _tmp3_;
	_tmp4_ = ht;
	if (_tmp4_ == NULL) {
		result = (GeeSet*) l;
		_g_object_unref0 (ht);
		return result;
	}
	{
		GeeIterator* _k_it = NULL;
		GeeHashMap* _tmp5_;
		GeeSet* _tmp6_;
		GeeSet* _tmp7_;
		GeeSet* _tmp8_;
		GeeIterator* _tmp9_;
		GeeIterator* _tmp10_;
		_tmp5_ = ht;
		_tmp6_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = _tmp7_;
		_tmp9_ = gee_iterable_iterator ((GeeIterable*) _tmp8_);
		_tmp10_ = _tmp9_;
		_g_object_unref0 (_tmp8_);
		_k_it = _tmp10_;
		while (TRUE) {
			GeeIterator* _tmp11_;
			gchar* k = NULL;
			GeeIterator* _tmp12_;
			gpointer _tmp13_;
			GeeHashSet* _tmp14_;
			const gchar* _tmp15_;
			_tmp11_ = _k_it;
			if (!gee_iterator_next (_tmp11_)) {
				break;
			}
			_tmp12_ = _k_it;
			_tmp13_ = gee_iterator_get (_tmp12_);
			k = (gchar*) _tmp13_;
			_tmp14_ = l;
			_tmp15_ = k;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp15_);
			_g_free0 (k);
		}
		_g_object_unref0 (_k_it);
	}
	result = (GeeSet*) l;
	_g_object_unref0 (ht);
	return result;
}

static GeeSet*
gxml_hash_three_map_real_third_keys_set (GXmlThreeMap* base,
                                         const gchar* pkey,
                                         const gchar* skey)
{
	GXmlHashThreeMap * self;
	GeeHashSet* l = NULL;
	GeeHashSet* _tmp0_;
	GeeHashMap* _tmp1_;
	GeeHashMap* ht = NULL;
	GeeHashMap* _tmp2_;
	gpointer _tmp3_;
	GeeHashMap* _tmp4_;
	GeeHashMap* hte = NULL;
	GeeHashMap* _tmp5_;
	gpointer _tmp6_;
	GeeHashMap* _tmp7_;
	GeeSet* result;
	self = (GXmlHashThreeMap*) base;
	g_return_val_if_fail (pkey != NULL, NULL);
	g_return_val_if_fail (skey != NULL, NULL);
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	l = _tmp0_;
	_tmp1_ = self->_hashtable;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp1_, pkey)) {
		result = (GeeSet*) l;
		return result;
	}
	_tmp2_ = self->_hashtable;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, pkey);
	ht = (GeeHashMap*) _tmp3_;
	_tmp4_ = ht;
	if (_tmp4_ == NULL) {
		result = (GeeSet*) l;
		_g_object_unref0 (ht);
		return result;
	}
	_tmp5_ = ht;
	_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp5_, skey);
	hte = (GeeHashMap*) _tmp6_;
	_tmp7_ = hte;
	if (_tmp7_ == NULL) {
		result = (GeeSet*) l;
		_g_object_unref0 (hte);
		_g_object_unref0 (ht);
		return result;
	}
	{
		GeeIterator* _k_it = NULL;
		GeeHashMap* _tmp8_;
		GeeSet* _tmp9_;
		GeeSet* _tmp10_;
		GeeSet* _tmp11_;
		GeeIterator* _tmp12_;
		GeeIterator* _tmp13_;
		_tmp8_ = hte;
		_tmp9_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = _tmp10_;
		_tmp12_ = gee_iterable_iterator ((GeeIterable*) _tmp11_);
		_tmp13_ = _tmp12_;
		_g_object_unref0 (_tmp11_);
		_k_it = _tmp13_;
		while (TRUE) {
			GeeIterator* _tmp14_;
			gchar* k = NULL;
			GeeIterator* _tmp15_;
			gpointer _tmp16_;
			GeeHashSet* _tmp17_;
			const gchar* _tmp18_;
			_tmp14_ = _k_it;
			if (!gee_iterator_next (_tmp14_)) {
				break;
			}
			_tmp15_ = _k_it;
			_tmp16_ = gee_iterator_get (_tmp15_);
			k = (gchar*) _tmp16_;
			_tmp17_ = l;
			_tmp18_ = k;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp17_, _tmp18_);
			_g_free0 (k);
		}
		_g_object_unref0 (_k_it);
	}
	result = (GeeSet*) l;
	_g_object_unref0 (hte);
	_g_object_unref0 (ht);
	return result;
}

GXmlHashThreeMap*
gxml_hash_three_map_construct (GType object_type)
{
	GXmlHashThreeMap * self = NULL;
	self = (GXmlHashThreeMap*) gxml_base_collection_construct (object_type);
	return self;
}

GXmlHashThreeMap*
gxml_hash_three_map_new (void)
{
	return gxml_hash_three_map_construct (GXML_TYPE_HASH_THREE_MAP);
}

static void
gxml_hash_three_map_class_init (GXmlHashThreeMapClass * klass,
                                gpointer klass_data)
{
	gxml_hash_three_map_parent_class = g_type_class_peek_parent (klass);
	((GXmlBaseCollectionClass *) klass)->validate_append = (gboolean (*) (GXmlBaseCollection*, gint, GXmlDomElement*, GError**)) gxml_hash_three_map_real_validate_append;
	((GXmlBaseCollectionClass *) klass)->clear = (void (*) (GXmlBaseCollection*, GError**)) gxml_hash_three_map_real_clear;
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_hash_three_map_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gxml_hash_three_map_set_property;
	G_OBJECT_CLASS (klass)->finalize = gxml_hash_three_map_finalize;
	/**
	   * An attribute's name in items to be added and used to retrieve elements
	   * as primary key.
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_HASH_THREE_MAP_ATTRIBUTE_PRIMARY_KEY_PROPERTY, gxml_hash_three_map_properties[GXML_HASH_THREE_MAP_ATTRIBUTE_PRIMARY_KEY_PROPERTY] = g_param_spec_string ("attribute-primary-key", "attribute-primary-key", "attribute-primary-key", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	/**
	   * An attribute's name in items to be added and used to retrieve elements
	   * as secondary key.
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_HASH_THREE_MAP_ATTRIBUTE_SECONDARY_KEY_PROPERTY, gxml_hash_three_map_properties[GXML_HASH_THREE_MAP_ATTRIBUTE_SECONDARY_KEY_PROPERTY] = g_param_spec_string ("attribute-secondary-key", "attribute-secondary-key", "attribute-secondary-key", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	/**
	   * An attribute's name in items to be added and used to retrieve elements
	   * as third key.
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_HASH_THREE_MAP_ATTRIBUTE_THIRD_KEY_PROPERTY, gxml_hash_three_map_properties[GXML_HASH_THREE_MAP_ATTRIBUTE_THIRD_KEY_PROPERTY] = g_param_spec_string ("attribute-third-key", "attribute-third-key", "attribute-third-key", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_HASH_THREE_MAP_PRIMARY_KEYS_SET_PROPERTY, gxml_hash_three_map_properties[GXML_HASH_THREE_MAP_PRIMARY_KEYS_SET_PROPERTY] = g_param_spec_object ("primary-keys-set", "primary-keys-set", "primary-keys-set", GEE_TYPE_SET, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gxml_hash_three_map_gxml_three_map_interface_init (GXmlThreeMapIface * iface,
                                                   gpointer iface_data)
{
	gxml_hash_three_map_gxml_three_map_parent_iface = g_type_interface_peek_parent (iface);
	iface->has_primary_key = (gboolean (*) (GXmlThreeMap*, const gchar*)) gxml_hash_three_map_real_has_primary_key;
	iface->has_secondary_key = (gboolean (*) (GXmlThreeMap*, const gchar*, const gchar*)) gxml_hash_three_map_real_has_secondary_key;
	iface->has_third_key = (gboolean (*) (GXmlThreeMap*, const gchar*, const gchar*, const gchar*)) gxml_hash_three_map_real_has_third_key;
	iface->item = (GXmlDomElement* (*) (GXmlThreeMap*, const gchar*, const gchar*, const gchar*)) gxml_hash_three_map_real_item;
	iface->secondary_keys_set = (GeeSet* (*) (GXmlThreeMap*, const gchar*)) gxml_hash_three_map_real_secondary_keys_set;
	iface->third_keys_set = (GeeSet* (*) (GXmlThreeMap*, const gchar*, const gchar*)) gxml_hash_three_map_real_third_keys_set;
	iface->get_attribute_primary_key = gxml_hash_three_map_real_get_attribute_primary_key;
	iface->set_attribute_primary_key = gxml_hash_three_map_real_set_attribute_primary_key;
	iface->get_attribute_secondary_key = gxml_hash_three_map_real_get_attribute_secondary_key;
	iface->set_attribute_secondary_key = gxml_hash_three_map_real_set_attribute_secondary_key;
	iface->get_attribute_third_key = gxml_hash_three_map_real_get_attribute_third_key;
	iface->set_attribute_third_key = gxml_hash_three_map_real_set_attribute_third_key;
	iface->get_primary_keys_set = gxml_hash_three_map_real_get_primary_keys_set;
}

static void
gxml_hash_three_map_instance_init (GXmlHashThreeMap * self,
                                   gpointer klass)
{
	GeeHashMap* _tmp0_;
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GEE_TYPE_HASH_MAP, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->_hashtable = _tmp0_;
}

static void
gxml_hash_three_map_finalize (GObject * obj)
{
	GXmlHashThreeMap * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_HASH_THREE_MAP, GXmlHashThreeMap);
	_g_object_unref0 (self->_hashtable);
	_g_free0 (self->_attribute_primary_key);
	_g_free0 (self->_attribute_secondary_key);
	_g_free0 (self->_attribute_third_key);
	G_OBJECT_CLASS (gxml_hash_three_map_parent_class)->finalize (obj);
}

/**
 * A class implementing {@link Collection} to store references to
 * child {@link DomElement} of {@link Collection.element}, using three attributes in
 * items as primary, secondary tertiary keys or {@link MappeableElementThreeKey.get_map_pkey},
 * {@link MappeableElementThreeKey.get_map_skey}
 * and {@link MappeableElementThreeKey.get_map_tkey}
 * methods if {@link MappeableElementThreeKey} are implemented
 * by items to be added. All keys should be defined in node, otherwise
 * it is not added; but keeps it as a child node of actual
 * {@link Collection.element}.
 *
 * If {@link GXml.Element} to be added is of type {@link Collection.items_type}
 * and implements {@link MappeableElementThreeKey}, you should set
 * {@link attribute_primary_key}, {@link attribute_secondary_key}
 * and  {@link attribute_third_key}
 * to null in order to use returned value of {@link MappeableElementThreeKey.get_map_pkey},
 * {@link MappeableElementThreeKey.get_map_skey}
 * and {@link MappeableElementThreeKey.get_map_tkey}
 * as keys.
 *
 * {{{
 *   public class YourObject : GXml.Element, MappeableElementThreeKey {
 *    [Description (nick="::Name")]
 *    public string name { get; set; }
 *    public string code { get; set; }
 *    public string category { get; set; }
 *    public string get_map_primary_key () { return code; }
 *    public string get_map_secondary_key () { return name; }
 *    public string get_map_third_key () { return category; }
 *   }
 *   public class YourList : HashThreeMap {
 *    construct {
 *      try { initialize_with (typeof (YourObject)); }
 *      catch (GLib.Error e) {
 *        warning ("Initialization error for collection type: %s : %s"
 *             .printf (get_type ().name(), e.message));
 *      }
 *    }
 *   }
 * }}}
 */
static GType
gxml_hash_three_map_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlHashThreeMapClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_hash_three_map_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlHashThreeMap), 0, (GInstanceInitFunc) gxml_hash_three_map_instance_init, NULL };
	static const GInterfaceInfo gxml_three_map_info = { (GInterfaceInitFunc) gxml_hash_three_map_gxml_three_map_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_hash_three_map_type_id;
	gxml_hash_three_map_type_id = g_type_register_static (GXML_TYPE_BASE_COLLECTION, "GXmlHashThreeMap", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_hash_three_map_type_id, GXML_TYPE_THREE_MAP, &gxml_three_map_info);
	return gxml_hash_three_map_type_id;
}

GType
gxml_hash_three_map_get_type (void)
{
	static volatile gsize gxml_hash_three_map_type_id__once = 0;
	if (g_once_init_enter (&gxml_hash_three_map_type_id__once)) {
		GType gxml_hash_three_map_type_id;
		gxml_hash_three_map_type_id = gxml_hash_three_map_get_type_once ();
		g_once_init_leave (&gxml_hash_three_map_type_id__once, gxml_hash_three_map_type_id);
	}
	return gxml_hash_three_map_type_id__once;
}

static void
_vala_gxml_hash_three_map_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	GXmlHashThreeMap * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_HASH_THREE_MAP, GXmlHashThreeMap);
	switch (property_id) {
		case GXML_HASH_THREE_MAP_ATTRIBUTE_PRIMARY_KEY_PROPERTY:
		g_value_set_string (value, gxml_three_map_get_attribute_primary_key ((GXmlThreeMap*) self));
		break;
		case GXML_HASH_THREE_MAP_ATTRIBUTE_SECONDARY_KEY_PROPERTY:
		g_value_set_string (value, gxml_three_map_get_attribute_secondary_key ((GXmlThreeMap*) self));
		break;
		case GXML_HASH_THREE_MAP_ATTRIBUTE_THIRD_KEY_PROPERTY:
		g_value_set_string (value, gxml_three_map_get_attribute_third_key ((GXmlThreeMap*) self));
		break;
		case GXML_HASH_THREE_MAP_PRIMARY_KEYS_SET_PROPERTY:
		g_value_take_object (value, gxml_three_map_get_primary_keys_set ((GXmlThreeMap*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gxml_hash_three_map_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	GXmlHashThreeMap * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_HASH_THREE_MAP, GXmlHashThreeMap);
	switch (property_id) {
		case GXML_HASH_THREE_MAP_ATTRIBUTE_PRIMARY_KEY_PROPERTY:
		gxml_three_map_set_attribute_primary_key ((GXmlThreeMap*) self, g_value_get_string (value));
		break;
		case GXML_HASH_THREE_MAP_ATTRIBUTE_SECONDARY_KEY_PROPERTY:
		gxml_three_map_set_attribute_secondary_key ((GXmlThreeMap*) self, g_value_get_string (value));
		break;
		case GXML_HASH_THREE_MAP_ATTRIBUTE_THIRD_KEY_PROPERTY:
		gxml_three_map_set_attribute_third_key ((GXmlThreeMap*) self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

