protected internal override void AddTo(Pick.Target target) { // get contents into separate buffer addBuffer.CopyState(target); addBuffer.Clear(); item.AddTo(addBuffer); String newValue = addBuffer.Get(); if (IBM.ICU.Charset.Pick.DEBUG) { System.Console.Out.WriteLine("Old: " + lastValue + ", New:" + newValue); } // if not first one, merge with old if (lastValue != null) { mergeBuffer.Length = 0; int lastIndex = 0; int newIndex = 0; // the new length is a random value between old and new. int newLenLimit = (int)IBM.ICU.Charset.Pick.PickMthd(target.random, lastValue.Length, newValue.Length); while (mergeBuffer.Length < newLenLimit && newIndex < newValue.Length && lastIndex < lastValue.Length) { int c = choice.ToIndex(target.NextDouble()); if (c == COPY_NEW || c == COPY_BOTH || c == SKIP) { newIndex = IBM.ICU.Charset.Pick.GetChar(newValue, newIndex, mergeBuffer, c < LEAST_SKIP); if (mergeBuffer.Length >= newLenLimit) { break; } } if (c == COPY_LAST || c == COPY_BOTH || c == SKIP) { lastIndex = IBM.ICU.Charset.Pick.GetChar(lastValue, lastIndex, mergeBuffer, c < LEAST_SKIP); } } newValue = mergeBuffer.ToString(); } lastValue = newValue; target.Append(newValue); if (IBM.ICU.Charset.Pick.DEBUG) { System.Console.Out.WriteLine("Result: " + newValue); } }
protected internal override void AddTo(Pick.Target target) { target.Append(name); }
protected internal override void AddTo(Pick.Target target) { target.Append(source.CharAt(IBM.ICU.Charset.Pick.PickMthd(target.random, 0, source.Size() - 1))); }