コード例 #1
0
ファイル: UnaryOp.cs プロジェクト: ptucker/WhitStream
 /// <summary>
 /// Determines if the given Punctuation sheme benefits Group-by
 /// </summary>
 /// <param name="ps">The punctuation scheme to check</param>
 /// <returns>If Benefits = true, else false</returns>
 public override bool Benefit(PunctuationScheme ps)
 {
     if (attrs == null) return false;
     List<int> NonWildcard = new List<int>();
     //Extract all the non-wildcard patterns from the Punctuation Scheme
     for (int i = 0; i < ps.Count; i++)
     {
         if (!(ps[i] is Punctuation.WildcardPattern))
             NonWildcard.Add(i);
     }
     //Foreach non-wildcard pattern - see if it only affects grouped attributes
     //Go through all the non-wildcard positions
     foreach (int position in NonWildcard)
     {
         bool grouped = false;
         //Go through all the attributes being grouped
         foreach (int attr in attrs)
         {
             //If we found a match - we know that the non-wildcard pattern
             //affects a grouped attribute.
             if (attr == position)
                 grouped = true;
         }
         if (!grouped)
             return false;
     }
     //If we made it through the matching process without returning,
     //we know that this punctuation scheme contains wildcard patterns
     //for all non-grouped attributes.
     return true;
 }
コード例 #2
0
ファイル: Query.cs プロジェクト: ptucker/WhitStream
 /// <summary>
 /// Determines if the operator benefits from the punctuation scheme
 /// </summary>
 /// <param name="ps">The punctuation scheme to be tested</param>
 public virtual bool Benefit(PunctuationScheme ps)
 {
     return true;
 }
コード例 #3
0
ファイル: UnaryOp.cs プロジェクト: ptucker/WhitStream
 /// <summary>
 /// Determines if the given Punctuation scheme benefits Project
 /// </summary>
 /// <param name="ps">The punctuation scheme to check</param>
 /// <returns>If Benefits = true, else false</returns>
 public override bool Benefit(PunctuationScheme ps)
 {
     if (attrsOrig == null) return false;
     List<int> NonWildcard = new List<int>();
     //Extract all the non-wildcard patterns from the Punctuation Scheme
     for (int i = 0; i < ps.Count; i++)
     {
         if (!(ps[i] is Punctuation.WildcardPattern))
             NonWildcard.Add(i);
     }
     //Foreach non-wildcard pattern - see if it is in the kept attributes
     //Go through all the non-wildcard positions
     foreach (int position in NonWildcard)
     {
         bool contains = false;
         //Go through all the attributes being projected
         foreach (int attr in attrsOrig)
         {
             //If we found a match - we know that we can punctuate on
             //that attribute
             if (attr == position)
                 contains = true;
         }
         if (!contains)
             return false;
     }
     //If we made it through the matching process without returning,
     //we know that we can pass this punctuation since we project all
     //of the non-wildcard patterns.
     return true;
 }