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.pentaho.chart.plugin.api.ChartItemLabelGenerator.java

private int lookupPosition(final String columnName) {
    final Integer integer = columnPositions.get(columnName.toLowerCase());
    if (integer == null) {
        return -1;
    }/*from  w  ww. ja  v a 2  s .c o m*/
    return integer.intValue();
}

From source file:com.exxonmobile.ace.hybris.core.suggestion.dao.impl.DefaultSimpleSuggestionDao.java

@Override
public List<ProductModel> findProductsRelatedToPurchasedProductsByCategory(final CategoryModel category,
        final UserModel user, final List<ProductReferenceTypeEnum> referenceTypes,
        final boolean excludePurchased, final Integer limit) {
    Assert.notNull(category);//from  www  . ja va  2 s .  co m
    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 (CollectionUtils.isNotEmpty(referenceTypes)) {
        builder.append(REF_QUERY_TYPES);
        params.put(REF_QUERY_PARAM_TYPES, referenceTypes);
    }
    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:com.evolveum.midpoint.model.common.expression.evaluator.GenerateExpressionEvaluator.java

private boolean isNotEmptyMinLength(StringPolicyType policy) {
    Integer minLength = policy.getLimitations().getMinLength();
    if (minLength != null) {
        if (minLength.intValue() == 0) {
            return false;
        }//from   w w  w  .  j  a  v  a 2s  .c o  m
        return true;
    }
    return false;
}

From source file:com.pedra.core.suggestion.dao.impl.DefaultSimpleSuggestionDao.java

@Override
public List<ProductModel> findProductsRelatedToPurchasedProductsByCategory(final CategoryModel category,
        final List<ProductReferenceTypeEnum> referenceTypes, final UserModel user,
        final boolean excludePurchased, final Integer limit) {
    Assert.notNull(category);/*from w w w.jav  a2  s . co  m*/
    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 (CollectionUtils.isNotEmpty(referenceTypes)) {
        builder.append(REF_QUERY_TYPES);
        params.put(REF_QUERY_PARAM_TYPES, referenceTypes);
    }
    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:org.hyperic.hq.plugin.apache.ApacheStatusCollector.java

private void parseScoreboard(String val) {
    int len = val.length();
    int[] states = new int[STATES.length];
    for (int i = 0; i < states.length; i++) {
        states[i] = 0;/*from   w  w  w  .  java 2s .c  o  m*/
    }

    for (int i = 0; i < len; i++) {
        String key = val.substring(i, i + 1);
        Integer ix = (Integer) STATE_MAP.get(key);
        if (ix == null) {
            continue;
        }
        states[ix.intValue()]++;
    }

    for (int i = 0; i < states.length; i++) {
        String name = STATES[i][1];
        setValue(name, states[i]);
    }
}

From source file:com.aurel.track.fieldType.fieldChange.apply.IntegerFieldChangeApply.java

/**
 * Sets the workItemBean's attribute//  w  w w.j a  v  a2s. c o  m
 * @param workItemContext
 * @param workItemBean
 * @param fieldID
 * @param parameterCode
 * @param value   
 * @return ErrorData if an error is found
 */
@Override
public List<ErrorData> setWorkItemAttribute(WorkItemContext workItemContext, TWorkItemBean workItemBean,
        Integer parameterCode, Object value) {
    if (getSetter() == FieldChangeSetters.SET_NULL || getSetter() == FieldChangeSetters.SET_REQUIRED) {
        return super.setWorkItemAttribute(workItemContext, workItemBean, parameterCode, value);
    }
    Integer intValue = null;
    try {
        intValue = (Integer) value;
    } catch (Exception e) {
        LOGGER.warn("Getting the integer value for " + value + " failed with " + e.getMessage());
        LOGGER.debug(ExceptionUtils.getStackTrace(e));
    }
    switch (getSetter()) {
    case FieldChangeSetters.SET_TO:
        workItemBean.setAttribute(activityType, parameterCode, intValue);
        break;
    case FieldChangeSetters.ADD_IF_SET:
        if (intValue != null) {
            Integer originalValue = (Integer) workItemBean.getAttribute(activityType, parameterCode);
            if (originalValue != null) {
                int newValue = originalValue.intValue() + intValue.intValue();
                workItemBean.setAttribute(activityType, parameterCode, Integer.valueOf(newValue));
            }
        }
        break;
    case FieldChangeSetters.ADD_OR_SET:
        if (intValue != null) {
            Integer originalValue = (Integer) workItemBean.getAttribute(activityType, parameterCode);
            if (originalValue != null) {
                int newValue = originalValue.intValue() + intValue.intValue();
                workItemBean.setAttribute(activityType, parameterCode, Integer.valueOf(newValue));
            } else {
                workItemBean.setAttribute(activityType, parameterCode, intValue);
            }
        }
        break;
    }
    return null;
}

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

/**
 * Convert the xml string to object value after load
 * @param value/*w ww.j a  v  a  2  s  .c o m*/
 * @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 Integer.valueOf(value);
        } catch (Exception e) {
            LOGGER.warn("Converting the " + value + " to Integer failed with " + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
        }
    }
    return null;
}

From source file:com.itemanalysis.psychometrics.scaling.PercentileRank.java

public long getCount(Integer score) {
    return freqTable.getCount(score.intValue());
}

From source file:com.joliciel.talismane.posTagger.PosTagEvaluationLexicalCoverageTester.java

@Override
public void onNextPosTagSequence(PosTagSequence realSequence, List<PosTagSequence> guessedSequences) {
    PosTagSequence guessedSequence = guessedSequences.get(0);

    for (int i = 0; i < realSequence.size(); i++) {
        TaggedToken<PosTag> realToken = realSequence.get(i);
        TaggedToken<PosTag> testToken = guessedSequence.get(i);

        boolean tokenUnknown = realToken.getToken().getPossiblePosTags() != null
                && realToken.getToken().getPossiblePosTags().size() == 0;
        if (tokenUnknown) {
            fscoreUnknownInLexicon.increment(realToken.getTag().getCode(), testToken.getTag().getCode());
            unknownWordCount++;/*from  ww w. j  av  a 2s  . c om*/
            Integer countObj = unknownWords.get(realToken.getTag() + "|" + realToken.getToken().getText());
            int count = countObj == null ? 0 : countObj.intValue();
            unknownWords.put(realToken.getTag() + "|" + realToken.getToken().getText(), count + 1);
        } else {
            knownWordCount++;
            knownWords.add(realToken.getToken().getText());
        }

        if (realToken.getTag().getOpenClassIndicator() == PosTagOpenClassIndicator.CLOSED
                && !realToken.getToken().getPossiblePosTags().contains(realToken.getTag())) {
            closedCategoryMismatches.add(realToken.getTag() + "|" + realToken.getToken().getText());
        }
    }
}

From source file:com.exxonmobile.ace.hybris.core.suggestion.dao.impl.DefaultSimpleSuggestionDao.java

@SuppressWarnings("deprecation")
@Override/*from  www.j  a  v a2s . c o m*/
@Deprecated
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();
}