Esempio n. 1
0
 public static bool isSubIndex(FormIndex parent, FormIndex child)
 {
     if (child.Equals(parent))
     {
         return(true);
     }
     else
     {
         if (parent == null)
         {
             return(false);
         }
         return(isSubIndex(parent.nextLevel, child));
     }
 }
Esempio n. 2
0
 /// <summary> Takes in a form index which is a subset of this index, and returns the
 /// total difference between them. This is useful for stepping up the level
 /// of index specificty. If the subIndex is not a valid subIndex of this index,
 /// null is returned. Since the FormIndex represented by null is always a subset,
 /// if null is passed in as a subIndex, the full index is returned
 ///
 /// For example:
 /// Indices
 /// a = 1_0,2,1,3
 /// b = 1,3
 ///
 /// a.diff(b) = 1_0,2
 ///
 /// </summary>
 /// <param name="subIndex">
 /// </param>
 /// <returns>
 /// </returns>
 public virtual FormIndex diff(FormIndex subIndex)
 {
     if (subIndex == null)
     {
         return(this);
     }
     if (!isSubIndex(this, subIndex))
     {
         return(null);
     }
     if (subIndex.Equals(this))
     {
         return(null);
     }
     return(new FormIndex(nextLevel.diff(subIndex), this.snip()));
 }