It is currently 29 Oct 2025, 07:09
   
Text Size

r17789

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins

r17789

Postby Max mtg » 30 Oct 2012, 12:44

RumbleBBU wrote:http://svn.slightlymagic.net/websvn/dif ... &peg=17789
Code: Select all
    /**
     * Empty the whole list.
     */
    public void emptyAllowedSets() {
        if (allowedSetCodes != null) {
            while (!allowedSetCodes.isEmpty()) {
                allowedSetCodes.remove(0);
            }
        }
    }
A whole function instead of allowedSetCodes.clear();

make it final:
Code: Select all
private final List<String> allowedSetCodes = new ArrayList<String>();
and you will never have to check for allowedSetCodes != null
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: r17789

Postby Max mtg » 30 Oct 2012, 12:51

http://svn.slightlymagic.net/websvn/dif ... &peg=17789

There are already all decks loaded in memory. If you are giving user freedom to choose his deck, then should not restrict on sealed. If you want him to use limited mode only decks - then do use Singeltons.gteModel().getDecks().get(Draft-or-Sealed) to give a list to choose from.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: r17789

Postby RumbleBBU » 30 Oct 2012, 13:36

1. The unnecessary loop: good catch. Missed that one when cleaning up my files before the commit.

2. The null check: I have a habit of putting in paranoia checks like this (even when they are technically unnecessary, i.e., when they should always be false). It's a habit that is difficult to unlearn.

3. The decks in memory: you're probably right. I'll change that when I have time.
User avatar
RumbleBBU
 
Posts: 394
Joined: 18 Aug 2012, 04:24
Has thanked: 29 times
Been thanked: 66 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 9 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 9 guests

Login Form