List of usage examples for java.lang Double intValue
public int intValue()
From source file:com.lm.lic.manager.controller.GenerateLicensesPerPayController.java
private Integer calculateNumLicenses(GenerateLicensesPerPayCommand glppc, Double ppl) { Double amount = glppc.getPayment_gross(); Double numLicenses = amount / ppl; Integer nl = numLicenses.intValue(); return nl;/* w w w .j a v a2 s .c om*/ }
From source file:demo.vmware.commands.poweroftwo.CommandPowerOfTwoHelper.java
@Override @Cacheable("POWERTABLE") public Integer calculateNthPower(Integer targetNumber) { LOG.info("Not cached so calculating 2^" + targetNumber); hitCount++;/*from w ww . j a va2 s . c om*/ Double result = Math.pow(2.0, targetNumber); try { // simulate long running service with 3 second delay Thread.sleep(3000); } catch (InterruptedException e) { // don't care } return new Integer(result.intValue()); }
From source file:com.wpi.assistments.HomeTabbedActivity.java
private int getScale() { Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int width = display.getWidth(); Double val = new Double(width) / 800d; val = val * 100d; Log.i("test", Integer.toString(val.intValue())); return val.intValue(); }
From source file:jp.go.nict.langrid.commons.beanutils.ConverterTest.java
@Test @SuppressWarnings("serial") public void test_bean_bean_withalias() throws Exception { Converter c = new Converter(); c.addTransformerConversion(/*w ww . j a v a2 s .com*/ new BeanToBeanTransformer<TestClass, TestClass2>(c, new HashMap<String, String>() { { put("c", "cc"); } }) { }); c.addTransformerConversion(new Transformer<Double, Character>() { @Override public Character transform(Double value) throws TransformationException { return (char) value.intValue(); } }); Assert.assertEquals(new TestClass2(0, "converter", (char) 30), c.convert(new TestClass(0, "converter", 30, null), TestClass2.class)); }
From source file:canreg.client.analysis.Tools.java
public static JFreeChart generateJChart(Collection<CancerCasesCount> casesCounts, String fileName, String header, FileTypes fileType, ChartType chartType, boolean includeOther, boolean legendOn, Double restCount, Double allCount, Color color, String labelsCategoryName) { JFreeChart chart;/*from w w w .ja v a2s. com*/ if (chartType == ChartType.PIE) { NumberFormat format = NumberFormat.getInstance(); format.setMaximumFractionDigits(1); DefaultPieDataset dataset = new DefaultKeyedValuesDataset(); int position = 0; for (CancerCasesCount count : casesCounts) { dataset.insertValue(position++, count.toString() + " (" + format.format(count.getCount() / allCount * 100) + "%)", count.getCount()); } if (includeOther) { dataset.insertValue(position++, "Other: " + restCount.intValue() + " (" + format.format(restCount / allCount * 100) + "%)", restCount); } chart = ChartFactory.createPieChart(header, dataset, legendOn, false, Locale.getDefault()); Tools.setPiePlotColours(chart, casesCounts.size() + 1, color.brighter()); } else { // assume barchart DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (CancerCasesCount count : casesCounts) { dataset.addValue(count.getCount(), count.getLabel(), count.toString()); } if (includeOther) { dataset.addValue(restCount.intValue(), "Other", "Other: " + restCount); } chart = ChartFactory.createStackedBarChart(header, labelsCategoryName, "Cases", dataset, PlotOrientation.HORIZONTAL, legendOn, true, false); Tools.setBarPlotColours(chart, casesCounts.size() + 1, color.brighter()); } return chart; }
From source file:org.openmrs.module.nbs.datasource.HibernateLogicProviderDAO.java
public List<Integer> getAllProviders(Integer patientId, ArrayList<Integer> encounterList) { String encounterRestrictions = ""; if (encounterList != null && encounterList.size() == 0) { return null; }//from ww w . j a v a2 s.c om if (encounterList != null) { encounterRestrictions = " and encounter_id in (:encounterList)"; } String sql = "select distinct value_numeric as provider_id from obs where encounter_id in ( " + "select encounter_id from encounter where patient_id=?" + encounterRestrictions + ") " + "and concept_id=? and value_numeric is not null"; ConceptService conceptService = Context.getConceptService(); Concept providerUserIdConcept = conceptService.getConceptByName("PROVIDER_USER_ID"); if (providerUserIdConcept == null) { return null; } SQLQuery qry = this.sessionFactory.getCurrentSession().createSQLQuery(sql); qry.setInteger(0, patientId); qry.setInteger(1, providerUserIdConcept.getConceptId()); if (encounterList != null) { qry.setParameterList("encounterList", encounterList); } qry.addScalar("provider_id"); try { List<Double> tmpList = qry.list(); List<Integer> resultList = new ArrayList(); for (Double item : tmpList) { resultList.add(item.intValue()); } return resultList; } catch (Exception e) { e.printStackTrace(); } return null; }
From source file:com.galenframework.speclang2.specs.SpecImageProcessor.java
private ImageFilter parseSimpleFilter(StringCharReader reader, String filterName) { Double value = new ExpectNumber().read(reader); if ("contrast".equals(filterName)) { return new ContrastFilter(value.intValue()); } else if ("blur".equals(filterName)) { return new BlurFilter(value.intValue()); } else if ("denoise".equals(filterName)) { return new DenoiseFilter(value.intValue()); } else if ("saturation".equals(filterName)) { return new SaturationFilter(value.intValue()); } else if ("quantinize".equals(filterName)) { return new QuantinizeFilter(value.intValue()); } else {/*from w w w . ja v a 2 s . c o m*/ throw new SyntaxException("Unknown image filter: " + filterName); } }
From source file:com.lm.lic.manager.controller.BuyLicenseBlockController.java
private Integer calculateNumLicenses(BuyLicenseBlockForm blbf, Double ppl) { Double amount = blbf.getAmount(); Double numLicenses = amount / ppl; Integer nl = numLicenses.intValue(); return nl;// w w w .ja v a 2 s . c o m }
From source file:ubic.gemma.core.datastructure.matrix.MatrixConversionTest.java
public final void testColumnMapping() { Collection<QuantitationType> quantTypes = new HashSet<>(); QuantitationType quantType = PersistentDummyObjectHelper.getTestNonPersistentQuantitationType(); quantType.setId(0L);// w w w.j a va2 s.c o m quantTypes.add(quantType); Collection<DesignElementDataVector> vectors = this.getDesignElementDataVectors(quantTypes); ExpressionDataDoubleMatrix mat = new ExpressionDataDoubleMatrix(vectors); MatrixConversionTest.log.debug(vectors.size() + " vectors"); TestCase.assertEquals(MatrixConversionTest.NUM_CS, mat.rows()); TestCase.assertEquals(MatrixConversionTest.NUM_BIOMATERIALS, mat.columns()); for (int j = 0; j < mat.rows(); j++) { // System.err.print( mat.getRowElement( j ) ); for (int i = 0; i < mat.columns(); i++) { Double r = mat.get(j, i); TestCase.assertNotNull("No value for at index " + i, r); TestCase.assertTrue("Expected " + i + ", got " + r, i == r.intValue() || r.equals(Double.NaN)); } } }
From source file:com.aptech.action.ProductAction.java
@SkipValidation public String index() throws Exception { try {/*from w ww .j a va 2 s.co m*/ Integer page; Double totalNumberOfRecords = 0.0; Double numberOfRecordsPerPage = 4.0; HttpServletRequest request = (HttpServletRequest) ActionContext.getContext() .get(ServletActionContext.HTTP_REQUEST); if (request.getParameter("page") != null) { page = Integer.parseInt(request.getParameter("page")); } else { page = 1; } totalNumberOfRecords = dao.count().doubleValue(); Double startIndex = (page * numberOfRecordsPerPage) - numberOfRecordsPerPage; Double temp = Math.ceil(totalNumberOfRecords / numberOfRecordsPerPage); maxPage = temp.intValue(); if (totalNumberOfRecords % 2 != 0) { maxPage += 1; } listProduct = dao.paging(startIndex.intValue(), numberOfRecordsPerPage.intValue()); } catch (Exception e) { e.printStackTrace(); } return SUCCESS; }