List of usage examples for java.lang Integer compareTo
public int compareTo(Integer anotherInteger)
From source file:org.finra.herd.tools.common.databridge.DataBridgeController.java
/** * Adjusts an Integer value according to the specified range of values. * * @param origValue the original value to be adjusted * @param minValue the minimum value of the range * @param maxValue the maximum value of the range * * @return the value adjusted per the specified range of values *//*from ww w . j a va 2 s .c om*/ protected Integer adjustIntegerValue(Integer origValue, Integer minValue, Integer maxValue) { Integer resultValue = origValue; if (resultValue.compareTo(minValue) < 0) { resultValue = minValue; } if (resultValue.compareTo(maxValue) > 0) { resultValue = maxValue; } return resultValue; }
From source file:gemlite.core.internal.index.compare.ComparatorImpl.java
private int compareInt(Integer o1, Integer o2) { return o1.compareTo(o2); }
From source file:org.orcid.frontend.web.forms.validate.FirstIntegerNotHigherThanSecondIntegerValidator.java
@Override public boolean isValid(final Object value, final ConstraintValidatorContext context) { try {/*from w w w . j a va 2s . c o m*/ String firstNumberField = BeanUtils.getProperty(value, firstFieldName); String secondNumberField = BeanUtils.getProperty(value, secondFieldName); if (!StringUtils.isNumeric(firstNumberField) || !StringUtils.isNumeric(secondNumberField)) { return true; } Integer firstNumValue = Integer.valueOf(firstNumberField); Integer secondNumValue = Integer.valueOf(secondNumberField); return secondNumValue.compareTo(firstNumValue) >= 0; } catch (final Exception ignore) { ignore.printStackTrace(); } return false; }
From source file:edu.nyu.vida.data_polygamy.scalar_function.Mode.java
@Override public int compareTo(Aggregation arg0) { Mode agg = (Mode) arg0;//from ww w . j a v a 2s.c o m Integer countObj = new Integer(count); return countObj.compareTo(agg.getCount()); }
From source file:edu.nyu.vida.data_polygamy.scalar_function.Median.java
@Override public int compareTo(Aggregation arg0) { Median agg = (Median) arg0;/*from w w w. j ava 2 s .co m*/ Integer countObj = new Integer(count); return countObj.compareTo(agg.getCount()); }
From source file:org.pdfgal.pdfgalweb.validators.SplitValidator.java
/** * Validates if argument is an {@link Integer} greater than 0. * //from w w w . jav a 2 s. c om * @param pages * @return */ private boolean validateNumberOfPages(final String pages) { boolean result = true; try { final Integer pagesValue = Integer.valueOf(pages); if (pagesValue.compareTo(new Integer(1)) < 0) { result = false; } } catch (final NumberFormatException e) { result = false; } return result; }
From source file:ComparatorExampleForUserDefinedClass.java
public int compare(Object o1, Object o2) { if (o1 instanceof String && o2 instanceof String) { String s1 = (String) o1; String s2 = (String) o2; Integer i1 = new Integer(s1.substring(s1.indexOf("-"), s1.length())); Integer i2 = new Integer(s2.substring(s2.indexOf("-"), s2.length())); return i1.compareTo(i2); }//from w w w.j a va2 s . com return 0; }
From source file:com.raven.loginn.service.AccountService.java
public Account findAccountById(Integer accountId) throws Exception { if (accountId == null || accountId.compareTo(0) <= 0) { throw new WarningMessageException("Account id hatal"); }//w w w . jav a2 s. c om return accountDao.find(accountId); }
From source file:org.kuali.coeus.common.committee.impl.rules.CommitteeScheduleDayRule.java
private boolean validateDay(Integer day, String key) { boolean rulePassed = true; if ((day != null) && (day.compareTo(31) > 0)) { rulePassed = false;/*from www. ja v a 2 s . c o m*/ reportError(key, KeyConstants.ERROR_COMMITTEESCHEDULE_DAY, "31"); } return rulePassed; }
From source file:com.adobe.acs.commons.workflow.bulk.removal.impl.WorkflowInstanceFolderComparator.java
private int compare(final String intString1, final String intString2) { Integer integer1 = Integer.valueOf(intString1); Integer integer2 = Integer.valueOf(intString2); return integer1.compareTo(integer2); }