List of usage examples for java.lang Number intValue
public abstract int intValue();
From source file:com.opengamma.financial.analytics.volatility.surface.BloombergBondFutureOptionVolatilitySurfaceInstrumentProvider.java
@Override /**// w w w . jav a2 s . c om * Provides ExternalID for Bloomberg ticker, eg RXZ3C 100 Comdty, * given a reference date and an integer offset, the n'th subsequent option * The format is futurePrefix + month + year + callPutFlag + strike + postfix * * @param futureNumber n'th future following curve date * @param strike option's strike, expressed as price, e.g. 100 * @param surfaceDate date of curve validity; valuation date */ public ExternalId getInstrument(final Number futureOptionNumber, final Double strike, final LocalDate surfaceDate) { Validate.notNull(futureOptionNumber, "futureOptionNumber"); final StringBuffer ticker = new StringBuffer(); ticker.append(getFutureOptionPrefix()); ticker.append(BloombergFutureUtils.getExpiryCodeForBondFutureOptions(getFutureOptionPrefix(), futureOptionNumber.intValue(), surfaceDate)); ticker.append(strike > useCallAboveStrike() ? "C " : "P "); ticker.append(FORMATTER.format(strike)); ticker.append(" "); ticker.append(getPostfix()); return ExternalId.of(SCHEME, ticker.toString()); }
From source file:com.prowidesoftware.swift.model.field.Field110.java
/** * Set the component1 from a Number object. * <br />/* w ww .jav a 2 s . com*/ * <em>If the component being set is a fixed length number, the argument will not be * padded.</em> It is recommended for these cases to use the setComponent1(String) * method. * * @see #setComponent1(String) * * @param component1 the Number with the component1 content to set */ public Field110 setComponent1(java.lang.Number component1) { if (component1 != null) { setComponent(1, "" + component1.intValue()); } return this; }
From source file:com.prowidesoftware.swift.model.field.Field122.java
/** * Set the component1 from a Number object. * <br />//from w ww . j av a2s. c o m * <em>If the component being set is a fixed length number, the argument will not be * padded.</em> It is recommended for these cases to use the setComponent1(String) * method. * * @see #setComponent1(String) * * @param component1 the Number with the component1 content to set */ public Field122 setComponent1(java.lang.Number component1) { if (component1 != null) { setComponent(1, "" + component1.intValue()); } return this; }
From source file:com.prowidesoftware.swift.model.field.Field349.java
/** * Set the component1 from a Number object. * <br />//w w w. j av a 2 s . c o m * <em>If the component being set is a fixed length number, the argument will not be * padded.</em> It is recommended for these cases to use the setComponent1(String) * method. * * @see #setComponent1(String) * * @param component1 the Number with the component1 content to set */ public Field349 setComponent1(java.lang.Number component1) { if (component1 != null) { setComponent(1, "" + component1.intValue()); } return this; }
From source file:com.prowidesoftware.swift.model.field.Field451.java
/** * Set the component1 from a Number object. * <br />/* w ww . j a va 2s .c o m*/ * <em>If the component being set is a fixed length number, the argument will not be * padded.</em> It is recommended for these cases to use the setComponent1(String) * method. * * @see #setComponent1(String) * * @param component1 the Number with the component1 content to set */ public Field451 setComponent1(java.lang.Number component1) { if (component1 != null) { setComponent(1, "" + component1.intValue()); } return this; }
From source file:com.prowidesoftware.swift.model.field.Field533.java
/** * Set the component1 from a Number object. * <br />/* w w w.j a va2s.co m*/ * <em>If the component being set is a fixed length number, the argument will not be * padded.</em> It is recommended for these cases to use the setComponent1(String) * method. * * @see #setComponent1(String) * * @param component1 the Number with the component1 content to set */ public Field533 setComponent1(java.lang.Number component1) { if (component1 != null) { setComponent(1, "" + component1.intValue()); } return this; }
From source file:de.innovationgate.wgpublisher.webtml.actions.TMLAction.java
public static Object defaultActionIncVar(TMLContext context, List<Object> params) throws TMLException, WGAPIException { if (params.size() < 1) { throw new TMLException("Default action $" + DEFAULTACTION_INCVAR + " needs 1 arguments while only " + params.size() + " were provided", false); }/* w ww .j ava2 s .c o m*/ try { String varName = String.valueOf(params.get(0)); Number num = (Number) context.item(varName); if (num == null) { num = 0; } num = num.intValue() + 1; context.updateOrSetVar(varName, num); return num; } catch (Exception e) { throw new TMLException("Error executing default action 'incvar'", e, false); } }
From source file:net.solarnetwork.node.dao.jdbc.power.JdbcPowerDatumDao.java
@Override @Transactional(readOnly = true, propagation = Propagation.REQUIRED) public List<PowerDatum> getDatumNotUploaded(String destination) { return findDatumNotUploaded(new RowMapper<PowerDatum>() { @Override/*from w w w .j a v a 2 s . c om*/ public PowerDatum mapRow(ResultSet rs, int rowNum) throws SQLException { if (log.isTraceEnabled()) { log.trace("Handling result row " + rowNum); } PowerDatum datum = new PowerDatum(); int col = 1; datum.setCreated(rs.getTimestamp(col++)); datum.setSourceId(rs.getString(col++)); Number val = (Number) rs.getObject(col++); datum.setLocationId(val == null ? null : val.longValue()); val = (Number) rs.getObject(col++); datum.setWatts(val == null ? null : val.intValue()); val = (Number) rs.getObject(col++); datum.setBatteryVolts(val == null ? null : val.floatValue()); val = (Number) rs.getObject(col++); datum.setBatteryAmpHours(val == null ? null : val.doubleValue()); val = (Number) rs.getObject(col++); datum.setDcOutputVolts(val == null ? null : val.floatValue()); val = (Number) rs.getObject(col++); datum.setDcOutputAmps(val == null ? null : val.floatValue()); val = (Number) rs.getObject(col++); datum.setAcOutputVolts(val == null ? null : val.floatValue()); val = (Number) rs.getObject(col++); datum.setAcOutputAmps(val == null ? null : val.floatValue()); val = (Number) rs.getObject(col++); datum.setWattHourReading(val == null ? null : val.longValue()); val = (Number) rs.getObject(col++); datum.setAmpHourReading(val == null ? null : val.doubleValue()); return datum; } }); }
From source file:com.marklogic.client.functionaltest.TestPOJOReadWrite1.java
@Test public void testPOJOgetDocumentUri() { PojoRepository<StringPOJO, String> strPojoRepo = client.newPojoRepository(StringPOJO.class, String.class); StringPOJO sobj = new StringPOJO(); String uri = "StringUri"; sobj.setName("StringUri"); strPojoRepo.write(sobj);/* w w w.j a v a 2 s.c om*/ System.out.println(strPojoRepo.getDocumentUri(sobj)); assertEquals("Uri mismatch", "com.marklogic.client.functionaltest.TestPOJOReadWrite1$StringPOJO/StringUri.json", strPojoRepo.getDocumentUri(sobj)); PojoRepository<IntegerPOJO, Integer> intPojoRepo = client.newPojoRepository(IntegerPOJO.class, Integer.class); IntegerPOJO iobj = new IntegerPOJO(); iobj.setId(-12); intPojoRepo.write(iobj); System.out.println(intPojoRepo.getDocumentUri(iobj)); assertEquals("Uri mismatch", "com.marklogic.client.functionaltest.TestPOJOReadWrite1$IntegerPOJO/-12.json", intPojoRepo.getDocumentUri(iobj)); PojoRepository<CalendarPOJO, Calendar> calPojoRepo = client.newPojoRepository(CalendarPOJO.class, Calendar.class); CalendarPOJO cobj = new CalendarPOJO(); Calendar cal = Calendar.getInstance(); cobj.setDateId(cal); calPojoRepo.write(cobj); System.out.println(calPojoRepo.getDocumentUri(cobj)); assertTrue("Uri mismatch", calPojoRepo.getDocumentUri(cobj) .contains("com.marklogic.client.functionaltest.TestPOJOReadWrite1$CalendarPOJO")); PojoRepository<DoublePOJO, Double> dPojoRepo = client.newPojoRepository(DoublePOJO.class, Double.class); DoublePOJO dobj = new DoublePOJO(); double dvar = 2.015; dobj.setDoubleId(dvar); dPojoRepo.write(dobj); System.out.println(dPojoRepo.getDocumentUri(dobj)); assertEquals("Uri mismatch", "com.marklogic.client.functionaltest.TestPOJOReadWrite1$DoublePOJO/2.015.json", dPojoRepo.getDocumentUri(dobj)); PojoRepository<NumberPOJO, Number> nPojoRepo = client.newPojoRepository(NumberPOJO.class, Number.class); NumberPOJO nobj = new NumberPOJO(); Number nvar = 99; nvar.intValue(); nobj.setNumberId(nvar); nPojoRepo.write(nobj); System.out.println(nPojoRepo.getDocumentUri(nobj)); assertEquals("Uri mismatch", "com.marklogic.client.functionaltest.TestPOJOReadWrite1$NumberPOJO/99.json", nPojoRepo.getDocumentUri(nobj)); }
From source file:org.openmrs.module.hospitalcore.db.hibernate.HibernateRadiologyDAO.java
public Integer countOrders(Date orderStartDate, OrderType orderType, Set<Concept> tests, List<Patient> patients) throws ParseException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Order.class); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String startDate = sdf.format(orderStartDate) + " 00:00:00"; String endDate = sdf.format(orderStartDate) + " 23:59:59"; criteria.add(Restrictions.eq("orderType", orderType)); SimpleDateFormat dateTimeFormatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); criteria.add(Expression.between("startDate", dateTimeFormatter.parse(startDate), dateTimeFormatter.parse(endDate))); criteria.add(Restrictions.eq("discontinued", false)); criteria.add(Restrictions.in("concept", tests)); if (!CollectionUtils.isEmpty(patients)) criteria.add(Restrictions.in("patient", patients)); Number rs = (Number) criteria.setProjection(Projections.rowCount()).uniqueResult(); return rs != null ? rs.intValue() : 0; }