private void UpdateNodeStatistics(Node <char> characterNode, WordPartStatistics statistics, bool isLastCharacter) { if (isLastCharacter) { UpdateNodeStatisticsInternal(characterNode, statistics); } }
private void UpdateNodeStatisticsInternal(Node <char> characterNode, WordPartStatistics statistics) { if (characterNode.Tag == null) { characterNode.Tag = statistics; } else { characterNode.Tag += statistics; } }
private char GetLeafLetterByStatistics(WordPartStatistics wordPartStatistics) { int result = Int32Constants.Zero; result = BoolToInt32(wordPartStatistics.Positions.Any(position => position.Key == Positions.First && position.Value > Int32Constants.Zero)); result = result << Int32Constants.One; result += BoolToInt32(wordPartStatistics.Positions.Any(position => position.Key == Positions.Middle && position.Value > Int32Constants.Zero)); result = result << Int32Constants.One; result += BoolToInt32(wordPartStatistics.Positions.Any(position => position.Key == Positions.Last && position.Value > Int32Constants.Zero)); return(StatisticsLeafNodeCharacters[result]); }
private char GetLeafLetter(WordPartStatistics wordPartStatistics) { char result; if (wordPartStatistics == null) { result = DefaultLeafNodeCharacter; } else { result = GetLeafLetterByStatistics(wordPartStatistics); } return(result); }