public TFunc this[Region from, RegionDirection direction, Region to] { get { TFunc result; if (Functions.TryGetValue(new TransferFunctionKey(from, direction, to), out result)) { return(result); } return(default(TFunc)); } set { var key = new TransferFunctionKey(from, direction, to); if (Functions.ContainsKey(key)) { Functions[key] = value; } else { Functions.Add(new TransferFunctionKey(from, direction, to), value); } } }
protected bool Equals(TransferFunctionKey other) { return(Equals(From, other.From) && Equals(To, other.To) && Direction == other.Direction); }