/// <summary> /// Gets the box modules asking for creation. /// </summary> /// <param name="localePrefs">The localization preferences.</param> /// <param name="boxModule">The box module.</param> /// <returns> /// Array of <see cref="T:Ferda.Modules.ModuleAskingForCreation"> /// Modules Asking For Creation</see>. /// </returns> public override ModulesAskingForCreation[] GetModulesAskingForCreation(string[] localePrefs, BoxModuleI boxModule) { Dictionary<string, ModulesAskingForCreation> modulesAFC = this.getModulesAskingForCreationNonDynamic(localePrefs); List<ModulesAskingForCreation> result = new List<ModulesAskingForCreation>(); ModulesAskingForCreation moduleAFC; ModulesConnection moduleConnection; ModuleAskingForCreation singleModuleAFC; //PropertySetting propertySetting; //Ferda.ModulesManager.BoxModuleProjectInformationPrx projectInfoPrx = boxModule.Manager.getProjectInformation(); //string label = projectInfoPrx.getUserLabel(boxModule.StringIceIdentity); foreach (string moduleAFCName in modulesAFC.Keys) { moduleAFC = modulesAFC[moduleAFCName]; moduleConnection = new ModulesConnection(); singleModuleAFC = new ModuleAskingForCreation(); switch (moduleAFCName) { case "BooleanPartialCedentSetting": moduleConnection.socketName = "EquivalenceClass"; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.BooleanPartialCedentSetting.BooleanPartialCedentSettingBoxInfo.typeIdentifier; break; default: throw Ferda.Modules.Exceptions.SwitchCaseNotImplementedError(moduleAFCName); } moduleConnection.boxModuleParam = boxModule.MyProxy; singleModuleAFC.modulesConnection = new ModulesConnection[] { moduleConnection }; moduleAFC.newModules = new ModuleAskingForCreation[] { singleModuleAFC }; result.Add(moduleAFC); } return result.ToArray(); }
/// <summary> /// Gets default value for box module user label. /// </summary> public override string GetDefaultUserLabel(BoxModuleI boxModule) { //get atom`s userLabel string atomsUserLabel = "???"; BoxModulePrx atomBoxModulePrx; if (Ferda.Modules.Boxes.SocketConnections.TryGetBoxModulePrx(boxModule, "AtomSetting", out atomBoxModulePrx)) { string[] atomDefaultUserLabel = atomBoxModulePrx.getDefaultUserLabel(); if (atomDefaultUserLabel.Length > 0) atomsUserLabel = atomDefaultUserLabel[0]; } GaceTypeEnum gaceType = (GaceTypeEnum)Enum.Parse(typeof(GaceTypeEnum), boxModule.GetPropertyString("GaceType")); string gaceTypeShort = ""; switch (gaceType) { case GaceTypeEnum.Positive: break; case GaceTypeEnum.Negative: gaceTypeShort = Constants.Negation.ToString(); break; case GaceTypeEnum.Both: gaceTypeShort = Constants.LeftFunctionBracket + Constants.Negation.ToString() + Constants.RightFunctionBracket; break; default: throw Ferda.Modules.Exceptions.SwitchCaseNotImplementedError(gaceType); } LiteralTypeEnum literalType = (LiteralTypeEnum)Enum.Parse(typeof(LiteralTypeEnum), boxModule.GetPropertyString("LiteralType")); string shortLiteralType = this.GetPropertyOptionShortLocalizedLabel("LiteralType", literalType.ToString(), boxModule.LocalePrefs); return gaceTypeShort + atomsUserLabel + shortLiteralType; }
/// <summary> /// Gets value of readonly property value. /// </summary> /// <param name="propertyName">Name of readonly property.</param> /// <param name="boxModule">Box module.</param> /// <returns> /// A <see cref="T:Ferda.Modules.PropertyValue"/> of /// readonly property named <c>propertyName</c>. /// </returns> public override PropertyValue GetReadOnlyPropertyValue(String propertyName, BoxModuleI boxModule) { AbstractLMTaskFunctions Func = (AbstractLMTaskFunctions)boxModule.FunctionsIObj; switch (propertyName) { case "GenerationState": return new Ferda.Modules.StringTI(Func.getGeneratingInfo().generationState.ToString()); case "GenerationNrOfTests": return new Ferda.Modules.LongTI(Func.getGeneratingInfo().generationNrOfTests); case "GenerationNrOfHypotheses": return new Ferda.Modules.LongTI(Func.getGeneratingInfo().generationNrOfHypotheses); case "GenerationStartTime": DateTimeT dateTime = Func.getGeneratingInfo().generationStartTime; return new Ferda.Modules.DateTimeTI(dateTime.year, dateTime.month, dateTime.day, dateTime.hour, dateTime.minute, dateTime.second); case "GenerationTotalTime": TimeT time = Func.getGeneratingInfo().generationTotalTime; return new Ferda.Modules.TimeTI(time.hour, time.minute, time.second); /* case "GenerationInfo": return new Ferda.Modules.GenerationInfoTI(Func.GetGeneratingInfo()); case "Hypotheses": return new Ferda.Modules.HypothesesTI(Func.GetResult()); */ default: throw Ferda.Modules.Exceptions.SwitchCaseNotImplementedError(propertyName); } }
/// <summary> /// Gets the hypotheses. /// </summary> /// <param name="boxModule">The box module.</param> /// <returns>Hypotheses.</returns> public static HypothesisStruct[] GetHypotheses(BoxModuleI boxModule) { HypothesisStruct[] result = ((HypothesesTI)boxModule.GetPropertyOther("Hypotheses")).getHypothesesValue(); if (result == null) return new HypothesisStruct[0]; else return result; }
/// <summary> /// Gets the generation info. /// </summary> /// <param name="boxModule">The box module.</param> /// <returns>Generation info.</returns> public static GeneratingStruct GetGenerationInfo(BoxModuleI boxModule) { GeneratingStruct result = ((GenerationInfoTI)boxModule.GetPropertyOther("GenerationInfo")).getGenerationInfo(); if (result.generationStartTime == null) result.generationStartTime = new DateTimeTI(0, 0, 0, 0, 0, 0); if (result.generationTotalTime == null) result.generationTotalTime = new TimeTI(0, 0, 0); return result; }
//EachValueOneCategoryAttributeFunctionsI Func = (EachValueOneCategoryAttributeFunctionsI)boxModule.FunctionsIObj; /// <summary> /// Gets the box modules asking for creation. /// </summary> /// <param name="localePrefs">The localization preferences.</param> /// <param name="boxModule">The box module.</param> /// <returns> /// Array of <see cref="T:Ferda.Modules.ModuleAskingForCreation"> /// Modules Asking For Creation</see>. /// </returns> public override ModulesAskingForCreation[] GetModulesAskingForCreation(string[] localePrefs, BoxModuleI boxModule) { Dictionary<string, ModulesAskingForCreation> modulesAFC = this.getModulesAskingForCreationNonDynamic(localePrefs); List<ModulesAskingForCreation> result = new List<ModulesAskingForCreation>(); ModulesAskingForCreation moduleAFC; ModulesConnection moduleConnection; ModuleAskingForCreation singleModuleAFC; //Ferda.ModulesManager.BoxModuleProjectInformationPrx projectInfoPrx = boxModule.Manager.getProjectInformation(); foreach (string moduleAFCName in modulesAFC.Keys) { moduleAFC = modulesAFC[moduleAFCName]; moduleConnection = new ModulesConnection(); singleModuleAFC = new ModuleAskingForCreation(); switch (moduleAFCName) { case "AtomSetting": moduleConnection.socketName = "Attribute"; //moduleAFC.newBoxModuleUserLabel = new string[] { projectInfoPrx.getUserLabel(boxModule.StringIceIdentity) }; moduleConnection.boxModuleParam = boxModule.MyProxy; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.AtomSetting.AtomSettingBoxInfo.typeIdentifier; break; case "EquivalenceClass": moduleConnection.socketName = "LiteralSettingOrAttribute"; moduleConnection.boxModuleParam = boxModule.MyProxy; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.EquivalenceClass.EquivalenceClassBoxInfo.typeIdentifier; break; case "CategorialPartialCedentSetting": moduleConnection.socketName = "Attribute"; //moduleAFC.newBoxModuleUserLabel = new string[] { projectInfoPrx.getUserLabel(boxModule.StringIceIdentity) }; moduleConnection.boxModuleParam = boxModule.MyProxy; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.CategorialPartialCedentSetting.CategorialPartialCedentSettingBoxInfo.typeIdentifier; break; case "Attribute": moduleConnection.socketName = "ColumnOrDerivedColumn"; //moduleAFC.newBoxModuleUserLabel = new string[] { projectInfoPrx.getUserLabel(boxModule.StringIceIdentity) }; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.Attributes.Attribute.AttributeBoxInfo.typeIdentifier; try { IAbstractDynamicAttribute func = this.getFuncIAbstractDynamicAttribute(boxModule); moduleConnection.boxModuleParam = func.GetColumnBoxModulePrx(); singleModuleAFC.propertySetting = func.GetSettingForNewAttributeBox(); } catch (Ferda.Modules.BoxRuntimeError) { continue; } break; default: throw Ferda.Modules.Exceptions.SwitchCaseNotImplementedError(moduleAFCName); } singleModuleAFC.modulesConnection = new ModulesConnection[] { moduleConnection }; moduleAFC.newModules = new ModuleAskingForCreation[] { singleModuleAFC }; result.Add(moduleAFC); } return result.ToArray(); }
/// <summary> /// Gets default value for box module user label. /// </summary> public override string GetDefaultUserLabel(BoxModuleI boxModule) { string boxLabel = boxModule.BoxInfo.GetLabel(boxModule.LocalePrefs); return boxLabel + Constants.LeftEnum + boxModule.GetPropertyLong("MinLen").ToString() + Constants.RangeSeparator + boxModule.GetPropertyLong("MaxLen").ToString() + Constants.RightEnum; }
/// <summary> /// Gets the categorial partial cedent setting sequence (array). /// </summary> /// <param name="boxModule">The box module.</param> /// <param name="socketName">Name of the socket.</param> /// <param name="oneAtMinimum">if set to <c>true</c> one patial cedent has to be set at minimum.</param> /// <returns>All categorial partial cedent settings from specified <c>socketName</c>.</returns> /// <exception cref="T:Ferda.Modules.NoConnectionInSocketError">Thrown iff there is no BoxModule connected in socketName and oneAtMinimum is true.</exception> public static CategorialPartialCedentSettingStruct[] GetCategorialPartialCedentSettingSeq(BoxModuleI boxModule, string socketName, bool oneAtMinimum) { List<CategorialPartialCedentSettingStruct> result = new List<CategorialPartialCedentSettingStruct>(); Ice.ObjectPrx[] prxs = SocketConnections.GetObjectPrxs(boxModule, socketName, oneAtMinimum); foreach (Ice.ObjectPrx prx in prxs) { result.Add((CategorialPartialCedentSettingFunctionsPrxHelper.checkedCast(prx)).getCategorialPartialCedentSetting()); } return result.ToArray(); }
/// <summary> /// Gets value of readonly property value. /// </summary> /// <param name="propertyName">Name of readonly property.</param> /// <param name="boxModule">Box module.</param> /// <returns> /// A <see cref="T:Ferda.Modules.PropertyValue"/> of /// readonly property named <c>propertyName</c>. /// </returns> public override PropertyValue GetReadOnlyPropertyValue(String propertyName, BoxModuleI boxModule) { EquifrequencyIntervalsAttributeFunctionsI Func = (EquifrequencyIntervalsAttributeFunctionsI)boxModule.FunctionsIObj; switch (propertyName) { //case "Categories": // return new Ferda.Modules.CategoriesTI(Func.GetGeneratedAttribute().CategoriesStruct); case "IncludeNullCategory": return new Ferda.Modules.StringTI(Func.GetGeneratedAttribute().IncludeNullCategoryName); default: throw Ferda.Modules.Exceptions.SwitchCaseNotImplementedError(propertyName); } }
/// <summary> /// Gets default value for box module user label. /// </summary> public override string GetDefaultUserLabel(BoxModuleI boxModule) { string nameInLiterals = boxModule.GetPropertyString("NameInLiterals"); if (!String.IsNullOrEmpty(nameInLiterals)) return nameInLiterals; Ice.ObjectPrx objectPrx; if (Ferda.Modules.Boxes.SocketConnections.TryGetObjectPrx(boxModule, "ColumnOrDerivedColumn", out objectPrx)) { ColumnFunctionsPrx columnFunctionsPrx = ColumnFunctionsPrxHelper.checkedCast(objectPrx); return columnFunctionsPrx.getColumnInfo().columnSelectExpression; } return null; }
/// <summary> /// Iff there is exactly one <see cref="T:Ferda.Modules.BoxModule"/> /// connected in socket named <c>socketName</c> than this object is /// returned. Iff there is no BoxModule connected in the socket than /// <see cref="T:Ferda.Modules.NoConnectionInSocketError"/> is thrown. /// Otherwise (i.e. there is more than one BoxModule in the socket) /// <see cref="T:System.Exception"/> is thrown. /// </summary> /// <example> /// <para> /// This example shows some usage of this function. We are in MyBoxModule instance. /// There is defined <see cref="T:Ferda.Modules.ModuleAskingForCreation"/> named "MAFC1", /// which gets proxy of BoxModule (Mark it "InputModule") connected into its socket named /// "MyBoxBoduleInputSocket" and make a connection from "InputModule" to socket named /// "Socket1" in newly created BoxModule. /// </para> /// <code> /// namespace MyBoxModule /// { /// class MyBoxModuleBoxInfo : Ferda.Modules.Boxes.BoxInfo /// { /// public override ModulesAskingForCreation[] GetModulesAskingForCreation(string[] localePrefs, BoxModuleI boxModule) /// { /// Dictionary<string, ModuleAskingForCreation> modulesAFC = this.getModulesAskingForCreationNonDynamic(localePrefs); /// List<ModuleAskingForCreation> result = new List<ModuleAskingForCreation>(); /// ModulesAskingForCreation moduleAFC; /// ModulesConnection moduleConnection; /// foreach (string moduleAFCName in modulesAFC.Keys) /// { /// moduleAFC = modulesAFC[moduleAFCName]; /// switch (moduleAFCName) /// { /// /* ... */ /// case "MAFC1": /// moduleConnection = new ModulesConnection(); /// moduleConnection.socketName = "Socket1"; /// moduleConnection.boxModuleParam = GetBoxModulePrx(boxModule, "MyBoxBoduleInputSocket"); /// /* ... */ /// break; /// } /// moduleAFC.modulesConnection = new ModulesConnection[] { moduleConnection }; /// result.Add(moduleAFC); /// } /// return result.ToArray(); /// } /// } /// } /// </code> /// </example> /// <param name="boxModule">Box Module (having socket named <c>socketName</c>).</param> /// <param name="socketName">Name of socket.</param> /// <returns><see cref="T:Ferda.Modules.BoxModulePrx"/> i.e. proxy of BoxModule connected in <c>socketName</c>.</returns> /// <exception cref="T:System.Exception">Thrown iff there /// is connected more than one BoxModule in <c>socketName</c>. /// </exception> /// <exception cref="T:Ferda.Modules.NoConnectionInSocketError"> /// Thrown iff there is no BoxModule connected in <c>socketName</c>. /// </exception> public static BoxModulePrx GetBoxModulePrx(BoxModuleI boxModule, string socketName) { BoxModulePrx[] connections = boxModule.GetConnections(socketName); if (connections.Length == 0) { throw Ferda.Modules.Exceptions.NoConnectionInSocketError(null, boxModule.StringIceIdentity, "BoxInf15: There is no connection in the socket! (" + socketName + ")", new string[] { socketName }); } else if (connections.Length == 1) { foreach (BoxModulePrx prx in connections) { return prx; } } string message = "BoxInf16: There should be connected one box at maximum! in socket: \"" + socketName + "\"."; System.Diagnostics.Debug.WriteLine(message); throw new Exception(message); }
/// <summary> /// Gets the box modules asking for creation. /// </summary> /// <param name="localePrefs">The localization preferences.</param> /// <param name="boxModule">The box module.</param> /// <returns> /// Array of <see cref="T:Ferda.Modules.ModuleAskingForCreation"> /// Modules Asking For Creation</see>. /// </returns> public override ModulesAskingForCreation[] GetModulesAskingForCreation(string[] localePrefs, BoxModuleI boxModule) { Dictionary<string, ModulesAskingForCreation> modulesAFC = this.getModulesAskingForCreationNonDynamic(localePrefs); List<ModulesAskingForCreation> result = new List<ModulesAskingForCreation>(); ModulesAskingForCreation moduleAFC; ModulesConnection moduleConnection; ModuleAskingForCreation singleModuleAFC; foreach (string moduleAFCName in modulesAFC.Keys) { moduleAFC = modulesAFC[moduleAFCName]; moduleConnection = new ModulesConnection(); singleModuleAFC = new ModuleAskingForCreation(); switch (moduleAFCName) { case "AtomSetting": moduleConnection.socketName = "Attribute"; moduleConnection.boxModuleParam = boxModule.MyProxy; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.AtomSetting.AtomSettingBoxInfo.typeIdentifier; break; case "EquivalenceClass": moduleConnection.socketName = "LiteralSettingOrAttribute"; moduleConnection.boxModuleParam = boxModule.MyProxy; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.EquivalenceClass.EquivalenceClassBoxInfo.typeIdentifier; break; case "CategorialPartialCedentSetting": moduleConnection.socketName = "Attribute"; moduleConnection.boxModuleParam = boxModule.MyProxy; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.CategorialPartialCedentSetting.CategorialPartialCedentSettingBoxInfo.typeIdentifier; break; default: throw Ferda.Modules.Exceptions.SwitchCaseNotImplementedError(moduleAFCName); } singleModuleAFC.modulesConnection = new ModulesConnection[] { moduleConnection }; moduleAFC.newModules = new ModuleAskingForCreation[] { singleModuleAFC }; result.Add(moduleAFC); } return result.ToArray(); }
/// <summary> /// Gets default value for box module user label. /// </summary> public override string GetDefaultUserLabel(BoxModuleI boxModule) { CoefficientTypeEnum coefficientType = (CoefficientTypeEnum)Enum.Parse(typeof(CoefficientTypeEnum), boxModule.GetPropertyString("CoefficientType")); string shortCoefficientType = this.GetPropertyOptionShortLocalizedLabel("CoefficientType", coefficientType.ToString(), boxModule.LocalePrefs); //get attribute`s userLabel string attributesUserLabel = "???"; BoxModulePrx attributeBoxModulePrx; if (Ferda.Modules.Boxes.SocketConnections.TryGetBoxModulePrx(boxModule, "Attribute", out attributeBoxModulePrx)) { string[] attributeDefaultUserLabel = attributeBoxModulePrx.getDefaultUserLabel(); if (attributeDefaultUserLabel.Length > 0) attributesUserLabel = attributeDefaultUserLabel[0]; } string result; switch (coefficientType) { case CoefficientTypeEnum.OneParticularCategory: result = (attributesUserLabel != "???") ? attributesUserLabel : shortCoefficientType; result += Constants.LeftFunctionBracket + boxModule.GetPropertyString("Category") + Constants.RightFunctionBracket; break; default: result = attributesUserLabel + Constants.LeftFunctionBracket + shortCoefficientType + Constants.LeftEnum + boxModule.GetPropertyLong("MinLen").ToString() + Constants.RangeSeparator + boxModule.GetPropertyLong("MaxLen").ToString() + Constants.RightEnum + Constants.RightFunctionBracket; break; } return result; }
/// <summary> /// Gets default value for box module user label. /// </summary> public override string GetDefaultUserLabel(BoxModuleI boxModule) { string odbcConnectionString = boxModule.GetPropertyString(OdbcConnectionStringPropertyName); if (!String.IsNullOrEmpty(odbcConnectionString)) { string[] itemsOfConnectionString = odbcConnectionString.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (itemsOfConnectionString != null) foreach (string item in itemsOfConnectionString) { if (!String.IsNullOrEmpty(item)) { item.Trim(); if (item.StartsWith("DSN=", StringComparison.OrdinalIgnoreCase)) return item.Substring(4); } } if (odbcConnectionString.Length <= 20) return odbcConnectionString; else return odbcConnectionString.Substring(0, 17) + "..."; } return null; }
/// <summary> /// Gets value of readonly property value. /// </summary> /// <param name="propertyName">Name of readonly property.</param> /// <param name="boxModule">Box module.</param> /// <returns> /// A <see cref="T:Ferda.Modules.PropertyValue"/> of /// readonly property named <c>propertyName</c>. /// </returns> public override PropertyValue GetReadOnlyPropertyValue(String propertyName, BoxModuleI boxModule) { switch (propertyName) { case RecordCountPropertyName: DataMatrixFunctionsI Func = (DataMatrixFunctionsI)boxModule.FunctionsIObj; long recordsCount = 0; try { recordsCount = Func.RecordsCount; } catch (Ferda.Modules.BoxRuntimeError) { } return new Ferda.Modules.LongTI(recordsCount); default: throw Ferda.Modules.Exceptions.SwitchCaseNotImplementedError(propertyName); } }
/// <summary> /// Executes (runs) action specified by <c>actionName</c>. /// </summary> /// <param name="actionName">Name of the action.</param> /// <param name="boxModule">The Box module.</param> /// <exception cref="T:Ferda.Modules.NameNotExistError">Thrown if action named <c>actionName</c> doesn`t exist.</exception> /// <exception cref="T:Ferda.Modules.BoxRuntimeError">Thrown if any runtime error occured while executing the action.</exception> public override void RunAction(string actionName, BoxModuleI boxModule) { switch (actionName) { case "TestPrimaryKeyColumns": this.TestPrimaryKeyColumnsAction(boxModule); break; default: throw Ferda.Modules.Exceptions.NameNotExistError(null, null, null, actionName); } }
/// <summary> /// Gets array of <see cref="T:Ferda.Modules.SelectString"/> as /// options for property, whose options are dynamically variable. /// </summary> public override SelectString[] GetPropertyOptions(String propertyName, BoxModuleI boxModule) { switch (propertyName) { case DataMatrixNamePropertyName: string[] dataMatrixNames = null; try { dataMatrixNames = ((DataMatrixFunctionsI)boxModule.FunctionsIObj).GetDatabaseFunctionsPrx().getDataMatrixNames(); } catch (Ferda.Modules.BoxRuntimeError) {} return BoxInfoHelper.StringArrayToSelectStringArray(dataMatrixNames); case PrimaryKeyColumnsPropertyName: string[] columnNames = null; try { columnNames = ((DataMatrixFunctionsI)boxModule.FunctionsIObj).getColumnsNames(); } catch (Ferda.Modules.BoxRuntimeError) { } return BoxInfoHelper.StringArrayToSelectStringArray(columnNames); default: return null; } }
public override void CreateFunctions(BoxModuleI boxModule, out Ice.Object iceObject, out IFunctions functions) { EquivalenceClassFunctionsI result = new EquivalenceClassFunctionsI(); iceObject = (Ice.Object)result; functions = (IFunctions)result; }
/// <summary> /// Gets default value for box module user label. /// </summary> public override string GetDefaultUserLabel(BoxModuleI boxModule) { return null; }
/// <summary> /// Gets array of <see cref="T:Ferda.Modules.SelectString"/> as /// options for property, whose options are dynamically variable. /// </summary> public override SelectString[] GetPropertyOptions(string propertyName, BoxModuleI boxModule) { return null; }
public override void CreateFunctions(BoxModuleI boxModule, out Ice.Object iceObject, out IFunctions functions) { FunctionSumOfRowsFunctionsI result = new FunctionSumOfRowsFunctionsI(); iceObject = (Ice.Object)result; functions = (IFunctions)result; }
/// <summary> /// It is strongly recommended to call this functions before calling any other function in this class. /// </summary> public GeneratedAttribute Value(string boxIdentity, BoxModuleI boxModule, ColumnInfo columnInfo, AttributeDomainEnum domainType, double from, double to, long countOfCategories) { lock (this) { Dictionary<string, IComparable> cacheSetting = new Dictionary<string, IComparable>(); cacheSetting.Add(Database.DatabaseBoxInfo.typeIdentifier + Database.DatabaseBoxInfo.OdbcConnectionStringPropertyName, columnInfo.dataMatrix.database.odbcConnectionString); cacheSetting.Add(DataMatrix.DataMatrixBoxInfo.typeIdentifier + DataMatrix.DataMatrixBoxInfo.DataMatrixNamePropertyName, columnInfo.dataMatrix.dataMatrixName); cacheSetting.Add(DataMatrix.DataMatrixBoxInfo.typeIdentifier + DataMatrix.DataMatrixBoxInfo.RecordCountPropertyName, columnInfo.dataMatrix.recordsCount); cacheSetting.Add(Column.ColumnBoxInfo.typeIdentifier + Column.ColumnBoxInfo.ColumnSelectExpressionPropertyName, columnInfo.columnSelectExpression); cacheSetting.Add("DomainType", domainType); cacheSetting.Add("From", from); cacheSetting.Add("To", to); cacheSetting.Add("CountOfCategories", countOfCategories); if (IsObsolete(columnInfo.dataMatrix.database.lastReloadInfo, cacheSetting)) { try { value = EquidistantAlgorithm.Generate( domainType, from, to, countOfCategories, columnInfo, boxIdentity); } catch (Ferda.Modules.BadParamsError ex) { value = new GeneratedAttribute(); if (ex.restrictionType == restrictionTypeEnum.DbColumnDataType) { boxModule.OutputMessage( Ferda.ModulesManager.MsgType.Info, "UnsupportedColumnDatatype", "NumericDatatypesSupportedOnly"); } else throw Ferda.Modules.Exceptions.BoxRuntimeError(ex, boxModule.StringIceIdentity, null); } } if (value == null) value = new GeneratedAttribute(); return value; } }
private void TestPrimaryKeyColumnsAction(BoxModuleI boxModule) { bool isPrimaryKey = false; DataMatrixFunctionsI functionsIObj = (DataMatrixFunctionsI)boxModule.FunctionsIObj; try { Ferda.Modules.Helpers.Data.DataMatrix.TestValuesInEnteredPrimaryKeyColumnsAreNotUniqueError( functionsIObj.GetDatabaseFunctionsPrx().getDatabaseInfo().odbcConnectionString, functionsIObj.DataMatrixName, functionsIObj.PrimaryKeyColumns, boxModule.StringIceIdentity ); isPrimaryKey = true; } catch (Ferda.Modules.BoxRuntimeError) { } if (isPrimaryKey) // test succeed boxModule.OutputMessage( Ferda.ModulesManager.MsgType.Info, "TestPrimaryKey", "ActionTestTestPrimaryKeySucceed"); else // test failed boxModule.OutputMessage( Ferda.ModulesManager.MsgType.Warning, "TestPrimaryKey", "ActionTestTestPrimaryKeyFailed"); }
/// <summary> /// Gets default value for box module user label. /// </summary> public override string GetDefaultUserLabel(BoxModuleI boxModule) { return boxModule.GetPropertyString(DataMatrixNamePropertyName); }
public override void Validate(BoxModuleI boxModule) { DataMatrixFunctionsI functionsIObj = (DataMatrixFunctionsI)boxModule.FunctionsIObj; Database.DatabaseInfo databaseInfo = functionsIObj.GetDatabaseFunctionsPrx().getDatabaseInfo(); Ferda.Modules.Helpers.Data.DataMatrix.TestDataMatrixExists( databaseInfo.odbcConnectionString, functionsIObj.DataMatrixName, boxModule.StringIceIdentity); Ferda.Modules.Helpers.Data.DataMatrix.TestValuesInEnteredPrimaryKeyColumnsAreNotUniqueError( databaseInfo.odbcConnectionString, functionsIObj.DataMatrixName, functionsIObj.PrimaryKeyColumns, boxModule.StringIceIdentity); }
public override void CreateFunctions(BoxModuleI boxModule, out Ice.Object iceObject, out IFunctions functions) { ChiSquaredFunctionsI result = new ChiSquaredFunctionsI(); iceObject = (Ice.Object)result; functions = (IFunctions)result; }
public override void CreateFunctions(BoxModuleI boxModule, out Ice.Object iceObject, out IFunctions functions) { DataMatrixFunctionsI result = new DataMatrixFunctionsI(); iceObject = (Ice.Object)result; functions = (IFunctions)result; }
/// <summary> /// It is strongly recommended to call this functions before calling any other function in this class. /// </summary> public GeneratedAttribute Value(string boxIdentity, BoxModuleI boxModule, ColumnInfo columnInfo) { lock (this) { Dictionary<string, IComparable> cacheSetting = new Dictionary<string, IComparable>(); cacheSetting.Add(Database.DatabaseBoxInfo.typeIdentifier + Database.DatabaseBoxInfo.OdbcConnectionStringPropertyName, columnInfo.dataMatrix.database.odbcConnectionString); cacheSetting.Add(DataMatrix.DataMatrixBoxInfo.typeIdentifier + DataMatrix.DataMatrixBoxInfo.DataMatrixNamePropertyName, columnInfo.dataMatrix.dataMatrixName); cacheSetting.Add(DataMatrix.DataMatrixBoxInfo.typeIdentifier + DataMatrix.DataMatrixBoxInfo.RecordCountPropertyName, columnInfo.dataMatrix.recordsCount); cacheSetting.Add(Column.ColumnBoxInfo.typeIdentifier + Column.ColumnBoxInfo.ColumnSelectExpressionPropertyName, columnInfo.columnSelectExpression); if (IsObsolete(columnInfo.dataMatrix.database.lastReloadInfo, cacheSetting)) { value = new GeneratedAttribute(); value = EachValueOneCategoryAlgorithm.Generate( columnInfo.dataMatrix.database.odbcConnectionString, columnInfo.dataMatrix.dataMatrixName, columnInfo.columnSelectExpression, boxIdentity); } if (value == null) value = new GeneratedAttribute(); return value; } }
/// <summary> /// Gets the box modules asking for creation. /// </summary> /// <param name="localePrefs">The localization preferences.</param> /// <param name="boxModule">The box module.</param> /// <returns> /// Array of <see cref="T:Ferda.Modules.ModuleAskingForCreation"> /// Modules Asking For Creation</see>. /// </returns> public override ModulesAskingForCreation[] GetModulesAskingForCreation(string[] localePrefs, BoxModuleI boxModule) { Dictionary<string, ModulesAskingForCreation> modulesAFC = this.getModulesAskingForCreationNonDynamic(localePrefs); List<ModulesAskingForCreation> result = new List<ModulesAskingForCreation>(); ModulesAskingForCreation moduleAFC; ModulesConnection moduleConnection; ModuleAskingForCreation singleModuleAFC; List<ModuleAskingForCreation> allColumnModulesAFC = new List<ModuleAskingForCreation>(); // I presuppose that item with key "Column" is before item with key "AllColumns" foreach (string moduleAFCName in modulesAFC.Keys) { moduleAFC = modulesAFC[moduleAFCName]; switch (moduleAFCName) { case "Column": DataMatrixFunctionsI Func = (DataMatrixFunctionsI)boxModule.FunctionsIObj; string[] columnsNames = null; try { columnsNames = Func.getColumnsNames(); } catch (Ferda.Modules.BoxRuntimeError) { } if (columnsNames != null && columnsNames.Length > 0) { moduleConnection = new ModulesConnection(); moduleConnection.socketName = "DataMatrixOrMultiColumn"; moduleConnection.boxModuleParam = boxModule.MyProxy; foreach (string columnName in columnsNames) { ModulesAskingForCreation newMAFC = new ModulesAskingForCreation(); newMAFC.label = moduleAFC.label.Replace("@Name", columnName); newMAFC.hint = moduleAFC.hint.Replace("@Name", columnName); newMAFC.help = moduleAFC.help; singleModuleAFC = new ModuleAskingForCreation(); singleModuleAFC.modulesConnection = new ModulesConnection[] { moduleConnection }; ; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.Column.ColumnBoxInfo.typeIdentifier; PropertySetting propertySetting = new PropertySetting(); propertySetting.propertyName = "Name"; propertySetting.value = new Ferda.Modules.StringTI(columnName); singleModuleAFC.propertySetting = new PropertySetting[] { propertySetting }; allColumnModulesAFC.Add(singleModuleAFC); newMAFC.newModules = new ModuleAskingForCreation[] { singleModuleAFC }; result.Add(newMAFC); } } break; case "DerivedColumn": moduleConnection = new ModulesConnection(); singleModuleAFC = new ModuleAskingForCreation(); moduleConnection.socketName = "DataMatrix"; moduleConnection.boxModuleParam = boxModule.MyProxy; singleModuleAFC.modulesConnection = new ModulesConnection[] { moduleConnection }; singleModuleAFC.newBoxModuleIdentifier = Ferda.Modules.Boxes.DataMiningCommon.DerivedColumn.DerivedColumnBoxInfo.typeIdentifier; moduleAFC.newModules = new ModuleAskingForCreation[] { singleModuleAFC }; result.Add(moduleAFC); break; case "AllColumns": if (allColumnModulesAFC.Count <= 1) continue; moduleConnection = new ModulesConnection(); moduleConnection.socketName = "DataMatrixOrMultiColumn"; moduleConnection.boxModuleParam = boxModule.MyProxy; moduleAFC.newModules = allColumnModulesAFC.ToArray(); result.Add(moduleAFC); break; default: throw Ferda.Modules.Exceptions.SwitchCaseNotImplementedError(moduleAFCName); } } return result.ToArray(); }
/// <summary> /// Sets the <see cref="T:Ferda.Modules.BoxModuleI">box module</see> /// and the <see cref="T:Ferda.Modules.Boxes.IBoxInfo">box info</see>. /// </summary> /// <param name="boxModule">The box module.</param> /// <param name="boxInfo">The box info.</param> public void setBoxModuleInfo(BoxModuleI boxModule, IBoxInfo boxInfo) { this.boxModule = boxModule; //this.boxInfo = boxInfo; }