List of usage examples for java.lang Integer MIN_VALUE
int MIN_VALUE
To view the source code for java.lang Integer MIN_VALUE.
Click Source Link
From source file:org.age.services.discovery.internal.HazelcastDiscoveryService.java
@Override public int getPhase() { return Integer.MIN_VALUE + 1; }
From source file:ExposedInt.java
public boolean action(Event evt, Object arg) { if (evt.target instanceof Button) { String bname = (String) arg; if (bname.equals(ExposedIntStringTable.increment)) { ++value;/*from w ww. j av a 2s . co m*/ } else if (bname.equals(ExposedIntStringTable.decrement)) { --value; } else if (bname.equals(ExposedIntStringTable.min)) { value = 0x80000000; } else if (bname.equals(ExposedIntStringTable.max)) { value = 0x7fffffff; } else if (bname.equals(ExposedIntStringTable.zero)) { value = 0; } else if (bname.equals(ExposedIntStringTable.negate)) { value *= -1; } UpdateNumberFields(); enableDisableButton(maximumButton, Integer.MAX_VALUE); enableDisableButton(minimumButton, Integer.MIN_VALUE); enableDisableButton(zeroButton, 0); } return true; }
From source file:desmoj.extensions.visualization2d.engine.modelGrafic.StatisticGrafic.java
/** * Construct the smallest rectangle,/* ww w . j a v a 2 s.c o m*/ * which include the positions of all statistics in view * @param viewId id of view * @return smallest Rectangle when an StatisticGrafic exist, * null otherwise. */ public static Rectangle getBoundsExternGlobal(Model model, String viewId) { boolean found = false; double minX = (double) Integer.MAX_VALUE / 2; double minY = (double) Integer.MAX_VALUE / 2; double maxX = (double) Integer.MIN_VALUE / 2; double maxY = (double) Integer.MIN_VALUE / 2; String[] id = model.getStatistics().getAllIds(); //System.out.println("Anz. Entities: "+id.length); for (int i = 0; i < id.length; i++) { Statistic statistic = model.getStatistics().get(id[i]); StatisticGrafic statistikGrafic = (StatisticGrafic) statistic.getGrafic(); if (statistikGrafic != null && statistikGrafic.getViewId().equals(viewId)) { found = true; Rectangle r = statistikGrafic.getBoundsExtern(); minX = Math.floor(Math.min(minX, r.getX())); minY = Math.floor(Math.min(minY, r.getY())); maxX = Math.ceil(Math.max(maxX, r.getX() + r.width)); maxY = Math.ceil(Math.max(maxY, r.getY() + r.height)); //System.out.println(statistic.getId()+" "+statistikGrafic.pointExtern.getX()+" "+statistikGrafic.pointExtern.getY()); } } Rectangle r = null; if (found) r = new Rectangle((int) Math.round(minX), (int) Math.round(minY), (int) Math.round(maxX - minX), (int) Math.round(maxY - minY)); //System.out.println("StatisticGrafic: BoundsExtern: "+r); return r; }
From source file:eu.scidipes.toolkits.palibrary.impl.FormFieldImpl.java
/** * @param o// ww w . j a v a2 s .c om * @return * @see java.lang.Comparable#compareTo(java.lang.Object) */ @Override public int compareTo(final FormField o) { final int left = getFieldID() != null ? getFieldID().intValue() : Integer.MAX_VALUE; final int right = o.getFieldID() != null ? o.getFieldID().intValue() : Integer.MIN_VALUE; return Integer.signum(left - right); }
From source file:EntityClustering.MarkovClustering.java
public int getMaxEntityId(int[] entityIds) { int maxId = Integer.MIN_VALUE; for (int i = 0; i < entityIds.length; i++) { if (maxId < entityIds[i]) { maxId = entityIds[i];//from ww w. j a v a 2 s .c om } } return maxId; }
From source file:org.literacyapp.web.content.multimedia.audio.AudioEditController.java
@RequestMapping(value = "/{id}", method = RequestMethod.POST) public String handleSubmit(HttpSession session, Audio audio, @RequestParam("bytes") MultipartFile multipartFile, BindingResult result, Model model) { logger.info("handleSubmit"); if (StringUtils.isBlank(audio.getTranscription())) { result.rejectValue("transcription", "NotNull"); } else {/*from w w w .j av a 2s .co m*/ Audio existingAudio = audioDao.read(audio.getTranscription(), audio.getLocale()); if ((existingAudio != null) && !existingAudio.getId().equals(audio.getId())) { result.rejectValue("transcription", "NonUnique"); } } try { byte[] bytes = multipartFile.getBytes(); if (multipartFile.isEmpty() || (bytes == null) || (bytes.length == 0)) { result.rejectValue("bytes", "NotNull"); } else { String originalFileName = multipartFile.getOriginalFilename(); logger.info("originalFileName: " + originalFileName); if (originalFileName.toLowerCase().endsWith(".mp3")) { audio.setAudioFormat(AudioFormat.MP3); } else if (originalFileName.toLowerCase().endsWith(".ogg")) { audio.setAudioFormat(AudioFormat.OGG); } else if (originalFileName.toLowerCase().endsWith(".wav")) { audio.setAudioFormat(AudioFormat.WAV); } else { result.rejectValue("bytes", "typeMismatch"); } if (audio.getAudioFormat() != null) { String contentType = multipartFile.getContentType(); logger.info("contentType: " + contentType); audio.setContentType(contentType); audio.setBytes(bytes); // TODO: convert to a default audio format? } } } catch (IOException e) { logger.error(e); } if (result.hasErrors()) { model.addAttribute("audio", audio); model.addAttribute("contentLicenses", ContentLicense.values()); model.addAttribute("literacySkills", LiteracySkill.values()); model.addAttribute("numeracySkills", NumeracySkill.values()); model.addAttribute("contentCreationEvents", contentCreationEventDao.readAll(audio)); return "content/multimedia/audio/edit"; } else { audio.setTranscription(audio.getTranscription().toLowerCase()); audio.setTimeLastUpdate(Calendar.getInstance()); audio.setRevisionNumber(Integer.MIN_VALUE); audioDao.update(audio); Contributor contributor = (Contributor) session.getAttribute("contributor"); ContentCreationEvent contentCreationEvent = new ContentCreationEvent(); contentCreationEvent.setContributor(contributor); contentCreationEvent.setContent(audio); contentCreationEvent.setCalendar(Calendar.getInstance()); contentCreationEventDao.update(contentCreationEvent); if (EnvironmentContextLoaderListener.env == Environment.PROD) { String text = URLEncoder.encode(contributor.getFirstName() + " just edited an Audio:\n" + " Language: " + audio.getLocale().getLanguage() + "\n" + " Transcription: \"" + audio.getTranscription() + "\"\n" + " Audio format: " + audio.getAudioFormat() + "\n" + "See ") + "http://literacyapp.org/content/multimedia/audio/list"; String iconUrl = contributor.getImageUrl(); SlackApiHelper.postMessage(Team.CONTENT_CREATION, text, iconUrl, "http://literacyapp.org/audio/" + audio.getId() + "." + audio.getAudioFormat().toString().toLowerCase()); } return "redirect:/content/multimedia/audio/list"; } }
From source file:com.github.jgility.core.util.ReleasePlanningUtils.java
private static int safeLongToInt(long l) { if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) { throw new IllegalArgumentException(l + " cannot be cast to int without changing its value."); }/* www.j av a 2s . c o m*/ return (int) l; }
From source file:com.magnet.android.mms.request.GenericResponseParserPrimitiveTest.java
@SmallTest public void testGenericPrimitiveResponse() throws MobileException, IOException { GenericResponseParser<String> parser = new GenericResponseParser<String>(String.class, null, GenericRestConstants.CONTENT_TYPE_TEXT_PLAIN, null); String response = "\"Whatever is the deal\""; String result = (String) parser.parseResponse(response.getBytes()); assertEquals("Whatever is the deal", result); result = (String) parser.parseResponse((byte[]) null); assertEquals(null, result);/*from w w w . j a v a2 s .co m*/ GenericResponseParser<Character> cparser = new GenericResponseParser<Character>(char.class, null, GenericRestConstants.CONTENT_TYPE_TEXT_PLAIN, null); char cresponse = 'p'; try { Character cresult = (Character) cparser.parseResponse(String.valueOf(cresponse).getBytes("UTF-8")); assertEquals(Character.valueOf(cresponse), cresult); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } GenericResponseParser<Integer> nparser = new GenericResponseParser<Integer>(Integer.class, null, GenericRestConstants.CONTENT_TYPE_TEXT_PLAIN, null); String strResponse = Integer.toString(Integer.MIN_VALUE); Integer nresult = (Integer) nparser.parseResponse(strResponse.getBytes()); assertEquals(Integer.MIN_VALUE, nresult.intValue()); }
From source file:com.example.clientapplication.MainActivity.java
/** * Gets the current registration ID for application on GCM service, if there is one. * <p>/* w w w . j a va 2 s .c o m*/ * If result is empty, the app needs to register. * * @return registration ID, or empty string if there is no existing * registration ID. */ private String getRegistrationId(Context context) { final SharedPreferences prefs = getGcmPreferences(context); String registrationId = prefs.getString(PROPERTY_REG_ID, ""); if (registrationId.equals("")) { Log.i(TAG, "Registration not found."); return ""; } // Check if app was updated; if so, it must clear the registration ID // since the existing regID is not guaranteed to work with the new // app version. int registeredVersion = prefs.getInt(PROPERTY_APP_VERSION, Integer.MIN_VALUE); int currentVersion = getAppVersion(context); if (registeredVersion != currentVersion) { Log.i(TAG, "App version changed."); return ""; } return registrationId; }
From source file:org.openmrs.module.sdmxhdintegration.reporting.extension.SDMXHDCrossSectionalReportRenderer.java
/** * @see org.openmrs.module.report.renderer.ReportRenderer#getRenderingModes(org.openmrs.module.report.ReportDefinition) *///from ww w . j av a2 s . c om @Override public Collection<RenderingMode> getRenderingModes(ReportDefinition definition) { if (definition.getDataSetDefinitions() == null || definition.getDataSetDefinitions().size() != 1) { return null; } // check that a corresponding SDMX-HD Message exists SDMXHDService sdmxhdService = Context.getService(SDMXHDService.class); List<KeyFamilyMapping> allKeyFamilyMappings = sdmxhdService.getAllKeyFamilyMappings(); boolean mappingExists = false; for (KeyFamilyMapping kfm : allKeyFamilyMappings) { if (kfm.getReportDefinitionId() != null && kfm.getReportDefinitionId().equals(definition.getId())) { mappingExists = true; break; } } if (mappingExists) { return Collections.singleton(new RenderingMode(this, this.getLabel(), null, Integer.MIN_VALUE)); } else { return null; } }