Parses the text of a Twitter status (tweet).
A tweet is known as a "status" in the Twitter API, so "status" is the term used in this class's methods.
Inheritance: Object
    //*************************************************************************
    //  Constructor: TwitterNetworkAnalyzerBase()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="TwitterNetworkAnalyzerBase" /> class.
    /// </summary>
    //*************************************************************************

    public TwitterNetworkAnalyzerBase()
    {
        m_oTwitterUtil = null;
        m_oTwitterStatusTextParser = new TwitterStatusTextParser();

        AssertValid();
    }
    //*************************************************************************
    //  Constructor: TwitterSearchNetworkTopItemsCalculator2()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="TwitterSearchNetworkTopItemsCalculator2" /> class.
    /// </summary>
    ///
    /// <param name="graphHistory">
    /// Describes how the graph was created.
    /// </param>
    //*************************************************************************

    public TwitterSearchNetworkTopItemsCalculator2
    (
        GraphHistory graphHistory
    )
    {
        m_oGraphHistory = graphHistory;
        m_oTwitterStatusTextParser = new TwitterStatusTextParser();

        AssertValid();
    }
    AppendRepliesToAndMentionsEdgeXmlNodes
    (
        GraphMLXmlDocument graphMLXmlDocument,
        TwitterStatusTextParser twitterStatusTextParser,
        HashSet<String> uniqueScreenNames,
        Boolean includeRepliesToEdges,
        Boolean includeMentionsEdges,
        Boolean includeNonRepliesToNonMentionsEdges,
        String screenName,
        TwitterStatus twitterStatus,
        Boolean includeStatus
    )
    {
        Debug.Assert(graphMLXmlDocument != null);
        Debug.Assert(twitterStatusTextParser != null);
        Debug.Assert(uniqueScreenNames != null);
        Debug.Assert( !String.IsNullOrEmpty(screenName) );
        Debug.Assert(twitterStatus != null);

        String statusText = twitterStatus.Text;
        Boolean isReplyTo = false;
        Boolean isMentions = false;

        Debug.Assert( !String.IsNullOrEmpty(statusText) );

        String repliedToScreenName;
        String [] uniqueMentionedScreenNames;

        twitterStatusTextParser.GetScreenNames(statusText,
            out repliedToScreenName, out uniqueMentionedScreenNames);

        if (repliedToScreenName != null)
        {
            if (
                repliedToScreenName != screenName
                &&
                uniqueScreenNames.Contains(repliedToScreenName)
                )
            {
                isReplyTo = true;

                if (includeRepliesToEdges)
                {
                    AppendRepliesToAndMentionsEdgeXmlNode(
                        graphMLXmlDocument, screenName, repliedToScreenName,
                        RepliesToRelationship, twitterStatus, includeStatus);
                }
            }
        }

        foreach (String mentionedScreenName in uniqueMentionedScreenNames)
        {
            if (
                mentionedScreenName != screenName
                &&
                uniqueScreenNames.Contains(mentionedScreenName)
                )
            {
                isMentions = true;

                if (includeMentionsEdges)
                {
                    AppendRepliesToAndMentionsEdgeXmlNode(
                        graphMLXmlDocument, screenName, mentionedScreenName,
                        MentionsRelationship, twitterStatus, includeStatus);
                }
            }
        }

        if (includeNonRepliesToNonMentionsEdges && !isReplyTo && !isMentions)
        {
            // Append a self-loop edge to represent the tweet.

            AppendRepliesToAndMentionsEdgeXmlNode(
                graphMLXmlDocument, screenName, screenName,
                NonRepliesToNonMentionsRelationship, twitterStatus,
                includeStatus);
        }
    }
    AppendRepliesToAndMentionsEdgeXmlNodes
    (
        GraphMLXmlDocument graphmlXmlDocument,
        IEnumerable<TwitterUser> twitterUsers,
        HashSet<String> uniqueScreenNames,
        Boolean includeRepliesToEdges,
        Boolean includeMentionsEdges,
        Boolean includeNonRepliesToNonMentionsEdges,
        Boolean includeStatuses
    )
    {
        Debug.Assert(graphmlXmlDocument != null);
        Debug.Assert(twitterUsers != null);
        Debug.Assert(uniqueScreenNames != null);

        if (!includeRepliesToEdges && !includeMentionsEdges &&
            !includeNonRepliesToNonMentionsEdges)
        {
            return;
        }

        // This method uses only one instance of TwitterStatusTextParser to
        // avoid making it repeatedly recompile all of its regular expressions.

        TwitterStatusTextParser twitterStatusTextParser =
            new TwitterStatusTextParser();

        foreach (TwitterUser twitterUser in twitterUsers)
        {
            foreach (TwitterStatus twitterStatus in twitterUser.Statuses)
            {
                AppendRepliesToAndMentionsEdgeXmlNodes(
                    graphmlXmlDocument, twitterStatusTextParser,
                    uniqueScreenNames, includeRepliesToEdges,
                    includeMentionsEdges, includeNonRepliesToNonMentionsEdges,
                    twitterUser.ScreenName, twitterStatus, includeStatuses);
            }
        }
    }
    GetMentionsAndRepliesToScreenNames
    (
        Dictionary<String, TwitterUser> userIDDictionary
    )
    {
        Debug.Assert(userIDDictionary != null);

        HashSet<String> uniqueScreenNamesWhoTweetedSearchTerm =
            TwitterGraphMLUtil.TwitterUsersToUniqueScreenNames(
                userIDDictionary.Values);

        HashSet<String> uniqueMentionsAndRepliesToScreenNames =
            new HashSet<String>();

        TwitterStatusTextParser twitterStatusTextParser =
            new TwitterStatusTextParser();

        foreach (TwitterUser twitterUser in userIDDictionary.Values)
        {
            foreach (TwitterStatus twitterStatus in twitterUser.Statuses)
            {
                String repliesToScreenName;
                String [] uniqueMentionsScreenNames;

                twitterStatusTextParser.GetScreenNames(twitterStatus.Text,
                    out repliesToScreenName,
                    out uniqueMentionsScreenNames);

                if (
                    repliesToScreenName != null
                    &&
                    !uniqueScreenNamesWhoTweetedSearchTerm.Contains(
                        repliesToScreenName) )
                {
                    uniqueMentionsAndRepliesToScreenNames.Add(
                        repliesToScreenName);
                }

                foreach (String uniqueMentionsScreenName in
                    uniqueMentionsScreenNames)
                {
                    if ( !uniqueScreenNamesWhoTweetedSearchTerm.Contains(
                        uniqueMentionsScreenName) )
                    {
                        uniqueMentionsAndRepliesToScreenNames.Add(
                            uniqueMentionsScreenName);
                    }
                }
            }
        }

        return ( uniqueMentionsAndRepliesToScreenNames.ToArray() );
    }
 SetUp()
 {
     m_oTwitterStatusTextParser = new TwitterStatusTextParser();
 }