From 388e903300b5101e17b92fd0c167c877e35730ca Mon Sep 17 00:00:00 2001 From: slapshot5 Date: Wed, 31 Aug 2011 07:40:50 +0000 Subject: [PATCH] AllZoneUtil Checkstyle fixes. --- src/main/java/forge/AllZoneUtil.java | 299 +++++++++++++++------------ 1 file changed, 162 insertions(+), 137 deletions(-) diff --git a/src/main/java/forge/AllZoneUtil.java b/src/main/java/forge/AllZoneUtil.java index 6a661c64a69..0d79ede15b7 100644 --- a/src/main/java/forge/AllZoneUtil.java +++ b/src/main/java/forge/AllZoneUtil.java @@ -12,23 +12,27 @@ import java.util.ArrayList; * @author dennis.r.friedrichsen (slapshot5 on slightlymagic.net) * @version $Id$ */ -public class AllZoneUtil { +public final class AllZoneUtil { + + private AllZoneUtil() { + throw new AssertionError(); + } //////////// Creatures /** - * use to get a list of creatures in play for a given player + * use to get a list of creatures in play for a given player. * * @param player the player to get creatures for * @return a CardList containing all creatures a given player has in play */ public static CardList getCreaturesInPlay(final Player player) { - CardList creatures = AllZoneUtil.getPlayerCardsInPlay(player); - return creatures.filter(AllZoneUtil.creatures); + CardList creats = AllZoneUtil.getPlayerCardsInPlay(player); + return creats.filter(AllZoneUtil.creatures); } /** - * use to get a list of creatures in play with a given keyword + * use to get a list of creatures in play with a given keyword. * * @param keyword the keyword to get creatures for * @return a CardList containing all creatures in play with a given keyword @@ -36,7 +40,7 @@ public class AllZoneUtil { public static CardList getCreaturesInPlayWithKeyword(final String keyword) { CardList list = getCreaturesInPlay(); list = list.filter(new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.hasKeyword(keyword); } }); @@ -49,14 +53,14 @@ public class AllZoneUtil { * @return a CardList of all creatures on the battlefield on both sides */ public static CardList getCreaturesInPlay() { - CardList creatures = getCardsInPlay(); - return creatures.filter(AllZoneUtil.creatures); + CardList creats = getCardsInPlay(); + return creats.filter(AllZoneUtil.creatures); } ///////////////// Lands /** - * use to get a list of all lands a given player has on the battlefield + * use to get a list of all lands a given player has on the battlefield. * * @param player the player whose lands we want to get * @return a CardList containing all lands the given player has in play @@ -67,7 +71,7 @@ public class AllZoneUtil { } /** - * gets a list of all lands in play + * gets a list of all lands in play. * * @return a CardList of all lands on the battlefield */ @@ -86,7 +90,7 @@ public class AllZoneUtil { //============================================================================= /** - * gets a list of all cards in play on both sides + * gets a list of all cards in play on both sides. * * @return a CardList of all cards in play on both sides */ @@ -97,7 +101,7 @@ public class AllZoneUtil { } /** - * gets a list of all cards in play with a given card name + * gets a list of all cards in play with a given card name. * * @param cardName the name of the card to search for * @return a CardList with all cards in play of the given name @@ -113,7 +117,7 @@ public class AllZoneUtil { } /** - * gets a list of all cards that a given Player has in play + * gets a list of all cards that a given Player has in play. * * @param player the player's cards to get * @return a CardList with all cards in the Play zone for the given player @@ -128,7 +132,7 @@ public class AllZoneUtil { } /** - * gets a list of all cards with a given name a given player has in play + * gets a list of all cards with a given name a given player has in play. * * @param player the player whose cards in play you want to get * @param cardName the card name to look for in that zone @@ -150,7 +154,7 @@ public class AllZoneUtil { /** - * gets a list of all cards owned by both players that have are currently in the graveyard + * gets a list of all cards owned by both players that have are currently in the graveyard. * * @return a CardList with all cards currently in a graveyard */ @@ -163,7 +167,7 @@ public class AllZoneUtil { /** - * gets all cards in given player's graveyard + * gets all cards in given player's graveyard. * * @param player the player whose graveyard we want to get * @return a CardList containing all cards in that player's graveyard @@ -178,7 +182,7 @@ public class AllZoneUtil { } /** - * gets a list of all cards with a given name in a certain player's graveyard + * gets a list of all cards with a given name in a certain player's graveyard. * * @param player the player whose graveyard we want to get * @param cardName the card name to find in the graveyard @@ -193,7 +197,7 @@ public class AllZoneUtil { // Get a Cards in All Graveyards with a certain name /** - * gets a CardList of all cards with a given name in all graveyards + * gets a CardList of all cards with a given name in all graveyards. * * @param cardName the card name to look for * @return a CardList of all cards with the given name in all graveyards @@ -207,20 +211,20 @@ public class AllZoneUtil { } /** - * answers the question "is a certain, specific card in this player's graveyard?" + * answers the question "is a certain, specific card in this player's graveyard?". * * @param player the player's hand to check * @param card the specific card to look for * @return true if the card is present in this player's hand; false otherwise */ - public static boolean isCardInPlayerGraveyard(Player player, Card card) { + public static boolean isCardInPlayerGraveyard(final Player player, final Card card) { return isCardInZone(AllZone.getZone(Constant.Zone.Graveyard, player), card); } //////// HAND /** - * gets a list of all cards in a given player's hand + * gets a list of all cards in a given player's hand. * * @param player the player's hand to target * @return a CardList containing all cards in target player's hand @@ -235,43 +239,46 @@ public class AllZoneUtil { } /** - * answers the question "is a certain, specific card in this player's hand?" + * answers the question "is a certain, specific card in this player's hand?". * * @param player the player's hand to check * @param card the specific card to look for * @return true if the card is present in this player's hand; false otherwise */ - public static boolean isCardInPlayerHand(Player player, Card card) { + public static boolean isCardInPlayerHand(final Player player, final Card card) { return isCardInZone(AllZone.getZone(Constant.Zone.Hand, player), card); } /** - * answers the question "is a specific card in this player's library?" + * answers the question "is a specific card in this player's library?". * * @param player the player's library to check * @param card the specific card to look for * @return true if the card is present in this player's library; false otherwise */ - public static boolean isCardInPlayerLibrary(Player player, Card card) { + public static boolean isCardInPlayerLibrary(final Player player, final Card card) { return isCardInZone(AllZone.getZone(Constant.Zone.Library, player), card); } /** - * answers the question "is a specific card in the specified zone?" + * answers the question "is a specific card in the specified zone?". * * @param pz the PlayerZone to check * @param card the specific card to look for * @return true if the card is present in this zone; false otherwise */ - public static boolean isCardInZone(PlayerZone pz, Card card) { - if (card == null) + public static boolean isCardInZone(final PlayerZone pz, final Card card) { + if (card == null) { return false; + } CardList cl = getCardsInZone(pz); - for (int i = 0; i < cl.size(); i++) - if (cl.get(i).equals(card)) + for (int i = 0; i < cl.size(); i++) { + if (cl.get(i).equals(card)) { return true; + } + } return false; } @@ -279,7 +286,7 @@ public class AllZoneUtil { ////////////// EXILE /** - * gets a list of all cards owned by both players that are in Exile + * gets a list of all cards owned by both players that are in Exile. * * @return a CardList with all cards in Exile */ @@ -291,7 +298,7 @@ public class AllZoneUtil { } /** - * gets a list of all cards in Exile for a given player + * gets a list of all cards in Exile for a given player. * * @param player the player whose cards we want that are in Exile * @return a CardList with all cards in Exile for a given player @@ -306,7 +313,7 @@ public class AllZoneUtil { } /** - * gets a list of all cards with a given name in a certain player's exile + * gets a list of all cards with a given name in a certain player's exile. * * @param player the player whose exile we want to get * @param cardName the card name to find in the exile @@ -321,7 +328,7 @@ public class AllZoneUtil { //////////////////////// LIBRARY /** - * gets a list of all cards in a given player's library + * gets a list of all cards in a given player's library. * * @return a CardList with all the cards currently in that player's library * @param player a {@link forge.Player} object. @@ -336,7 +343,7 @@ public class AllZoneUtil { } /** - * gets a list of all cards with a certain name in a given player's library + * gets a list of all cards with a certain name in a given player's library. * * @param player the player's library one is interested in * @param cardName the card's name that one is interested in @@ -348,34 +355,35 @@ public class AllZoneUtil { } /** - * gets a list of a given number of cards from the top of given player's library + * gets a list of a given number of cards from the top of given player's library. * * @param player the player's library one is interested in * @param numCards the number of cards to get from the top * @return a CardList of the top number of cards in the given player's library */ - public static CardList getPlayerCardsInLibrary(final Player player, int numCards) { + public static CardList getPlayerCardsInLibrary(final Player player, final int numCards) { CardList cards = new CardList(); if (player.isHuman() || player.isComputer()) { PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player); - if (lib.size() <= numCards) + if (lib.size() <= numCards) { cards.addAll(lib.getCards()); - else { - for (int i = 0; i < numCards; i++) + } else { + for (int i = 0; i < numCards; i++) { cards.add(lib.get(i)); + } } } return cards; } /** - * answers the question "is the given card in any exile zone?" + * answers the question "is the given card in any exile zone?". * * @param c the card to look for in Exile * @return true is the card is in Human or Computer's Exile zone */ - public static boolean isCardExiled(Card c) { + public static boolean isCardExiled(final Card c) { return getCardsInExile().contains(c); } @@ -385,7 +393,7 @@ public class AllZoneUtil { * @param c a {@link forge.Card} object. * @return a boolean. */ - public static boolean isCardInGrave(Card c) { + public static boolean isCardInGrave(final Card c) { return getCardsInGraveyard().contains(c); } @@ -397,12 +405,12 @@ public class AllZoneUtil { * @param card a {@link forge.Card} object. * @return a boolean. */ - public static boolean isCardInPlay(Card card) { + public static boolean isCardInPlay(final Card card) { return getCardsInPlay().contains(card); } /** - * Answers the question: "Is in play?" + * Answers the question: "Is in play?". * * @param cardName the name of the card to look for * @return true is the card is in play, false otherwise @@ -412,7 +420,7 @@ public class AllZoneUtil { } /** - * Answers the question: "Does have in play?" + * Answers the question: "Does have in play?". * * @param cardName the name of the card to look for * @param player the player whose battlefield we want to check @@ -421,9 +429,9 @@ public class AllZoneUtil { public static boolean isCardInPlay(final String cardName, final Player player) { return getPlayerCardsInPlay(player, cardName).size() > 0; } - + /** - * Answers the question: "Does have in play?" + * Answers the question: "Does have in play?". * * @param card the card to look for * @param player the player whose battlefield we want to check @@ -437,7 +445,7 @@ public class AllZoneUtil { ///get a list of certain types are in play (like Mountain, Elf, etc...) /** - * gets a list of all cards with a certain type (Mountain, Elf, etc...) in play + * gets a list of all cards with a certain type (Mountain, Elf, etc...) in play. * * @param cardType the type to find in play * @return a CardList with all cards of the given type in play @@ -449,7 +457,7 @@ public class AllZoneUtil { } /** - * gets a list of all cards of a certain type that a given player has in play + * gets a list of all cards of a certain type that a given player has in play. * * @param player the player to check for cards in play * @param cardType the card type to check for @@ -462,7 +470,7 @@ public class AllZoneUtil { } /** - * gets a list of all cards of a certain type that a given player has in his library + * gets a list of all cards of a certain type that a given player has in his library. * * @param player the player to check for cards in play * @param cardType the card type to check for @@ -475,7 +483,7 @@ public class AllZoneUtil { } /** - * gets a list of all cards of a certain type that a given player has in graveyard + * gets a list of all cards of a certain type that a given player has in graveyard. * * @param player the player to check for cards in play * @param cardType the card type to check for @@ -490,7 +498,7 @@ public class AllZoneUtil { //////////////// getting all cards of a given color /** - * gets a list of all Cards of a given color on the battlefield + * gets a list of all Cards of a given color on the battlefield. * * @param color the color of cards to get * @return a CardList of all cards in play of a given color @@ -502,7 +510,7 @@ public class AllZoneUtil { } /** - * gets a list of all Cards of a given color a given player has on the battlefield + * gets a list of all Cards of a given color a given player has on the battlefield. * * @param player the player's cards to get * @param color the color of cards to get @@ -511,7 +519,7 @@ public class AllZoneUtil { public static CardList getPlayerColorInPlay(final Player player, final String color) { CardList cards = getPlayerCardsInPlay(player); cards = cards.filter(new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { ArrayList colorList = CardUtil.getColors(c); return colorList.contains(color); } @@ -525,15 +533,18 @@ public class AllZoneUtil { * @param card a {@link forge.Card} object. * @return a {@link forge.Card} object. */ - public static Card getCardState(Card card) { + public static Card getCardState(final Card card) { PlayerZone zone = AllZone.getZone(card); - if (zone == null) // for tokens + //for tokens + if (zone == null) { return null; + } CardList list = getCardsInZone(zone.getZoneName()); for (Card c : list) { - if (card.equals(c)) + if (card.equals(c)) { return c; + } } return card; @@ -545,7 +556,7 @@ public class AllZoneUtil { * @param zone a {@link java.lang.String} object. * @return a {@link forge.CardList} object. */ - public static CardList getCardsInZone(String zone) { + public static CardList getCardsInZone(final String zone) { return getCardsInZone(zone, null); } @@ -555,7 +566,7 @@ public class AllZoneUtil { * @param zone a {@link forge.PlayerZone} object. * @return a {@link forge.CardList} object. */ - public static CardList getCardsInZone(PlayerZone zone) { + public static CardList getCardsInZone(final PlayerZone zone) { return new CardList(zone.getCards()); } @@ -566,38 +577,48 @@ public class AllZoneUtil { * @param player a {@link forge.Player} object. * @return a {@link forge.CardList} object. */ - public static CardList getCardsInZone(String zone, Player player) { + public static CardList getCardsInZone(final String zone, final Player player) { CardList all = new CardList(); if (zone.contains(Constant.Zone.Graveyard)) { - if (player == null || player.isHuman()) + if (player == null || player.isHuman()) { all.addAll(AllZone.getHumanGraveyard().getCards()); - if (player == null || player.isComputer()) + } + if (player == null || player.isComputer()) { all.addAll(AllZone.getComputerGraveyard().getCards()); + } } if (zone.contains(Constant.Zone.Hand)) { - if (player == null || player.isHuman()) + if (player == null || player.isHuman()) { all.addAll(AllZone.getHumanHand().getCards()); - if (player == null || player.isComputer()) + } + if (player == null || player.isComputer()) { all.addAll(AllZone.getComputerHand().getCards()); + } } if (zone.contains(Constant.Zone.Battlefield)) { - if (player == null || player.isHuman()) + if (player == null || player.isHuman()) { all.addAll(AllZone.getHumanBattlefield().getCards()); - if (player == null || player.isComputer()) + } + if (player == null || player.isComputer()) { all.addAll(AllZone.getComputerBattlefield().getCards()); + } } if (zone.contains(Constant.Zone.Exile)) { - if (player == null || player.isHuman()) + if (player == null || player.isHuman()) { all.addAll(AllZone.getHumanExile().getCards()); - if (player == null || player.isComputer()) + } + if (player == null || player.isComputer()) { all.addAll(AllZone.getComputerExile().getCards()); + } } if (zone.contains(Constant.Zone.Library)) { - if (player == null || player.isHuman()) + if (player == null || player.isHuman()) { all.addAll(AllZone.getHumanLibrary().getCards()); - if (player == null || player.isComputer()) + } + if (player == null || player.isComputer()) { all.addAll(AllZone.getComputerLibrary().getCards()); + } } return all; @@ -610,7 +631,7 @@ public class AllZoneUtil { * @param type a {@link java.lang.String} object. * @return a int. */ - public static int compareTypeAmountInPlay(final Player player, String type) { + public static int compareTypeAmountInPlay(final Player player, final String type) { // returns the difference between player's Player opponent = player.getOpponent(); CardList playerList = getPlayerTypeInPlay(player, type); @@ -625,7 +646,7 @@ public class AllZoneUtil { * @param type a {@link java.lang.String} object. * @return a int. */ - public static int compareTypeAmountInGraveyard(final Player player, String type) { + public static int compareTypeAmountInGraveyard(final Player player, final String type) { // returns the difference between player's Player opponent = player.getOpponent(); CardList playerList = getPlayerTypeInGraveyard(player, type); @@ -635,150 +656,150 @@ public class AllZoneUtil { /** - * a CardListFilter to get all cards that are tapped + * a CardListFilter to get all cards that are tapped. */ public static final CardListFilter tapped = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isTapped(); } }; /** - * a CardListFilter to get all cards that are untapped + * a CardListFilter to get all cards that are untapped. */ public static final CardListFilter untapped = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isUntapped(); } }; /** - * a CardListFilter to get all creatures + * a CardListFilter to get all creatures. */ public static final CardListFilter creatures = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isCreature(); } }; /** - * a CardListFilter to get all enchantments + * a CardListFilter to get all enchantments. */ public static final CardListFilter enchantments = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isEnchantment(); } }; /** - * a CardListFilter to get all equipment + * a CardListFilter to get all equipment. */ public static final CardListFilter equipment = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isEquipment(); } }; /** - * a CardListFilter to get all unenchanted cards in a list + * a CardListFilter to get all unenchanted cards in a list. */ public static final CardListFilter unenchanted = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return !c.isEnchanted(); } }; /** - * a CardListFilter to get all enchanted cards in a list + * a CardListFilter to get all enchanted cards in a list. */ public static final CardListFilter enchanted = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isEnchanted(); } }; /** - * a CardListFilter to get all nontoken cards + * a CardListFilter to get all nontoken cards. */ public static final CardListFilter nonToken = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return !c.isToken(); } }; /** - * a CardListFilter to get all token cards + * a CardListFilter to get all token cards. */ public static final CardListFilter token = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isToken(); } }; /** - * a CardListFilter to get all nonbasic lands + * a CardListFilter to get all nonbasic lands. */ public static final CardListFilter nonBasicLand = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return !c.isBasicLand(); } }; /** - * a CardListFilter to get all basicLands + * a CardListFilter to get all basicLands. */ public static final CardListFilter basicLands = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { //the isBasicLand() check here may be sufficient... return c.isLand() && c.isBasicLand(); } }; /** - * a CardListFilter to get all artifacts + * a CardListFilter to get all artifacts. */ public static final CardListFilter artifacts = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isArtifact(); } }; /** - * a CardListFilter to get all nonartifacts + * a CardListFilter to get all nonartifacts. */ public static final CardListFilter nonartifacts = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return !c.isArtifact(); } }; /** - * a CardListFilter to get all lands + * a CardListFilter to get all lands. */ public static final CardListFilter lands = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isLand(); } }; /** - * a CardListFilter to get all nonlands + * a CardListFilter to get all nonlands. */ public static final CardListFilter nonlands = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return !c.isLand(); } }; /** - * get a CardListFilter to filter in only cards that can be targeted + * get a CardListFilter to filter in only cards that can be targeted. * * @param source - the card to be the source for the target * @return a CardListFilter to only add cards that can be targeted */ public static CardListFilter getCanTargetFilter(final Card source) { CardListFilter canTarget = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return CardFactoryUtil.canTarget(source, c); } }; @@ -786,14 +807,14 @@ public class AllZoneUtil { } /** - * get a CardListFilter to filter a CardList for a given keyword + * get a CardListFilter to filter a CardList for a given keyword. * * @param keyword - the keyword to look for * @return a CardListFilter to only add cards with the given keyword */ public static CardListFilter getKeywordFilter(final String keyword) { CardListFilter filter = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.hasKeyword(keyword); } }; @@ -801,14 +822,14 @@ public class AllZoneUtil { } /** - * get a CardListFilter to filter a CardList for a given type + * get a CardListFilter to filter a CardList for a given type. * * @param type - the type to check for * @return a CardListFilter to only add cards of the given type */ public static CardListFilter getTypeFilter(final String type) { CardListFilter filter = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isType(type); } }; @@ -816,52 +837,52 @@ public class AllZoneUtil { } /** - * a CardListFilter to get all cards that are black + * a CardListFilter to get all cards that are black. */ public static final CardListFilter black = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isBlack(); } }; /** - * a CardListFilter to get all cards that are blue + * a CardListFilter to get all cards that are blue. */ public static final CardListFilter blue = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isBlue(); } }; /** - * a CardListFilter to get all cards that are green + * a CardListFilter to get all cards that are green. */ public static final CardListFilter green = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isGreen(); } }; /** - * a CardListFilter to get all cards that are red + * a CardListFilter to get all cards that are red. */ public static final CardListFilter red = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isRed(); } }; /** - * a CardListFilter to get all cards that are white + * a CardListFilter to get all cards that are white. */ public static final CardListFilter white = new CardListFilter() { - public boolean addCard(Card c) { + public boolean addCard(final Card c) { return c.isWhite(); } }; /** - * a CardListFilter to get all cards that are a part of this game + * a CardListFilter to get all cards that are a part of this game. * * @return a {@link forge.CardList} with all cards in all Battlefields, Hands, Graveyards, Libraries, and Exiles. */ @@ -892,15 +913,17 @@ public class AllZoneUtil { * @param player the {@link forge.Player} player to determine if is affected by Doubling Season * @return a int. */ - public static int getDoublingSeasonMagnitude(Player player) { + public static int getDoublingSeasonMagnitude(final Player player) { int multiplier = 1; int doublingSeasons = getPlayerCardsInPlay(player, "Doubling Season").size(); - if (doublingSeasons > 0) multiplier = (int) Math.pow(2, doublingSeasons); + if (doublingSeasons > 0) { + multiplier = (int) Math.pow(2, doublingSeasons); + } return multiplier; } /** - * get a list of all players participating in this game + * get a list of all players participating in this game. * * @return a list of all player participating in this game */ @@ -912,12 +935,12 @@ public class AllZoneUtil { } /** - * gets a list of all opponents of a given player + * gets a list of all opponents of a given player. * * @param p the player whose opponents to get * @return a list of all opponents */ - public static ArrayList getOpponents(Player p) { + public static ArrayList getOpponents(final Player p) { ArrayList list = new ArrayList(); list.add(p.getOpponent()); return list; @@ -932,20 +955,22 @@ public class AllZoneUtil { * @return a boolean. * @since 1.0.15 */ - public static boolean compare(int leftSide, String comp, int rightSide) { + public static boolean compare(final int leftSide, final String comp, final int rightSide) { // should this function be somewhere else? // leftSide COMPARED to rightSide: - if (comp.contains("LT")) return leftSide < rightSide; - - else if (comp.contains("LE")) return leftSide <= rightSide; - - else if (comp.contains("EQ")) return leftSide == rightSide; - - else if (comp.contains("GE")) return leftSide >= rightSide; - - else if (comp.contains("GT")) return leftSide > rightSide; - - else if (comp.contains("NE")) return leftSide != rightSide; // not equals + if (comp.contains("LT")) { + return leftSide < rightSide; + } else if (comp.contains("LE")) { + return leftSide <= rightSide; + } else if (comp.contains("EQ")) { + return leftSide == rightSide; + } else if (comp.contains("GE")) { + return leftSide >= rightSide; + } else if (comp.contains("GT")) { + return leftSide > rightSide; + } else if (comp.contains("NE")) { + return leftSide != rightSide; // not equals + } return false; }