<commit_before>/****************************************************************************

 This file is part of the GLC-lib library.
 Copyright (C) 2005-2008 <NAME> (<EMAIL>)
 Version 1.1.0, packaged on March, 2009.

 http://glc-lib.sourceforge.net

 GLC-lib 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 2 of the License, or
 (at your option) any later version.

 GLC-lib 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 GLC-lib; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

*****************************************************************************/

//! \file glc_collection.h interface for the GLC_Collection class.

#ifndef GLC_COLLECTION_H_
#define GLC_COLLECTION_H_


#include <QHash>
#include "glc_instance.h"
#include "../glc_enum.h"

class GLC_Material;
class GLC_Shader;
class GLC_Viewport;

//! Geometry hash table
typedef QHash< GLC_uint, GLC_Instance> CNodeMap;
typedef QHash< GLC_uint, GLC_Instance*> PointerNodeHash;

//! Hash of geometry hash table which use a shader
typedef QHash<GLuint, PointerNodeHash*> HashList;

//! Hash of shader group id
typedef QHash<GLC_uint, GLuint> ShaderGroup;

//////////////////////////////////////////////////////////////////////
//! \class GLC_Collection
/*! \brief GLC_Collection : GLC_Instance flat collection */

/*! An GLC_Collection contain  :
 * 		- A hash table containing GLC_Instance Class
 */
//////////////////////////////////////////////////////////////////////

class GLC_Collection
{

//////////////////////////////////////////////////////////////////////
/*! @name Constructor / Destructor */
//@{
//////////////////////////////////////////////////////////////////////
public:
	//! Default constructor
	GLC_Collection();

	//! Destructor
	/*! Delete all Node in the Hash Table and clear the Hash Table*/
	virtual ~GLC_Collection();

//@}

//////////////////////////////////////////////////////////////////////
/*! \name Get Functions*/
//@{
//////////////////////////////////////////////////////////////////////
public:

	//! Return true if the collection is empty
	inline bool isEmpty() const {return m_NodeMap.size() == 0;}

	//! Return the number of Node in the collection
	inline int size(void) const{return m_NodeMap.size();}

	//! Return all GLC_Instance from collection
	QList<GLC_Instance*> instancesHandle();

	//! Return all visible GLC_Instance from the collection
	QList<GLC_Instance*> visibleInstanceHandle();

	//! Return list of invisible instance name
	QList<QString> invisibleInstanceName() const;

	//! Return a GLC_Instance from collection
	/*! If the element is not found in collection a empty node is return*/
	GLC_Instance* instanceHandle(GLC_uint Key);

	//! Return the entire collection Bounding Box
	GLC_BoundingBox boundingBox(void);

	//! Return the number of Node in the selection Hash
	inline int selectionSize(void) const {return m_SelectedNodes.size();}

	//! Get the Hash table of Selected Nodes
	inline PointerNodeHash* selection() {return &m_SelectedNodes;}

	//! Return true if the Node is in the collection
	inline bool isInCollection(GLC_uint key) const {return m_NodeMap.contains(key);}

	//! Return true if the element is selected
	inline bool isSelected(GLC_uint key) const {return m_SelectedNodes.contains(key);}

	//! Return the showing state
	inline bool showState() const {return m_IsInShowSate;}

	//! Return the number of drawable objects
	int DrawableObjectsSize() const;

	//! Return the element shading group
	inline GLuint shadingGroup(GLC_uint key) const
	{ return m_ShaderGroup.value(key);}

	//! Return true if the element is in a shading group
	inline bool isInAShadingGroup(GLC_uint key) const
	{ return m_ShaderGroup.contains(key);}

	//! Return instances name from the specified shading group
	QList<QString> instanceNamesFromShadingGroup(GLuint) const;

	//! Return the number of used shading group
	int numberOfUsedShadingGroup() const;


//@}

//////////////////////////////////////////////////////////////////////
/*! \name Set Functions*/
//@{
//////////////////////////////////////////////////////////////////////<commit_msg>Refactoring<commit_after>/****************************************************************************

 This file is part of the GLC-lib library.
 Copyright (C) 2005-2008 <NAME> (<EMAIL>)
 Version 1.1.0, packaged on March, 2009.

