List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:com.aurel.track.admin.customize.category.filter.execute.loadItems.LoadItemLinksUtil.java
/** * Get the linked items: either linked though parent or children hierarchy or through plugin links * It is very important to remove those linked/parent/child issues which are * already contained in the result set to avoid adding them once again * @param linkTypeFilterSuperset/*from ww w. jav a 2s. c o m*/ * @param archived * @param deleted * @param itemTypesList * @param baseWorkItemBeanList */ public static int[] getLinkedWorkItemIDs(String linkTypeFilterSuperset, Integer archived, Integer deleted, List<Integer> itemTypesList, List<TWorkItemBean> baseWorkItemBeanList) { if (linkTypeFilterSuperset == null || "".equals(linkTypeFilterSuperset) || baseWorkItemBeanList == null || baseWorkItemBeanList.isEmpty()) { return null; } else { List<Integer> baseWorkItemIDsList = GeneralUtils.createIntegerListFromBeanList(baseWorkItemBeanList); int[] baseWorkItemIDsArr = GeneralUtils.createIntArrFromIntegerList(baseWorkItemIDsList); Integer[] parts = MergeUtil.getParts(linkTypeFilterSuperset); Integer linkType = parts[0]; Integer direction = parts[1]; Set<Integer> linkedWorkItemIDsSet = null; if (ILinkType.PARENT_CHILD == linkType.intValue()) { if (PARENT_CHILD_EXPRESSION.ALL_PARENTS == direction) { linkedWorkItemIDsSet = getParentHierarchy(baseWorkItemBeanList, archived, deleted); } else { linkedWorkItemIDsSet = ItemBL.getChildHierarchy(baseWorkItemIDsArr, direction, archived, deleted, itemTypesList); } } else { Map<Integer, SortedSet<Integer>> linkedWorkItemIDsMap = getLinkedWorkItemIDsMap(baseWorkItemIDsList, linkType, direction, archived, deleted); linkedWorkItemIDsSet = getFlatItems(linkedWorkItemIDsMap); } //remove those linked/parent/child issues which are //already contained in the result set to avoid adding them once again if (linkedWorkItemIDsSet != null) { linkedWorkItemIDsSet.removeAll(GeneralUtils.createSetFromIntArr(baseWorkItemIDsArr)); } return GeneralUtils.createIntArrFromSet(linkedWorkItemIDsSet); } }
From source file:com.aurel.track.admin.customize.category.report.execute.ReportBeansToXML.java
/** * Whether the field has extra sort order field * @param fieldID// w w w.j a v a 2 s.co m * @return */ public static boolean hasExtraSortField(Integer fieldID) { if (fieldID != null && fieldID.intValue() > 0) { IFieldTypeRT fieldTypeRT = FieldTypeManager.getFieldTypeRT(fieldID); if (fieldTypeRT != null) { if (fieldTypeRT.getValueType() == ValueType.CUSTOMOPTION || fieldTypeRT.isComposite() || fieldTypeRT.getValueType() == ValueType.SYSTEMOPTION) { //for lists the field name to sort by is not by the list field (would be alphabetically by label) but by they have explicit sort order field if (fieldTypeRT.getValueType() == ValueType.SYSTEMOPTION) { switch (fieldID.intValue()) { case SystemFields.STATE: case SystemFields.ISSUETYPE: case SystemFields.PRIORITY: case SystemFields.SEVERITY: case SystemFields.RELEASENOTICED: case SystemFields.RELEASESCHEDULED: //there is explicit sort order only for some system lists (not for persons) return true; } } else { //there is explicit sort order for each custom list return true; } } } } return false; }
From source file:com.microsoft.tfs.core.util.CodePageMapping.java
/** * <p>//from w w w . ja v a 2 s .c o m * Translates the specified {@link Charset} into a code page. * </p> * * <p> * If the {@link Charset} does not map to a code page, the * <code>mustExist</code> parameter specifies the policy. If * <code>mustExist</code> is <code>true</code>, an * {@link UnknownEncodingException} is thrown. Otherwise, <code>0</code> is * returned. The value 0 is not a valid code page value for TFS. * </p> * * @param charset * a {@link Charset} to translate (must not be <code>null</code>) * @param mustExist * if <code>true</code>, the {@link Charset} must map to a code page * @return a code page for the {@link Charset}, which may be <code>0</code> * if <code>mustExist</code> is <code>false</code> * @throws UnknownEncodingException */ public static int getCodePage(final Charset charset, final boolean mustExist) { Check.notNull(charset, "charset"); //$NON-NLS-1$ Integer codePage = tryLookupSystemPropertyCodePage(charset.name()); if (codePage != null) { return codePage.intValue(); } final Set<String> aliases = charset.aliases(); for (final Iterator<String> it = aliases.iterator(); it.hasNext();) { final String alias = it.next(); codePage = tryLookupSystemPropertyCodePage(alias); if (codePage != null) { return codePage.intValue(); } } codePage = CodePageData.getCodePage(charset.name()); if (codePage != null) { return codePage.intValue(); } if (mustExist) { throw new UnknownEncodingException(charset); } return 0; }
From source file:fr.landel.utils.commons.ObjectUtils.java
/** * Get the primitive value of an {@link Integer}. If {@code value} is not * {@code null}, returns the primitive value of {@code value} otherwise returns * {@code defaultValue}//from ww w.j a va 2s . c o m * * <pre> * Integer value = new Integer(1); * int value1 = ObjectUtils.toPrimitive(value, 0); // => value1 = 1 * int value2 = ObjectUtils.toPrimitive((Integer) null, 0); // => value2 = 0 * </pre> * * @param value * the {@link Integer} value * @param defaultValue * the default value * @return a primitive int */ public static int toPrimitive(final Integer value, final int defaultValue) { if (value == null) { return defaultValue; } else { return value.intValue(); } }
From source file:it.cnr.icar.eric.client.ui.swing.SwingWorker.java
/** * Activate the capabilities of glasspane, only if this is the 1st running * call for 'aComp'//from ww w. j ava 2 s. co m * * @return GlassPane for aComponent's top level component. */ private static synchronized GlassPane activateGlassPaneSynch(Component aComp) { // Mount the glasspane on the component window GlassPane aPane = GlassPane.mount(aComp, true); if (aPane != null) { Integer iCount = countPerGlassPane.get(aPane); if (iCount == null) { // no GlassPane active for it, create new, cache it and increase count countPerGlassPane.put(aPane, new Integer(1)); // Start interception UI interactions aPane.setVisible(true); } else { // GlassPane already exist, just increase count int newCount = iCount.intValue() + 1; countPerGlassPane.put(aPane, new Integer(newCount)); } } return aPane; }
From source file:com.abstratt.mdd.core.util.MDDUtil.java
public static LiteralUnlimitedNatural createLiteralUnlimitedNatural(Package parent, Integer value) { LiteralUnlimitedNatural valueSpec = (LiteralUnlimitedNatural) parent.createPackagedElement(null, IRepository.PACKAGE.getLiteralUnlimitedNatural()); valueSpec.setValue(value == null ? LiteralUnlimitedNatural.UNLIMITED : value.intValue()); valueSpec.setType(BasicTypeUtils.findBuiltInType("Integer")); return valueSpec; }
From source file:com.microsoft.tfs.core.util.CodePageMapping.java
/** * <p>//w w w . java 2s.c om * Translates the specified encoding into a code page. * </p> * * <p> * If the encoding does not map to a code page, the <code>mustExist</code> * parameter specifies the policy. If <code>mustExist</code> is * <code>true</code>, an {@link UnknownEncodingException} is thrown. * Otherwise, <code>0</code> is returned. The value 0 is not a valid code * page value for TFS. * </p> * * @param encoding * an encoding to translate (must not be <code>null</code>) * @param mustExist * if <code>true</code>, the encoding must map to a code page * @return a code page for the encoding, which may be <code>0</code> if * <code>mustExist</code> is <code>false</code> * @throws UnknownEncodingException */ public static int getCodePage(final String encoding, final boolean mustExist) { Check.notNull(encoding, "encoding"); //$NON-NLS-1$ Integer codePage = tryLookupSystemPropertyCodePage(encoding); if (codePage != null) { return codePage.intValue(); } final Charset charset = tryCharsetForName(encoding); if (charset != null) { final String name = charset.name(); if (!encoding.equalsIgnoreCase(name)) { codePage = tryLookupSystemPropertyCodePage(name); if (codePage != null) { return codePage.intValue(); } } final Set<String> aliases = charset.aliases(); for (final Iterator<String> it = aliases.iterator(); it.hasNext();) { final String alias = it.next(); if (encoding.equalsIgnoreCase(alias)) { continue; } codePage = tryLookupSystemPropertyCodePage(alias); if (codePage != null) { return codePage.intValue(); } } } codePage = CodePageData.getCodePage(encoding); if (codePage != null) { return codePage.intValue(); } if (charset != null) { final String name = charset.name(); if (!encoding.equalsIgnoreCase(name)) { codePage = CodePageData.getCodePage(charset.name()); if (codePage != null) { return codePage.intValue(); } } } if (mustExist) { if (charset != null) { throw new UnknownEncodingException(charset); } throw new UnknownEncodingException(encoding); } return 0; }
From source file:net.sf.firemox.xml.XmlTools.java
/** * Return the corresponding code to the specified zone name. * /*from w w w . j a v a 2s.c o m*/ * @param zoneAlias * the alias of place * @return the corresponding code to the specified zone name. * @see IdZones#ZONE_NAMES */ public static int getZone(String zoneAlias) { final Integer obj = XmlTools.zones.get(zoneAlias); if (obj != null) { return obj.intValue(); } XmlConfiguration.error("Unknown zone : '" + zoneAlias + "'"); return 0; }
From source file:net.sf.firemox.xml.XmlTools.java
/** * Return the corresponding code to the specified ability name. * /* w ww .j a v a 2 s .c o m*/ * @param abilityAlias * the alias of place * @return the corresponding code to the specified ability name. * @see IdAbilities#ABILITIES_NAMES */ public static int getAbility(String abilityAlias) { final Integer obj = XmlTools.abilities.get(abilityAlias); if (obj != null) { return obj.intValue(); } XmlConfiguration.error("Unknown ability : '" + abilityAlias + "'"); return 0; }
From source file:com.aurel.track.exchange.excel.ExcelFieldMatchBL.java
/** * Returns the first row headers (field names) mapped to the column indexes * @return Map<ColumnNumber, ColumnHeader> *///from w w w .j av a 2 s . c o m static SortedMap<Integer, String> getFirstRowHeaders(Workbook hSSFWorkbook, Integer sheetID) { SortedMap<Integer, String> firstRowMap = new TreeMap<Integer, String>(); if (hSSFWorkbook == null || sheetID == null) { return firstRowMap; } //first search for duplicate columns Set<String> sameColumnNames = new HashSet<String>(); Set<String> columnNames = new HashSet<String>(); Sheet sheet = hSSFWorkbook.getSheetAt(sheetID.intValue()); Row firstRow = sheet.getRow(0); if (firstRow != null) { for (Cell cell : firstRow) { String columnHeader = ExcelImportBL.getStringCellValue(cell); if (columnHeader != null && !"".equals(columnHeader)) { if (columnNames.contains(columnHeader)) { sameColumnNames.add(columnHeader); } else { columnNames.add(columnHeader); } } } } sheet = hSSFWorkbook.getSheetAt(sheetID.intValue()); firstRow = sheet.getRow(0); if (firstRow != null) { for (Cell cell : firstRow) { String columnHeader = ExcelImportBL.getStringCellValue(cell); if (columnHeader != null && !"".equals(columnHeader)) { if (sameColumnNames.contains(columnHeader)) { //for duplicate columns add also the column index columnHeader += " (" + cell.getColumnIndex() + ")"; } firstRowMap.put(Integer.valueOf(cell.getColumnIndex()), columnHeader); } } } return firstRowMap; }