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);
            }
        }
Пример #2
0
 public MustPreferences(OptionalPreferences firstDecPref, bool isSpectateAllowed, int minRank, int maxRank)
 {
     this.firstDecPref      = firstDecPref;
     this.isSpectateAllowed = isSpectateAllowed;
     this.minRank           = minRank;
     this.maxRank           = maxRank;
     isLeague = true;
 }
Пример #3
0
 public MustPreferences(OptionalPreferences firstDecPref, bool isSpectateAllowed)
 {
     this.firstDecPref      = firstDecPref;
     this.isSpectateAllowed = isSpectateAllowed;
     minRank  = -2;
     maxRank  = -2;
     isLeague = false;
 }
Пример #4
0
 public OptionalPreferences getMatchingOptionalPref(OptionalPreferences toGet)
 {
     while (toGet != null)
     {
         if (GetType() == toGet.GetType())
         {
             return(toGet);
         }
         toGet = toGet.nextDecPref;
     }
     return(null);
 }
Пример #5
0
        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;
 }
Пример #8
0
 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;
 }
Пример #11
0
 public MinBetDecPref(int minimalBet, OptionalPreferences nextDecPref) : base(nextDecPref)
 {
     this.minimalBet = minimalBet;
 }