From 0504837cce24027cba077555ec1ee7f0a23deda8 Mon Sep 17 00:00:00 2001 From: Aaron Moser Date: Sun, 23 Jul 2023 16:19:21 +0200 Subject: [PATCH] Commented research --- .../Research/Technology/ETechnology.cs | 12 ++ .../Scripts/Research/Technology/TechLevels.cs | 52 +++++ .../Research/Technology/Technologies.cs | 58 ++++- .../Scripts/Research/Technology/Technology.cs | 42 ++++ .../Research/View/ResearchCostViewScript.cs | 40 +++- .../Research/View/ResearchQueueViewScript.cs | 77 ++++++- .../Research/View/ResearchTechViewScript.cs | 198 +++++++++++------- .../Research/View/ResearchViewScript.cs | 56 +++++ .../Research/View/ToggleScienceUIScript.cs | 37 ++++ 9 files changed, 484 insertions(+), 88 deletions(-) diff --git a/Space4x/Assets/Scripts/Research/Technology/ETechnology.cs b/Space4x/Assets/Scripts/Research/Technology/ETechnology.cs index e8ab9e8..bfd99ea 100644 --- a/Space4x/Assets/Scripts/Research/Technology/ETechnology.cs +++ b/Space4x/Assets/Scripts/Research/Technology/ETechnology.cs @@ -1,9 +1,21 @@ +/** + * @file + * + * @author Marc de Craigher + * + * @package Assets.Scripts.Research.Technology + */ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace NTechnology { + /** + * @section DESCRIPTION + * + * Enum contains all possible technologies. + */ public enum ETechnology { IndustryTech, diff --git a/Space4x/Assets/Scripts/Research/Technology/TechLevels.cs b/Space4x/Assets/Scripts/Research/Technology/TechLevels.cs index c0782be..ff7fe95 100644 --- a/Space4x/Assets/Scripts/Research/Technology/TechLevels.cs +++ b/Space4x/Assets/Scripts/Research/Technology/TechLevels.cs @@ -1,13 +1,62 @@ +/** + * @file + * + * @author Aaron Moser + * + * @package Assets.Scripts.Research.Technology + */ namespace NTechnology { + /** + * @section DESCRIPTION + * + * Class is a container to transport all tech levels at once. + */ public class TechLevels { + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public values + + /** + * Level of industry tech. + */ public int IndustryTechLevel; + + /** + * Level of wealth tech. + */ public int WealthTechLevel; + + /** + * Level of science tech. + */ public int ScienceTechLevel; + + /** + * Level of food tech. + */ public int FoodTechLevel; + + /** + * Level of power tech. + */ public int PowerTechLevel; + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private values + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public functions + + /** + * Initializes levels with overhanded values. + * + * @param IndustryTechLevel, level of industry tech to transport. + * @param WealthTechLevel, level of wealth tech to transport. + * @param ScienceTechLevel, level of science tech to transport. + * @param FoodTechLevel, level of food tech to transport. + * @param PowerTechLevel, level of power tech to transport. + */ public TechLevels(int IndustryTechLevel, int WealthTechLevel, int ScienceTechLevel, int FoodTechLevel, int PowerTechLevel) { this.IndustryTechLevel = IndustryTechLevel; @@ -16,5 +65,8 @@ namespace NTechnology this.FoodTechLevel = FoodTechLevel; this.PowerTechLevel = PowerTechLevel; } + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private functions } } diff --git a/Space4x/Assets/Scripts/Research/Technology/Technologies.cs b/Space4x/Assets/Scripts/Research/Technology/Technologies.cs index b1c449f..006ff36 100644 --- a/Space4x/Assets/Scripts/Research/Technology/Technologies.cs +++ b/Space4x/Assets/Scripts/Research/Technology/Technologies.cs @@ -1,18 +1,60 @@ +/** + * @file + * + * @author Marc de Craigher + * + * @package Assets.Scripts.Research.Technology + */ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace NTechnology { + /** + * @section DESCRIPTION + * + * Class contains all technologies. + */ public class Technologies { - // Technology levels + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public values + + /** + * Technology of wealth. + */ public Technology WealthTech { get; set; } + + /** + * Technology of science. + */ public Technology ScienceTech { get; set; } + + /** + * Technology of power. + */ public Technology PowerTech { get; set; } + + /** + * Technology of food. + */ public Technology FoodTech { get; set; } + + /** + * Technology of industry. + */ public Technology IndustrialCapacityTech { get; set; } + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private values + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public functions + + /** + * Init all techs starting cost and level with 1. + */ public Technologies() { // Init all techs starting cost and level with 1. @@ -23,6 +65,17 @@ namespace NTechnology IndustrialCapacityTech = new Technology(1, 1, ETechnology.IndustryTech); } + /** + * Init all techs starting cost and level with overhanded techs. + * + * @todo create deep copy instead of references. + * + * @param wealth, technology representing wealth tech of player. + * @param science, technology representing science tech of player. + * @param power, technology representing power tech of player. + * @param food, technology representing food tech of player. + * @param industry, technology representing industry tech of player. + */ public Technologies(Technology wealth, Technology science, Technology power, Technology food, Technology industry) { WealthTech = wealth; @@ -31,5 +84,8 @@ namespace NTechnology FoodTech = food; IndustrialCapacityTech = industry; } + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private functions } } \ No newline at end of file diff --git a/Space4x/Assets/Scripts/Research/Technology/Technology.cs b/Space4x/Assets/Scripts/Research/Technology/Technology.cs index 443e7b0..20756c8 100644 --- a/Space4x/Assets/Scripts/Research/Technology/Technology.cs +++ b/Space4x/Assets/Scripts/Research/Technology/Technology.cs @@ -1,20 +1,62 @@ +/** + * @file + * + * @author Marc de Craigher + * + * @package Assets.Scripts.Research.Technology + */ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace NTechnology { + /** + * @section DESCRIPTION + * + * Class contains information about a technology. + */ public class Technology { + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public values + + /** + * Cost of technology to increase level. + */ public int Cost; + + /** + * Current level of technology. + */ public int Level; + + /** + * Name of technology. + */ public ETechnology Name; + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private values + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public functions + + /** + * Sets cost, level and name to overhanded values. + * + * @param cost, starting cost of technology. + * @param level, starting level of technology. + * @param name, name of technology. + */ public Technology(int cost, int level, ETechnology name) { this.Cost = cost; this.Level = level; this.Name = name; } + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private functions } } diff --git a/Space4x/Assets/Scripts/Research/View/ResearchCostViewScript.cs b/Space4x/Assets/Scripts/Research/View/ResearchCostViewScript.cs index 0d14fe7..68d80f7 100644 --- a/Space4x/Assets/Scripts/Research/View/ResearchCostViewScript.cs +++ b/Space4x/Assets/Scripts/Research/View/ResearchCostViewScript.cs @@ -1,21 +1,57 @@ -using System.Collections; -using System.Collections.Generic; +/** + * @file + * + * @author Marc de Craigher + * + * @package Assets.Scripts.Research.View + */ using UnityEngine; using UnityEngine.UI; +/** + * @section DESCRIPTION + * + * Class contains functionality to set cost label. + */ public class ResearchCostViewScript : MonoBehaviour { + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public values + + /** + * Reference to tech cost banner. + */ public Text TechCostBanner; + /** + * Reference to tech cost label. + */ public Text TechCostLabel; + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private values + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public functions + + /** + * Sets text of cost label to overhanded value. + * + * @param Cost, value to set text of cost label to. + */ public void SetCostLabel(int Cost) { TechCostLabel.text = Cost.ToString(); } + /** + * @todo Changes language of cost banner, depending on overhanded value or public fetchable settings variable/function. + */ public void ChangeLanguage() { //TechCostBanner.text; } + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private functions } diff --git a/Space4x/Assets/Scripts/Research/View/ResearchQueueViewScript.cs b/Space4x/Assets/Scripts/Research/View/ResearchQueueViewScript.cs index d89bfe3..4a4f3d0 100644 --- a/Space4x/Assets/Scripts/Research/View/ResearchQueueViewScript.cs +++ b/Space4x/Assets/Scripts/Research/View/ResearchQueueViewScript.cs @@ -1,30 +1,78 @@ +/** + * @file + * + * @author Marc de Craigher + * + * @package Assets.Scripts.Research.View + */ using System; using System.Collections; using UnityEngine; using UnityEngine.UI; +/** + * @section DESCRIPTION + * + * Class contains functionality of research queue view, displaying the research queue model. + */ public class ResearchQueueViewScript : MonoBehaviour { - private const int TECHQUEUESIZE = 4; + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public values + /** + * Reference of tech queue banner. + * + * GalaxyCanvas.ScienceManagerCanvas.ResearchQueueCanvas.QueueBanner + */ public Text TechQueueBanner; + /** + * Reference of tech queue labels. + * + * GalaxyCanvas.ScienceManagerCanvas.ResearchQueueCanvas.QueuePos1 + * GalaxyCanvas.ScienceManagerCanvas.ResearchQueueCanvas.QueuePos2 + * GalaxyCanvas.ScienceManagerCanvas.ResearchQueueCanvas.QueuePos3 + * GalaxyCanvas.ScienceManagerCanvas.ResearchQueueCanvas.QueuePos4 + */ public Text[] TechQueueLabels = new Text[TECHQUEUESIZE]; + /** + * Reference of remove last tech from queue button. + * + * GalaxyCanvas.ScienceManagerCanvas.ResearchTechsCanvas.RemoveLastButton + */ public Button RemoveLastTechFromQueueButton; + /** + * Reference to game model. + */ public GameModel oGameModel; - void Start() - { - RemoveLastTechFromQueueButton.onClick.AddListener(() => SendEventToController(NResearch.EResearchEvent.RemoveLastTechFromQueue)); - } + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private values + /** + * Maximum size of tech queue. + */ + private const int TECHQUEUESIZE = 4; + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public functions + + /** + * Sends overhanded research event to research queue controller. + * + * @param eResearchEvent, research event that occured. + */ public void SendEventToController(NResearch.EResearchEvent eResearchEvent) { NResearchController.ResearchQueueController.TechRemoveButtonPressedEvent(this, eResearchEvent); } + /** + * Fetches data from research queue model at game model and writes data into tech queue labels. + */ public void UpdateQueueLabelsText() { for (int i = 0; i < 4; i++) @@ -42,14 +90,33 @@ public class ResearchQueueViewScript : MonoBehaviour } } + /** + * Sets game model. + * + * @param oGameModel, reference to game model. + */ public void SetGameModel(GameModel oGameModel) { this.oGameModel = oGameModel; } + /** + * @todo Change language of research queue banner and labels. + */ public void ChangeLanguage() { //TechQueueBanner.text = ; //RemoveLastTechFromQueueButton.GetComponent().text = ; } + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private functions + + /** + * Start is called before the first frame update is called. + */ + void Start() + { + RemoveLastTechFromQueueButton.onClick.AddListener(() => SendEventToController(NResearch.EResearchEvent.RemoveLastTechFromQueue)); + } } diff --git a/Space4x/Assets/Scripts/Research/View/ResearchTechViewScript.cs b/Space4x/Assets/Scripts/Research/View/ResearchTechViewScript.cs index 15544e9..4e17a25 100644 --- a/Space4x/Assets/Scripts/Research/View/ResearchTechViewScript.cs +++ b/Space4x/Assets/Scripts/Research/View/ResearchTechViewScript.cs @@ -1,31 +1,135 @@ +/** + * @file + * + * @author Marc de Craigher + * + * @package Assets.Scripts.Research.View + */ using System; -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace NResearch { + /** + * @section DESCRIPTION + * + * Class contains functionality of research tech view, containing refernces to tech buttons, sending events to research tech and cost controllers. + */ public class ResearchTechViewScript : MonoBehaviour { - /// - /// References to unity TechButtons, used to add new tech to research queue or check cost of next level. - /// + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public values + + /** + * References to unity TechButtons, used to add new tech to research queue or check cost of next level. + * + * GalaxyCanvas.ScienceManagerCanvas.ResearchTechsCanvas.IndustryButton + * GalaxyCanvas.ScienceManagerCanvas.ResearchTechsCanvas.WealthButton + * GalaxyCanvas.ScienceManagerCanvas.ResearchTechsCanvas.ScienceButton + * GalaxyCanvas.ScienceManagerCanvas.ResearchTechsCanvas.FoodButton + */ public TechButton IndustrialTechButton, WealthTechButton, ScienceTechButton, FoodTechButton; - /// - /// References to unity labels, displaying current level of tech. - /// + /** + * References to unity labels, displaying current level of tech. + * + * GalaxyCanvas.ScienceManagerCanvas.ResearchTechsCanvas.IndustryVal + * GalaxyCanvas.ScienceManagerCanvas.ResearchTechsCanvas.WealthVal + * GalaxyCanvas.ScienceManagerCanvas.ResearchTechsCanvas.ScienceVal + * GalaxyCanvas.ScienceManagerCanvas.ResearchTechsCanvas.FoodVal + */ public Text IndustrialTechLevelLabel, WealthTechLevelLabel, ScienceTechLevelLabel, FoodTechLevelLabel; - /// - /// Reference for gamemodel. Set from parent view. - /// + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private values + + /** + * Reference for gamemodel. Set from parent view. + */ private GameModel oGameModel; - /// - /// Called at start of game. Sets EResearchEvents, onClick-, onMouseEnter- and onMouseExit-events of TechButtons. - /// + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public functions + + /** + * Sets reference to game model. + * + * @param oGameModel, reference to game model. + */ + public void SetGameModel(GameModel oGameModel) + { + this.oGameModel = oGameModel; + } + + /** + * Calls enter or exit method, depending on eResearchEvent of event args. + * + * @param sender, object which triggered the event. + * @param e, research event args, containing additional information about event. + */ + public void SendEventToCostController(object sender, NResearch.ResearchEventArgs e) + { + switch (e.eResearchEvent) + { + case (EResearchEvent.EnterIndustryTechButton): + case (EResearchEvent.EnterWealthTechButton): // Fall through wanted + case (EResearchEvent.EnterScienceTechButton): // Fall through wanted + case (EResearchEvent.EnterFoodTechButton): // Fall through wanted + { + NResearchController.ResearchCostController.TechButtonEnterEvent(this, e.eResearchEvent); + } + break; + case (EResearchEvent.ExitTechButton): + { + NResearchController.ResearchCostController.TechButtonExitEvent(this, e.eResearchEvent); + } + break; + } + } + + /** + * Sends event eResearchEvent which indicates which tech button was pressed to research tech controller. + * + * @param eResearchEvent, event which was triggered. + */ + public void SendEventToController(EResearchEvent eResearchEvent) + { + NResearchController.ResearchTechController.TechButtonPressedEvent(this, eResearchEvent); + } + + /** + * Gets the level of the techs from model and sets labels of view. + */ + public void UpdateResearchTechView() + { + // Get levels of techs + int IndustryTechLevel = oGameModel.PlayerModel.GetPlayerManagers()[0].ResearchModel.Techs.IndustrialCapacityTech.Level; + int WealthTechLevel = oGameModel.PlayerModel.GetPlayerManagers()[0].ResearchModel.Techs.WealthTech.Level; + int ScienceTechLevel = oGameModel.PlayerModel.GetPlayerManagers()[0].ResearchModel.Techs.ScienceTech.Level; + int FoodTechLevel = oGameModel.PlayerModel.GetPlayerManagers()[0].ResearchModel.Techs.FoodTech.Level; + + // Set text of labels to levels values + IndustrialTechLevelLabel.text = IndustryTechLevel.ToString(); + WealthTechLevelLabel.text = WealthTechLevel.ToString(); + ScienceTechLevelLabel.text = ScienceTechLevel.ToString(); + FoodTechLevelLabel.text = FoodTechLevel.ToString(); + } + + /** + * @todo Change language depending on overhanded value. + */ + public void ChangeLanguage() + { + //TechnologiesButtons[i].GetComponent().text; + } + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private functions + + /** + * Called at start of game. Sets EResearchEvents, onClick-, onMouseEnter- and onMouseExit-events of TechButtons. + */ void Start() { // Set EResearchEvents @@ -52,71 +156,5 @@ namespace NResearch ScienceTechButton.onMouseExit += SendEventToCostController; FoodTechButton.onMouseExit += SendEventToCostController; } - - /// - /// Sets reference to game model. - /// - /// - public void SetGameModel(GameModel oGameModel) - { - this.oGameModel = oGameModel; - } - - /// - /// Calls enter or exit method, depending on eResearchEvent of event args. - /// - /// - /// - public void SendEventToCostController(object sender, NResearch.ResearchEventArgs e) - { - switch (e.eResearchEvent) - { - case (EResearchEvent.EnterIndustryTechButton): - case (EResearchEvent.EnterWealthTechButton): // Fall through wanted - case (EResearchEvent.EnterScienceTechButton): // Fall through wanted - case (EResearchEvent.EnterFoodTechButton): // Fall through wanted - { - NResearchController.ResearchCostController.TechButtonEnterEvent(this, e.eResearchEvent); - } - break; - case (EResearchEvent.ExitTechButton): - { - NResearchController.ResearchCostController.TechButtonExitEvent(this, e.eResearchEvent); - } - break; - } - } - - /// - /// Sends event eResearchEvent which indicates which tech button was pressed to research tech controller. - /// - /// - public void SendEventToController(EResearchEvent eResearchEvent) - { - NResearchController.ResearchTechController.TechButtonPressedEvent(this, eResearchEvent); - } - - /// - /// Gets the level of the techs from model and sets labels of view. - /// - public void UpdateResearchTechView() - { - // Get levels of techs - int IndustryTechLevel = oGameModel.PlayerModel.GetPlayerManagers()[0].ResearchModel.Techs.IndustrialCapacityTech.Level; - int WealthTechLevel = oGameModel.PlayerModel.GetPlayerManagers()[0].ResearchModel.Techs.WealthTech.Level; - int ScienceTechLevel = oGameModel.PlayerModel.GetPlayerManagers()[0].ResearchModel.Techs.ScienceTech.Level; - int FoodTechLevel = oGameModel.PlayerModel.GetPlayerManagers()[0].ResearchModel.Techs.FoodTech.Level; - - // Set text of labels to levels values - IndustrialTechLevelLabel.text = IndustryTechLevel.ToString(); - WealthTechLevelLabel.text = WealthTechLevel.ToString(); - ScienceTechLevelLabel.text = ScienceTechLevel.ToString(); - FoodTechLevelLabel.text = FoodTechLevel.ToString(); - } - - public void ChangeLanguage() - { - //TechnologiesButtons[i].GetComponent().text; - } } } \ No newline at end of file diff --git a/Space4x/Assets/Scripts/Research/View/ResearchViewScript.cs b/Space4x/Assets/Scripts/Research/View/ResearchViewScript.cs index 46c16e4..533e0af 100644 --- a/Space4x/Assets/Scripts/Research/View/ResearchViewScript.cs +++ b/Space4x/Assets/Scripts/Research/View/ResearchViewScript.cs @@ -1,3 +1,11 @@ +/** + * @file + * + * @author Marc de Craigher + * @author Aaron Moser + * + * @package Assets.Scripts.Research.View + */ using System; using System.Collections; using System.Collections.Generic; @@ -7,16 +15,53 @@ using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; +/** + * @section DESCRIPTION + * + * Class represents research view. + */ public class ResearchViewScript : MonoBehaviour { + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public values + + /** + * Reference to research queue view. + * + * InvisibleObjectsCanvas.GameView.ResearchView.ResearchQueueView + */ public ResearchQueueViewScript ResearchQueueView; + /** + * Reference to research tech view. + * + * InvisibleObjectsCanvas.GameView.ResearchView.ResearchTechView + */ public NResearch.ResearchTechViewScript ResearchTechView; + /** + * Reference to research cost view. + * + * InvisibleObjectsCanvas.GameView.ResearchView.ResearchCostView + */ public ResearchCostViewScript ResearchCostView; + /** + * Reference to game model. + */ public GameModel oGameModel; + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private values + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public functions + + /** + * Sets own and children game model. + * + * @param oGameModel, reference to game model. + */ public void SetGameModel(GameModel oGameModel) { // Set own game model @@ -29,6 +74,9 @@ public class ResearchViewScript : MonoBehaviour // The cost will be overhanded to the given method } + /** + * Gets called every day, updates children views. + */ public void DailyUpdateView() { if (oGameModel != null) @@ -43,8 +91,16 @@ public class ResearchViewScript : MonoBehaviour } } + /** + * @todo Change language depending on overhanded value. + * + * @param Language, indicates language, to set view elements to. + */ public void ChangeLanguage(ELanguage Language) { } + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private functions } \ No newline at end of file diff --git a/Space4x/Assets/Scripts/Research/View/ToggleScienceUIScript.cs b/Space4x/Assets/Scripts/Research/View/ToggleScienceUIScript.cs index d5352fd..d7880c6 100644 --- a/Space4x/Assets/Scripts/Research/View/ToggleScienceUIScript.cs +++ b/Space4x/Assets/Scripts/Research/View/ToggleScienceUIScript.cs @@ -1,13 +1,47 @@ +/** + * @file + * + * @author Marc de Craigher + * + * @package Assets.Scripts.Research.View + */ using System.Collections; using System.Collections.Generic; using UnityEngine; +/** + * @section DESCRIPTION + * + * Class contains functionality to toggle visibility of science manager and galaxy bodys canvas. + */ public class ToggleScienceUIScript : MonoBehaviour { + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public values + + /** + * Reference to science manager canvas. + * + * GalaxyCanvas.ScienceManagerCanvas + */ public Canvas scienceManagerCanvas; + /** + * Reference to galaxy bodys canvas. + * + * GalaxyCanvas.GalaxyBodysCanvas + */ public Canvas galaxyBodysCanvas; + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private values + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Public functions + + /** + * Toggles visibility of science manager canvas and galaxy bodys canvas. + */ public void ToggleCanvasVisibility() { GameObject smObject = scienceManagerCanvas.gameObject; @@ -18,4 +52,7 @@ public class ToggleScienceUIScript : MonoBehaviour // Toggle visibility of galaxy body canvas gbObject.SetActive(!gbObject.activeSelf); } + + //--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + // Private functions }