List of usage examples for java.lang Long MIN_VALUE
long MIN_VALUE
To view the source code for java.lang Long MIN_VALUE.
Click Source Link
From source file:com.navercorp.pinpoint.common.buffer.AutomaticBufferTest.java
@Test public void testPutVLong() throws Exception { Buffer buffer = new AutomaticBuffer(0); buffer.putVLong(Long.MAX_VALUE); buffer.putVLong(Long.MIN_VALUE); buffer.putVLong(0L);/*from www.j a va 2 s . co m*/ buffer.putVLong(1L); buffer.putVLong(12345L); buffer.setOffset(0); Assert.assertEquals(buffer.readVLong(), Long.MAX_VALUE); Assert.assertEquals(buffer.readVLong(), Long.MIN_VALUE); Assert.assertEquals(buffer.readVLong(), 0L); Assert.assertEquals(buffer.readVLong(), 1L); Assert.assertEquals(buffer.readVLong(), 12345L); }
From source file:com.github.rvesse.airline.restrictions.factories.RangeRestrictionFactory.java
protected RangeRestriction createLongRange(Annotation annotation) { LongRange iRange = (LongRange) annotation; return new RangeRestriction( iRange.min() != Long.MIN_VALUE || !iRange.minInclusive() ? Long.valueOf(iRange.min()) : null, iRange.minInclusive(),//from w w w . j a va 2 s .com iRange.max() != Long.MAX_VALUE || !iRange.maxInclusive() ? Long.valueOf(iRange.max()) : null, iRange.maxInclusive(), LONG_COMPARATOR); }
From source file:com.ning.arecibo.collector.persistent.TestTimelineAggregator.java
private Map<Integer, ScalarSample> createEvent(final long ts) { return ImmutableMap.<Integer, ScalarSample>of(minHeapUsedKindId, new ScalarSample(SampleOpcode.LONG, Long.MIN_VALUE + ts), maxHeapUsedKindId, new ScalarSample(SampleOpcode.LONG, Long.MAX_VALUE - ts)); }
From source file:com.joliciel.jochre.search.JochreIndexBuilderImpl.java
private void processDocument(File documentDir, boolean forceUpdate) { try {/*ww w . ja v a 2s . c o m*/ File instructionsFile = new File(documentDir, "instructions.txt"); boolean updateIndex = false; if (instructionsFile.exists()) { String instructions = null; Scanner scanner = new Scanner( new BufferedReader(new InputStreamReader(new FileInputStream(instructionsFile), "UTF-8"))); while (scanner.hasNextLine()) { instructions = scanner.nextLine(); break; } scanner.close(); LOG.info("Instructions: " + instructions + " for " + documentDir.getName()); if (instructions.equals("delete")) { this.deleteDocumentInternal(documentDir); File lastIndexDateFile = new File(documentDir, "indexDate.txt"); if (lastIndexDateFile.exists()) lastIndexDateFile.delete(); return; } else if (instructions.equals("skip")) { return; } else if (instructions.equals("update")) { updateIndex = true; } else { LOG.info("Unknown instructions."); } } File zipFile = new File(documentDir, documentDir.getName() + ".zip"); if (!zipFile.exists()) { LOG.info("Nothing to index in " + documentDir.getName()); return; } File metaDataFile = new File(documentDir, "metadata.txt"); if (!metaDataFile.exists()) { LOG.info("Skipping: OCR analysis incomplete for " + documentDir.getName()); return; } if (forceUpdate) updateIndex = true; if (!updateIndex) { LOG.debug("Checking last update date on " + documentDir.getName()); long zipDate = zipFile.lastModified(); File lastIndexDateFile = new File(documentDir, "indexDate.txt"); long lastIndexDate = Long.MIN_VALUE; if (lastIndexDateFile.exists()) { Scanner scanner = new Scanner(new BufferedReader( new InputStreamReader(new FileInputStream(lastIndexDateFile), "UTF-8"))); while (scanner.hasNextLine()) { lastIndexDate = Long.parseLong(scanner.nextLine()); break; } scanner.close(); } if (zipDate > lastIndexDate) updateIndex = true; } if (updateIndex) { this.updateDocumentInternal(documentDir); } else { LOG.info("Index for " + documentDir.getName() + "already up-to-date."); } // should update index? } catch (IOException ioe) { LogUtils.logError(LOG, ioe); throw new RuntimeException(ioe); } }
From source file:com.gsma.mobileconnect.impl.StartAuthenticationTest.java
@Test public void startAuthentication_withExpiredDiscoveryResponse_shouldThrowException() throws OIDCException, DiscoveryResponseExpiredException, IOException { // GIVEN//from w w w . jav a2 s .c o m IOIDC oidc = Factory.getOIDC(null); CaptureStartAuthenticationResponse captureStartAuthenticationResponse = new CaptureStartAuthenticationResponse(); DiscoveryResponse discoveryResponse = new DiscoveryResponse(true, new Date(Long.MIN_VALUE), 0, null, parseJson(OPERATOR_JSON_STRING)); // THEN thrown.expect(DiscoveryResponseExpiredException.class); thrown.expectMessage(containsString("discoveryResult has expired")); // WHEN oidc.startAuthentication(discoveryResponse, "", null, "", null, null, null, null, null, captureStartAuthenticationResponse); }
From source file:InlineSchemaValidator.java
/** Prints the results. */ public void printResults(PrintWriter out, String uri, long time, long memory, int repetition) { // filename.xml: 631 ms out.print(uri);//www . j a va 2 s .c o m out.print(": "); if (repetition == 1) { out.print(time); } else { out.print(time); out.print('/'); out.print(repetition); out.print('='); out.print(((float) time) / repetition); } out.print(" ms"); if (memory != Long.MIN_VALUE) { out.print(", "); out.print(memory); out.print(" bytes"); } out.println(); out.flush(); }
From source file:br.com.fidias.chance4j.Chance.java
/** * Return a random long between {@value Long#MIN_VALUE} and * {@value Long#MAX_VALUE}.// w w w.j a va 2s.c o m * <pre> * chance.getLong(); * => 16 * chance.getLong(); * => -921 * </pre> * * @return A single random long number * @throws ChanceException */ public long getLong() throws ChanceException { return getLong(Long.MIN_VALUE, Long.MAX_VALUE); }
From source file:com.erbjuder.logger.server.soap.services.LogMessageServiceBase.java
public Response create(Transactions transactions) throws WebServiceException { ///* www .jav a 2 s.c o m*/ // Return Response response = new Response(); response.setReturn(true); try { // // Parse SOAP Header and looking for MessageId String message_id = ""; HeaderList headerList = (com.sun.xml.ws.api.message.HeaderList) getWebServiceContext() .getMessageContext().get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY); for (Header header : headerList) { String urn = header.getNamespaceURI(); String key = header.getLocalPart(); String value = header.getStringContent().trim(); if (MESSAGE_ID_URN.equalsIgnoreCase(urn) && MESSAGE_ID.equalsIgnoreCase(key) && !value.isEmpty()) { //logger.log(Level.SEVERE, "[ Found messageId " + value + " ] "); message_id = value; response.setReturn(false); } else { logger.log(Level.SEVERE, "Got <Urn : Key> =[ " + urn + " ] " + " [ " + key + " ]"); } } // // Copy all element into new structure due the original list seams to be NOT modifiable // ( That's a requirement of Collection.sort method ) List<Transactions.Transaction> tmpTransactionList = transactions.getTransaction(); Transactions.Transaction[] transactionArray = tmpTransactionList .toArray(new Transaction[tmpTransactionList.size()]); Arrays.sort(transactionArray, new TransactionComparator()); for (Transactions.Transaction transaction : transactionArray) { LogMessage logMessage = new LogMessage(); // // Mandator String referenceId = transaction.getTransactionReferenceID(); if (message_id.isEmpty() || referenceId.equals(message_id)) { logMessage.setTransactionReferenceID(referenceId); } else { logger.log(Level.SEVERE, "[ TransactionReferanceId don't match SOAP Header content-id ] "); response.setReturn(false); } // // Server UTC time logMessage.setApplicationName(transaction.getApplicationName().toLowerCase()); logMessage.setIsError(transaction.isIsError()); logMessage.setUtcServerTimeStamp(TimeStampUtils.createSystemNanoTimeStamp()); try { long UTCLocalTimeStamp = transaction.getUTCLocalTimeStamp().toGregorianCalendar() .getTimeInMillis(); long UTCLocalTimeStampNanoSeconds = 0; try { UTCLocalTimeStampNanoSeconds = transaction.getUTCLocalTimeStampNanoSeconds(); } catch (Exception UTCLocalTimeStampNanoSecondsNotPressent) { //Skip client nano Timestamp timestamp = new Timestamp(UTCLocalTimeStamp); UTCLocalTimeStampNanoSeconds = timestamp.getNanos(); } if (Long.MAX_VALUE > UTCLocalTimeStamp && Long.MIN_VALUE < UTCLocalTimeStamp) { logger.log(Level.INFO, "UTCLocalTimeStamp=[ " + UTCLocalTimeStamp + " ]"); logger.log(Level.INFO, "UTCLocalTimeStampNanoSeconds=[ " + UTCLocalTimeStampNanoSeconds + " ]"); logger.log(Level.INFO, "createNanoTimeStamp=[ " + TimeStampUtils .createNanoTimeStamp(UTCLocalTimeStamp, UTCLocalTimeStampNanoSeconds) .getNanos() + " ]"); logMessage.setUtcLocalTimeStamp(TimeStampUtils.createNanoTimeStamp(UTCLocalTimeStamp, UTCLocalTimeStampNanoSeconds)); } else { logger.log(Level.INFO, "[ Invalid UTCLocalTimeStamp range, Use current system time instead! ] "); logger.log(Level.INFO, "[ " + UTCLocalTimeStamp + " ] "); logMessage.setUtcLocalTimeStamp(TimeStampUtils.createSystemNanoTimeStamp()); } } catch (Exception invalidDateException) { logger.log(Level.INFO, "[ Invalid log date! Use current system time instead! ] "); logger.log(Level.INFO, invalidDateException.getMessage()); logMessage.setUtcLocalTimeStamp(TimeStampUtils.createSystemNanoTimeStamp()); } // // Optional try { Date expiredTime = transaction.getExpiryDate().toGregorianCalendar().getTime(); if (expiredTime != null && Long.MAX_VALUE > expiredTime.getTime() && Long.MIN_VALUE < expiredTime.getTime()) { logMessage.setExpiredDate(expiredTime); } else { Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar.add(Calendar.MONTH, addNumberOfMonth); logMessage.setExpiredDate(calendar.getTime()); } } catch (Exception invalidExiredDateException) { logger.log(Level.INFO, "[ Invalid ExpiryDate! Use default expired time instead! ] "); logger.log(Level.INFO, invalidExiredDateException.getMessage()); Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar.add(Calendar.MONTH, addNumberOfMonth); logMessage.setExpiredDate(calendar.getTime()); } // // Transaction point info if (transaction.getTransactionLogPointInfo() != null) { String flowName = transaction.getTransactionLogPointInfo().getFlowName().trim().toLowerCase(); String flowPointName = transaction.getTransactionLogPointInfo().getFlowPointName().trim() .toLowerCase(); if (flowName.isEmpty()) { flowName = transaction.getApplicationName().trim().toLowerCase(); } if (flowPointName.isEmpty()) { flowPointName = ""; } logMessage.setFlowName(flowName); logMessage.setFlowPointName(flowPointName); } else { logMessage.setFlowName(""); logMessage.setFlowPointName(""); } logger.log(Level.INFO, "Flow done ]"); // // Transaction log data logMessage = this.buildTransactioLogDataEntity(transaction, logMessage); // // Persist getLogMessageFacade().create(logMessage); } } catch (Throwable ex) { StringBuilder builder = new StringBuilder(); builder.append("============= [ Java Server exception ] =============== \n"); builder.append(ex.getMessage()); logger.log(Level.SEVERE, builder.toString()); response.setReturn(false); } // // Return return response; }
From source file:org.cds06.speleograph.data.Series.java
/** * Compute the date range of the items in this set. * * @return A date range which contains the lower and upper bounds of data. *//*from w ww .ja v a2 s . c o m*/ public DateRange getRange() { int max = getItemCount(); DateRange range; if (max == 0) { Date now = Calendar.getInstance().getTime(); return new DateRange(now, now); } Date minDate = new Date(Long.MAX_VALUE), maxDate = new Date(Long.MIN_VALUE); for (int i = 0; i < max; i++) { Item item = items.get(i); if (item.getDate().before(minDate)) minDate = item.getDate(); if (item.getDate().after(maxDate)) maxDate = item.getDate(); } range = new DateRange(minDate, maxDate); return range; }
From source file:org.apache.hadoop.hbase.mapreduce.HLogInputFormat.java
@Override public List<InputSplit> getSplits(JobContext context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); Path inputDir = new Path(conf.get("mapreduce.input.fileinputformat.inputdir")); long startTime = conf.getLong(START_TIME_KEY, Long.MIN_VALUE); long endTime = conf.getLong(END_TIME_KEY, Long.MAX_VALUE); FileSystem fs = inputDir.getFileSystem(conf); List<FileStatus> files = getFiles(fs, inputDir, startTime, endTime); List<InputSplit> splits = new ArrayList<InputSplit>(files.size()); for (FileStatus file : files) { splits.add(new HLogSplit(file.getPath().toString(), file.getLen(), startTime, endTime)); }/*w ww . j av a2 s . c o m*/ return splits; }