示例#1
0
        public static string generateLineMatrix(GenerationRules ruleData, MatrixJson matrixData)
        {
            string matrixString = "";

            for (int i = 0; i < ruleData.matrixAtLine; i++)
            {
                matrixString = matrixString + "\r\n";
            }
            for (int i = 0; i < matrixData.connections.Count; i++)
            {
                matrixString = matrixString + Helper.CorrectSeparatorValue(matrixData.connections[i].value, ruleData.separator) + ruleData.delimiter;
            }

            return(matrixString);
        }
示例#2
0
        public static string generateColumnMatrix(GenerationRules ruleData, MatrixJson matrixData)
        {
            string matrixString = "";

            for (int i = 0; i < ruleData.matrixAtLine; i++)
            {
                matrixString = matrixString + "\r\n";
            }
            for (int i = 0; i < matrixData.connections.Count; i++)
            {
                if (Helper.ConvertToDouble(matrixData.connections[i].value) > 0)
                {
                    matrixString = matrixString + matrixData.connections[i].from + ruleData.delimiter + matrixData.connections[i].to + ruleData.delimiter + Helper.CorrectSeparatorValue(matrixData.connections[i].value, ruleData.separator) + "\r\n";
                }
            }

            return(matrixString);
        }
示例#3
0
        public static string AddNotationRules(string matrix, GenerationRules ruleData, MatrixJson matrixData)
        {
            var    notation  = (YamlMappingNode)ruleData.notation;
            string newMatrix = "";

            for (int i = 0; i < notation.Children.Count; i++)
            {
                if (newMatrix != "")
                {
                    matrix = newMatrix;
                }

                YamlMappingNode notationData = (YamlMappingNode)notation.Children[new YamlScalarNode((i + 1).ToString())];
                string          element      = notationData.Children[new YamlScalarNode("el")].ToString();
                string          formula      = notationData.Children[new YamlScalarNode("f")].ToString();
                string          value        = notationData.Children[new YamlScalarNode("v")].ToString();
                newMatrix = DoNotationRule(matrix, element, formula, value, matrixData);
            }

            return(newMatrix);
        }