List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:msi.gaml.operators.Maths.java
@operator(value = "even", can_be_const = true, category = { IOperatorCategory.ARITHMETIC }) @doc(value = "Returns true if the operand is even and false if it is odd.", usages = { @usage(value = "if the operand is equal to 0, it returns true."), @usage(value = "if the operand is a float, it is truncated before") }, examples = { @example(value = "even (3)", equals = "false"), @example(value = "even(-12)", equals = "true") }) public static Boolean even(final Integer rv) { return rv.intValue() % 2 == 0; }
From source file:com.aurel.track.itemNavigator.ItemNavigatorFilterBL.java
private static List<MenuItem> getQueryNodes(Integer nodeObjectID, Integer personID, Locale locale) { List<MenuItem> result = null; if (nodeObjectID != null) { switch (nodeObjectID.intValue()) { case CategoryBL.REPOSITORY_TYPE.PRIVATE: { result = getRootNodes(CategoryBL.REPOSITORY_TYPE.PRIVATE, null, personID, locale); break; }//from w ww.j ava 2 s .c o m case CategoryBL.REPOSITORY_TYPE.PUBLIC: { result = getRootNodes(CategoryBL.REPOSITORY_TYPE.PUBLIC, null, personID, locale); break; } case CategoryBL.REPOSITORY_TYPE.PROJECT: { result = getQueryProjectNodes(personID); break; } } } return result; }
From source file:net.sf.jasperreports.functions.standard.TextFunctions.java
/** * Returns a single text character, given a character code. *///from www . j av a 2s . c o m @Function("CHAR") @FunctionParameters({ @FunctionParameter("number") }) public static String CHAR(Integer number) { if (number == null || (number < 1 || number > 255)) { if (log.isDebugEnabled()) { log.debug("The number must be an integer number between 1 and 255."); } return null; } return Character.toString((char) number.intValue()); }
From source file:com.aurel.track.admin.customize.category.CategoryBL.java
/** * The main repository nodes and projects are read only independently of any rights * @param categoryBaseFacade/*from w ww . ja v a2 s .c om*/ * @param node * @param add * @return */ public static boolean isReadOnly(String node, boolean add) { if (add) { return false; } CategoryTokens categoryTokens = CategoryTokens.decodeNode(node); Integer type = categoryTokens.getType(); if (type == null || type.intValue() == TYPE.PROJECT) { return true; } return false; }
From source file:com.aurel.track.admin.customize.localize.LocalizeBL.java
/** * //from ww w .j a va 2 s . c o m * @param inputStream * @param locale * @param overwrite - overwrite values modified from the user interface. This makes only sense * during development * @param importTarget - RESOURCE_CATEGORIES.DB_ENTITY or RESOURCE_CATEGORIES.UI_TEXT * @param initBoxResources do not overwrite box resources (status, item type by upgrade) */ public static void saveResources(InputStream inputStream, String locale, boolean overwrite, Integer importTarget, boolean initBoxResources) { OrderedProperties properties = new OrderedProperties(); try { properties.load(inputStream); boolean withPrimaryKey = false; if (importTarget != null && importTarget.intValue() == LocalizeBL.RESOURCE_CATEGORIES.DB_ENTITY) { withPrimaryKey = true; } LocalizeBL.uploadResources(properties, locale, overwrite, withPrimaryKey, initBoxResources); } catch (IOException e) { LOGGER.warn("Loading the resource properties from classpath failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } finally { //flush and close the streams if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } } }
From source file:net.java.sip.communicator.impl.certificate.CertificateServiceImpl.java
/** * Gets the SAN (Subject Alternative Name) of the specified type. * * @param cert the certificate to extract from * @param altNameType The type to be returned * @return SAN of the type/*from w w w .j ava2s.c om*/ * * <PRE> * GeneralName ::= CHOICE { * otherName [0] OtherName, * rfc822Name [1] IA5String, * dNSName [2] IA5String, * x400Address [3] ORAddress, * directoryName [4] Name, * ediPartyName [5] EDIPartyName, * uniformResourceIdentifier [6] IA5String, * iPAddress [7] OCTET STRING, * registeredID [8] OBJECT IDENTIFIER * } * <PRE> */ private static Iterable<String> getSubjectAltNames(X509Certificate cert, int altNameType) { Collection<List<?>> altNames = null; try { altNames = cert.getSubjectAlternativeNames(); } catch (CertificateParsingException e) { return Collections.emptyList(); } List<String> matchedAltNames = new LinkedList<String>(); for (List<?> item : altNames) { if (item.contains(altNameType)) { Integer type = (Integer) item.get(0); if (type.intValue() == altNameType) matchedAltNames.add((String) item.get(1)); } } return matchedAltNames; }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.publico.teachersBody.ReadProfessorshipsAndResponsibilitiesByExecutionDegreeAndExecutionPeriod.java
protected static List getDetailedProfessorships(List professorships, final List responsibleFors, final Integer teacherType) { List detailedProfessorshipList = (List) CollectionUtils.collect(professorships, new Transformer() { @Override//from w ww . j a v a2 s . c om public Object transform(Object input) { Professorship professorship = (Professorship) input; InfoProfessorship infoProfessorShip = InfoProfessorship.newInfoFromDomain(professorship); List executionCourseCurricularCoursesList = getInfoCurricularCourses( professorship.getExecutionCourse()); DetailedProfessorship detailedProfessorship = new DetailedProfessorship(); Boolean isResponsible = Boolean.valueOf(professorship.getResponsibleFor()); if ((teacherType.intValue() == 1) && (!isResponsible.booleanValue())) { return null; } detailedProfessorship.setResponsibleFor(isResponsible); detailedProfessorship.setInfoProfessorship(infoProfessorShip); detailedProfessorship.setExecutionCourseCurricularCoursesList(executionCourseCurricularCoursesList); return detailedProfessorship; } private List getInfoCurricularCourses(ExecutionCourse executionCourse) { List infoCurricularCourses = (List) CollectionUtils .collect(executionCourse.getAssociatedCurricularCoursesSet(), new Transformer() { @Override public Object transform(Object input) { CurricularCourse curricularCourse = (CurricularCourse) input; InfoCurricularCourse infoCurricularCourse = InfoCurricularCourse .newInfoFromDomain(curricularCourse); return infoCurricularCourse; } }); return infoCurricularCourses; } }); return detailedProfessorshipList; }
From source file:msi.gaml.operators.Maths.java
public static Double opTruncate(final Double x, final Integer precision) { double x1 = x.doubleValue(); int precision1 = precision.intValue(); double fract; double whole; double mult;//from w ww. j av a 2 s.c om if (x1 > 0) { whole = floor(x1); mult = pow(10.0, precision1); fract = floor((x1 - whole) * mult) / mult; } else { whole = ceil(x1); mult = pow(10, precision1); fract = ceil((x1 - whole) * mult) / mult; } return whole + fract; }
From source file:com.aurel.track.util.GeneralUtils.java
/** * Prepares a list of chunks to avoid the IN statement * limitations in some databases (for ex. Oracle) * @param objectIDs//from www . j ava 2 s . co m * @return */ public static List<int[]> getListOfChunks(Integer[] arrIntegers) { if (arrIntegers == null || arrIntegers.length == 0) { return new LinkedList<int[]>(); } int[] arrInts = new int[arrIntegers.length]; for (int i = 0; i < arrIntegers.length; i++) { Integer intValue = arrIntegers[i]; if (intValue != null) { arrInts[i] = intValue.intValue(); } } return getListOfChunks(arrInts); }
From source file:com.aurel.track.util.GeneralUtils.java
/** * Prepares a list of chunks to avoid the IN statement * limitations in some databases (for ex. Oracle) * @param objectIDs/* ww w . java2 s . c o m*/ * @return */ public static List<int[]> getListOfChunks(List<Integer> objectIDList) { if (objectIDList == null || objectIDList.isEmpty()) { return new LinkedList<int[]>(); } int[] arrInts = new int[objectIDList.size()]; for (int i = 0; i < objectIDList.size(); i++) { Integer intObj = objectIDList.get(i); if (intObj != null) { arrInts[i] = intObj.intValue(); } } return getListOfChunks(arrInts); }