public override bool isContain(DecoratorPreferencesInterface pref) { if (pref.GetType().IsAssignableFrom(typeof(OptionalPreferences))) { //if (pref.GetType() != typeof(OptionalPreferences)) return(false); } OptionalPreferences opPref = ((OptionalPreferences)pref); BuyInPolicyDecPref matchingPref = (BuyInPolicyDecPref)getMatchingOptionalPref(opPref); //if we found matchig optinal pref and he have the same policy if (matchingPref != null && matchingPref.buyInPolicy == buyInPolicy) { //if we still need to check the rest of the chain if (matchingPref.nextDecPref != null) { //return its result return(nextDecPref.isContain(pref)); } //if we don't have anything else to check return true. else { return(true); } } //if we couldent found or if we found pref with different value. else if (matchingPref == null && nextDecPref != null) { return(nextDecPref.isContain(opPref)); } else { return(false); } }
public bool isContain(DecoratorPreferencesInterface pref) { if (pref.GetType() != GetType()) { return(false); } MustPreferences mustPref = (MustPreferences)pref; if (mustPref.isLeague == isLeague && mustPref.isSpectateAllowed == isSpectateAllowed) { if (mustPref.firstDecPref != null) { return(firstDecPref.isContain(mustPref.firstDecPref)); } else { return(true); } } else { return(false); } }
public abstract bool isContain(DecoratorPreferencesInterface pref);