Example #1
0
        public bool TryAddParameter(ProfileParameter parameter)
        {
            if (this.TotalBytes + parameter.ByteCount > MaxBytes)
            {
                return(false);
            }

            this.Parameters.Add(parameter);
            return(true);
        }
 public MathValueAndDependencies(
     MathValue mathValue,
     ProfileParameter xParameter,
     Conversion xConversion,
     ProfileParameter yParameter,
     Conversion yConversion)
 {
     this.MathValue   = mathValue;
     this.XParameter  = xParameter;
     this.XConversion = xConversion;
     this.YParameter  = yParameter;
     this.YConversion = yConversion;
 }
        public MathValueProcessor(LogProfile profile, MathValueConfiguration mathValueConfiguration)
        {
            this.profile    = profile;
            this.mathValues = new List <MathValueAndDependencies>();

            foreach (MathValue mathValue in mathValueConfiguration.MathValues)
            {
                ProfileParameter xParameter  = null;
                Conversion       xConversion = null;
                ProfileParameter yParameter  = null;
                Conversion       yConversion = null;

                foreach (ProfileParameter parameter in this.profile.AllParameters)
                {
                    // TODO: Find the parameter in a configuration file that contains all parameters and conversions,
                    // pick the appropriate conversion even if it's not what the user chose for this log profile.
                    if (parameter.Name == mathValue.XParameter)
                    {
                        xParameter  = parameter;
                        xConversion = parameter.Conversion;
                    }

                    if (parameter.Name == mathValue.YParameter)
                    {
                        yParameter  = parameter;
                        yConversion = parameter.Conversion;
                    }
                }

                if ((xParameter != null) &&
                    (xConversion != null) &&
                    (yParameter != null) &&
                    (yConversion != null))
                {
                    MathValueAndDependencies valueAndDependencies = new MathValueAndDependencies(
                        mathValue,
                        xParameter,
                        xConversion,
                        yParameter,
                        yConversion);

                    this.mathValues.Add(valueAndDependencies);
                }
            }
        }