List of usage examples for java.lang Integer valueOf
@HotSpotIntrinsicCandidate public static Integer valueOf(int i)
From source file:ch.rasc.s4ws.snake.SnakeTimer.java
protected static synchronized void addSnake(Snake snake) { if (snakes.size() == 0) { startTimer();//from w ww.j a v a 2 s . c o m } snakes.put(Integer.valueOf(snake.getId()), snake); }
From source file:com.editor.SkillTypeEditor.java
@Override public void setAsText(String text) { SkillType skilltype = this.skillTypeService.getSkillType(Integer.valueOf(text)); this.setValue(skilltype); }
From source file:com.editor.EducationEditor.java
@Override public void setAsText(String text) { Education education = this.educationService.getEducation(Integer.valueOf(text)); this.setValue(education); }
From source file:net.sf.commons.ssh.directory.Description.java
static Description loadDescription(Element element) { Description description = new Description(); description.className = StringUtils.trim(getFromElement(element, "class-name", true)); //$NON-NLS-1$ description.name = getFromElement(element, "name", true); //$NON-NLS-1$ description.license = getFromElement(element, "license", false); //$NON-NLS-1$ description.url = getFromElement(element, "url", true); //$NON-NLS-1$ try {/*from w w w . j a va 2s . c om*/ description.priority = Integer.valueOf(getFromElement(element, "priority", false)); } catch (NumberFormatException e) { description.priority = 100; } return description; }
From source file:Main.java
public static float getX(MotionEvent event, int index) { float value;//from w w w . j a va 2s .c om try { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ECLAIR) { if (index == 0) { value = event.getX(); } else { value = 0; } } else { value = ((Float) (event.getClass().getMethod("getX", new Class[] { int.class }).invoke(event, new Object[] { Integer.valueOf(index) }))).floatValue(); } } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (SecurityException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } return value; }
From source file:com.gmind7.bakery.websocket.SnakeTimer.java
public static synchronized void addSnake(Snake snake) { if (snakes.size() == 0) { startTimer();/*from w w w .jav a2 s. c o m*/ } snakes.put(Integer.valueOf(snake.getId()), snake); }
From source file:ReplaceWorker.java
public void run() { for (int i = 0; i < 100; i++) { Main.map.merge("key", Integer.valueOf(1), (ov, nv) -> { return ov + 1; });// w ww . j a va2 s.c o m } }
From source file:gate.termraider.util.Utilities.java
/** This is a little dodgy because it forces the new value * to be Integer; to be used carefully.// w ww . j a va2 s . co m * @param map * @param key * @param increment * @return */ public static int incrementMap(Map<Term, Number> map, Term key, int increment) { int count = 0; if (map.containsKey(key)) { count = map.get(key).intValue(); } count += increment; map.put(key, Integer.valueOf(count)); return count; }
From source file:com.tedx.logics.AttendeeLogic.java
public static Bundle GetCurrentDancers(Resources res, String EventUniqueId) { String Action = "GetAttendeeByUniqueId"; JSONObject requestJSONParameters = new JSONObject(); try {//from w ww.j av a 2 s .c o m requestJSONParameters.put("EventId", Integer.valueOf(res.getString(R.string.eventId))); requestJSONParameters.put("EventUniqueId", EventUniqueId); } catch (JSONException e) { // TODO Auto-generated catch block return null; } String URL = res.getString(R.string.WebServiceAddress) + Action; JSONObject responseJSON = WebServices.SendHttpPost(URL, requestJSONParameters); if (responseJSON != null) { try { if (responseJSON.getBoolean("IsSuccessful")) { Bundle ret = new Bundle(); ret.putInt("AttendeeId", responseJSON.getInt("AttendeeId")); ret.putString("FirstName", responseJSON.getString("FirstName")); ret.putString("LastName", responseJSON.getString("LastName")); ret.putString("ContactNumber", responseJSON.getString("ContactNumber")); ret.putString("Website", responseJSON.getString("Website")); ret.putString("Email", responseJSON.getString("Email")); ret.putString("Facebook", responseJSON.getString("Facebook")); ret.putString("Twitter", responseJSON.getString("Twitter")); ret.putString("Description", responseJSON.getString("Description")); return ret; } else return null; } catch (JSONException e) { // TODO Auto-generated catch block return null; } } else return null; }
From source file:controllers.FileHandler.java
/** * brief: read content of a given file to the proper list * @param strFilePath - path of given file e.g. "D:\\EGYETEM\\Szakdolgozat\\Mernoki_tervezes\\update files\\sr28upd\\ADD_NUTR.txt" * @param strFileType - type of the given file e.g. AddFood * @param TList - list to fill with data e.g. List<FileFoodStruct> ListFFS *///from w w w. j ava2 s. c o m public static <T> void readFile(String strFilePath, List<T> TList, String strFileType) { TList.clear(); try { File file = FileUtils.getFile(strFilePath); LineIterator iter = FileUtils.lineIterator(file); while (iter.hasNext()) { String strLine = iter.next(); switch (strFileType) { case "ADD_FOOD": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructFood Object = new FileStructFood(strList.get(0), strList.get(2), strList.get(3), Integer.valueOf(strList.get(8))); TList.add((T) Object); //System.out.println(Object.toString()); break; } case "ADD_NUTR": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructNutrient Object = new FileStructNutrient(strList.get(0), strList.get(1), Double.valueOf(strList.get(2))); TList.add((T) Object); //System.out.println(Object.toString()); break; } case "ADD_WGT": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructWeight Object = new FileStructWeight(strList.get(0), Double.valueOf(strList.get(2)), strList.get(3), Double.valueOf(strList.get(4))); TList.add((T) Object); //System.out.println(Object.toString()); break; } case "CHG_FOOD": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructFood Object = new FileStructFood(strList.get(0), strList.get(2), strList.get(3), Integer.valueOf(strList.get(8))); TList.add((T) Object); //System.out.println(Object.toString()); break; } case "CHG_NUTR": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructNutrient Object = new FileStructNutrient(strList.get(0), strList.get(1), Double.valueOf(strList.get(2))); TList.add((T) Object); //System.out.println(Object.toString()); break; } case "CHG_WGT": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructWeight Object = new FileStructWeight(strList.get(0), Double.valueOf(strList.get(2)), strList.get(3), Double.valueOf(strList.get(4))); TList.add((T) Object); //System.out.println(Object.toString()); break; } case "DEL_FOOD": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructFood Object = new FileStructFood(strList.get(0), strList.get(1)); TList.add((T) Object); //System.out.println(Object.toString()); break; } case "DEL_NUTR": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructNutrient Object = new FileStructNutrient(strList.get(0), strList.get(1)); TList.add((T) Object); //System.out.println(Object.toString()); break; } case "DEL_WGT": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructWeight Object = new FileStructWeight(strList.get(0), Double.valueOf(strList.get(2)), strList.get(3), Double.valueOf(strList.get(4))); TList.add((T) Object); //System.out.println(Object.toString()); break; } case "ADD_NDEF": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructNutrient Object = new FileStructNutrient(strList.get(0), strList.get(1), strList.get(2), strList.get(3), Integer.valueOf(strList.get(4))); TList.add((T) Object); System.out.println(strList.get(0) + " " + strList.get(1) + " " + strList.get(2) + " " + strList.get(3) + " " + Integer.valueOf(strList.get(4))); break; } case "CHG_NDEF": { ArrayList<String> strList = ParseUpdateFile(strLine); FileStructNutrient Object = new FileStructNutrient(strList.get(0), strList.get(1), strList.get(2), strList.get(3), Integer.valueOf(strList.get(4))); TList.add((T) Object); System.out.println(strList.get(0) + " " + strList.get(1) + " " + strList.get(2) + " " + strList.get(3) + " " + Integer.valueOf(strList.get(4))); break; } case "LOG_FILE": { ArrayList<String> strList = ParseLogFile(strLine); TraceMessage Object = new TraceMessage(strList.get(0), strList.get(1)); TList.add((T) Object); break; } } } iter.close(); } catch (IOException ex) { Logger.getLogger(FileHandler.class.getName()).log(Level.SEVERE, null, ex); } finally { return; } }