<commit_before>/*
    Uiml.Net: a .Net UIML renderer (http://lumumba.luc.ac.be/kris/research/uiml.net)

	 Copyright (C) 2003  <NAME> (<EMAIL>)
	                     Expertise Centre for Digital Media (http://edm.luc.ac.be)
								Limburgs Universitair Centrum

	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 2
	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, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

namespace Uiml{

	using System;
	using System.Xml;
	using System.Collections;

	using Uiml.Rendering;

	///<summary>
	///Represents the constant element:
	///  &lt;!ELEMENT constant (constant*)&gt; 
	///  &lt;!ATTLIST constant id NMTOKEN #IMPLIED 
	///               source CDATA #IMPLIED 
	///               how (union|cascade|replace) "replace" 
	///               export (hidden|optional|required) "optional" 
	///               model CDATA #IMPLIED 
	///               value CDATA #IMPLIED&gt;
	///
	/// Valid model attributes are : list | tree
	///</summary>
	public class Constant : UimlAttributes, IUimlElement {

		private string m_model;
		//Generics would be nice here :-)
		private Object m_data;
		private ArrayList m_children;
		private Constant parent;

		public Constant()
		{
		}

		public Constant(XmlNode n) : this()
		{
			Process(n);

		}

		public void Process(XmlNode n)
		{
			if(n.Name == IAM)
			{
				base.ReadAttributes(n);
				XmlAttributeCollection attr = n.Attributes;
				if(attr.GetNamedItem(MODEL) != null) //it is a model == other sub constants are there!!
					m_model = attr.GetNamedItem(MODEL).Value;
				if(attr.GetNamedItem(VALUE) != null)
					Value = attr.GetNamedItem(VALUE).Value; //it is always a string
				if(n.HasChildNodes)
				{
					XmlNodeList xnl = n.ChildNodes;
					for(int i=0; i<xnl.Count; i++)
						Add(new Constant(xnl[i]));
				}
			}
		}

		public void Add(Constant c)
		{
			if(Children == null)
				Children = new ArrayList();
			Children.Add(c);
		}

		public bool NoChildren
		{
			get
			{
				return Children == null;
			}			
		}

		public int ChildCount
		{
			get
			{
				if(Children == null)
					return 0;
				else
					return Children.Count;
			}			
		}

		public string Model
		{<commit_msg>Renamed the NoChildren property to HasChildren and changed the implementation accordingly.<commit_after>/*
    Uiml.Net: a .Net UIML renderer (http://lumumba.luc.ac.be/kris/research/uiml.net)

	 Copyright (C) 2003  <NAME> (<EMAIL>)
	                     Expertise Centre for Digital Media (http://edm.luc.ac.be)
								Limburgs Universitair Centrum

	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 2
	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, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

namespace Uiml{

	using System;
	using System.Xml;
	using System.Collections;

	using Uiml.Rendering;

	///<summary>
	///Represents the constant element:
	///  &lt;!ELEMENT constant (constant*)&gt; 
	///  &lt;!ATTLIST constant id NMTOKEN #IMPLIED 
	///               source CDATA #IMPLIED 
	///               how (union|cascade|replace) "replace" 
	///               export (hidden|optional|required) "optional" 
	///               model CDATA #IMPLIED 
	///               value CDATA #IMPLIED&gt;
	///
	/// Valid model attributes are : list | tree
	///</summary>
	public class Constant : UimlAttributes, IUimlElement {

		private string m_model;
		//Generics would be nice here :-)
		private Object m_data;
		private ArrayList m_children;
		private Constant parent;

		public Constant()
		{
		}

		public Constant(XmlNode n) : this()
		{
			Process(n);

		}

		public void Process(XmlNode n)
		{
			if(n.Name == IAM)
			{
				base.ReadAttributes(n);
				XmlAttributeCollection attr = n.Attributes;
				if(attr.GetNamedItem(MODEL) != null) //it is a model == other sub constants are there!!
					m_model = attr.GetNamedItem(MODEL).Value;
				if(attr.GetNamedItem(VALUE) != null)
					Value = attr.GetNamedItem(VALUE).Value; //it is always a string
				if(n.HasChildNodes)
				{
					XmlNodeList xnl = n.ChildNodes;
					for(int i=0; i<xnl.Count; i++)
						Add(new Constant(xnl[i]));
				}
			}
		}

		public void Add(Constant c)
		{
			if(Children == null)
				Children = new ArrayList();
			Children.Add(c);
		}

		public bool HasChildren
		{
			get
			{
				return Children != null;
			}			
		}

		public int ChildCount
		{
			get
			{
				if(Children == null)
					return 0;
				else
					return Children.Count;
			}			
		}

		public string Model
		{
{'fraction_non_alphanumeric': 0.10094237042406669, 'fraction_numerical': 0.007611453425154041, 'mean_word_length': 2.6453104359313078, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '6462766', 'n_tokens_mistral': 2023, 'n_tokens_neox': 1687, 'n_words': 572}