/// <summary> /// Find pods can only be reached from pods of same user. /// </summary> /// <param name="matrix">ingress reachability matrix.</param> /// <param name="userHashmap">user-pod mapping.</param> /// <param name="pods">all pods.</param> /// <param name="userKey">key of user label.</param> /// <returns>list of pods can only be reached from pods of same user.</returns> public static Zen <IList <ushort> > UserCrossCheck( Zen <IList <bool> >[] matrix, Zen <IDictionary <int, IList <bool> > > userHashmap, Zen <Pod>[] pods, Zen <string> userKey) { var n = pods.Length; Zen <IList <ushort> > podList = EmptyList <ushort>(); for (int i = 0; i < n; ++i) { var userString = pods[i].LabelValue(userKey); if (userString == null) { continue; } var veriSet = userHashmap.Get(userString.GetHashCode()).Value(); veriSet = veriSet.Not().And(matrix[i]); var c = If <ushort>(veriSet.All(r => r.Equals(False())), (ushort)i, ushort.MaxValue); // if this pod can only be reached from same user's pods, add it to list if (!c.EqualToNumber(ushort.MaxValue)) { podList = podList.AddBack(c); } } return(podList); }