/// <summary> /// Gets the leg match of this handling activity. Never null. /// </summary> /// <param name="handlingActivity">handling activity</param> /// <returns>The leg match of this handling activity. Never null.</returns> internal LegActivityMatch MatchLeg(HandlingActivity handlingActivity) { if (handlingActivity == null) { return(LegActivityMatch.NoMatch(handlingActivity, this)); } else if (handlingActivity.Type == HandlingActivityType.RECEIVE) { return(LegActivityMatch.IfLoadLocationSame(FirstLeg, handlingActivity, this)); } else if (handlingActivity.Type == HandlingActivityType.CLAIM) { return(LegActivityMatch.IfUnloadLocationSame(LastLeg, handlingActivity, this)); } else { return(FindLegMatchingActivity(handlingActivity)); } }