Example usage for java.lang Long valueOf

List of usage examples for java.lang Long valueOf

Introduction

In this page you can find the example usage for java.lang Long valueOf.

Prototype

@HotSpotIntrinsicCandidate
public static Long valueOf(long l) 

Source Link

Document

Returns a Long instance representing the specified long value.

Usage

From source file:cherry.foundation.type.SecureLongTest.java

@Test
public void testRandomTest() {
    for (int i = 0; i < 100; i++) {
        Long plain = Long.valueOf(random.nextLong());
        SecureLong sec0 = plainValueOf(plain);
        SecureLong sec1 = cryptoValueOf(sec0.crypto());
        assertThat(sec1.plain(), is(plain));
    }/*www.j av  a  2  s. c om*/
}

From source file:de.berlios.jhelpdesk.web.tools.TicketCategoryEditor.java

@Override
public void setAsText(String text) {
    Long ticketCategoryId = Long.valueOf(text);
    TicketCategory category = ticketCategoryDAO.getById(ticketCategoryId);
    setValue(category);//from ww w  . jav  a 2 s.co m
}

From source file:cherry.foundation.numbering.SimpleNumberingStore.java

@Override
public void afterPropertiesSet() {
    currentValueMap = DefaultedMap.defaultedMap(new HashMap<String, Long>(), Long.valueOf(0L));
    lockMap = new HashMap<String, Lock>();
}

From source file:com.github.brandtg.stl.PlotTest.java

@Test
public void testMinimalCase() throws Exception {
    List<Number> times = new ArrayList<Number>();
    List<Number> measures = new ArrayList<Number>();

    // Read from STDIN
    String line;//w  w  w .  j a v a2s  . c  om
    BufferedReader reader = new BufferedReader(
            new InputStreamReader(ClassLoader.getSystemResourceAsStream("minimal.csv")));
    while ((line = reader.readLine()) != null) {
        String[] tokens = line.split(",");
        times.add(Long.valueOf(tokens[0]));
        measures.add(Double.valueOf(tokens[1]));
    }

    StlDecomposition stl = new StlDecomposition(288);
    stl.getConfig().setTrendComponentBandwidth(0.751);
    stl.getConfig().setSeasonalComponentBandwidth(0.85);
    // TODO: With default 10 we get decent results, but with 1 the head end seems a little off
    //    stl.getConfig().setNumberOfInnerLoopPasses(1);
    stl.getConfig().setPeriodic(false);
    StlResult res = stl.decompose(times, measures);

    // TODO: Validate more somehow (from https://github.com/brandtg/stl-java/issues/9)
    //    for (int i = 0; i < times.size(); i++) {
    //      System.out.println(String.format("%d,%02f,%02f,%02f,%02f",
    //          (long) res.getTimes()[i],
    //          res.getSeries()[i],
    //          res.getTrend()[i],
    //          res.getSeasonal()[i],
    //          res.getRemainder()[i]));
    //    }
}

From source file:com.wabacus.system.datatype.LongType.java

public Object getColumnValue(ResultSet rs, String column, AbsDatabaseType dbtype) throws SQLException {
    return Long.valueOf(rs.getLong(column));
}

From source file:com.perceptive.epm.perkolcentral.dataaccessor.EmployeeLicenseDataAccessor.java

public ArrayList<String> getEmployeeIdsByLicenseId(java.lang.String licenseTypeId) throws ExceptionWrapper {
    ArrayList<String> employeeIds = new ArrayList<String>();
    Session session = hibernateTemplate.getSessionFactory().openSession();
    boolean isInTransaction = session.getTransaction() != null;
    Transaction tx = null;//from   w w  w.ja v a 2  s .c  om
    if (!isInTransaction) {
        tx = session.beginTransaction();
    }
    try {
        Criteria criteria = session.createCriteria(Employeelicensemapping.class);

        criteria.createAlias("employee", "emp");
        criteria.add(Restrictions.eq("licensemaster.licenseTypeId", Long.valueOf(licenseTypeId)));
        criteria.add(Restrictions.like("emp.isActive", true));
        for (Object obj : criteria.list()) {
            Employeelicensemapping employeelicensemapping = (Employeelicensemapping) obj;
            employeeIds.add(Long.toString(employeelicensemapping.getEmployee().getEmployeeId()));
        }
    } catch (Exception ex) {
        throw new ExceptionWrapper(ex);
    } finally {
        {
            if (!isInTransaction && tx.isActive()) {
                tx.commit();
            }
            session.close();
        }
    }
    return employeeIds;
}

From source file:com.eugene.fithealthmaingit.FatSecretSearchAndGet.FatSecretGetMethod.java

private static String[] generateOauthParams() {
    return new String[] { "oauth_consumer_key=" + Globals.APP_KEY, "oauth_signature_method=HMAC-SHA1",
            "oauth_timestamp=" + Long.valueOf(System.currentTimeMillis() * 1000).toString(),
            "oauth_nonce=" + nonce(), "oauth_version=1.0", "format=json" };
}

From source file:com.snv.guard.DefaultHmacRequester.java

@Override
public String getPublicSecret(String iss) {
    User user = userService.get(Long.valueOf(iss));
    if (user != null) {
        return user.getPublicSecret();
    }//from   w  w  w  .ja v a2 s . c  om
    return null;
}

From source file:net.cnmconsulting.springbean.JetBeanTest.java

@Test
public void testJetBean() {
    // create the spring container using the AppConfig @Configuration class
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    JetBean jetBean = ctx.getBean(JetBean.class);
    assertThat(jetBean.getName(), equalTo("Gulf Stream G550"));
    assertThat(jetBean.getPrice(), equalTo(Long.valueOf(60000000)));
    URL gulfstream;/*from w  w w  . j  a va 2 s  .  c  o m*/
    try {
        gulfstream = new URL("http://www.gulfstream.com/products/g550/");
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        fail("error creating URL");
        throw new RuntimeException("error creating URL");
    }
    assertThat(jetBean.getUrl(), equalTo(gulfstream));
}

From source file:csns.web.editor.MFTDistributionTypePropertyEditor.java

@Override
public void setAsText(String text) throws IllegalArgumentException {
    if (StringUtils.hasText(text))
        setValue(mftDistributionTypeDao.getDistributionType(Long.valueOf(text)));
}