 http://glc-lib.sourceforge.net

 GLC-lib 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 2 of the License, or
 (at your option) any later version.

 GLC-lib 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 GLC-lib; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

*****************************************************************************/

//! \file glc_collection.h interface for the GLC_Collection class.

#ifndef GLC_COLLECTION_H_
#define GLC_COLLECTION_H_


#include <QHash>
#include "glc_instance.h"
#include "../glc_enum.h"

class GLC_Material;
class GLC_Shader;
class GLC_Viewport;

//! Geometry hash table
typedef QHash< GLC_uint, GLC_Instance> CNodeMap;
typedef QHash< GLC_uint, GLC_Instance*> PointerNodeHash;

//! Hash of geometry hash table which use a shader
typedef QHash<GLuint, PointerNodeHash*> HashList;

//! Hash of shader group id
typedef QHash<GLC_uint, GLuint> ShaderGroup;

//////////////////////////////////////////////////////////////////////
//! \class GLC_Collection
/*! \brief GLC_Collection : GLC_Instance flat collection */

/*! An GLC_Collection contain  :
 * 		- A hash table containing GLC_Instance Class
 */
//////////////////////////////////////////////////////////////////////

class GLC_Collection
{

//////////////////////////////////////////////////////////////////////
/*! @name Constructor / Destructor */
//@{
//////////////////////////////////////////////////////////////////////
public:
	//! Default constructor
	GLC_Collection();

	//! Destructor
	/*! Delete all Node in the Hash Table and clear the Hash Table*/
	virtual ~GLC_Collection();

//@}

//////////////////////////////////////////////////////////////////////
/*! \name Get Functions*/
//@{
//////////////////////////////////////////////////////////////////////
public:

	//! Return true if the collection is empty
	inline bool isEmpty() const
	{return m_NodeMap.size() == 0;}

	//! Return the number of Node in the collection
	inline int size(void) const
	{return m_NodeMap.size();}

	//! Return all GLC_Instance from collection
	QList<GLC_Instance*> instancesHandle();

	//! Return all visible GLC_Instance from the collection
	QList<GLC_Instance*> visibleInstanceHandle();

	//! Return list of invisible instance name
	QList<QString> invisibleInstanceName() const;

	//! Return a GLC_Instance from collection
	/*! If the element is not found in collection a empty node is return*/
	GLC_Instance* instanceHandle(GLC_uint Key);

	//! Return the entire collection Bounding Box
	GLC_BoundingBox boundingBox(void);

	//! Return the number of Node in the selection Hash
	inline int selectionSize(void) const
	{return m_SelectedNodes.size();}

	//! Get the Hash table of Selected Nodes
	inline PointerNodeHash* selection()
	{return &m_SelectedNodes;}

	//! Return true if the Instance Id is in the collection
	inline bool contains(GLC_uint key) const
	{return m_NodeMap.contains(key);}

	//! Return true if the element is selected
	inline bool isSelected(GLC_uint key) const
	{return m_SelectedNodes.contains(key);}

	//! Return the showing state
	inline bool showState() const
	{return m_IsInShowSate;}

	//! Return the number of drawable objects
	int drawableObjectsSize() const;

	//! Return the element shading group
	inline GLuint shadingGroup(GLC_uint key) const
	{ return m_ShaderGroup.value(key);}

	//! Return true if the element is in a shading group
	inline bool isInAShadingGroup(GLC_uint key) const
	{ return m_ShaderGroup.contains(key);}

	//! Return instances name from the specified shading group
	QList<QString> instanceNamesFromShadingGroup(GLuint) const;

	//! Return the number of used shading group
	int numberOfUsedShadingGroup() const;


//@}

//////////////////////////////////////////////////////////////////////
/*! \name Set Functions*/
//@{
//////////////////////////////////////////////////////////////////////
{'fraction_non_alphanumeric': 0.23353624792473712, 'fraction_numerical': 0.006198118428334256, 'mean_word_length': 2.515953307392996, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4794495', 'n_tokens_mistral': 2434, 'n_tokens_neox': 2236, 'n_words': 888}