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 MustPreferences(OptionalPreferences firstDecPref, bool isSpectateAllowed, int minRank, int maxRank) { this.firstDecPref = firstDecPref; this.isSpectateAllowed = isSpectateAllowed; this.minRank = minRank; this.maxRank = maxRank; isLeague = true; }
public MustPreferences(OptionalPreferences firstDecPref, bool isSpectateAllowed) { this.firstDecPref = firstDecPref; this.isSpectateAllowed = isSpectateAllowed; minRank = -2; maxRank = -2; isLeague = false; }
public OptionalPreferences getMatchingOptionalPref(OptionalPreferences toGet) { while (toGet != null) { if (GetType() == toGet.GetType()) { return(toGet); } toGet = toGet.nextDecPref; } return(null); }
public OptionalPreferences getOptionalPref(OptionalPreferences wantedPref) { OptionalPreferences temp = firstDecPref; while (temp != null) { if (temp.GetType() == wantedPref.GetType()) { return(temp); } temp = temp.nextDecPref; } return(null); }
public GamePolicyDecPref(GameTypePolicy gamePolicy, int limit, OptionalPreferences nextDecPref) : base(nextDecPref) { this.gamePolicy = gamePolicy; this.limit = limit; }
public BuyInPolicyDecPref(int buyInPolicy, OptionalPreferences nextDecPref) : base(nextDecPref) { this.buyInPolicy = buyInPolicy; }
public OptionalPreferences(OptionalPreferences nextPref) { nextDecPref = nextPref; }
public MaxPlayersDecPref(int maxPlayers, OptionalPreferences nextDecPref) : base(nextDecPref) { this.maxPlayers = maxPlayers; }
public StartingAmountChipsCedPref(int startingChipsPolicy, OptionalPreferences nextDecPref) : base(nextDecPref) { this.startingChipsPolicy = startingChipsPolicy; }
public MinBetDecPref(int minimalBet, OptionalPreferences nextDecPref) : base(nextDecPref) { this.minimalBet = minimalBet; }