Example usage for java.lang Integer Integer

List of usage examples for java.lang Integer Integer

Introduction

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

Prototype

@Deprecated(since = "9")
public Integer(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Integer object that represents the int value indicated by the String parameter.

Usage

From source file:net.sf.morph.util.TestClass.java

public static Map getPartialMap() {
    Map partialMap = new HashMap();
    partialMap.put("anObject", new Long(14));
    partialMap.put("myInteger", new Integer(4));
    partialMap.put("myMap", null);
    partialMap.put("myLongValue", new Long(13));
    partialMap.put("array", null);
    partialMap.put("numberArray", null);
    partialMap.put("funkyArray", null);
    partialMap.put("bigDecimal", null);
    partialMap.put("string", null);
    return partialMap;
}

From source file:metier.Freechart.java

public void stats() {
    List<Produit> produits = ProduitDAO.getInstance().readAll();

    DefaultPieDataset pieDataset = new DefaultPieDataset();
    for (Produit pr : produits) {
        pieDataset.setValue(pr.getNom(), new Integer(pr.getQuantiteInitial() - pr.getQuantiteDisponible()));

    }//from   w  w w .ja va2 s  .com
    JFreeChart chart = ChartFactory.createPieChart("Pie Chart", pieDataset, true, true, true);
    //.createPieChart(PieChart, pieDataset, true, true, true);
    PiePlot P = (PiePlot) chart.getPlot();
    P.setForegroundAlpha(TOP_ALIGNMENT);
    ChartFrame frame = new ChartFrame("Pie Chart", chart);
    frame.setVisible(true);
    frame.setSize(450, 500);

}

From source file:fr.mael.microrss.dao.CategoryDaoTest.java

@Test
public void testList() {
    User user = new User();
    user.setId(17);//from   w  ww .j ava  2 s  .c o  m
    List<Category> categories = categoryDao.forUser(user);
    Assert.assertEquals(new Integer(5), new Integer(categories.size()));
    Category cat1 = getCategory(1, categories);
    Assert.assertEquals(new Integer(1), new Integer(cat1.getUserFeeds().size()));
    Assert.assertEquals(new Integer(1), cat1.getUserFeeds().iterator().next().getFeed().getId());
    Category cat2 = getCategory(2, categories);
    Assert.assertEquals(new Integer(0), new Integer(cat2.getUserFeeds().size()));
    Category cat3 = getCategory(3, categories);
    Assert.assertEquals(new Integer(2), new Integer(cat3.getUserFeeds().size()));
    Category cat4 = getCategory(2, categories);
    Assert.assertEquals(new Integer(0), new Integer(cat4.getUserFeeds().size()));
    Category cat5 = getCategory(2, categories);
    Assert.assertEquals(new Integer(0), new Integer(cat5.getUserFeeds().size()));
}

From source file:com.sharmila.hibernatespringsecurity.dao.impl.RoleDaoImpl.java

@Override
public void delete(int id) {
    session = sessionFactory.openSession();
    transaction = session.beginTransaction();
    Role role = (Role) session.get(Role.class, new Integer(id));
    if (role != null) {
        session.delete(role);//w w  w. j  ava2s .  c  o  m
    }
    transaction.commit();
    session.close();
}

From source file:FibonacciTest.java

public int calculateOnlyWithCache(int x) {
    Integer v1 = values.get(new Integer(x - 1));
    Integer v2 = values.get(new Integer(x - 2));
    Integer key = new Integer(x);
    Integer result = values.get(key);

    if (result != null)
        return result.intValue();

    if ((v1 == null) || (v2 == null))
        throw new IllegalArgumentException("values not in cache");
    result = new Integer(v1.intValue() + v2.intValue());

    values.putIfAbsent(key, result);//  ww w .  j a  v a  2  s.  c o  m
    return result.intValue();
}

From source file:ThreadIDMain.java

private synchronized Integer getNewID() {
    Integer id = new Integer(nextID);
    nextID++;
    return id;
}

From source file:com.googlecode.tawus.jfreechart.pages.ChartPage.java

public JFreeChart getChart() {
    DefaultPieDataset pieDataset = new DefaultPieDataset();

    pieDataset.setValue("One", new Integer(10));
    pieDataset.setValue("Two", new Integer(20));
    pieDataset.setValue("Three", new Integer(30));
    pieDataset.setValue("Four", new Integer(10));
    pieDataset.setValue("Five", new Integer(20));
    pieDataset.setValue("Six", new Integer(10));

    return ChartFactory.createPieChart("Pie Chart using JFreeChart", pieDataset, true, true, true);
}

From source file:com.yahoo.egads.models.adm.SimpleThresholdModel.java

public SimpleThresholdModel(Properties config) {
    super(config);

    this.threshold = parseMap(config.getProperty("THRESHOLD"));
    this.maxHrsAgo = new Integer(config.getProperty("MAX_ANOMALY_TIME_AGO"));
    if (config.getProperty("THRESHOLD") != null && this.threshold.isEmpty() == true) {
        throw new IllegalArgumentException("THRESHOLD PARSE ERROR");
    }/*from  w ww  .  j a  va 2 s . c om*/
    if (config.getProperty("SIMPLE_THRESHOLD_TYPE") != null) {
        simpleThrType = config.getProperty("SIMPLE_THRESHOLD_TYPE");
    }
}

From source file:fr.mael.microrss.dao.UserDaoTest.java

@Test
public void testLoadByUsername() {
    User user = userDao.loadByUsername("admin");
    Assert.assertEquals(new Integer(17), user.getId());
}

From source file:fr.mael.microrss.service.CategoryServiceTest.java

@Test
public void testNb() {
    login(17);//  w w w  .j  a  v a2  s. com
    List<Category> categories = categoryService.list();
    Category cat1 = getCategory(1, categories);
    Category cat3 = getCategory(3, cat1.getCategories());
    Assert.assertEquals(new Integer(2), new Integer(cat3.getUserFeeds().size()));
}