List of usage examples for java.lang Integer decode
public static Integer decode(String nm) throws NumberFormatException
From source file:lineage2.gameserver.Config.java
/** * Method loadServicesSettings./*from ww w . j a v a 2s . com*/ */ public static void loadServicesSettings() { ExProperties servicesSettings = load(SERVICES_FILE); for (int id : servicesSettings.getProperty("AllowClassMasters", ArrayUtils.EMPTY_INT_ARRAY)) { if (id != 0) { ALLOW_CLASS_MASTERS_LIST.add(id); } } CLASS_MASTERS_PRICE = servicesSettings.getProperty("ClassMastersPrice", "0,0,0,0"); if (CLASS_MASTERS_PRICE.length() >= 7) { int level = 1; for (String id : CLASS_MASTERS_PRICE.split(",")) { CLASS_MASTERS_PRICE_LIST[level] = Integer.parseInt(id); level++; } } CLASS_MASTERS_PRICE_ITEM = servicesSettings.getProperty("ClassMastersPriceItem", "0,0,0,0"); if (CLASS_MASTERS_PRICE_ITEM.length() >= 7) { int level = 1; for (String id : CLASS_MASTERS_PRICE_ITEM.split(",")) { CLASS_MASTERS_PRICE_ITEM_LIST[level] = Integer.parseInt(id); level++; } } SERVICES_CHANGE_NICK_ENABLED = servicesSettings.getProperty("NickChangeEnabled", false); SERVICES_CHANGE_NICK_PRICE = servicesSettings.getProperty("NickChangePrice", 100); SERVICES_CHANGE_NICK_ITEM = servicesSettings.getProperty("NickChangeItem", 4037); SERVICES_CHANGE_CLAN_NAME_ENABLED = servicesSettings.getProperty("ClanNameChangeEnabled", false); SERVICES_CHANGE_CLAN_NAME_PRICE = servicesSettings.getProperty("ClanNameChangePrice", 100); SERVICES_CHANGE_CLAN_NAME_ITEM = servicesSettings.getProperty("ClanNameChangeItem", 4037); SERVICES_CHANGE_PET_NAME_ENABLED = servicesSettings.getProperty("PetNameChangeEnabled", false); SERVICES_CHANGE_PET_NAME_PRICE = servicesSettings.getProperty("PetNameChangePrice", 100); SERVICES_CHANGE_PET_NAME_ITEM = servicesSettings.getProperty("PetNameChangeItem", 4037); SERVICES_EXCHANGE_BABY_PET_ENABLED = servicesSettings.getProperty("BabyPetExchangeEnabled", false); SERVICES_EXCHANGE_BABY_PET_PRICE = servicesSettings.getProperty("BabyPetExchangePrice", 100); SERVICES_EXCHANGE_BABY_PET_ITEM = servicesSettings.getProperty("BabyPetExchangeItem", 4037); SERVICES_CHANGE_SEX_ENABLED = servicesSettings.getProperty("SexChangeEnabled", false); SERVICES_CHANGE_SEX_PRICE = servicesSettings.getProperty("SexChangePrice", 100); SERVICES_CHANGE_SEX_ITEM = servicesSettings.getProperty("SexChangeItem", 4037); SERVICES_CHANGE_BASE_ENABLED = servicesSettings.getProperty("BaseChangeEnabled", false); SERVICES_CHANGE_BASE_PRICE = servicesSettings.getProperty("BaseChangePrice", 100); SERVICES_CHANGE_BASE_ITEM = servicesSettings.getProperty("BaseChangeItem", 4037); SERVICES_SEPARATE_SUB_ENABLED = servicesSettings.getProperty("SeparateSubEnabled", false); SERVICES_SEPARATE_SUB_PRICE = servicesSettings.getProperty("SeparateSubPrice", 100); SERVICES_SEPARATE_SUB_ITEM = servicesSettings.getProperty("SeparateSubItem", 4037); SERVICES_CHANGE_NICK_COLOR_ENABLED = servicesSettings.getProperty("NickColorChangeEnabled", false); SERVICES_CHANGE_NICK_COLOR_PRICE = servicesSettings.getProperty("NickColorChangePrice", 100); SERVICES_CHANGE_NICK_COLOR_ITEM = servicesSettings.getProperty("NickColorChangeItem", 4037); SERVICES_CHANGE_NICK_COLOR_LIST = servicesSettings.getProperty("NickColorChangeList", new String[] { "00FF00" }); SERVICES_BASH_ENABLED = servicesSettings.getProperty("BashEnabled", false); SERVICES_BASH_SKIP_DOWNLOAD = servicesSettings.getProperty("BashSkipDownload", false); SERVICES_BASH_RELOAD_TIME = servicesSettings.getProperty("BashReloadTime", 24); SERVICES_RATE_TYPE = servicesSettings.getProperty("RateBonusType", Bonus.NO_BONUS); SERVICES_RATE_BONUS_PRICE = servicesSettings.getProperty("RateBonusPrice", new int[] { 1500 }); SERVICES_RATE_BONUS_ITEM = servicesSettings.getProperty("RateBonusItem", new int[] { 4037 }); SERVICES_RATE_BONUS_VALUE = servicesSettings.getProperty("RateBonusValue", new double[] { 1.25 }); SERVICES_RATE_BONUS_DAYS = servicesSettings.getProperty("RateBonusTime", new int[] { 30 }); SERVICES_NOBLESS_SELL_ENABLED = servicesSettings.getProperty("NoblessSellEnabled", false); SERVICES_NOBLESS_SELL_PRICE = servicesSettings.getProperty("NoblessSellPrice", 1000); SERVICES_NOBLESS_SELL_ITEM = servicesSettings.getProperty("NoblessSellItem", 4037); SERVICES_HERO_SELL_ENABLED = servicesSettings.getProperty("HeroSellEnabled", false); SERVICES_HERO_SELL_DAY = servicesSettings.getProperty("HeroSellDay", new int[] { 30 }); SERVICES_HERO_SELL_PRICE = servicesSettings.getProperty("HeroSellPrice", new int[] { 30 }); SERVICES_HERO_SELL_ITEM = servicesSettings.getProperty("HeroSellItem", new int[] { 4037 }); SERVICES_EXPAND_INVENTORY_ENABLED = servicesSettings.getProperty("ExpandInventoryEnabled", false); SERVICES_EXPAND_INVENTORY_PRICE = servicesSettings.getProperty("ExpandInventoryPrice", 1000); SERVICES_EXPAND_INVENTORY_ITEM = servicesSettings.getProperty("ExpandInventoryItem", 4037); SERVICES_EXPAND_INVENTORY_MAX = servicesSettings.getProperty("ExpandInventoryMax", 250); SERVICES_EXPAND_WAREHOUSE_ENABLED = servicesSettings.getProperty("ExpandWarehouseEnabled", false); SERVICES_EXPAND_WAREHOUSE_PRICE = servicesSettings.getProperty("ExpandWarehousePrice", 1000); SERVICES_EXPAND_WAREHOUSE_ITEM = servicesSettings.getProperty("ExpandWarehouseItem", 4037); SERVICES_EXPAND_CWH_ENABLED = servicesSettings.getProperty("ExpandCWHEnabled", false); SERVICES_EXPAND_CWH_PRICE = servicesSettings.getProperty("ExpandCWHPrice", 1000); SERVICES_EXPAND_CWH_ITEM = servicesSettings.getProperty("ExpandCWHItem", 4037); SERVICES_DELEVEL_ENABLED = servicesSettings.getProperty("DelevelEnabled", false); SERVICES_DELEVEL_PRICE = servicesSettings.getProperty("DelevelPrice", 1); SERVICES_DELEVEL_ITEM = servicesSettings.getProperty("DelevelItem", 4037); SERVICES_SELLPETS = servicesSettings.getProperty("SellPets", ""); SERVICES_OFFLINE_TRADE_ALLOW = servicesSettings.getProperty("AllowOfflineTrade", false); SERVICES_OFFLINE_TRADE_ALLOW_OFFSHORE = servicesSettings.getProperty("AllowOfflineTradeOnlyOffshore", true); SERVICES_OFFLINE_TRADE_MIN_LEVEL = servicesSettings.getProperty("OfflineMinLevel", 0); SERVICES_OFFLINE_TRADE_NAME_COLOR = Integer .decode("0x" + servicesSettings.getProperty("OfflineTradeNameColor", "B0FFFF")); SERVICES_OFFLINE_TRADE_PRICE_ITEM = servicesSettings.getProperty("OfflineTradePriceItem", 0); SERVICES_OFFLINE_TRADE_PRICE = servicesSettings.getProperty("OfflineTradePrice", 0); SERVICES_OFFLINE_TRADE_SECONDS_TO_KICK = servicesSettings.getProperty("OfflineTradeDaysToKick", 14) * 86400L; SERVICES_OFFLINE_TRADE_RESTORE_AFTER_RESTART = servicesSettings.getProperty("OfflineRestoreAfterRestart", true); SERVICES_NO_TRADE_ONLY_OFFLINE = servicesSettings.getProperty("NoTradeOnlyOffline", false); SERVICES_TRADE_TAX = servicesSettings.getProperty("TradeTax", 0.0); SERVICES_OFFSHORE_TRADE_TAX = servicesSettings.getProperty("OffshoreTradeTax", 0.0); SERVICES_TRADE_TAX_ONLY_OFFLINE = servicesSettings.getProperty("TradeTaxOnlyOffline", false); SERVICES_OFFSHORE_NO_CASTLE_TAX = servicesSettings.getProperty("NoCastleTaxInOffshore", false); SERVICES_TRADE_ONLY_FAR = servicesSettings.getProperty("TradeOnlyFar", false); SERVICES_TRADE_MIN_LEVEL = servicesSettings.getProperty("MinLevelForTrade", 0); SERVICES_TRADE_RADIUS = servicesSettings.getProperty("TradeRadius", 30); SERVICES_GIRAN_HARBOR_ENABLED = servicesSettings.getProperty("GiranHarborZone", false); SERVICES_PARNASSUS_ENABLED = servicesSettings.getProperty("ParnassusZone", false); SERVICES_PARNASSUS_NOTAX = servicesSettings.getProperty("ParnassusNoTax", false); SERVICES_PARNASSUS_PRICE = servicesSettings.getProperty("ParnassusPrice", 500000); SERVICES_ALLOW_LOTTERY = servicesSettings.getProperty("AllowLottery", false); SERVICES_LOTTERY_PRIZE = servicesSettings.getProperty("LotteryPrize", 50000); SERVICES_ALT_LOTTERY_PRICE = servicesSettings.getProperty("AltLotteryPrice", 2000); SERVICES_LOTTERY_TICKET_PRICE = servicesSettings.getProperty("LotteryTicketPrice", 2000); SERVICES_LOTTERY_5_NUMBER_RATE = servicesSettings.getProperty("Lottery5NumberRate", 0.6); SERVICES_LOTTERY_4_NUMBER_RATE = servicesSettings.getProperty("Lottery4NumberRate", 0.4); SERVICES_LOTTERY_3_NUMBER_RATE = servicesSettings.getProperty("Lottery3NumberRate", 0.2); SERVICES_LOTTERY_2_AND_1_NUMBER_PRIZE = servicesSettings.getProperty("Lottery2and1NumberPrize", 200); SERVICES_ALLOW_ROULETTE = servicesSettings.getProperty("AllowRoulette", false); SERVICES_ROULETTE_MIN_BET = servicesSettings.getProperty("RouletteMinBet", 1L); SERVICES_ROULETTE_MAX_BET = servicesSettings.getProperty("RouletteMaxBet", Long.MAX_VALUE); SERVICES_ENABLE_NO_CARRIER = servicesSettings.getProperty("EnableNoCarrier", false); SERVICES_NO_CARRIER_MIN_TIME = servicesSettings.getProperty("NoCarrierMinTime", 0); SERVICES_NO_CARRIER_MAX_TIME = servicesSettings.getProperty("NoCarrierMaxTime", 90); SERVICES_NO_CARRIER_DEFAULT_TIME = servicesSettings.getProperty("NoCarrierDefaultTime", 60); ITEM_BROKER_ITEM_SEARCH = servicesSettings.getProperty("UseItemBrokerItemSearch", false); ALLOW_EVENT_GATEKEEPER = servicesSettings.getProperty("AllowEventGatekeeper", false); }
From source file:lineage2.gameserver.Config.java
/** * Method loadPvPSettings./*w w w. j a va 2s.com*/ */ public static void loadPvPSettings() { ExProperties pvpSettings = load(PVP_CONFIG_FILE); KARMA_MIN_KARMA = pvpSettings.getProperty("MinKarma", 240); KARMA_SP_DIVIDER = pvpSettings.getProperty("SPDivider", 7); KARMA_LOST_BASE = pvpSettings.getProperty("BaseKarmaLost", 0); KARMA_DROP_GM = pvpSettings.getProperty("CanGMDropEquipment", false); KARMA_NEEDED_TO_DROP = pvpSettings.getProperty("KarmaNeededToDrop", true); DROP_ITEMS_ON_DIE = pvpSettings.getProperty("DropOnDie", false); DROP_ITEMS_AUGMENTED = pvpSettings.getProperty("DropAugmented", false); KARMA_DROP_ITEM_LIMIT = pvpSettings.getProperty("MaxItemsDroppable", 10); MIN_PK_TO_ITEMS_DROP = pvpSettings.getProperty("MinPKToDropItems", 5); KARMA_RANDOM_DROP_LOCATION_LIMIT = pvpSettings.getProperty("MaxDropThrowDistance", 70); KARMA_DROPCHANCE_BASE = pvpSettings.getProperty("ChanceOfPKDropBase", 20.); KARMA_DROPCHANCE_MOD = pvpSettings.getProperty("ChanceOfPKsDropMod", 1.); NORMAL_DROPCHANCE_BASE = pvpSettings.getProperty("ChanceOfNormalDropBase", 1.); DROPCHANCE_EQUIPPED_WEAPON = pvpSettings.getProperty("ChanceOfDropWeapon", 3); DROPCHANCE_EQUIPMENT = pvpSettings.getProperty("ChanceOfDropEquippment", 17); DROPCHANCE_ITEM = pvpSettings.getProperty("ChanceOfDropOther", 80); KARMA_LIST_NONDROPPABLE_ITEMS = new ArrayList<Integer>(); for (int id : pvpSettings.getProperty("ListOfNonDroppableItems", new int[] { 57, 1147, 425, 1146, 461, 10, 2368, 7, 6, 2370, 2369, 3500, 3501, 3502, 4422, 4423, 4424, 2375, 6648, 6649, 6650, 6842, 6834, 6835, 6836, 6837, 6838, 6839, 6840, 5575, 7694, 6841, 8181 })) { KARMA_LIST_NONDROPPABLE_ITEMS.add(id); } PVP_TIME = pvpSettings.getProperty("PvPTime", 40000); REPUTATION_COUNT = pvpSettings.getProperty("CountReputation", 360); PK_KILLER_NAME_COLOUR = Integer.decode("0x" + pvpSettings.getProperty("PKKillerNameColour", "00FF00")); }
From source file:de.juwimm.cms.remote.ContentServiceSpringImpl.java
private List<ContentVersionHbm> checkResourcesInContentVersions( Map<ViewComponentHbm, List<ContentVersionHbm>> contentVersions, boolean withHistory, List<PictureHbm> pictures, List<DocumentHbm> documents) throws Exception { DocumentResourceComparer documentComparer = new DocumentResourceComparer(); PictureResourceComparer pictureComparer = new PictureResourceComparer(); List<ContentVersionHbm> contentsToDelete = new ArrayList<ContentVersionHbm>(); if (contentVersions == null || contentVersions.size() == 0) { return contentsToDelete; }/*from w ww.j a v a2s .c om*/ for (Entry<ViewComponentHbm, List<ContentVersionHbm>> contentVersionGroup : contentVersions.entrySet()) { Integer maxVersion = getMaxVersion(contentVersionGroup.getValue()); for (ContentVersionHbm contentVersion : contentVersionGroup.getValue()) { String content = contentVersion.getText(); ResourceUsageState state = null; Integer currentVersion = Integer.decode(contentVersion.getVersion()); if (currentVersion < maxVersion) { state = ResourceUsageState.UsedInOlderVersions; } else if (currentVersion == maxVersion) { state = ResourceUsageState.Used; } if (content != null) { Document domDocument = null; try { domDocument = XercesHelper.string2Dom(content); } catch (Exception e) { log.info("could not parse used ressources: " + e.getMessage()); if (log.isDebugEnabled()) log.debug("Parsing Error", e); } if (domDocument != null) { boolean deleteContent = false; deleteContent = deleteContent || documentComparer.checkResourcesInContentText(domDocument, state, withHistory, documents, "document", "src"); deleteContent = deleteContent || pictureComparer.checkResourcesInContentText(domDocument, state, withHistory, pictures, "picture", "description"); deleteContent = deleteContent || pictureComparer.checkResourcesInContentText(domDocument, state, withHistory, pictures, "image", "src"); if (deleteContent) { contentsToDelete.add(contentVersion); } } } } } return contentsToDelete; }
From source file:de.juwimm.cms.remote.ContentServiceSpringImpl.java
/** * Also in the contentVersions it replaces the PUBLS version with the max version * @param contentVersions - The list of contents should be all the contents from a view * @return/*from ww w . j a v a2 s . c o m*/ */ private Integer getMaxVersion(List<ContentVersionHbm> contentVersions) { Integer maxVersion = 0; ContentVersionHbm publishContentVersion = null; //search max revision for (ContentVersionHbm contentVersion : contentVersions) { if (contentVersion.getVersion().equals(Constants.PUBLISH_VERSION)) { publishContentVersion = contentVersion; break; } int versionNumber = Integer.decode(contentVersion.getVersion()); if (versionNumber > maxVersion) { maxVersion = versionNumber; } } if (publishContentVersion != null) { publishContentVersion.setVersion(Integer.toString(++maxVersion)); } return maxVersion; }
From source file:de.juwimm.cms.remote.ContentServiceSpringImpl.java
@Override protected void handleMakeContentOffline(Integer viewComponentId) throws Exception { ViewComponentHbm viewComponent = getViewComponentHbmDao().load(viewComponentId); //update online status viewComponent.setOnline((byte) 0); viewComponent.setStatus(Constants.DEPLOY_STATUS_EDITED); getViewComponentHbmDao().update(viewComponent); try {/*from w ww . j a v a 2s . c o m*/ ContentHbm content = getContentHbmDao().load(Integer.decode(viewComponent.getReference())); ContentVersionHbm publishContentVersion = content != null ? content.getContentVersionForPublish() : null; if (publishContentVersion == null) { return; } //remove publish content version content.getContentVersions().remove(publishContentVersion); getContentHbmDao().update(content); removeContentVersion(publishContentVersion.getContentVersionId()); } catch (Exception e) { log.error(e.getMessage(), e); } }
From source file:org.ohmage.domain.campaign.Campaign.java
/** * Process the property Nodes from the XML and creates a mapping of all of * the keys to label/value pairs./*from ww w.ja va 2 s .c o m*/ * * @param properties The properties for the prompt in the XML. * * @return A mapping of property keys to their label/value pairs. * * @throws DomainException Thrown if a property is invalid. */ private static Map<String, LabelValuePair> getKeyValueLabelTrios(final String containerId, final Nodes properties) throws DomainException { int numProperties = properties.size(); if (numProperties == 0) { return Collections.emptyMap(); } Map<String, LabelValuePair> result = new HashMap<String, LabelValuePair>(numProperties); for (int i = 0; i < numProperties; i++) { Node propertyNode = properties.get(i); Nodes keys = propertyNode.query(XML_PROPERTY_KEY); if (keys.size() == 0) { throw new DomainException("The property key is missing: " + containerId); } else if (keys.size() > 1) { throw new DomainException("Multiple property keys were found: " + containerId); } String key = keys.get(0).getValue().trim(); if (key.length() == 0) { throw new DomainException("The property key cannot be whitespace only: " + containerId); } Nodes labels = propertyNode.query(XML_PROPERTY_LABEL); if (labels.size() == 0) { throw new DomainException("The property label is missing: " + containerId); } else if (labels.size() > 1) { throw new DomainException("Multiple property labels were found: " + containerId); } String label = labels.get(0).getValue().trim(); Number value = null; Nodes values = propertyNode.query(XML_PROPERTY_VALUE); if (values.size() > 1) { throw new DomainException("Multiple property values found: " + containerId); } else if (values.size() == 1) { String valueString = values.get(0).getValue().trim(); try { value = Short.decode(valueString); } catch (NumberFormatException notShort) { try { value = Integer.decode(valueString); } catch (NumberFormatException notInteger) { try { value = Long.decode(valueString); } catch (NumberFormatException notLong) { try { value = Float.parseFloat(valueString); } catch (NumberFormatException notFloat) { try { value = Double.parseDouble(valueString); } catch (NumberFormatException notDouble) { throw new DomainException( "The property value is not a numeric value: " + containerId); } } } } } } if (result.put(key, new LabelValuePair(label, value)) != null) { throw new DomainException( "Multiple properties with the same key were found for the container with id: " + containerId); } } return result; }
From source file:org.ramadda.util.HtmlUtils.java
/** * This takes the given String and tries to convert it to a color. * The string may be a space or comma separated triple of RGB integer * values. It may be an integer or it may be a color name defined in * the COLORNAMES array//from w w w.j ava2 s . co m * * @param value String value * @param dflt This is returned if the value cannot be converted * @return Color defined by the String value or the dflt */ public static Color decodeColor(String value, Color dflt) { if (value == null) { return dflt; } value = value.trim(); if (value.equals("null")) { return null; } String s = value; String lookFor = ","; int i1 = s.indexOf(lookFor); if (i1 < 0) { lookFor = " "; i1 = s.indexOf(lookFor); } if (i1 > 0) { String red = s.substring(0, i1); s = s.substring(i1 + 1).trim(); int i2 = s.indexOf(lookFor); if (i2 > 0) { String green = s.substring(0, i2); String blue = s.substring(i2 + 1); try { return new Color(Integer.decode(red).intValue(), Integer.decode(green).intValue(), Integer.decode(blue).intValue()); } catch (Exception exc) { System.err.println("Bad color:" + value); } } } try { return new Color(Integer.decode(s).intValue()); } catch (Exception e) { s = s.toLowerCase(); for (int i = 0; i < COLORNAMES.length; i++) { if (s.equals(COLORNAMES[i])) { return COLORS[i]; } } } return dflt; }
From source file:org.ohmage.domain.campaign.Campaign.java
/** * Processes a multi-choice prompt and returns a MultiChoicePrompt object. * /* ww w . j a v a 2s .c o m*/ * @param id The prompt's unique identifier. * * @param condition The condition value. * * @param unit The prompt's visualization unit. * * @param text The prompt's text value. * * @param explanationText The prompt's explanation text value. * * @param skippable Whether or not this prompt is skippable. * * @param skipLabel The label to show to skip this prompt. * * @param displayLabel The label for this display type. * * @param defaultValue The default value given in the XML. * * @param properties The properties defined in the XML for this prompt. * * @param index The index of this prompt in its collection of survey items. * * @return A MultiChoicePrompt object. * * @throws DomainException Thrown if the required properties are missing or * if any of the parameters are invalid. */ private static MultiChoicePrompt processMultiChoice(final String id, final String condition, final String unit, final String text, final String explanationText, final boolean skippable, final String skipLabel, final String displayLabel, final String defaultValue, final Map<String, LabelValuePair> properties, final int index) throws DomainException { Map<Integer, LabelValuePair> choices = new HashMap<Integer, LabelValuePair>(properties.size()); for (String key : properties.keySet()) { Integer keyInt; try { keyInt = Integer.decode(key); if (keyInt < 0) { throw new DomainException("The key value cannot be negative: " + id); } } catch (NumberFormatException e) { throw new DomainException("The key is not a valid integer: " + id, e); } choices.put(keyInt, properties.get(key)); } List<Integer> defaultValues = null; if ((defaultValue != null) && (!"".equals(defaultValue))) { String[] values = defaultValue.split(InputKeys.LIST_ITEM_SEPARATOR); defaultValues = new ArrayList<Integer>(values.length); for (int i = 0; i < values.length; i++) { String currValue = values[i]; if (!"".equals(currValue)) { try { defaultValues.add(Integer.decode(currValue)); } catch (NumberFormatException e) { throw new DomainException("One of the default values was not an integer."); } } } } return new MultiChoicePrompt(id, condition, unit, text, explanationText, skippable, skipLabel, displayLabel, choices, defaultValues, index); }
From source file:org.ohmage.domain.campaign.Campaign.java
/** * Processes a multi-choice custom prompt and returns a * MultiChoiceCustomPrompt object./*from w w w. jav a 2 s. c o m*/ * * @param id The prompt's unique identifier. * * @param condition The condition value. * * @param unit The prompt's visualization unit. * * @param text The prompt's text value. * * @param explanationText The prompt's explanation text value. * * @param skippable Whether or not this prompt is skippable. * * @param skipLabel The label to show to skip this prompt. * * @param displayLabel The label for this display type. * * @param defaultValue The default value given in the XML. * * @param properties The properties defined in the XML for this prompt. * * @param index The index of this prompt in its collection of survey items. * * @return A MultiChoiceCustomPrompt object. * * @throws DomainException Thrown if the required properties are missing or * if any of the parameters are invalid. */ private static MultiChoiceCustomPrompt processMultiChoiceCustom(final String id, final String condition, final String unit, final String text, final String explanationText, final boolean skippable, final String skipLabel, final String displayLabel, final String defaultValue, final Map<String, LabelValuePair> properties, final int index) throws DomainException { Map<Integer, LabelValuePair> choices = new HashMap<Integer, LabelValuePair>(properties.size()); for (String key : properties.keySet()) { Integer keyInt; try { keyInt = Integer.decode(key); if (keyInt < 0) { throw new DomainException("The key value cannot be negative: " + id); } } catch (NumberFormatException e) { throw new DomainException("The key is not a valid integer: " + id, e); } choices.put(keyInt, properties.get(key)); } List<Integer> defaultValues = null; if ((defaultValue != null) && (!"".equals(defaultValue))) { String[] values = defaultValue.split(InputKeys.LIST_ITEM_SEPARATOR); defaultValues = new ArrayList<Integer>(values.length); for (int i = 0; i < values.length; i++) { String currValue = values[i]; if (!"".equals(currValue)) { try { defaultValues.add(Integer.decode(currValue)); } catch (NumberFormatException e) { throw new DomainException("One of the default values was not an integer."); } } } } return new MultiChoiceCustomPrompt(id, condition, unit, text, explanationText, skippable, skipLabel, displayLabel, choices, new HashMap<Integer, LabelValuePair>(), defaultValues, index); }
From source file:SeedGenerator.MainForm.java
private void btnRunSeedGeneratorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRunSeedGeneratorActionPerformed int crawlId = createCrawl(getQueryText(), "SearchEngineCrawler"); maxPage = Integer.decode(txtMaxPage.getText()); threadArray = new Thread[maxPage]; List selist = lstSearchEngines.getSelectedValuesList(); jProgressBar1.setMaximum(maxPage * selist.size()); int i = 0;/*from ww w .j av a 2 s .c o m*/ for (Object se : selist) { WorkerSearch sworker = new WorkerSearch(this, se.toString(), crawlId, getQueryText()); sworker.setName("Worker " + wNr); //threadArray[i++] = sworker; sworker.start(); try { Thread.sleep(300); } catch (Exception ex) { } // search(getSearchEngineFromName((String) se)); } }