Example usage for java.lang Integer intValue

List of usage examples for java.lang Integer intValue

Introduction

In this page you can find the example usage for java.lang Integer intValue.

Prototype

@HotSpotIntrinsicCandidate
public int intValue() 

Source Link

Document

Returns the value of this Integer as an int .

Usage

From source file:org.kew.rmf.matchconf.web.DictionaryController.java

@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "page", required = false) Integer page,
        @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
    if (page != null || size != null) {
        int sizeNo = size == null ? 10 : size.intValue();
        final int firstResult = page == null ? 0 : (page.intValue() - 1) * sizeNo;
        uiModel.addAttribute("dictionaries", Dictionary.findDictionaryEntries(firstResult, sizeNo));
        float nrOfPages = (float) Dictionary.countDictionarys() / sizeNo;
        uiModel.addAttribute("maxPages",
                (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
    } else {/*from w ww. j a  va  2  s  .co  m*/
        uiModel.addAttribute("dictionaries", Dictionary.findAllDictionarys());
    }
    return "dictionaries/list";
}

From source file:UsingContexts.java

public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();

    HttpSession session = request.getSession(true);

    Integer counter2 = (Integer) getServletContext().getAttribute("counter2");

    if (counter2 == null) {
        counter2 = new Integer(1);
    } else {/*from w w  w.ja  v  a2  s . c o m*/
        counter2 = new Integer(counter2.intValue() + 1);
    }

    getServletContext().setAttribute("counter2", counter2);

    Integer counter = (Integer) session.getAttribute("counter");

    if (counter == null) {
        counter = new Integer(1);
    } else {
        counter = new Integer(counter.intValue() + 1);
    }

    session.setAttribute("counter", counter);

    out.println("<HTML>");
    out.println("<HEAD>");
    out.println("<TITLE>");
    out.println("Using Contexts");
    out.println("</TITLE>");
    out.println("</HEAD>");
    out.println("<BODY>");
    out.println("<H1>Using Contexts</H1>");

    out.println("Welcome! You have been here " + counter + " times.<BR>");

    out.println("Total page accesses: " + counter2 + "<BR>");

    if (session.isNew()) {
        out.println("This is a new session.<BR>");
    } else {
        out.println("This is not a new session.<BR>");
    }

    out.println("The session ID: " + session.getId() + "<BR>");
    out.println("Last time accessed: " + new Date(session.getLastAccessedTime()) + "<BR>");
    out.println("Creation time: " + new Date(session.getCreationTime()) + "<BR>");
    out.println("Timeout length: " + session.getMaxInactiveInterval() + " seconds<BR>");

    out.println("</BODY>");
    out.println("</HTML>");
}

From source file:com.microsoft.tfs.client.common.ui.wit.form.DebuggingContext.java

