예제 #1
0
        /// <summary>
        /// This method will create a jitterbug flow using the passing in IPDs as the base.
        /// </summary>
        /// <param name="ipdsToModify">Note, these ipds will be cloned and thus the passed reference will remain unmodified</param>
        /// <param name="type"></param>
        /// <returns></returns>
        protected List <decimal> CreateJitterBugFlow(List <decimal> ipdsToModify, JitterBugType type)
        {
            //This will clone the passed in IPDs so that we do not modify the original list.
            List <decimal> ipds = ipdsToModify.FindAll(r => true);

            List <decimal> jBugIpds = new List <decimal>();

            while (ipds.Count > 0)
            {
                List <decimal> sampleIpds;

                if (ipds.Count > _setInfo.SampleSize)
                {
                    sampleIpds = ipds.GetRange(0, _setInfo.SampleSize);
                    ipds.RemoveRange(0, _setInfo.SampleSize);
                }
                else
                {
                    sampleIpds = ipds.GetRange(0, ipds.Count);
                    ipds.Clear();
                }

                JitterBugBase jBug = JitterBugBase.Create(_setInfo.MessageToEncode, sampleIpds, type, _trainingIpds, _setInfo.NumTrainingBins, _setInfo.JBugInfo);

                jBugIpds.AddRange(jBug.GetIPDs());
            }

            return(jBugIpds);
        }
예제 #2
0
파일: SetBase.cs 프로젝트: rjwalls/Liquid
        /// <summary>
        /// This method will create a jitterbug flow using the passing in IPDs as the base.
        /// </summary>
        /// <param name="ipdsToModify">Note, these ipds will be cloned and thus the passed reference will remain unmodified</param>
        /// <param name="type"></param>
        /// <returns></returns>
        protected List<decimal> CreateJitterBugFlow(List<decimal> ipdsToModify, JitterBugType type)
        {
            //This will clone the passed in IPDs so that we do not modify the original list.
            List<decimal> ipds = ipdsToModify.FindAll(r => true);

            List<decimal> jBugIpds = new List<decimal>();

            while (ipds.Count > 0)
            {
                List<decimal> sampleIpds;

                if (ipds.Count > _setInfo.SampleSize)
                {
                    sampleIpds = ipds.GetRange(0, _setInfo.SampleSize);
                    ipds.RemoveRange(0, _setInfo.SampleSize);
                }
                else
                {
                    sampleIpds = ipds.GetRange(0, ipds.Count);
                    ipds.Clear();
                }

                JitterBugBase jBug = JitterBugBase.Create(_setInfo.MessageToEncode, sampleIpds, type, _trainingIpds, _setInfo.NumTrainingBins, _setInfo.JBugInfo);

                jBugIpds.AddRange(jBug.GetIPDs());
            }

            return jBugIpds;
        }
예제 #3
0
        public static JitterBugBase Create(string message, List <decimal> ipds, JitterBugType type, List <decimal> trainingIpds, int numBins, JitterBugInfo jBugInfo)
        {
            string binaryMessage = ConvertToBinary(message);

            JitterBugBase jitterBase;

            switch (type)
            {
            case JitterBugType.Rnd:
                jitterBase = new JitterBugRnd(binaryMessage, ipds, jBugInfo);
                break;

            case JitterBugType.NonRnd:
                jitterBase = new JitterBugNonRnd(binaryMessage, ipds, jBugInfo);
                break;

            case JitterBugType.Shaping:
                jitterBase = new JitterBugShaping(binaryMessage, ipds, jBugInfo, trainingIpds, numBins);
                break;

            default:
                throw new ApplicationException("Unknown Jitterbug type!");
            }

            return(jitterBase);
        }
예제 #4
0
        public static JitterBugBase Create(string message, List<decimal> ipds, JitterBugType type, List<decimal> trainingIpds, int numBins, JitterBugInfo jBugInfo)
        {
            string binaryMessage = ConvertToBinary(message);

            JitterBugBase jitterBase;

            switch(type)
            {
                case JitterBugType.Rnd:
                    jitterBase = new JitterBugRnd(binaryMessage, ipds, jBugInfo);
                    break;
                case JitterBugType.NonRnd:
                    jitterBase = new JitterBugNonRnd(binaryMessage, ipds, jBugInfo);
                    break;
                case JitterBugType.Shaping:
                    jitterBase = new JitterBugShaping(binaryMessage, ipds, jBugInfo, trainingIpds, numBins);
                    break;
                default:
                    throw new ApplicationException("Unknown Jitterbug type!");
            }

            return jitterBase;
        }