List of usage examples for java.lang Integer equals
public boolean equals(Object obj)
From source file:com.android.ddmuilib.HeapPanel.java
private void fillDetailedTable(Client client, boolean forceRedraw) { // first check if the client is invalid or heap updates are not enabled. if (client == null || client.isHeapUpdateEnabled() == false) { mStatisticsTable.removeAll();/* ww w . j a va2 s . c o m*/ showChart(null); return; } ClientData cd = client.getClientData(); Map<Integer, ArrayList<HeapSegmentElement>> heapMap; // Atomically get and clear the heap data. synchronized (cd) { if (serializeHeapData(cd.getVmHeapData()) == false && forceRedraw == false) { // no change, we return. return; } heapMap = cd.getVmHeapData().getProcessedHeapMap(); } // we have new data, lets display it. // First, get the current selection, and its key. int index = mStatisticsTable.getSelectionIndex(); Integer selectedKey = null; if (index != -1) { selectedKey = (Integer) mStatisticsTable.getItem(index).getData(); } // disable redraws and remove all from the table. mStatisticsTable.setRedraw(false); mStatisticsTable.removeAll(); if (heapMap != null) { int selectedIndex = -1; ArrayList<HeapSegmentElement> selectedList = null; // get the keys Set<Integer> keys = heapMap.keySet(); int iter = 0; // use a manual iter int because Set<?> doesn't have an index // based accessor. for (Integer key : keys) { ArrayList<HeapSegmentElement> list = heapMap.get(key); // check if this is the key that is supposed to be selected if (key.equals(selectedKey)) { selectedIndex = iter; selectedList = list; } iter++; TableItem item = new TableItem(mStatisticsTable, SWT.NONE); item.setData(key); // get the type item.setText(0, mMapLegend[key]); // set the count, smallest, largest int count = list.size(); item.setText(1, addCommasToNumber(count)); if (count > 0) { item.setText(3, prettyByteCount(list.get(0).getLength())); item.setText(4, prettyByteCount(list.get(count - 1).getLength())); int median = count / 2; HeapSegmentElement element = list.get(median); long size = element.getLength(); item.setText(5, prettyByteCount(size)); long totalSize = 0; for (int i = 0; i < count; i++) { element = list.get(i); size = element.getLength(); totalSize += size; } // set the average and total item.setText(2, prettyByteCount(totalSize)); item.setText(6, prettyByteCount(totalSize / count)); } } mStatisticsTable.setRedraw(true); if (selectedIndex != -1) { mStatisticsTable.setSelection(selectedIndex); showChart(selectedList); } else { showChart(null); } } else { mStatisticsTable.setRedraw(true); } }
From source file:org.kuali.coeus.s2sgen.impl.generate.support.PHS398FellowshipSupplementalV1_1Generator.java
private AdditionalInformation getAdditionalInformation() { AdditionalInformation additionalInformation = AdditionalInformation.Factory.newInstance(); additionalInformation.setCitizenship(CitizenshipDataType.U_S_CITIZEN_OR_NONCITIZEN_NATIONAL); StemCells stemCells = StemCells.Factory.newInstance(); stemCells.setIsHumanStemCellsInvolved(YesNoDataType.N_NO); stemCells.setStemCellsIndicator(YesNoDataType.N_NO); GraduateDegreeSought graduateDegreeSought = GraduateDegreeSought.Factory.newInstance(); ProposalPersonContract principalInvestigator = s2SProposalPersonService.getPrincipalInvestigator(pdDoc); ArrayList<String> cellLinesList = new ArrayList<>(Arrays.asList(stemCells.getCellLinesArray())); for (ProposalPersonContract proposalPerson : pdDoc.getDevelopmentProposal().getProposalPersons()) { if (proposalPerson.isPrincipalInvestigator()) { CitizenshipType citizenShip = s2SProposalPersonService.getCitizenship(proposalPerson); if (citizenShip != null && StringUtils.isNotBlank(citizenShip.getCitizenShip())) { if (citizenShip.getCitizenShip().trim() .equals(CitizenshipDataType.NON_U_S_CITIZEN_WITH_TEMPORARY_VISA.toString())) { additionalInformation .setCitizenship(CitizenshipDataType.NON_U_S_CITIZEN_WITH_TEMPORARY_VISA); } else if (citizenShip.getCitizenShip().trim() .equals(CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S.toString())) { additionalInformation.setCitizenship(CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S); } else if (citizenShip.getCitizenShip().trim() .equals(CitizenshipDataType.U_S_CITIZEN_OR_NONCITIZEN_NATIONAL.toString())) { additionalInformation .setCitizenship(CitizenshipDataType.U_S_CITIZEN_OR_NONCITIZEN_NATIONAL); } else if (citizenShip.getCitizenShip().trim() .equals(CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S_PENDING.toString())) { additionalInformation.setCitizenship(CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S_PENDING); }// www .ja v a2 s.c o m } else { additionalInformation.setCitizenship(null); } } } if (principalInvestigator != null && principalInvestigator.getMobilePhoneNumber() != null) { additionalInformation.setAlernatePhoneNumber(principalInvestigator.getMobilePhoneNumber()); } List<? extends AnswerHeaderContract> answerHeaders = getPropDevQuestionAnswerService() .getQuestionnaireAnswerHeaders(pdDoc.getDevelopmentProposal().getProposalNumber(), getNamespace(), getFormName()); for (AnswerHeaderContract answerHeader : answerHeaders) { for (AnswerContract questionnaireAnswer : answerHeader.getAnswers()) { String answer = questionnaireAnswer.getAnswer(); Integer seqId = getQuestionAnswerService().findQuestionById(questionnaireAnswer.getQuestionId()) .getQuestionSeqId(); if (seqId.equals(STEMCELLLINES)) { List<AnswerContract> answerList = getAnswers(questionnaireAnswer.getQuestionnaireQuestionsId(), answerHeader); for (AnswerContract questionnaireAnswerBO : answerList) { String questionnaireSubAnswer = questionnaireAnswerBO.getAnswer(); if (questionnaireSubAnswer != null) { cellLinesList.add(questionnaireSubAnswer); stemCells.addCellLines(questionnaireSubAnswer); } } } if (answer != null) { switch (seqId) { case BROAD_TRAINING: case FIELD_TRAINING: if (!answer.toUpperCase().equals(SUB_CATEGORY_NOT_FOUND)) { FieldOfTrainingDataType.Enum e = FieldOfTrainingDataType.Enum.forString(answer); additionalInformation.setFieldOfTraining(e); } break; case NRSA_SUPPORT: additionalInformation.setCurrentPriorNRSASupportIndicator( answer.equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; case SUBMITTED_DIFF_INST: additionalInformation.setChangeOfInstitution( answer.equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; case FORMER_INST: additionalInformation.setFormerInstitution(answer); break; case STEMCELLS: stemCells.setIsHumanStemCellsInvolved( answer.equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; case CELLLINEIND: stemCells.setStemCellsIndicator( answer.equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; case DEGREE_TYPE_SOUGHT: graduateDegreeSought.setDegreeType(DegreeTypeDataType.Enum.forString(answer)); break; case DEG_EXP_COMP_DATE: graduateDegreeSought .setDegreeDate(answer.substring(6, 10) + STRING_SEPRATOR + answer.substring(0, 2)); break; case OTHER_MASTERS: graduateDegreeSought.setOtherDegreeTypeText(answer); break; case OTHER_DOCT: graduateDegreeSought.setOtherDegreeTypeText(answer); break; case OTHER_DDOT: graduateDegreeSought .setDegreeType(DegreeTypeDataType.DDOT_OTHER_DOCTOR_OF_MEDICAL_DENTISTRY); graduateDegreeSought.setOtherDegreeTypeText(answer); break; case OTHER_VDOT: graduateDegreeSought .setDegreeType(DegreeTypeDataType.VDOT_OTHER_DOCTOR_OF_VETERINARY_MEDICINE); graduateDegreeSought.setOtherDegreeTypeText(answer); break; case OTHER_DBOTH: graduateDegreeSought.setDegreeType(DegreeTypeDataType.DBOTH_OTHER_DOUBLE_DEGREE_PROGRAM); graduateDegreeSought.setOtherDegreeTypeText(answer); break; case OTHER_MDOT: graduateDegreeSought.setDegreeType(DegreeTypeDataType.MDOT_OTHER_DOCTOR_OF_MEDICINE); graduateDegreeSought.setOtherDegreeTypeText(answer); break; default: break; } } } } additionalInformation.setStemCells(stemCells); if (graduateDegreeSought.getDegreeType() != null) { additionalInformation.setGraduateDegreeSought(graduateDegreeSought); } additionalInformation.setCurrentPriorNRSASupportArray(getCurrentPriorNRSASupportArray()); additionalInformation.setConcurrentSupport(YesNoDataType.N_NO); FellowshipTrainingAndCareerGoals fellowshipTrainingAndCareerGoals = FellowshipTrainingAndCareerGoals.Factory .newInstance(); ActivitiesPlannedUnderThisAward activitiesPlannedUnderThisAward = ActivitiesPlannedUnderThisAward.Factory .newInstance(); AttachedFileDataType attachedFileDataType = null; for (NarrativeContract narrative : pdDoc.getDevelopmentProposal().getNarratives()) { if (narrative.getNarrativeType().getCode() != null) { switch (Integer.parseInt(narrative.getNarrativeType().getCode())) { case CONCURRENT_SUPPORT: attachedFileDataType = getAttachedFileType(narrative); if (attachedFileDataType == null) { continue; } ConcurrentSupportDescription concurrentSupportDescription = ConcurrentSupportDescription.Factory .newInstance(); concurrentSupportDescription.setAttFile(attachedFileDataType); additionalInformation.setConcurrentSupport(YesNoDataType.Y_YES); additionalInformation.setConcurrentSupportDescription(concurrentSupportDescription); break; case FELLOWSHIP: attachedFileDataType = getAttachedFileType(narrative); if (attachedFileDataType == null) { continue; } fellowshipTrainingAndCareerGoals.setAttFile(attachedFileDataType); break; case DISSERTATION: attachedFileDataType = getAttachedFileType(narrative); if (attachedFileDataType == null) { continue; } DissertationAndResearchExperience dissertationAndResearchExperience = DissertationAndResearchExperience.Factory .newInstance(); dissertationAndResearchExperience.setAttFile(attachedFileDataType); additionalInformation.setDissertationAndResearchExperience(dissertationAndResearchExperience); break; case ACTIVITIES: attachedFileDataType = getAttachedFileType(narrative); if (attachedFileDataType == null) { continue; } activitiesPlannedUnderThisAward.setAttFile(attachedFileDataType); break; default: break; } } } additionalInformation.setFellowshipTrainingAndCareerGoals(fellowshipTrainingAndCareerGoals); additionalInformation.setActivitiesPlannedUnderThisAward(activitiesPlannedUnderThisAward); return additionalInformation; }
From source file:net.sourceforge.fenixedu.presentationTier.backBeans.sop.evaluation.WrittenEvaluationsByRoomBackingBean.java
private Collection<InfoRoom> searchRooms() throws FenixServiceException { final String name = getName(); final String building = (getBuilding() != null && getBuilding().length() > 0) ? getBuilding() : null; final Integer floor = (getFloor() != null && getFloor().length() > 0) ? Integer.valueOf(getFloor()) : null; final String type = getType(); final Integer normalCapacity = (getNormalCapacity() != null && getNormalCapacity().length() > 0) ? Integer.valueOf(getNormalCapacity()) : null;/*w ww . ja va 2s . c o m*/ final Integer examCapacity = (getExamCapacity() != null && getExamCapacity().length() > 0) ? Integer.valueOf(getExamCapacity()) : null; final Collection<InfoRoom> rooms = getAllRooms(); final Collection<InfoRoom> selectedRooms = new ArrayList<InfoRoom>(); for (final InfoRoom room : rooms) { boolean matchesCriteria = true; if (name != null && name.length() > 0 && !room.getName().equalsIgnoreCase(name)) { matchesCriteria = false; } else if (building != null && !room.getSpaceBuilding().getExternalId().equals(building)) { matchesCriteria = false; } else if (floor != null && !floor.equals(room.getPiso())) { matchesCriteria = false; } else if (type != null && type.length() > 0 && (room.getClassification() == null || !room.getClassification().getExternalId().toString().equals(type))) { matchesCriteria = false; } else if (normalCapacity != null && room.getCapacidadeNormal().intValue() < normalCapacity.intValue()) { matchesCriteria = false; } else if (examCapacity != null && (Integer) room.getCapacidadeExame() < examCapacity.intValue()) { matchesCriteria = false; } if (matchesCriteria && !StringUtils.isEmpty(room.getName())) { selectedRooms.add(room); } } return selectedRooms; }
From source file:io.seldon.clustering.recommender.CountRecommender.java
private List<UserCluster> getClusters(long userId, Integer group) { if (userClusters == null) return null; List<UserCluster> clusters = null; String memcacheKey = null;/*from w w w .j a v a 2s. c om*/ if (userClusters.needsExternalCaching()) { memcacheKey = MemCacheKeys.getClustersForUser(client, userId); clusters = (List<UserCluster>) MemCachePeer.get(memcacheKey); } if (clusters == null) { clusters = userClusters.getClusters(userId); if (userClusters.needsExternalCaching()) MemCachePeer.put(memcacheKey, clusters, EXPIRE_USER_CLUSTERS); } //prune clusters not in desired group if (group != null) { for (Iterator<UserCluster> i = clusters.iterator(); i.hasNext();) { if (!group.equals(i.next().getGroup())) i.remove(); } } return clusters; }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.barcharts.OverlaidBarLine.java
public void configureChart(SourceBean content) { super.configureChart(content); logger.debug("IN"); if (confParameters.get("add_labels") != null) { String additional = (String) confParameters.get("add_labels"); if (additional.equalsIgnoreCase("true")) { additionalLabels = true;/*from w w w.j a v a 2s. co m*/ catSerLabels = new LinkedHashMap(); } else additionalLabels = false; } else { additionalLabels = false; } if (confParameters.get("stacked_bar_renderer_1") != null) { String stacked = (String) confParameters.get("stacked_bar_renderer_1"); if (stacked.equalsIgnoreCase("true")) { stackedBarRenderer_1 = true; } } if (confParameters.get("stacked_bar_renderer_2") != null) { String stacked = (String) confParameters.get("stacked_bar_renderer_2"); if (stacked.equalsIgnoreCase("true")) { stackedBarRenderer_2 = true; } } //reading series draw: there is specified if a serie has to be drawn as a bar or as a line. SourceBean draws = (SourceBean) content.getAttribute("SERIES_DRAW"); if (draws == null) { draws = (SourceBean) content.getAttribute("CONF.SERIES_DRAW"); } seriesDraw = new LinkedHashMap(); if (draws != null) { List atts = draws.getContainedAttributes(); String serieName = ""; String serieDraw = ""; for (Iterator iterator = atts.iterator(); iterator.hasNext();) { SourceBeanAttribute object = (SourceBeanAttribute) iterator.next(); serieName = new String(object.getKey()); serieDraw = new String((String) object.getValue()); if (serieDraw.equalsIgnoreCase("line")) { seriesDraw.put(serieName, "line"); } else if (serieDraw.equalsIgnoreCase("line_no_shapes")) { seriesDraw.put(serieName, "line_no_shapes"); } else { seriesDraw.put(serieName, "bar"); } } } else { useBars = true; } if (confParameters.get(SECOND_AXIS_LABEL) != null && !confParameters.get(SECOND_AXIS_LABEL).equals("")) { secondAxis = true; secondAxisLabel = (String) confParameters.get(SECOND_AXIS_LABEL); // only if second axis is defined check wich series has to be mapped to the first axis and wich to the second SourceBean scales = (SourceBean) content.getAttribute("SERIES_SCALES"); if (scales == null) { scales = (SourceBean) content.getAttribute("CONF.SERIES_SCALES"); } seriesScale = new LinkedHashMap(); if (scales != null) { List attsScales = scales.getContainedAttributes(); String serieName = ""; Integer serieScale = 1; for (Iterator iterator = attsScales.iterator(); iterator.hasNext();) { SourceBeanAttribute object = (SourceBeanAttribute) iterator.next(); serieName = new String(object.getKey()); try { String serieScaleS = (String) object.getValue(); serieScale = Integer.valueOf(serieScaleS); } catch (Exception e) { logger.error("Not correct numebr scale; setting default 1"); serieScale = Integer.valueOf(1); } if (serieScale.equals(2)) { seriesScale.put(serieName, "2"); } else { seriesScale.put(serieName, "1"); } } } } logger.debug("OUT"); }
From source file:com.flexive.shared.value.FxValue.java
/** * Unset value data for a language/* w ww.ja v a 2s . c o m*/ * @param language language to clear value data for * @since 3.2 */ public void clearValueData(long language) { if (this.multiLangData != null && this.multiLangData.containsKey(language)) { final Integer oldValue = this.multiLangData.remove(language); if (this.multiLangData.isEmpty()) { this.multiLangData = null; if (oldValue != null && oldValue.equals(this.valueData)) { this.valueData = VALUE_NODATA; } } } else if (multiLangData == null || multiLangData.isEmpty()) { // reset only when there are no other values this.multiLangData = null; this.valueData = VALUE_NODATA; } }
From source file:it.eng.spagobi.analiticalmodel.execution.presentation.tag.ParametersGeneratorTag.java
/** * Finds the parameters the input parameter depends on. * Returns a List of BIObjectParameter instances. * @param biparam The dependent (if it is the case) parameter * @return the list of BIObjectParameter the input parameter depends on. */// ww w. j a va 2 s.co m private List getDependencies(BIObjectParameter biparam) { List toReturn = new ArrayList(); ExecutionInstance instance = getExecutionInstance(); BIObject obj = instance.getBIObject(); BIObjectParameter objParFather = null; ObjParuse objParuse = null; try { IObjParuseDAO objParuseDAO = DAOFactory.getObjParuseDAO(); IParameterUseDAO paruseDAO = DAOFactory.getParameterUseDAO(); List objParuses = objParuseDAO.loadObjParuses(biparam.getId()); if (objParuses != null && objParuses.size() > 0) { Iterator it = objParuses.iterator(); while (it.hasNext()) { ObjParuse aObjParuse = (ObjParuse) it.next(); Integer paruseId = aObjParuse.getParuseId(); ParameterUse aParameterUse = paruseDAO.loadByUseID(paruseId); Integer idLov = aParameterUse.getIdLov(); if (idLov.equals(getModalityValue(biparam).getId())) { // the ModalitiesValue of the BIObjectParameter corresponds to a ParameterUse correlated objParuse = aObjParuse; logger.debug("Found correlation:" + " dependent BIObjectParameter id = " + biparam.getId() + "," + " ParameterUse with id = " + paruseId + ";" + " BIObjectParameter father has id = " + objParuse.getObjParFatherId()); // now we have to find the BIObjectParameter father of the correlation Integer objParFatherId = objParuse.getObjParFatherId(); List parameters = obj.getBiObjectParameters(); Iterator i = parameters.iterator(); while (i.hasNext()) { BIObjectParameter aBIObjectParameter = (BIObjectParameter) i.next(); if (aBIObjectParameter.getId().equals(objParFatherId)) { objParFather = aBIObjectParameter; break; } } if (objParFather == null) { // the BIObjectParameter father of the correlation was not found logger.error("Cannot find the BIObjectParameter father of the correlation"); throw new EMFUserError(EMFErrorSeverity.ERROR, 100); } toReturn.add(objParFather); } } } } catch (EMFUserError e) { logger.error("Error while retrieving information from db", e); return new ArrayList(); } return toReturn; }
From source file:it.eng.spagobi.analiticalmodel.execution.presentation.tag.ParametersGeneratorTag.java
private Object[] getObjectFather(BIObjectParameter biparam) { BIObjectParameter objParFather = null; ObjParuse objParuse = null;//from w w w. jav a 2 s.co m try { IObjParuseDAO objParuseDAO = DAOFactory.getObjParuseDAO(); IParameterUseDAO paruseDAO = DAOFactory.getParameterUseDAO(); List objParuses = objParuseDAO.loadObjParuses(biparam.getId()); if (objParuses != null && objParuses.size() > 0) { Iterator it = objParuses.iterator(); while (it.hasNext()) { ObjParuse aObjParuse = (ObjParuse) it.next(); Integer paruseId = aObjParuse.getParuseId(); ParameterUse aParameterUse = paruseDAO.loadByUseID(paruseId); Integer idLov = aParameterUse.getIdLov(); if (idLov.equals(getModalityValue(biparam).getId())) { // the ModalitiesValue of the BIObjectParameter // corresponds to a ParameterUse correlated objParuse = aObjParuse; logger.debug("Found correlation:" + " dependent BIObjectParameter id = " + biparam.getId() + "," + " ParameterUse with id = " + paruseId + ";" + " BIObjectParameter father has id = " + objParuse.getObjParFatherId()); // now we have to find the BIObjectParameter father of // the correlation Integer objParFatherId = objParuse.getObjParFatherId(); ExecutionInstance instance = getExecutionInstance(); BIObject obj = instance.getBIObject(); List parameters = obj.getBiObjectParameters(); Iterator i = parameters.iterator(); while (i.hasNext()) { BIObjectParameter aBIObjectParameter = (BIObjectParameter) i.next(); if (aBIObjectParameter.getId().equals(objParFatherId)) { objParFather = aBIObjectParameter; break; } } if (objParFather == null) { // the BIObjectParameter father of the correlation // was not found logger.error("Cannot find the BIObjectParameter father of the correlation"); throw new EMFUserError(EMFErrorSeverity.ERROR, 100); } break; } } } } catch (EMFUserError e) { logger.error("Error while retrieving information from db", e); e.printStackTrace(); } return new Object[] { objParuse, objParFather }; }
From source file:files.TestFileDirCleaner.java
private void runTest(int expectedEntriesByDirectoryAndByType, long cleanAfterThisDuration, SCAN_STRATEGY strategy, Integer expectedDeletedEntries, String filesRegExpPattern, String directoriesRegExpPattern) { try {/*from w ww .j av a 2s . c o m*/ generateFiles(LEVELS_COUNT); FileDirCleaner fileDirCleaner = new FileDirCleaner(true, strategy, expectedEntriesByDirectoryAndByType, cleanAfterThisDuration); int deletedEntries = fileDirCleaner.clean(rootPath, filesRegExpPattern, directoriesRegExpPattern); if (expectedDeletedEntries != null && !expectedDeletedEntries.equals(deletedEntries)) { fail("expectedDeletedEntries is " + expectedDeletedEntries + " but real deleted entries is " + deletedEntries); } FileDirCheckerForFSManager checkerOperations = new FileDirCheckerForFSManager(); checkerOperations.setDirectoriesCount(COUNT_FILES_DIRECTORIES); checkerOperations.setFilesCount(COUNT_FILES_DIRECTORIES); checkerOperations.setExpectedEntriesByDirectoryAndByType(expectedEntriesByDirectoryAndByType); checkerOperations.setCleanAfterThisDuration(cleanAfterThisDuration); checkerOperations.setCleanDirectories(strategy.isCleanDirectories()); checkerOperations.setCleanFiles(strategy.isCleanFiles()); checkerOperations.setRecursively(strategy.isRecursively()); checkerOperations.setFilesRegExpPattern(filesRegExpPattern); checkerOperations.setDirectoriesRegExpPattern(directoriesRegExpPattern); FSManager fsManager = new FSManager(checkerOperations); fsManager.process(rootPath, LEVELS_COUNT, 0); } catch (IOException e) { throw new RuntimeException(e); } }