List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:com.if3games.chessonline.data.SaveGame.java
public int getStatsFromName(String statName) { Integer r = mStats.get(statName); return r == null ? 0 : r.intValue(); }
From source file:com.pedra.core.suggestion.dao.impl.DefaultSimpleSuggestionDao.java
@SuppressWarnings("deprecation") @Deprecated//from w w w .j a va 2 s . c o m @Override public List<ProductModel> findProductsRelatedToPurchasedProductsByCategory(final CategoryModel category, final UserModel user, final ProductReferenceTypeEnum referenceType, final boolean excludePurchased, final Integer limit) { Assert.notNull(category); Assert.notNull(user); final int maxResultCount = limit == null ? DEFAULT_LIMIT : limit.intValue(); final Map<String, Object> params = new HashMap<String, Object>(); final StringBuilder builder = new StringBuilder(REF_QUERY_START); if (excludePurchased) { builder.append(REF_QUERY_SUB); } if (referenceType != null) { builder.append(REF_QUERY_TYPE); params.put(REF_QUERY_PARAM_TYPE, referenceType); } builder.append(REF_QUERY_END); params.put(REF_QUERY_PARAM_USER, user); params.put(REF_QUERY_PARAM_CATEGORY, category); final FlexibleSearchQuery query = new FlexibleSearchQuery(builder.toString()); query.addQueryParameters(params); query.setNeedTotal(false); query.setCount(maxResultCount); final SearchResult<ProductModel> result = getFlexibleSearchService().search(query); return result.getResult(); }
From source file:demo.model.ResultSetBean.java
/** * Handles the ActionEvent generated as a result of clicking on a * link that points a particular page in the result-set. *///from w ww.ja va2s. c o m public void processScrollEvent(ActionEvent event) { int currentRow = 1; if (log.isTraceEnabled()) { log.trace("TRACE: ResultSetBean.processScrollEvent "); } FacesContext context = FacesContext.getCurrentInstance(); UIComponent component = event.getComponent(); Integer curRow = (Integer) component.getAttributes().get("currentRow"); if (curRow != null) { currentRow = curRow.intValue(); } // scroll to the appropriate page in the ResultSet. scroll(currentRow); }
From source file:TrackFocusDemo.java
public TrackFocusDemo() { super(new BorderLayout()); JPanel mugshots = new JPanel(new GridLayout(2, 3)); pic1 = new Picture(createImageIcon("images/" + mayaString + ".jpg", mayaString).getImage()); pic1.setName("1"); mugshots.add(pic1);/* ww w.j ava 2s . c o m*/ pic2 = new Picture(createImageIcon("images/" + anyaString + ".jpg", anyaString).getImage()); pic2.setName("2"); mugshots.add(pic2); pic3 = new Picture(createImageIcon("images/" + laineString + ".jpg", laineString).getImage()); pic3.setName("3"); mugshots.add(pic3); pic4 = new Picture(createImageIcon("images/" + cosmoString + ".jpg", cosmoString).getImage()); pic4.setName("4"); mugshots.add(pic4); pic5 = new Picture(createImageIcon("images/" + adeleString + ".jpg", adeleString).getImage()); pic5.setName("5"); mugshots.add(pic5); pic6 = new Picture(createImageIcon("images/" + alexiString + ".jpg", alexiString).getImage()); pic6.setName("6"); mugshots.add(pic6); info = new JLabel("Nothing selected"); setPreferredSize(new Dimension(450, 350)); add(mugshots, BorderLayout.CENTER); add(info, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); focusManager.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (("focusOwner".equals(prop)) && (e.getNewValue() != null) && ((e.getNewValue()) instanceof Picture)) { Component comp = (Component) e.getNewValue(); String name = comp.getName(); Integer num = new Integer(name); int index = num.intValue(); if (index < 0 || index > comments.length) { index = 0; } info.setText(comments[index]); } } }); }
From source file:com.myjeeva.spring.security.securechannel.AbstractCrossDomainRetryEntryPoint.java
/** * {@inheritDoc}//from w w w . j a va 2s . c o m */ public void commence(ServletRequest req, ServletResponse res) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; String pathInfo = request.getPathInfo(); String queryString = request.getQueryString(); String contextPath = request.getContextPath(); String destination = request.getServletPath() + ((pathInfo == null) ? "" : pathInfo) + ((queryString == null) ? "" : ("?" + queryString)); String redirectUrl = contextPath; Integer currentPort = new Integer(portResolver.getServerPort(request)); Integer redirectPort = getMappedPort(currentPort); if (redirectPort != null) { boolean includePort = redirectPort.intValue() != standardPort; redirectUrl = scheme + getMappedDomain(request.getServerName()) + ((includePort) ? (":" + redirectPort) : "") + contextPath + destination; } LOG.debug(" Cross Domain EntryPoint Redirecting to: " + redirectUrl); ((HttpServletResponse) res).sendRedirect(((HttpServletResponse) res).encodeRedirectURL(redirectUrl)); }
From source file:uk.org.rbc1b.roms.controller.report.ReportsController.java
private ReportResults extractResults(String sql) throws SQLException { Connection con = DataSourceUtils.getConnection(dataSource); Statement s = con.createStatement(); ResultSet rs = s.executeQuery(sql); ReportResults reportResults = new ReportResults(); ResultSetMetaData rsmd = rs.getMetaData(); int columnCount = rsmd.getColumnCount(); List<Integer> columnTypeIds = new ArrayList<Integer>(); for (int i = 0; i < columnCount; i++) { columnTypeIds.add(rsmd.getColumnType(i + 1)); }//from w ww. ja v a 2 s . c om reportResults.columnNames = new ArrayList<String>(); for (int i = 0; i < columnCount; i++) { reportResults.columnNames.add(rsmd.getColumnLabel(i + 1)); } reportResults.resultRows = new ArrayList<List<String>>(); while (rs.next()) { List<String> resultRow = new ArrayList<String>(); for (int i = 0; i < columnCount; i++) { Integer columnTypeId = columnTypeIds.get(i); if (columnTypeId.intValue() == Types.BOOLEAN || columnTypeId.intValue() == Types.BIT) { resultRow.add(Boolean.valueOf(rs.getBoolean(i + 1)).toString()); } else { resultRow.add(rs.getString(i + 1)); } } reportResults.resultRows.add(resultRow); } return reportResults; }
From source file:com.joliciel.jochre.lexicon.TextFileLexicon.java
@Override public int getFrequency(String word) { Integer freqObj = entries.get(word); if (freqObj != null) return freqObj.intValue(); else// w ww. j a v a2 s . c om return 0; }
From source file:org.semispace.semimeter.controller.CounterController.java
/** * *//*from www . jav a 2 s .c o m*/ @RequestMapping("/**/array.html") public String showArray(Model model, HttpServletRequest request, HttpServletResponse response, @RequestParam String resolution, @RequestParam Integer numberOfSamples) { if (numberOfSamples.intValue() < 1) { throw new RuntimeException("numberOfSamples must be larger than 0."); } if (!isSane(request.getServletPath())) { throw new RuntimeException("Disallowed character found in query."); } String path = trimPath("/array.html", request.getServletPath()); long endAt = semimeterService.getCurrentEndTime(); long startAt = semimeterService.calculateStartTimeFromResolution(resolution, endAt); JsonResults[] jrs = semimeterService.getArrayCounts(resolution, numberOfSamples, path, endAt, startAt); String str = jsonService.createJsonStringFromArray(jrs); model.addAttribute("numberOfItems", str); return "showcount"; }
From source file:com.adobe.acs.commons.util.impl.ReflectionUtilTest.java
@Test public void convertValueMapValue() { Integer myIntegerField = ReflectionUtil.convertValueMapValue(valueMap, "myIntegerField", Integer.class); assertEquals(22, myIntegerField.intValue()); Integer[] myIntegerArray = ReflectionUtil.convertValueMapValue(valueMap, "myIntegerArray", Integer[].class); assertEquals(2, myIntegerArray.length); assertEquals(33, myIntegerArray[1].intValue()); Double[] myDoubleArray = ReflectionUtil.convertValueMapValue(valueMap, "myDoubleArray", Double[].class); assertEquals(2, myDoubleArray.length); assertEquals(22.22, myDoubleArray[1], 0); }
From source file:com.microsoft.tfs.client.common.ui.wit.results.data.WorkItemInfoQueryResult.java
private int[] getUniqueWorkItemIDs(final WorkItemLinkInfo[] links) { // Build up a list of unique ID's final Set idSet = new HashSet(); for (int i = 0; i < links.length; i++) { final Integer sourceId = new Integer(links[i].getSourceID()); final Integer targetId = new Integer(links[i].getTargetID()); if (sourceId.intValue() != 0 && !idSet.contains(sourceId)) { idSet.add(sourceId);/*from ww w . j ava 2s .c o m*/ } if (targetId.intValue() != 0 && !idSet.contains(targetId)) { idSet.add(targetId); } } // Convert to int[] final int[] results = new int[idSet.size()]; int i = 0; for (final Iterator it = idSet.iterator(); it.hasNext();) { results[i++] = ((Integer) it.next()).intValue(); } return results; }