ConcatenateTopWordsOrWordPairs ( List <GraphMetricValueOrdered> topWordsOrWordPairs, Boolean concatenateTopWords, Int32 maximumTopWordsOrWordPairs ) { Debug.Assert(topWordsOrWordPairs != null); Debug.Assert(maximumTopWordsOrWordPairs > 0); return(String.Join( concatenateTopWords ? WordSeparator : WordPairSeparator, TwitterSearchNetworkStringUtil.TakeTopStringsAsArray( (from oGroupMetricValueWithID in topWordsOrWordPairs select ExcelTextUtil.UnforceCellText( (String)oGroupMetricValueWithID.Value)) , maximumTopWordsOrWordPairs) )); }
CopyWordMetricsForGroup ( String groupNameOrDummyGroupName, GraphMetricValueOrdered [] word1Values, GraphMetricValueOrdered [] word2Values, GraphMetricValueOrdered [] countValues, GraphMetricValueOrdered [] groupNameValues, Int32 firstRowForGroup, Int32 maximumTopWordsOrWordPairs, List <GraphMetricValueOrdered> topWordsOrWordPairs, List <GraphMetricValueOrdered> topCounts ) { Debug.Assert(!String.IsNullOrEmpty(groupNameOrDummyGroupName)); Debug.Assert(word1Values != null); // word2Values Debug.Assert(countValues != null); Debug.Assert(groupNameValues != null); Debug.Assert(firstRowForGroup >= 0); Debug.Assert(maximumTopWordsOrWordPairs > 0); Debug.Assert(topWordsOrWordPairs != null); Debug.Assert(topCounts != null); Int32 iRows = groupNameValues.Length; for (Int32 iRow = firstRowForGroup, iItems = 0; iRow < iRows && iItems < maximumTopWordsOrWordPairs; iRow++, iItems++) { Object oWord1AsObject = word1Values[iRow].Value; Object oCountAsObject = countValues[iRow].Value; Object oGroupNameAsObject = groupNameValues[iRow].Value; if ( !(oGroupNameAsObject is String) || (String)oGroupNameAsObject != groupNameOrDummyGroupName || !(oWord1AsObject is String) || !(oCountAsObject is Int32) ) { break; } String sWordOrWordPair = ExcelTextUtil.UnforceCellText( (String)oWord1AsObject); if (word2Values != null) { Object oWord2AsObject = word2Values[iRow].Value; if (!(oWord2AsObject is String)) { break; } sWordOrWordPair = FormatWordPair( sWordOrWordPair, ExcelTextUtil.UnforceCellText((String)oWord2AsObject)); } topWordsOrWordPairs.Add(new GraphMetricValueOrdered( ExcelTextUtil.ForceCellText(sWordOrWordPair))); topCounts.Add(new GraphMetricValueOrdered(oCountAsObject)); } }