Example #1
0
        public bool HasValidCandidate()
        {
            if (Neighbours
                .Select(n => n.StateTypes)
                .Count(s => s == NeighbourStateTypes.NotContacted || s == NeighbourStateTypes.UnResponsive)
                .Equals(Constants.NumberOfRandomPeers))
            {
                return(false);
            }

            // see if sum of unreachable peers and reachable peers equals the total contacted number.
            return(Neighbours
                   .Select(n => n.StateTypes)
                   .Count(s => s == NeighbourStateTypes.Responsive || s == NeighbourStateTypes.UnResponsive)
                   .Equals(Constants.NumberOfRandomPeers));
        }
Example #2
0
 private IEnumerable <PatternType> ComputePattern()
 {
     return(Neighbours
            .Select(c => c.Read() == 0 ? PatternType.ConstZero : PatternType.ConstOne));
 }