<commit_before>//
//  RadioButtonGroup.as
//
//  Created by <NAME> on 2008-06-19.
//  Copyright (c) 2008 Fork Unstable Media GmbH. All rights reserved.
//

package reprise.controls
{
	import reprise.controls.RadioButton;
	import reprise.core.reprise;
	import reprise.ui.DocumentView;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	use namespace reprise;
	
	public class RadioButtonGroup extends EventDispatcher
	{
		
		/***************************************************************************
		*                           protected properties                           *
		***************************************************************************/
		protected static var g_radioGroups:Object;
		protected var m_radioButtons:Array;
		protected var m_name:String;
		protected var m_selectedIndex:int = -1;
		
		
		
		/***************************************************************************
		*                              Public methods                              *
		***************************************************************************/
		public function RadioButtonGroup(name:String)
		{
			m_name = name;
			m_radioButtons = [];
		}
		
		
		public static function groupWithName(name:String):RadioButtonGroup
		{
			if (!g_radioGroups)
			{
				g_radioGroups = {};
			}
			if (!g_radioGroups[name])
			{
				g_radioGroups[name] = new RadioButtonGroup(name);	
			}
			return g_radioGroups[name];
		}
		
		public function addRadioButton(btn:RadioButton):void
		{
			m_radioButtons.push(btn);
		}
		
		public function removeRadioButton(btn:RadioButton):void
		{
			m_radioButtons.splice(m_radioButtons.indexOf(btn), 1);
		}
		
		public function setRadioButtonSelected(btn:RadioButton, bFlag:Boolean):void
		{
			var oldIndex : int = m_selectedIndex;
			if (!bFlag)
			{
				btn.setSelected(false);
				return;<commit_msg>- added another reset method<commit_after>//
//  RadioButtonGroup.as
//
//  Created by <NAME> on 2008-06-19.
//  Copyright (c) 2008 Fork Unstable Media GmbH. All rights reserved.
//

package reprise.controls
{
	import reprise.controls.RadioButton;
	import reprise.core.reprise;
	import reprise.ui.DocumentView;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	use namespace reprise;
	
	public class RadioButtonGroup extends EventDispatcher
	{
		
		/***************************************************************************
		*                           protected properties                           *
		***************************************************************************/
		protected static var g_radioGroups:Object;
		protected var m_radioButtons:Array;
		protected var m_name:String;
		protected var m_selectedIndex:int = -1;
		
		
		
		/***************************************************************************
		*                              Public methods                              *
		***************************************************************************/
		public function RadioButtonGroup(name:String)
		{
			m_name = name;
			m_radioButtons = [];
		}
		
		
		public static function groupWithName(name:String):RadioButtonGroup
		{
			if (!g_radioGroups)
			{
				g_radioGroups = {};
			}
			if (!g_radioGroups[name])
			{
				g_radioGroups[name] = new RadioButtonGroup(name);	
			}
			return g_radioGroups[name];
		}
		
		public function addRadioButton(btn:RadioButton):void
		{
			m_radioButtons.push(btn);
		}
		
		public function removeRadioButton(btn:RadioButton):void
		{
			m_radioButtons.splice(m_radioButtons.indexOf(btn), 1);
		}
		
		public function reset():void
		{
			super.reset();
			for (var i:int = 0; i < m_radioButtons.length; i++)
			{
				var rbtn:RadioButton = m_radioButtons[i] as RadioButton;
				rbtn.setSelected(false);
			}
			m_selectedIndex = -1;
		}
		
		public function setRadioButtonSelected(btn:RadioButton, bFlag:Boolean):void
		{
			var oldIndex : int = m_selectedIndex;
			if (!bFlag)
			{
				btn.setSelected(false);
				return;
{'fraction_non_alphanumeric': 0.23322442824830358, 'fraction_numerical': 0.007539582809751194, 'mean_word_length': 3.2566844919786098, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '4879355', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1063, 'n_words': 214}