Exemple #1
0
        public virtual GraphBuildInstruction MakeNodeInstruction(TNode node, diagramNodeShapeEnum nodeShapeType)
        {
            GraphBuildInstruction instruction = new GraphBuildInstruction();

            instruction.InstructionType = nodeShapeType;
            instruction.Parameters.Add(node.UID);

            return(instruction);
        }
Exemple #2
0
        public virtual GraphBuildInstructionSpan MakeNodeSpan(TNode node)
        {
            GraphBuildInstructionSpan output = new GraphBuildInstructionSpan();

            GraphBuildInstruction instruction = new GraphBuildInstruction();

            instruction.InstructionType = GetShapeForNode(node);
            instruction.Parameters.Add(node.UID);

            output.Add(instruction);
            return(output);
        }
Exemple #3
0
        public virtual GraphBuildInstructionSpan MakeLinkSpan(TNode nodeA, TNode nodeB)
        {
            GraphBuildInstructionSpan output = new GraphBuildInstructionSpan();

            output.Add(MakeNodeInstruction(nodeA, GetShapeForNode(nodeA)));

            GraphBuildInstruction instruction = new GraphBuildInstruction();

            instruction.InstructionType = GetShapeForLink(nodeA, nodeB);

            output.Add(instruction);

            output.Add(MakeNodeInstruction(nodeB, GetShapeForNode(nodeB)));
            return(output);
        }
Exemple #4
0
        /// <summary>
        /// Interprets the specified code into graph instruction sequence
        /// </summary>
        /// <param name="code">The code.</param>
        /// <returns></returns>
        public GraphBuildInstructionSequence Interpret(String code)
        {
            GraphBuildInstructionSequence output = new GraphBuildInstructionSequence();

            List <String> lines = code.SplitSmart(Environment.NewLine);

            foreach (String line in lines)
            {
                regexMarkerResultCollection syntaxInstructions = SyntaxMarkers.process(line);
                foreach (regexMarkerResult result in syntaxInstructions.GetByOrder())
                {
                    GraphBuildInstruction instruction = new GraphBuildInstruction()
                    {
                        InstructionType = result.marker,
                        Parameters      = result.GetGroups()
                    };
                    output.Add(instruction);
                }

                output.Add(new GraphBuildInstruction());
            }

            return(output);
        }