// Need a value copy constructor for typical uses public FloodfillPathfinder(FloodfillPathfinder <T> src) { #if DEBUG if (null == src) { throw new ArgumentNullException(nameof(src)); } #endif _blacklist = new HashSet <T>(src._blacklist); _blacklist_fn = src._blacklist_fn; _inDomain = src._inDomain; _map = new Dictionary <T, int>(src._map); _forward = src._forward; _inverse = src._inverse; }
// retain domain and blacklist, change specification of forward and inverse which invalidates the map itself public FloodfillPathfinder(FloodfillPathfinder <T> src, Func <T, Dictionary <T, int> > Forward, Func <T, Dictionary <T, int> > Inverse) { #if DEBUG if (null == src) { throw new ArgumentNullException(nameof(src)); } #endif _blacklist = new HashSet <T>(src._blacklist); _blacklist_fn = src._blacklist_fn; _inDomain = src._inDomain; _map = new Dictionary <T, int>(); _forward = Forward #if DEBUG ?? throw new ArgumentNullException(nameof(Forward)) #endif ; _inverse = Inverse #if DEBUG ?? throw new ArgumentNullException(nameof(Inverse)) #endif ; }