List of usage examples for java.lang Integer equals
public boolean equals(Object obj)
From source file:com.aurel.track.admin.customize.category.filter.parameters.FilterSelectsParametersUtil.java
/** * Whether a list has also the $Parameter entry selected * @param selectedValues/* w w w .jav a2 s .c om*/ * @return */ static boolean containsParameter(Integer[] selectedValues) { if (selectedValues != null && selectedValues.length > 0) { for (Integer selectedValue : selectedValues) { try { if (selectedValue != null && selectedValue.equals(MatcherContext.PARAMETER)) { return true; } } catch (Exception e) { } } } return false; }
From source file:es.emergya.comunications.MessageGenerator.java
/** * Devuelve el cuerpo del mensaje tetra. * /*from w ww.j a v a2 s . co m*/ * @param codigo * @param tipo * @param cuerpo * @return */ protected static String getDatagrama(Integer codigo, Integer tipo, String cuerpo) { String datagramaTetra = null; if (log.isTraceEnabled()) { log.trace("Tipos de mensaje sin tipo:"); for (Integer i : LogicConstants.MENSAJES_SIN_TIPO) { log.trace(">Tipo: " + i); } log.trace("Nosotros tenemos un tipo " + tipo); } for (Integer i : LogicConstants.MENSAJES_SIN_TIPO) { if (tipo.equals(i)) { log.info("mensaje sin codigo ni tipo"); datagramaTetra = cuerpo; } } if (datagramaTetra == null) { log.error("mensaje con codigo y tipo " + tipo); datagramaTetra = codigo + LogicConstants.FIELD_SEPARATOR + cuerpo + LogicConstants.FIELD_SEPARATOR; } return datagramaTetra; }
From source file:de.micromata.genome.util.types.DateUtils.java
/** * Prfen, ob das gegebene Datum innerhalb der gegebenen Tage liegt. * * @param date Nie <code>null</code>. * @param dayIndices Konstanten der Form <code>Calendar.SUNDAY</code>. * @return <code>true</code>, falls das Datum in den Tagen enthalten ist. *///from w ww. ja v a 2 s . com public static boolean isWithinDays(Date date, Integer... dayIndices) { Validate.notNull(date, "date not set"); final Calendar cal = Calendar.getInstance(); cal.setTime(date); final Integer dayOfWeek = cal.get(GregorianCalendar.DAY_OF_WEEK); boolean result = false; for (Integer dayIndex : dayIndices) { if (dayOfWeek.equals(dayIndex) == true) { result = true; break; } } // for return result; }
From source file:Main.java
/** * <p>Converts an Integer to a Boolean specifying the conversion values.</p> * /*from w w w. j av a2s. co m*/ * <pre> * BooleanUtils.toBooleanObject(new Integer(0), new Integer(0), new Integer(2), new Integer(3)) = Boolean.TRUE * BooleanUtils.toBooleanObject(new Integer(2), new Integer(1), new Integer(2), new Integer(3)) = Boolean.FALSE * BooleanUtils.toBooleanObject(new Integer(3), new Integer(1), new Integer(2), new Integer(3)) = null * </pre> * * @param value the Integer to convert * @param trueValue the value to match for <code>true</code>, * may be <code>null</code> * @param falseValue the value to match for <code>false</code>, * may be <code>null</code> * @param nullValue the value to to match for <code>null</code>, * may be <code>null</code> * @return Boolean.TRUE, Boolean.FALSE, or <code>null</code> * @throws IllegalArgumentException if no match */ public static Boolean toBooleanObject(Integer value, Integer trueValue, Integer falseValue, Integer nullValue) { if (value == null) { if (trueValue == null) { return Boolean.TRUE; } else if (falseValue == null) { return Boolean.FALSE; } else if (nullValue == null) { return null; } } else if (value.equals(trueValue)) { return Boolean.TRUE; } else if (value.equals(falseValue)) { return Boolean.FALSE; } else if (value.equals(nullValue)) { return null; } // no match throw new IllegalArgumentException("The Integer did not match any specified value"); }
From source file:com.aurel.track.fieldType.runtime.system.select.SystemSelectBaseRT.java
/** * Verify that the each value is part of the datasource * @param actualValue//from w w w. j a v a 2s .co m * @param possibleValues * @return */ private static Integer getValidValues(Integer actualValue, List<IBeanID> possibleValues) { if (actualValue != null) { for (IBeanID labelBean : possibleValues) { if (actualValue.equals(labelBean.getObjectID())) { return actualValue; } } } return Integer.valueOf(possibleValues.get(0).getObjectID()); }
From source file:com.aurel.track.item.consInf.ConsInfBL.java
/** * Whether the current user is selected for delete * @param selectedPersons//from w w w .j a v a 2s . c om * @param person * @return */ public static boolean foundMeAsSelected(Integer[] selectedPersons, Integer person) { if (selectedPersons == null || person == null) { return false; } else { for (int i = 0; i < selectedPersons.length; i++) { if (person.equals(selectedPersons[i])) { return true; } } } return false; }
From source file:Main.java
/** * <p>Converts an Integer to a Boolean specifying the conversion values.</p> * * <p>NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean. </p> * * <pre>//w w w. ja v a 2 s. co m * BooleanUtils.toBooleanObject(Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(2), Integer.valueOf(3)) = Boolean.TRUE * BooleanUtils.toBooleanObject(Integer.valueOf(2), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3)) = Boolean.FALSE * BooleanUtils.toBooleanObject(Integer.valueOf(3), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3)) = null * </pre> * * @param value the Integer to convert * @param trueValue the value to match for {@code true}, may be {@code null} * @param falseValue the value to match for {@code false}, may be {@code null} * @param nullValue the value to to match for {@code null}, may be {@code null} * @return Boolean.TRUE, Boolean.FALSE, or {@code null} * @throws IllegalArgumentException if no match */ public static Boolean toBooleanObject(Integer value, Integer trueValue, Integer falseValue, Integer nullValue) { if (value == null) { if (trueValue == null) { return Boolean.TRUE; } if (falseValue == null) { return Boolean.FALSE; } if (nullValue == null) { return null; } } else if (value.equals(trueValue)) { return Boolean.TRUE; } else if (value.equals(falseValue)) { return Boolean.FALSE; } else if (value.equals(nullValue)) { return null; } // no match throw new IllegalArgumentException("The Integer did not match any specified value"); }
From source file:com.aurel.track.admin.customize.category.filter.parameters.FilterSelectsParametersUtil.java
/** * Replace the parameter value(s) with actual values in the original selections * @param originalValues//from www .jav a 2 s . c om * @param parameterValues * @return */ static Integer[] replaceParameter(Integer[] originalValues, Integer[] parameterValues) { if (containsParameter(originalValues)) { List<Integer> selectedValues = new ArrayList<Integer>(); if (originalValues != null && originalValues.length > 0) { for (int i = 0; i < originalValues.length; i++) { Integer selectedValue = originalValues[i]; if (selectedValue != null) { try { if (selectedValue.equals(MatcherContext.PARAMETER)) { //if "clear" do not add anything instead of parameter, only get rid of parameter if (parameterValues != null) { for (int j = 0; j < parameterValues.length; j++) { if (parameterValues[j] != null) { selectedValues.add(parameterValues[j]); } } } } else { selectedValues.add(selectedValue); } } catch (Exception e) { } } } } return GeneralUtils.createIntegerArrFromCollection(selectedValues); } else { return originalValues; } }
From source file:Main.java
/** * <p>Converts an Integer to a boolean specifying the conversion values.</p> * * <pre>/*from www. j a v a2 s .c o m*/ * BooleanUtils.toBoolean(Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(0)) = false * BooleanUtils.toBoolean(Integer.valueOf(1), Integer.valueOf(1), Integer.valueOf(0)) = true * BooleanUtils.toBoolean(Integer.valueOf(2), Integer.valueOf(1), Integer.valueOf(2)) = false * BooleanUtils.toBoolean(Integer.valueOf(2), Integer.valueOf(2), Integer.valueOf(0)) = true * BooleanUtils.toBoolean(null, null, Integer.valueOf(0)) = true * </pre> * * @param value the Integer to convert * @param trueValue the value to match for {@code true}, may be {@code null} * @param falseValue the value to match for {@code false}, may be {@code null} * @return {@code true} or {@code false} * @throws IllegalArgumentException if no match */ public static boolean toBoolean(Integer value, Integer trueValue, Integer falseValue) { if (value == null) { if (trueValue == null) { return true; } if (falseValue == null) { return false; } } else if (value.equals(trueValue)) { return true; } else if (value.equals(falseValue)) { return false; } // no match throw new IllegalArgumentException("The Integer did not match either specified value"); }
From source file:Main.java
/** * <p>Converts an Integer to a boolean specifying the conversion values.</p> * * <pre>//ww w.jav a2 s . c o m * BooleanUtils.toBoolean(Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(0)) = false * BooleanUtils.toBoolean(Integer.valueOf(1), Integer.valueOf(1), Integer.valueOf(0)) = true * BooleanUtils.toBoolean(Integer.valueOf(2), Integer.valueOf(1), Integer.valueOf(2)) = false * BooleanUtils.toBoolean(Integer.valueOf(2), Integer.valueOf(2), Integer.valueOf(0)) = true * BooleanUtils.toBoolean(null, null, Integer.valueOf(0)) = true * </pre> * * @param value the Integer to convert * @param trueValue the value to match for {@code true}, may be {@code null} * @param falseValue the value to match for {@code false}, may be {@code null} * @return {@code true} or {@code false} * @throws IllegalArgumentException if no match */ public static boolean toBoolean(final Integer value, final Integer trueValue, final Integer falseValue) { if (value == null) { if (trueValue == null) { return true; } if (falseValue == null) { return false; } } else if (value.equals(trueValue)) { return true; } else if (value.equals(falseValue)) { return false; } // no match throw new IllegalArgumentException("The Integer did not match either specified value"); }