private LegActivityMatch FindLegMatchingActivity(HandlingActivity handlingActivity) { foreach (var leg in Legs) { if (leg.MatchesActivity(handlingActivity)) { return(LegActivityMatch.Match(leg, handlingActivity, this)); } } return(LegActivityMatch.NoMatch(handlingActivity, this)); }
/// <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)); } }