/// <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); }
/// <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; }
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); }
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; }