List of usage examples for java.lang Number longValue
public abstract long longValue();
From source file:de.tuberlin.uebb.jbop.optimizer.utils.NodeHelper.java
private static AbstractInsnNode getFloatInsnNode(final Number newNumber) { if (newNumber.longValue() == 0) { return new InsnNode(Opcodes.FCONST_0); } else if (newNumber.floatValue() == 1) { return new InsnNode(Opcodes.FCONST_1); } else if (newNumber.floatValue() == 2) { return new InsnNode(Opcodes.FCONST_2); } else {//from w w w. j a v a 2 s.c om return new LdcInsnNode(newNumber); } }
From source file:datafu.pig.stats.WilsonBinConf.java
public Tuple call(Number x, Number n) throws IOException { if (x == null || n == null) return null; return binconf(x.longValue(), n.longValue()); }
From source file:org.patientview.radar.dao.impl.IssueDaoImpl.java
public void saveIssue(final Issue issue) throws Exception { Map<String, Object> issueMap = new HashMap<String, Object>() { {// w w w. j a v a 2s . c om put("bType", issue.getType().getName()); put("bPage", issue.getPage()); put("bDateLogged", issue.getDateLogged()); put("bDateResolved", issue.getDateResolved()); put("bDesc", issue.getDescription()); put("bComment", issue.getComments()); put("bPriority", issue.getPriority().getName()); put("bStatus", issue.getStatus().getName()); put("bUpdated", issue.getUpdated()); put("bID", issue.getId()); } }; if (issue.hasValidId()) { String updateSql = buildUpdateQuery("tbl_IssueTracker", "bID", issueMap); namedParameterJdbcTemplate.update(updateSql, issueMap); } else { Number id = issuesInsert.executeAndReturnKey(issueMap); issue.setId(id.longValue()); } }
From source file:org.ala.spatial.services.dao.ApplicationDAOImpl.java
@Override public void addApplication(Application app) { logger.info("Adding a new application " + app.getName() + " by " + app.getOrganisation() + " (" + app.getEmail() + ") "); app.setRegtime(new Timestamp(new Date().getTime())); try {// w ww . jav a 2s.co m MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update((app.getName() + app.getEmail() + app.getRegtime()).getBytes()); byte byteData[] = md.digest(); //convert the byte to hex format method 1 StringBuffer sb = new StringBuffer(); for (int i = 0; i < byteData.length; i++) { sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1)); } app.setAppid(sb.toString()); } catch (NoSuchAlgorithmException ex) { java.util.logging.Logger.getLogger(ApplicationDAOImpl.class.getName()).log(Level.SEVERE, null, ex); } System.out.println(app.toString()); SqlParameterSource parameters = new BeanPropertySqlParameterSource(app); Number appUid = insertApplication.executeAndReturnKey(parameters); app.setId(appUid.longValue()); }
From source file:com.comcast.video.dawg.common.PersistableDevice.java
@Override public Long getExpiration() { Number num = (Number) data.get(EXPIRATION_KEY); return num == null ? null : num.longValue(); }
From source file:com.bdb.weather.display.summary.HiLoItemLabelGenerator.java
@Override public String generateToolTip(XYDataset dataset, int series, int item) { String result = null;//ww w . j a va 2 s. c om if (dataset instanceof OHLCDataset) { OHLCDataset d = (OHLCDataset) dataset; Number high = d.getHigh(series, item); Number low = d.getLow(series, item); Number open = d.getOpen(series, item); Number x = d.getX(series, item); result = d.getSeriesKey(series).toString(); if (x != null) { Date date = new Date(x.longValue()); result = result + "--> Date=" + dateFormat.format(date); if (high != null) result = result + " High=" + numberFormat.format(high.doubleValue()); if (low != null) result = result + " Low=" + numberFormat.format(low.doubleValue()); if (open != null) result = result + " Avg=" + numberFormat.format(open.doubleValue()); } } return result; }
From source file:ispok.dao.VisitorHibernateJpaDao.java
@Override public <ENTITY> Long getCount(Class<ENTITY> clazz) { Session session = getEntityManager().unwrap(Session.class); Number number = (Number) session.createCriteria(clazz).setProjection(Projections.rowCount()).uniqueResult(); return number.longValue(); }
From source file:org.jodconverter.process.ProcessManagerTest.java
/** * Tests the UnixProcessManager class.//w w w . j a va 2 s. com * * @throws Exception if an error occurs. */ @Test public void unixProcessManager() throws Exception { assumeTrue(SystemUtils.IS_OS_UNIX && !SystemUtils.IS_OS_MAC); final ProcessManager processManager = UnixProcessManager.getDefault(); final Process process = Runtime.getRuntime().exec("sleep 5s"); final ProcessQuery query = new ProcessQuery("sleep", "5s"); final long pid = processManager.findPid(query); assertThat(pid).isNotEqualTo(ProcessManager.PID_NOT_FOUND); final Number javaPid = (Number) FieldUtils.readDeclaredField(process, "pid", true); assertThat(pid).isEqualTo(javaPid.longValue()); processManager.kill(process, pid); assertThat(processManager.findPid(query)).isEqualTo(ProcessManager.PID_NOT_FOUND); }
From source file:org.jodconverter.process.ProcessManagerTest.java
/** * Tests the MacProcessManager class.//from w w w. java2 s . c o m * * @throws Exception if an error occurs. */ @Test public void macProcessManager() throws Exception { assumeTrue(SystemUtils.IS_OS_MAC); final ProcessManager processManager = MacProcessManager.getDefault(); final Process process = Runtime.getRuntime().exec("sleep 5s"); final ProcessQuery query = new ProcessQuery("sleep", "5s"); final long pid = processManager.findPid(query); assertThat(pid).isNotEqualTo(ProcessManager.PID_NOT_FOUND); final Number javaPid = (Number) FieldUtils.readDeclaredField(process, "pid", true); assertThat(pid).isEqualTo(javaPid.longValue()); processManager.kill(process, pid); assertThat(processManager.findPid(query)).isEqualTo(ProcessManager.PID_NOT_FOUND); }
From source file:MutableLong.java
public int compareTo(Number other) { final long thisVal = _value; final long anotherVal = other.longValue(); return thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1); }