예제 #1
0
 internal TreeOccSet this[TreeId treeId]
 {
     get
     {
         return(TreeSet.ContainsKey(treeId) ? TreeSet[treeId] : null);
     }
 }
예제 #2
0
        internal IOccurrence GetFirstOccAfterSpecifiedIndex(Depth depth, TreeId treeId, PreorderIndex rootIndex, PreorderIndex specifiedIndex)
        {
            if (!ContainsRootIndex(depth, treeId, rootIndex))
            {
                return(null);
            }

            var rOcc = this[depth][treeId][rootIndex];

            return(rOcc.RightMostSet.FirstOrDefault(t => t.SecondIndex > specifiedIndex));
        }
예제 #3
0
        OccInduced(TreeId treeId, Depth depth, IList <int> preorderCode)
        {
            if (string.IsNullOrEmpty(treeId))
            {
                throw new ArgumentOutOfRangeException("treeId");
            }

            if (depth < 0)
            {
                throw new ArgumentOutOfRangeException("depth", "Depth of an occurrence should be larger than or equal to 0.");
            }

            if (preorderCode == null || preorderCode.Count <= 0)
            {
                throw new ArgumentNullException("preorderCode");
            }

            this.treeId       = treeId;
            this.depth        = depth;
            this.preorderCode = new ReadOnlyCollection <int>(preorderCode);

            AbleToConnect     = (PreorderCode.Count == 2);
            AbleToBeConnected = preorderCode[0] > 0;
        }
예제 #4
0
 internal List <IOccurrence> GetRightMostOccurrences(int depth, TreeId treeId, PreorderIndex rootIndex)
 {
     return(ContainsRootIndex(depth, treeId, rootIndex) ? this[depth][treeId][rootIndex].RightMostSet : null);
 }
예제 #5
0
 internal IOccurrence GetOccurrence(int depth, TreeId treeId, PreorderIndex rootIndex)
 {
     return(ContainsRootIndex(depth, treeId, rootIndex) ? this[depth][treeId][rootIndex].FirstOcc : null);
 }
예제 #6
0
 internal bool ContainsRootIndex(int depth, TreeId treeId, PreorderIndex rootIndex)
 {
     return(DepthOccSet.ContainsKey(depth) && (DepthOccSet[depth].ContainsRootIndex(treeId, rootIndex)));
 }
예제 #7
0
 internal bool ContainsTreeAtDepth(Depth depth, TreeId treeId)
 {
     return(DepthOccSet.ContainsKey(depth) && DepthOccSet[depth].ContainsTree(treeId));
 }
예제 #8
0
 internal bool ContainsTree(TreeId treeId)
 {
     return(TreeSet.ContainsKey(treeId));
 }
예제 #9
0
 internal bool ContainsRootIndex(TreeId treeId, PreorderIndex rootIndex)
 {
     return(ContainsTree(treeId) && TreeSet[treeId].ContainsRootIndex(rootIndex));
 }
 public RootOcc(TreeId treeId, Depth depth, PreorderIndex rootIndex)
 {
     this.treeId    = treeId;
     this.depth     = depth;
     this.rootIndex = rootIndex;
 }
예제 #11
0
 internal static IOccurrence Create(TreeId treeId, Depth depth, IList <int> preorderCode)
 {
     return(new OccInduced(treeId, depth, preorderCode));
 }
예제 #12
0
 internal TreeOccSet(TreeId treeId)
 {
     this.treeId = treeId;
 }