Пример #1
0
        internal static List <string> GetAcronymsUsedByVariable(string variableName)
        {
            List <string> acronymList = new List <string>();

            variableName = VariablesManager.RemoveSimulatedPostfix(variableName).ToLower();
            for (int pos = 1; pos < variableName.Length - 1; pos += 2)
            {
                acronymList.Add(variableName.Substring(pos, 2));
            }
            if (variableName.Length > 0 && variableName.Length % 2 == 0)          //correct variable name must have an odd length (type + acros with 2 characters)
            {
                acronymList.Add(variableName.Substring(variableName.Length - 1)); //add the incorrect (1-character) acro to produce an invalid description in the automatic label
            }
            return(acronymList);
        }
Пример #2
0
 internal void UpdateAutomaticLabelForSpecificAcronyms(List <KeyValuePair <string, string> > acronymsWithType)
 {
     foreach (DataGridViewRow row in _variablesForm.dgvVariables.Rows)
     {
         VarConfig.VariableRow variableRow = row.Tag as VarConfig.VariableRow;
         foreach (KeyValuePair <string, string> acronymWithType in acronymsWithType)
         {
             if (acronymWithType.Value.ToLower().Contains(VariablesManager.GetVariableType(variableRow.Name).ToLower()) &&
                 GetAcronymsUsedByVariable(variableRow.Name).Contains(acronymWithType.Key.ToLower()))
             {
                 variableRow.AutoLabel = GetAutomaticLabel(variableRow.Name);
             }
         }
     }
 }
Пример #3
0
        internal string GetVariablesUsingAcronym(string acronym, string acronymType)
        {
            string usingVariables = string.Empty;

            foreach (DataGridViewRow row in _variablesForm.dgvVariables.Rows)
            {
                VarConfig.VariableRow variableRow = row.Tag as VarConfig.VariableRow;
                if (acronymType.ToLower().Contains(VariablesManager.GetVariableType(variableRow.Name).ToLower()) &&
                    GetAcronymsUsedByVariable(variableRow.Name).Contains(acronym.ToLower()))
                {
                    usingVariables += variableRow.Name + " ";
                }
            }
            return(usingVariables);
        }
Пример #4
0
        internal static bool IsAcronymOfVariable(string variable, string acro, string acroType)
        {
            variable = variable.ToLower();
            acro     = acro.ToLower();

            if (variable.Contains(acro)) //first a rough test ...
            {                            //... if passed a more accurate test
                if (VariablesManager.IsVariableOfType(variable, acroType))
                {
                    if (GetAcronymsUsedByVariable(variable).Contains(acro))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #5
0
        internal string GetAutomaticLabel(string variableName, string currentLabel = "")
        {
            string variableType = VariablesManager.GetVariableType(variableName);

            if (variableType.ToLower() == IDENTIFIER_TYPE.ToLower())
            {
                return(currentLabel); //id's (e.g. idhh, idperson) do not follow the rules, therefore don't change
            }
            string AutomaticLabel = _varConfigFacade.GetTypeDescription(variableType);

            foreach (string acronym in GetAcronymsUsedByVariable(variableName))
            {
                AutomaticLabel += AUTOMATICLABEL_SEPARATOR + _varConfigFacade.GetAcronymDescription(variableType, acronym);
            }
            if (VariablesManager.IsSimulated(variableName))
            {
                AutomaticLabel += AUTOMATICLABEL_SEPARATOR + AUTOMATICLABEL_SIMULATED;
            }
            return(AutomaticLabel);
        }