private void Arguments()
 {
     foreach (Snippet pSnippet in m_lOriginalSnippets)
     {
         if (pSnippet.Tags.Contains("Argument"))
         {
             PageSnippet pPageSnippet = new PageSnippet(pSnippet, 0, PageSection.Arguments);
             m_lPageSnippets.Add(pPageSnippet);
         }
     }
 }
 private void Notes()
 {
     foreach (Snippet pSnippet in m_lOriginalSnippets)
     {
         if (pSnippet.Tags.Contains("Note") && !pSnippet.Tags.Contains("Depth"))
         {
             PageSnippet pPageSnippet = new PageSnippet(pSnippet, 0, PageSection.Notes);
             m_lPageSnippets.Add(pPageSnippet);
         }
     }
 }
 private void NormalStuff()
 {
     foreach (Snippet pSnippet in m_lOriginalSnippets)
     {
         if (!pSnippet.Tags.Contains("Theory") && !pSnippet.Tags.Contains("Definition") && !pSnippet.Tags.Contains("Note") && !pSnippet.Tags.Contains("Depth") && !pSnippet.Tags.Contains("Argument"))
         {
             PageSnippet pPageSnippet = new PageSnippet(pSnippet, 0, PageSection.Normal);
             m_lPageSnippets.Add(pPageSnippet);
         }
     }
 }
 private void HighLevelTheories()
 {
     foreach (Snippet pSnippet in m_lOriginalSnippets)
     {
         if (pSnippet.Tags.Contains("Theory") && !pSnippet.Tags.Contains("Depth") && !pSnippet.Tags.Contains(m_sInterestTag + "_Theory") && !pSnippet.Tags.Contains(m_sInterestTag + "_Definition"))
         {
             PageSnippet pPageSnippet = new PageSnippet(pSnippet, 0, PageSection.Theories);
             m_lPageSnippets.Add(pPageSnippet);
         }
     }
 }
 private void CreateInterestTagSnippet()
 {
     // find a snippet with a tag of InterestTag_Definition or InterestTag_Theory
     foreach (Snippet pSnippet in m_lOriginalSnippets)
     {
         if (pSnippet.Tags.Contains(m_sInterestTag + "_Definition") || pSnippet.Tags.Contains(m_sInterestTag + "_Theory"))
         {
             PageSnippet pPageSnippet = new PageSnippet(pSnippet, 4, PageSection.Interest);
             m_lPageSnippets.Add(pPageSnippet);
         }
     }
 }
        // checks if this snippet exists in any of the depth sections (returns true if used, false if not)
        private bool CheckIfSnippetUsedInDepth(PageSnippet pSnippet)
        {
            foreach (string sSectionKey in m_dDepthSections.Keys)
            {
                foreach (PageSnippet pPageSnippet in m_dDepthSections[sSectionKey])
                {
                    if (pPageSnippet.Snippet.FileName == pSnippet.Snippet.FileName)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        private void HandleTheDepths()
        {
            // get all the snippets that are in depth
            List <Snippet> lDeepSnippets = new List <Snippet>();

            foreach (Snippet pSnippet in m_lOriginalSnippets)
            {
                if (pSnippet.Tags.Contains("Depth"))
                {
                    lDeepSnippets.Add(pSnippet);

                    // adding page snippet to list just so we have a global list of all depth snippets (these should NOT be used for building html of depth snippets)
                    PageSnippet pPageSnippet = new PageSnippet(pSnippet, 0, PageSection.Depth);
                    m_lPageSnippets.Add(pPageSnippet);
                }
            }

            // get tag snippet collections (IGNORING SOURCE TAGS [use meta])
            Dictionary <string, List <Snippet> > dTagOrganizedSnippets = new Dictionary <string, List <Snippet> >();

            dTagOrganizedSnippets.Add("Normal", new List <Snippet>());
            foreach (Snippet pSnippet in lDeepSnippets)
            {
                bool bSnippetAdded = false;                 // if snippet is never added in the conditions, then add it after the loop into the "normal" section
                foreach (string sTag in pSnippet.Tags)
                {
                    if (sTag == "Depth" || sTag == "Important" || sTag == "source:" + pSnippet.MetaData["sourceTag"] || m_lQueryTags.Contains(sTag))
                    {
                        continue;
                    }
                    if (dTagOrganizedSnippets.ContainsKey(sTag))
                    {
                        bSnippetAdded = true; dTagOrganizedSnippets[sTag].Add(pSnippet);
                    }                                                                                                                                     // if collection for this tag exists, add snippet to it
                    else
                    {
                        bSnippetAdded = true; dTagOrganizedSnippets.Add(sTag, new List <Snippet>()
                        {
                            pSnippet
                        });
                    }                                                                                                                     // if collection for tag doesn't exist, make it
                }
                if (!bSnippetAdded)
                {
                    dTagOrganizedSnippets["Normal"].Add(pSnippet);
                }                                                                                      // if wasn't added to any other tag collections, add it to normal
            }

            List <PageSnippet> pUnusedSnippets = new List <PageSnippet>();

            // TODO: SCALE this, like with importance level NOTE: If certain fraction of number of depth snippets have same tag, then include that tag (but only if above a certain limit, cause this doesn't work for small numbers)
            // for every tag collection of snippets, if meets criteria create specific depth section for them
            m_dDepthSections.Add("Normal", new List <PageSnippet>());
            foreach (string sKey in dTagOrganizedSnippets.Keys)
            {
                if (dTagOrganizedSnippets[sKey].Count > 1 || sKey == "Normal")                 // if this collection has more than one snippet, give it its own section (change)
                {
                    if (sKey != "Normal")
                    {
                        m_dDepthSections.Add(sKey, new List <PageSnippet>());
                    }
                    // make a page snippet for each snippet and add it to the depth section collection
                    foreach (Snippet pSnippet in dTagOrganizedSnippets[sKey])
                    {
                        PageSnippet pPageSnippet = new PageSnippet(pSnippet, 0, PageSection.Depth);
                        m_dDepthSections[sKey].Add(pPageSnippet);
                    }
                }
                else                 // otherwise dump in the unusued snippets
                {
                    foreach (Snippet pSnippet in dTagOrganizedSnippets[sKey])
                    {
                        PageSnippet pPageSnippet = new PageSnippet(pSnippet, 0, PageSection.Depth);
                        pUnusedSnippets.Add(pPageSnippet);
                    }
                }
            }

            // anything not yet used (in the unusued snippets list) just throw in "depth normal"
            foreach (PageSnippet pSnippet in pUnusedSnippets)
            {
                if (!CheckIfSnippetUsedInDepth(pSnippet))
                {
                    m_dDepthSections["Normal"].Add(pSnippet);
                }
            }
        }