Beispiel #1
0
        /// <summary>
        /// Simple factory function that creates a terminal node and gets it's
        /// value initialized.  Terminals are only selected from the parameters
        /// to the ADF.
        /// </summary>
        protected new GPNode CreateNodeTerminal()
        {
            GPNodeTerminal node = GPNodeTerminal.Initialize(
                true, m_BranchADF.NumberArgs,
                false, (short)0,
                false, (short)0,
                m_Config.TerminalSet, m_Config.Profile.IntegerMin, m_Config.Profile.IntegerMax);

            return(node);
        }
        /// <summary>
        /// A simple factory function that creates a terminal node and gets
        /// it's value initialized.
        /// </summary>
        /// <returns>new terminal node</returns>
        protected GPNode CreateNodeTerminal()
        {
            GPNodeTerminal node = GPNodeTerminal.Initialize(
                false, (short)0,
                false, (short)0,
                false, (short)0,
                m_Config.TerminalSet, m_Config.Profile.IntegerMin, m_Config.Profile.IntegerMax);

            return(node);
        }
        /// <summary>
        /// A simple factory function that creates a terminal node and gets
        /// it's value initialized.
        /// </summary>
        protected new GPNode CreateNodeTerminal()
        {
            //
            // TODO: Need to modify the terminal initialization to allow the arguments
            // to be selected from ADR parameters.
            GPNodeTerminal node = GPNodeTerminal.Initialize(
                false, 0,
                false, 0,
                true, m_BranchADR.NumberArgs,
                m_Config.TerminalSet, m_Config.Profile.IntegerMin, m_Config.Profile.IntegerMax);

            return(node);
        }
        //
        // Create the Element entry for a single node in the progam
        private void WriteProgramNode(GPNode node)
        {
            m_xmlWriter.WriteStartElement("GPNode");

            //
            // Terminal or function node?
            if (node is GPNodeTerminal)
            {
                GPNodeTerminal nodeTerminal = (GPNodeTerminal)node;

                m_xmlWriter.WriteAttributeString("Type", "Terminal");
                //
                // Write the type
                m_xmlWriter.WriteStartElement("Terminal");
                m_xmlWriter.WriteValue(nodeTerminal.ToValueTypeString());
                m_xmlWriter.WriteEndElement();
                //
                // Write the value
                m_xmlWriter.WriteStartElement("Value");
                if (node is GPNodeTerminalADRoot)
                {
                    m_xmlWriter.WriteValue(((GPNodeTerminalADRoot)node).WhichParameter);
                }
                else if (node is GPNodeTerminalUserDefined)
                {
                    m_xmlWriter.WriteValue(((GPNodeTerminalUserDefined)node).WhichUserDefined);
                }
                else if (node is GPNodeTerminalInteger)
                {
                    m_xmlWriter.WriteValue(((GPNodeTerminalInteger)node).Value);
                }
                else if (node is GPNodeTerminalDouble)
                {
                    m_xmlWriter.WriteValue(((GPNodeTerminalDouble)node).ToString());
                }
                m_xmlWriter.WriteEndElement();
            }
            else
            if (node is GPNodeFunction)
            {
                m_xmlWriter.WriteAttributeString("Type", "Function");

                WriteFunctionNodeBody(node);
            }

            m_xmlWriter.WriteEndElement();
        }