public void debug(final Composite composite, final WIFormElement formElement) {
    if (!DEBUG_ENABLED) {
        return;//from ww  w. j  av  a 2  s  .  c  o m
    }

    final Integer parentIx = (Integer) composite.getParent().getData(KEY);
    int ix = 0;
    if (parentIx != null) {
        ix = parentIx.intValue() + 1;
    }

    if (ix >= BG_COLORS.length) {
        ix = 0;
    }

    composite.setBackground(display.getSystemColor(BG_COLORS[ix]));
    composite.setData(KEY, new Integer(ix));

    final StringBuffer sb = new StringBuffer();
    sb.append(getShortName(formElement));
    sb.append(" - "); //$NON-NLS-1$
    sb.append(BG_COLOR_NAMES[ix]);
    if (formElement instanceof WIFormGroup) {
        final WIFormGroup groupDescription = (WIFormGroup) formElement;
        if (groupDescription.getLabel() != null) {
            sb.append(" (" + groupDescription.getLabel() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
        }
    } else if (formElement instanceof WIFormControl) {
        final WIFormControl controlDescription = (WIFormControl) formElement;
        sb.append(" (" + controlDescription.getLabel() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
    } else if (formElement instanceof WIFormTab) {
        final WIFormTab tabDescription = (WIFormTab) formElement;
        sb.append(" (" + tabDescription.getLabel() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    log.trace(sb.toString());
}

From source file:com.serotonin.m2m2.CoreLicenseDefinition.java

public final void addLicenseWarnings(List<TranslatableMessage> warnings) {
    Integer majorVersion = Common.license() == null ? null : Integer.valueOf(Common.license().getVersion());

    if ((majorVersion != null) && (majorVersion.intValue() < Common.getMajorVersion())) {
        warnings.add(new TranslatableMessage("modules.core.old",
                new Object[] { Integer.valueOf(Common.getMajorVersion()), majorVersion }));
    }//w ww.  j  a v a 2 s. c  o m

    if ((this.shutdownTask == null) && (this.freeMode))
        warnings.add(new TranslatableMessage("modules.freeMode"));
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.teachersBody.ShowTeachersBodyDispatchAction.java

private String makeBodyHeader(String executionYear, Integer semester, Integer teacherType) {

    String sem = semester.intValue() == 0 ? "Ambos Semestres" : (semester.intValue() + "&ordm; Semestre");
    String teacher = teacherType.intValue() == 0 ? "Todos os Docentes" : "Apenas Respons&aacute;veis";
    String header = "Ano Lectivo " + executionYear + " - " + sem + " - " + teacher;

    return header;

}

From source file:com.aurel.track.fieldType.runtime.matchers.converter.DoubleMatcherConverter.java

/**
 * Convert the xml string to object value after load
 * @param value/* w ww .j av a2s.c  om*/
 * @param matcherRelation
 * @return
 */
@Override
public Object fromXMLString(String value, Integer matcherRelation) {
    if (value == null || "".equals(value) || matcherRelation == null) {
        return null;
    }
    switch (matcherRelation.intValue()) {
    case MatchRelations.EQUAL:
    case MatchRelations.NOT_EQUAL:
    case MatchRelations.GREATHER_THAN:
    case MatchRelations.GREATHER_THAN_EQUAL:
    case MatchRelations.LESS_THAN:
    case MatchRelations.LESS_THAN_EQUAL:
        try {
            return new Double(value);
        } catch (Exception e) {
            LOGGER.warn("Converting the " + value + " to Double from xml string failed with " + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
        }
    }
    return null;
}

From source file:edu.utah.further.mdr.data.common.domain.asset.LookupValueEntity.java

/**
 * @param other// ww  w  .j  a  v  a2 s .com
 * @return
 * @see edu.utah.further.mdr.api.domain.asset.Resource#copyFrom(edu.utah.further.mdr.api.domain.asset.Resource)
 */
@Override
public LookupValue copyFrom(final BasicLookupValue other) {
    if (other == null) {
        return this;
    }

    // Identifier is not copied

    // Deep-copy fields
    this.label = other.getLabel();
    final Integer otherOrder = other.getOrder();
    if (otherOrder != null) {
        this.order = new Integer(otherOrder.intValue());
    }

    // Deep-copy collection references but soft-copy their elements

    return this;
}

From source file:no.uis.service.ws.studinfosolr.impl.StudinfoSolrServiceImpl.java

private XMLGregorianCalendar createXmlCalendar(Integer year, Integer month, Integer day) {

    int y = year != null ? year.intValue() : DatatypeConstants.FIELD_UNDEFINED;
    int m = month != null ? month.intValue() : DatatypeConstants.FIELD_UNDEFINED;
    int d = day != null ? day.intValue() : DatatypeConstants.FIELD_UNDEFINED;

    return getDatatypeFactory().newXMLGregorianCalendarDate(y, m, d, DatatypeConstants.FIELD_UNDEFINED);
}

From source file:net.nosleep.superanalyzer.analysis.views.PlayCountView.java

private void refreshDataset() {

    Stat itemStats = null;/*w w w  . j  av a2  s.  co  m*/

    if (_comboBox == null) {
        itemStats = _analysis.getStats(Analysis.KIND_TRACK, null);
    } else {
        ComboItem item = (ComboItem) _comboBox.getSelectedItem();
        itemStats = _analysis.getStats(item.getKind(), item.getValue());
    }

    Vector playCountList = new Vector();

    Hashtable playCounts = itemStats.getPlayCounts();
    Enumeration e = playCounts.keys();
    while (e.hasMoreElements()) {
        Integer playCount = (Integer) e.nextElement();
        Integer count = (Integer) playCounts.get(playCount);
        if (count.intValue() > 0)
            playCountList.addElement(new PlayCountItem(playCount.intValue(), count.intValue()));
    }
    Collections.sort(playCountList, new PlayCountComparator());

    XYSeries series = new XYSeries(Misc.getString("PLAY_COUNT"));

    for (int i = 0; i < playCountList.size(); i++) {
        PlayCountItem item = (PlayCountItem) playCountList.elementAt(i);
        series.add(item.PlayCount, item.Count);
    }

    collection.removeAllSeries();

    collection.addSeries(series);

}

From source file:com.ondeck.datapipes.http.HttpConnectorResponseHandlerUnitTest.java

@Test
public void testHandleResponseWithoutEntity() throws IOException {
    when(httpResponse.getStatusLine()).thenReturn(statusLine);
    Integer expectedCode = 200;
    when(statusLine.getStatusCode()).thenReturn(expectedCode);
    HttpConnectorResponse result = underTest.handleResponse(httpResponse);
    assertNotNull(result);//from ww  w.  j  a v a  2s .  c o  m
    assertEquals(expectedCode.intValue(), result.getHttpStatusCode());
    assertNull(result.getContent());
}