private static string[] GetDirectoriesIncludingRoot( IStorageService oStorage, string sPath, bool bIncludeSubDirs, List <string> selectedSubDirs = null) { List <string> Dirs = new List <string>(); if (!bIncludeSubDirs || selectedSubDirs == null || selectedSubDirs.Count == 0) { // Root directory is always copied Dirs.Add(sPath); } if (bIncludeSubDirs) { // Query for subdirs Dirs.AddRange(oStorage.QuerySubDirs(sPath, true, DirectoryView.Tree)); if (selectedSubDirs != null && selectedSubDirs.Count > 0) { string[] foundFirs = SetUtil <string> .GetIntersection(Dirs, selectedSubDirs); Dirs.Clear(); Dirs.AddRange(foundFirs); } } return(Dirs.ToArray()); }
public void superSetsOfSingleElement() { HashSet <HashSet <int> > expected = new HashSet <HashSet <int> >(); expected.Add(setWithElements()); expected.Add(setWithElements(1)); setEquals(expected, SetUtil.superSets(setWithElements(1))); }
public static bool MustHaveOneOfRequiredRoles( string[] PresentRoles, string[] RequiredRoles) { if (RequiredRoles.Length > 0) { return(SetUtil <string> .GetIntersection( PresentRoles, RequiredRoles).Length > 0); } return(false); }
public static bool HasOneOfRequiredRoles( string[] PresentRoles, string[] RequiredRoles) { if (RequiredRoles.Length == 0) { // No roles required - ok return(true); } return(SetUtil <string> .GetIntersection( PresentRoles, RequiredRoles).Length > 0); }
public void superSetsOfBiggerSet() { HashSet <HashSet <int> > expected = new HashSet <HashSet <int> >(); expected.Add(setWithElements()); expected.Add(setWithElements(1)); expected.Add(setWithElements(2)); expected.Add(setWithElements(3)); expected.Add(setWithElements(1, 2)); expected.Add(setWithElements(1, 3)); expected.Add(setWithElements(2, 3)); expected.Add(setWithElements(1, 2, 3)); setEquals(expected, SetUtil.superSets(setWithElements(1, 2, 3))); }
public EntityTypeInfo(Type oType) { TheType = oType; OwnerParent = GetOwnerParent(TheType); AllDirectParents = GetDirectParents(TheType); AggregatedChildren = GetAggregatedChildren(TheType); OwnedChildren = GetOwnedChildrenLists(TheType); LinkedChildren = GetLinkedChildrenLists(TheType); AllChildren = (EntityChildrenListInfo[])ArrayBuilder.ChangeArrayType( SetUtil <EntityChildrenListInfo> .GetUnion(OwnedChildren, LinkedChildren), typeof(EntityChildrenListInfo)); Parameters = GetParameters(TheType, AggregatedChildren); UniqueParentLinks = GetUniqueParentLinks(TheType); ObsoleteMembers = GetObsoleteMembers(TheType); }
public void superSetsOfEmptySet() { setEquals(new HashSet <HashSet <int> >(), SetUtil.superSets(new HashSet <int>())); }