/// <summary>
        /// Copy the object.
        /// </summary>
        /// <param name="src">The copy is placed in this parameter.</param>
        public override void Copy(OptionalParameter src)
        {
            base.Copy(src);

            if (src is ExpansionParameter)
            {
                ExpansionParameter p = (ExpansionParameter)src;
                m_fProb           = p.prob;
                m_fMaxExpandRatio = p.max_expand_ratio;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Parses the parameter from a RawProto.
        /// </summary>
        /// <param name="rp">Specifies the RawProto to parse.</param>
        /// <returns>A new instance of the parameter is returned.</returns>
        public static ExpansionParameter FromProto(RawProto rp)
        {
            ExpansionParameter p = new ExpansionParameter();
            string             strVal;

            if ((strVal = rp.FindValue("prob")) != null)
            {
                p.prob = float.Parse(strVal);
            }

            if ((strVal = rp.FindValue("max_expand_ratio")) != null)
            {
                p.max_expand_ratio = float.Parse(strVal);
            }

            return(p);
        }
        /// <summary>
        /// Parses the parameter from a RawProto.
        /// </summary>
        /// <param name="rp">Specifies the RawProto to parse.</param>
        /// <returns>A new instance of the parameter is returned.</returns>
        public static new ExpansionParameter FromProto(RawProto rp)
        {
            ExpansionParameter p = new ExpansionParameter(false);
            string             strVal;

            RawProto rpOption = rp.FindChild("option");

            if (rpOption != null)
            {
                ((OptionalParameter)p).Copy(OptionalParameter.FromProto(rpOption));
            }

            if ((strVal = rp.FindValue("prob")) != null)
            {
                p.prob = BaseParameter.ParseFloat(strVal);
            }

            if ((strVal = rp.FindValue("max_expand_ratio")) != null)
            {
                p.max_expand_ratio = BaseParameter.ParseFloat(strVal);
            }

            return(p);
        }
Beispiel #4
0
 /// <summary>
 /// Copy the object.
 /// </summary>
 /// <param name="src">The copy is placed in this parameter.</param>
 public void Copy(ExpansionParameter src)
 {
     m_fProb           = src.prob;
     m_fMaxExpandRatio = src.max_expand_ratio;
 }