Some code examples
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
2 posts
• Page 1 of 1
Some code examples
by Max mtg » 13 Nov 2012, 20:51
I don't know whose code that is but I am definetelly quite unhappy to find such masterpieces in our project.
- Code: Select all
// Show or hide the set unlocking button
if (qCtrl.getFormatNumberUnlockable() > 0) {
view0.getBtnUnlock().setVisible(true);
} else {
view0.getBtnUnlock().setVisible(false);
}
- Code: Select all
view0.getBtnUnlock().setVisible(qCtrl.getFormatNumberUnlockable() > 0)
Last edited by Max mtg on 13 Nov 2012, 21:43, edited 1 time in total.
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: Some code examples
by Max mtg » 13 Nov 2012, 20:57
How do we get sorted list of all magic edtions? I have seen a solution!
- Code: Select all
TreeMap<Integer, CardEdition> sortedMap = new TreeMap<Integer, CardEdition>();
for (CardEdition ce : Singletons.getModel().getEditions()) {
sortedMap.put(new Integer(ce.getIndex()), ce);
}
List<CardEdition> sortedEditions = new ArrayList<CardEdition>(sortedMap.values());
- Code: Select all
List<CardEdition> editions = Lists.newArrayList(Singletons.getModel().getEditions());
Collections.sort(editions);
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 8 guests