List of usage examples for java.lang Integer MAX_VALUE
int MAX_VALUE
To view the source code for java.lang Integer MAX_VALUE.
Click Source Link
From source file:com.ibm.watson.developer_cloud.professor_languo.it.endpoints.IT_GetThread.java
/** * Test what happens when a properly formated id request is sent to endpoint * /*w w w . j av a 2 s. c o m*/ * @throws Exception */ @Test public void getThreadWithInteger() throws Exception { // Set up the connection String id = String.valueOf(Integer.MAX_VALUE); String getUrl = GET_URL + id; // Execute the query and get the response HttpResponse response = httpClient.execute(new HttpGet(getUrl)); String jsonString = EntityUtils.toString(response.getEntity()); // The response has to be a 200 if the id is found or 404 if it is not Assert.assertTrue("response was: " + jsonString, response.getStatusLine().getStatusCode() == 404 || response.getStatusLine().getStatusCode() == 200); }
From source file:Main.java
@SuppressWarnings("deprecation") public static boolean isServiceRunning(String activityClass, Context context) { ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningTaskInfo task : manager.getRunningTasks(Integer.MAX_VALUE)) { if (activityClass.equalsIgnoreCase(task.baseActivity.getClassName())) return true; }// w w w . j av a2 s . c o m return false; }
From source file:com.espertech.esper.epl.datetime.calop.CalendarOpPlusFastAddHelper.java
public static CalendarOpPlusFastAddResult computeNextDue(long currentTime, TimePeriod timePeriod, Calendar reference) {//from w w w .j a v a 2 s . c o m if (reference.getTimeInMillis() > currentTime) { return new CalendarOpPlusFastAddResult(0, reference); } // add one time period Calendar work = (Calendar) reference.clone(); if (DEBUG && log.isDebugEnabled()) { log.debug("Work date is " + DateTime.print(work)); } CalendarOpPlusMinus.actionSafeOverflow(work, 1, timePeriod); long inMillis = work.getTimeInMillis(); if (inMillis > currentTime) { return new CalendarOpPlusFastAddResult(1, work); } if (DEBUG && log.isDebugEnabled()) { log.debug("Work date is " + DateTime.print(work)); } long factor = 1; // determine multiplier long deltaCurrentToStart = currentTime - reference.getTimeInMillis(); long deltaAddedOne = work.getTimeInMillis() - reference.getTimeInMillis(); double multiplierDbl = (deltaCurrentToStart / deltaAddedOne) - 1; long multiplierRoundedLong = (long) multiplierDbl; // handle integer max while (multiplierRoundedLong > Integer.MAX_VALUE) { CalendarOpPlusMinus.actionSafeOverflow(work, Integer.MAX_VALUE, timePeriod); factor += Integer.MAX_VALUE; multiplierRoundedLong -= Integer.MAX_VALUE; if (DEBUG && log.isDebugEnabled()) { log.debug("Work date is " + DateTime.print(work) + " factor " + factor); } } // add int multiplierRoundedInt = (int) multiplierRoundedLong; CalendarOpPlusMinus.actionSafeOverflow(work, multiplierRoundedInt, timePeriod); factor += multiplierRoundedInt; // if below, add more if (work.getTimeInMillis() <= currentTime) { while (work.getTimeInMillis() <= currentTime) { CalendarOpPlusMinus.actionSafeOverflow(work, 1, timePeriod); factor += 1; if (DEBUG && log.isDebugEnabled()) { log.debug("Work date is " + DateTime.print(work) + " factor " + factor); } } return new CalendarOpPlusFastAddResult(factor, work); } // we are over while (work.getTimeInMillis() > currentTime) { CalendarOpPlusMinus.actionSafeOverflow(work, -1, timePeriod); factor -= 1; if (DEBUG && log.isDebugEnabled()) { log.debug("Work date is " + DateTime.print(work) + " factor " + factor); } } CalendarOpPlusMinus.actionSafeOverflow(work, 1, timePeriod); if (DEBUG && log.isDebugEnabled()) { log.debug("Work date is " + DateTime.print(work) + " factor " + factor); } return new CalendarOpPlusFastAddResult(factor + 1, work); }
From source file:com.nesscomputing.migratory.migration.MigrationPlan.java
public MigrationPlan addMigration(final String personalityName) { addMigration(personalityName, Integer.MAX_VALUE, 0); return this; }
From source file:com.github.ferstl.spring.jdbc.oracle.TestBatchPreparedStatementSetter.java
@Override public void setValues(PreparedStatement ps, int i) throws SQLException { StatementCreatorUtils.setParameterValue(ps, 1, SqlTypeValue.TYPE_UNKNOWN, Integer.MAX_VALUE); StatementCreatorUtils.setParameterValue(ps, 2, SqlTypeValue.TYPE_UNKNOWN, this.parameters[i]); }
From source file:edu.wisc.jmeter.dao.JdbcMonitorDaoTest.java
@Before public void setup() throws Exception { this.ds = new SimpleDriverDataSource(new jdbcDriver(), "jdbc:hsqldb:mem:JdbcMonitorTest", "sa", ""); this.jdbcTemplate = new JdbcTemplate(this.ds); SimpleJdbcTestUtils.executeSqlScript(new SimpleJdbcTemplate(this.jdbcTemplate), new ClassPathResource("/tables_hsql.sql"), false); this.jdbcMonitorDao = new JdbcMonitorDao(this.ds, Integer.MAX_VALUE, Integer.MAX_VALUE); this.jdbcMonitorDao.afterPropertiesSet(); }
From source file:edu.msu.cme.rdp.readseq.utils.ResampleSeqFile.java
public static void select(String infiledir, String outdir, int num_of_seqs, int subregion_length) throws IOException { File outdirFile = new File(outdir); if (!outdirFile.exists()) { outdirFile.mkdir();/* w w w .j av a 2s . co m*/ } File infile = new File(infiledir); // need to find the smallest sample size int min_num_of_seqs = Integer.MAX_VALUE; if (infile.isDirectory()) { for (File f : infile.listFiles()) { IndexedSeqReader reader = new IndexedSeqReader(f); if (reader.getSeqIdSet().size() < min_num_of_seqs) { min_num_of_seqs = reader.getSeqIdSet().size(); } } } else { IndexedSeqReader reader = new IndexedSeqReader(infile); if (reader.getSeqIdSet().size() < min_num_of_seqs) { min_num_of_seqs = reader.getSeqIdSet().size(); } } if (num_of_seqs == 0) { // if user dis not specify the number, use the minimum sample size num_of_seqs = min_num_of_seqs; } if (min_num_of_seqs < num_of_seqs) { throw new IllegalArgumentException("The smallest sample size is " + min_num_of_seqs + ". Please modify the value for option num_selection"); } String subregion = (subregion_length == 0) ? "" : "_" + subregion_length + "bp"; if (infile.isDirectory()) { for (File f : infile.listFiles()) { File outfile = new File(outdir, "subset_" + subregion + f.getName()); selectOne(f, num_of_seqs, subregion_length, outfile); } } else { String infile_prefix = infile.getName(); String infile_suffix = ""; int index = infile.getName().lastIndexOf("."); if (index != -1) { infile_prefix = infile.getName().substring(0, index); infile_suffix = infile.getName().substring(index); } File outfile = new File(outdir, infile_prefix + ".sub" + subregion + infile_suffix); selectOne(infile, num_of_seqs, subregion_length, outfile); } }
From source file:com.mothsoft.alexis.engine.textual.DocumentFeatures.java
public DocumentFeatures(final Document document, final DocumentFeatureContext context) { this.termVector = new OpenMapRealVector(Integer.MAX_VALUE); this.associationVector = new OpenMapRealVector(Integer.MAX_VALUE); this.nameVector = new OpenMapRealVector(Integer.MAX_VALUE); for (final DocumentAssociation association : document.getDocumentAssociations()) { final Integer id = context.getContextId(association); increment(associationVector, id, 1); }//from ww w.j av a 2 s . c om for (final DocumentTerm documentTerm : document.getDocumentTerms()) { final Integer termId = context.getContextId(documentTerm.getTerm()); increment(termVector, termId, documentTerm.getCount()); } for (final DocumentNamedEntity entity : document.getNamedEntities()) { final Integer id = context.getContextId(entity); increment(nameVector, id, 1); } }
From source file:com.microsoft.azure.servicebus.samples.deadletterqueue.DeadletterQueue.java
public void run(String connectionString) throws Exception { CompletableFuture<Void> receiveTask; CompletableFuture<Void> fixUpTask; IMessageSender sendClient;/*from w w w . j a v a2 s. c om*/ sendClient = ClientFactory.createMessageSenderFromConnectionStringBuilder( new ConnectionStringBuilder(connectionString, "BasicQueue")); // max delivery-count scenario this.sendMessagesAsync(sendClient, 1).join(); this.exceedMaxDelivery(connectionString, "BasicQueue").join(); // fix-up scenario this.sendMessagesAsync(sendClient, Integer.MAX_VALUE); ExecutorService executorService = Executors.newCachedThreadPool(); receiveTask = this.receiveMessagesAsync(connectionString, "BasicQueue", executorService); fixUpTask = this.PickUpAndFixDeadletters(connectionString, "BasicQueue", sendClient, executorService); // wait for ENTER or 10 seconds elapsing waitForEnter(10); receiveTask.cancel(true); fixUpTask.cancel(true); CompletableFuture.allOf(sendClient.closeAsync(), receiveTask.exceptionally(t -> { if (t instanceof CancellationException) { return null; } throw new RuntimeException((Throwable) t); }), fixUpTask.exceptionally(t -> { if (t instanceof CancellationException) { return null; } throw new RuntimeException((Throwable) t); })).join(); executorService.shutdown(); }
From source file:BoxSample.java
private static void changeWidth(JComponent comp) { comp.setAlignmentX(Component.CENTER_ALIGNMENT); comp.setAlignmentY(Component.CENTER_ALIGNMENT); Dimension dim = comp.getPreferredSize(); dim.width = Integer.MAX_VALUE; comp.setMaximumSize(dim);// w w w . j av a2 s. com }