/// <summary> /// Class constructor /// </summary> /// <param name="localePrefs">Localeprefs</param> /// <param name="hypotheses">Hypotheses to display</param> /// <param name="used_quantifiers">Used quantifiers</param> /// <param name="Displayer">Propertygrid</param> /// <param name="statisticsProxies">Statistics proxies</param> public FerdaResultBrowserControl(string[] localePrefs, HypothesisStruct[] hypotheses, QuantifierProvider[] used_quantifiers, IOtherObjectDisplayer Displayer, List<Ferda.Statistics.StatisticsProviderPrx> statisticsProxies, string taskType, IOwnerOfAddIn ownerOfAddIn) { //setting the ResManager resource manager and localization string string locale; try { locale = localePrefs[0]; localizationString = locale; locale = "Ferda.FrontEnd.AddIns.ResultBrowser.Localization_" + locale; resManager = new ResourceManager(locale, Assembly.GetExecutingAssembly()); } catch { resManager = new ResourceManager("Ferda.FrontEnd.AddIns.ResultBrowser.Localization_en-US", Assembly.GetExecutingAssembly()); localizationString = "en-US"; } this.ownerOfAddIn = ownerOfAddIn; columnSorter.column = 0; InitializeComponent(); InitializeGraph(); this.hypothesesCount = hypotheses.Length; this.taskType = taskType; resultBrowser = new FerdaResult(resManager); resultBrowser.IceTicked += new LongRunTick(resultBrowser_IceTicked); resultBrowser.IceComplete += new LongRunCompleted(resultBrowser_IceComplete); //setting locale this.ChangeLocale(this.resManager); this.displayer = Displayer; this.displayer.Reset(); this.PreloadDisable(); resultBrowser.Initialize(hypotheses, used_quantifiers, statisticsProxies); if ((this.taskType == "LISpMinerTasks.KLTask") || (this.taskType == "LISpMinerTasks.CFTask") || (this.taskType == "LISpMinerTasks.FFTTask")) { RadioFirstTable.Visible = false; RadioSecondTable.Visible = false; } }
/// <summary> /// Gets the quantifier providers. /// </summary> /// <param name="boxModule">The box module.</param> /// <param name="socketName">Name of the socket.</param> /// <returns>Quantifier providers.</returns> public static QuantifierProvider[] GetQuantifierProviders(BoxModuleI boxModule, string socketName) { List<QuantifierProvider> result = new List<QuantifierProvider>(); QuantifierProvider item; foreach (BoxModulePrx prx in SocketConnections.GetBoxModulePrxs(boxModule, socketName, false)) { item = new QuantifierProvider(); item.localizedBoxLabel = prx.getMyFactory().getMyFactoryCreator().getLabel(boxModule.LocalePrefs); item.userBoxLabel = boxModule.Manager.getProjectInformation().getUserLabel(Ice.Util.identityToString(prx.ice_getIdentity())); item.functions = AbstractQuantifier.AbstractQuantifierFunctionsPrxHelper.checkedCast(prx.getFunctions()); result.Add(item); } return result.ToArray(); }
/// <summary> /// Method which finds out whether the quantifier is used. /// </summary> /// <param name="quantifier"></param> /// <returns></returns> protected bool QuantifierIsUsed(QuantifierProvider quantifier) { for (int i = 0; i < this.UsedQuantifiers.Length; i++) { if (quantifier == this.UsedQuantifiers[i]) { return true; } } return false; }
/// <summary> /// Method to initialize the ResultBrowser structure /// </summary> /// <param name="hypotheses"></param> public void Initialize(HypothesisStruct[] hypotheses, QuantifierProvider[] used_quantifiers, List<Ferda.Statistics.StatisticsProviderPrx> statisticsProxies) { this.Hypotheses = hypotheses; this.statisticsProxies = statisticsProxies; //working with quantifiers - need to obtain all quantifier, for now working only with used ones this.UsedQuantifiers = used_quantifiers; this.SelectedQuantifiers = new int[this.UsedQuantifiers.Length]; for (int i = 0; i < this.SelectedQuantifiers.Length; i++) { this.SelectedQuantifiers[i] = 0; } proxy = new AbstractQuantifierFunctionsPrx[this.UsedQuantifiers.Length]; for (int i = 0; i < this.UsedQuantifiers.Length; i++) { this.proxy[i] = this.UsedQuantifiers[i].functions; } #region Caching //caching statistics names this.cachedStatisticsNames = this.GetStatisticsNames(); //initializing hypotheses cache this.cachedHypotheses = new CachedHypothesis[this.Hypotheses.Length]; Thread IceCommunicationThread = new Thread(new ThreadStart(IceCommunication)); IceCommunicationThread.Start(); #endregion }
/// <summary> /// Method which gets column name based on function name. /// </summary> /// <returns></returns> protected String GetColumnName(QuantifierProvider quantifier) { String returnString; returnString = quantifier.localizedBoxLabel.ToString(); return returnString; }