public void AddFollowingEntry(EdataDictionaryPathEntry entry) { if (!followingEntries.Contains(entry)) { followingEntries.Add(entry); entry.PrecedingEntry = this; } }
public void RemoveFollowingEntry(EdataDictionaryPathEntry entry) { if (followingEntries.Contains(entry)) { followingEntries.Remove(entry); entry.PrecedingEntry = null; } }
public virtual EdataDictionaryPathEntry SelectEntryByPath(String path) { EdataDictionaryPathEntry result = null; //This alghoritm assumes that there are no two child entries with the same sub paths. if (path == PathPart) { result = this; } else if (path.StartsWith(PathPart)) { int startIndex = PathPart.Length; EdataDictionaryPathEntry currentMatch = this; bool matchFound = true; while (matchFound) { matchFound = false; for (int i = 0; i < currentMatch.FollowingEntries.Count; ++i) { var potentialMatch = currentMatch.FollowingEntries[i]; var subPath = potentialMatch.PathPart; if ((startIndex < path.Length) && (startIndex + subPath.Length <= path.Length) && (path.IndexOf(subPath, startIndex, subPath.Length) != -1)) { currentMatch = potentialMatch; matchFound = true; startIndex += subPath.Length; break; } } if (matchFound && startIndex == path.Length) { result = currentMatch; break; } } } return(result); }