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:org.apache.hadoop.hbase.regionserver.compactions.DateTieredCompactionPolicy.java
/** * @return a list of boundaries for multiple compaction output from minTimestamp to maxTimestamp. */// w w w .j a v a 2 s . c om private static List<Long> getCompactionBoundariesForMinor(CompactionWindow window, boolean singleOutput) { List<Long> boundaries = new ArrayList<Long>(); boundaries.add(Long.MIN_VALUE); if (!singleOutput) { boundaries.add(window.startMillis()); } return boundaries; }
From source file:com.tascape.qa.th.webui.comm.Firefox.java
int getOverallLoadTimeMillis() throws ParseException { final String format = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; long start = Long.MAX_VALUE; long end = Long.MIN_VALUE; for (Entry entry : this.entries) { long s = Utils.getTime(entry.startedDateTime, format); start = Math.min(start, s); long e = s + entry.time; end = Math.max(end, e);//from ww w. j a v a 2 s .co m LOG.debug("{}/{} - {}", entry.request.method, entry.response.status, entry.request.url); } if (end <= start) { return -1; } long time = end - start; LOG.debug("Overall load time {} ms", time); return (int) (time); }
From source file:net.tourbook.tour.photo.TourPhotoManager.java
/** * create pseudo tours for photos which are not contained in a tour and remove all tours which * do not contain any photos/*from w w w . java 2 s .com*/ * * @param allPhotos * @param visibleTourPhotoLinks * @param isShowToursOnlyWithPhotos * @param isShowToursWithoutSavedPhotos * @param allTourCameras */ void createTourPhotoLinks(final ArrayList<Photo> allPhotos, final ArrayList<TourPhotoLink> visibleTourPhotoLinks, final HashMap<String, Camera> allTourCameras, final boolean isShowToursOnlyWithPhotos, final boolean isShowToursWithoutSavedPhotos) { loadToursFromDb(allPhotos, true); TourPhotoLink currentTourPhotoLink = createTourPhotoLinks_10_GetFirstTour(allPhotos); final HashMap<String, String> tourCameras = new HashMap<String, String>(); final int numberOfRealTours = _dbTourPhotoLinks.size(); long nextDbTourStartTime = numberOfRealTours > 0 ? _dbTourPhotoLinks.get(0).tourStartTime : Long.MIN_VALUE; int tourIndex = 0; long photoTime = 0; // loop: all photos for (final Photo photo : allPhotos) { photoTime = photo.adjustedTimeLink; // check if current photo can be put into current tour photo link if (currentTourPhotoLink.isHistoryTour == false && photoTime <= currentTourPhotoLink.tourEndTime) { // current photo can be put into current real tour } else if (currentTourPhotoLink.isHistoryTour && photoTime < nextDbTourStartTime) { // current photo can be put into current history tour } else { // current photo do not fit into current photo link // finalize current tour photo link createTourPhotoLinks_30_FinalizeCurrentTourPhotoLink(currentTourPhotoLink, tourCameras, visibleTourPhotoLinks, isShowToursOnlyWithPhotos, isShowToursWithoutSavedPhotos); currentTourPhotoLink = null; tourCameras.clear(); /* * create/get new merge tour */ if (tourIndex >= numberOfRealTours) { /* * there are no further tours which can contain photos, put remaining photos * into a history tour */ nextDbTourStartTime = Long.MAX_VALUE; } else { for (; tourIndex < numberOfRealTours; tourIndex++) { final TourPhotoLink dbTourPhotoLink = _dbTourPhotoLinks.get(tourIndex); final long dbTourStart = dbTourPhotoLink.tourStartTime; final long dbTourEnd = dbTourPhotoLink.tourEndTime; if (photoTime < dbTourStart) { // image time is before the next tour start, create history tour nextDbTourStartTime = dbTourStart; break; } if (photoTime >= dbTourStart && photoTime <= dbTourEnd) { // current photo can be put into current tour currentTourPhotoLink = dbTourPhotoLink; break; } // current tour do not contain any images if (isShowToursOnlyWithPhotos == false && isShowToursWithoutSavedPhotos == false) { // tours without photos are displayed createTourPhotoLinks_40_AddTour(dbTourPhotoLink, visibleTourPhotoLinks); } // get start time for the next tour if (tourIndex + 1 < numberOfRealTours) { nextDbTourStartTime = _dbTourPhotoLinks.get(tourIndex + 1).tourStartTime; } else { nextDbTourStartTime = Long.MAX_VALUE; } } } if (currentTourPhotoLink == null) { // create history tour currentTourPhotoLink = new TourPhotoLink(photoTime); } } currentTourPhotoLink.linkPhotos.add(photo); // set camera into the photo final Camera camera = setCamera(photo, allTourCameras); tourCameras.put(camera.cameraName, camera.cameraName); // set number of GPS/No GPS photos final double latitude = photo.getLinkLatitude(); if (latitude == 0) { currentTourPhotoLink.numberOfNoGPSPhotos++; } else { currentTourPhotoLink.numberOfGPSPhotos++; } } createTourPhotoLinks_30_FinalizeCurrentTourPhotoLink(currentTourPhotoLink, tourCameras, visibleTourPhotoLinks, isShowToursOnlyWithPhotos, isShowToursWithoutSavedPhotos); createTourPhotoLinks_60_MergeHistoryTours(visibleTourPhotoLinks); /* * set tour GPS into photo */ final List<TourPhotoLink> tourPhotoLinksWithGps = new ArrayList<TourPhotoLink>(); for (final TourPhotoLink tourPhotoLink : visibleTourPhotoLinks) { if (tourPhotoLink.tourId != Long.MIN_VALUE) { tourPhotoLinksWithGps.add(tourPhotoLink); } } if (tourPhotoLinksWithGps.size() > 0) { setTourGpsIntoPhotos(tourPhotoLinksWithGps); } }
From source file:org.apache.axis2.databinding.utils.ConverterUtil.java
public static long convertToLong(String s) { if ((s == null) || s.equals("")) { return Long.MIN_VALUE; }//from w w w . j ava 2 s . c om if (s.startsWith("+")) { s = s.substring(1); } return Long.parseLong(s); }
From source file:net.ymate.platform.core.lang.TreeObject.java
public TreeObject(Long l) { _object = l != null ? l : Long.MIN_VALUE; _type = TYPE_LONG; }
From source file:org.apache.hadoop.hbase.regionserver.compactions.DateTieredCompactionPolicy.java
/** * Return a list of boundaries for multiple compaction output * in ascending order.//from w ww. j ava 2 s. c o m */ private List<Long> getCompactBoundariesForMajor(Collection<StoreFile> filesToCompact, long now) { long minTimestamp = Long.MAX_VALUE; for (StoreFile file : filesToCompact) { minTimestamp = Math.min(minTimestamp, file.getMinimumTimestamp() == null ? Long.MAX_VALUE : file.getMinimumTimestamp()); } List<Long> boundaries = new ArrayList<Long>(); // Add startMillis of all windows between now and min timestamp for (CompactionWindow window = getIncomingWindow(now); window .compareToTimestamp(minTimestamp) > 0; window = window.nextEarlierWindow()) { boundaries.add(window.startMillis()); } boundaries.add(Long.MIN_VALUE); Collections.reverse(boundaries); return boundaries; }
From source file:com.flexive.tests.embedded.persistence.ValueTest.java
@Test public void valueTest() throws Exception { GregorianCalendar gc_multi_date = new GregorianCalendar(1940, 11, 22); GregorianCalendar gc_multi_date2 = new GregorianCalendar(1997, 9, 21); GregorianCalendar gc_single_date = new GregorianCalendar(1974, 0, 12); GregorianCalendar gc_single_date2 = new GregorianCalendar(1974, 3, 17); GregorianCalendar gc_multi_datetime = new GregorianCalendar(1940, 11, 22, 3, 30, 20); GregorianCalendar gc_multi_datetime2 = new GregorianCalendar(1997, 9, 21, 7, 40, 30); GregorianCalendar gc_single_datetime = new GregorianCalendar(1974, 0, 12, 4, 35, 45); GregorianCalendar gc_single_datetime2 = new GregorianCalendar(1974, 3, 17, 14, 30, 15); String s_single = "ABC"; String s_multi = "DEF"; String s_single_big = RandomStringUtils.randomAlphanumeric(50000); String s_multi_big = RandomStringUtils.randomAlphanumeric(50000); File testFile = new File("test.file"); if (!testFile.exists()) testFile = new File("src/framework/testresources/image/Exif.JPG"); if (!testFile.exists()) return;/* ww w. ja v a 2 s . c o m*/ FileInputStream fis = new FileInputStream(testFile); long time = System.currentTimeMillis(); BinaryDescriptor binary = new BinaryDescriptor(testFile.getName(), testFile.length(), fis); System.out.println("size: " + binary.getSize() + " time: " + (System.currentTimeMillis() - time)); System.out.println("==valueTest== Handle received for " + binary.getName() + ": " + binary.getHandle()); fis.close(); TestData[] data = { new TestData<FxHTML>(FxDataType.HTML, new FxHTML(false, s_single).setTidyHTML(true), new FxHTML(true, s_multi)), new TestData<FxString>(FxDataType.String1024, new FxString(false, s_single), new FxString(true, s_multi)), new TestData<FxString>(FxDataType.Text, new FxString(false, s_single_big), new FxString(true, s_multi_big)), new TestData<FxNumber>(FxDataType.Number, new FxNumber(false, Integer.MAX_VALUE), new FxNumber(true, Integer.MIN_VALUE)), new TestData<FxLargeNumber>(FxDataType.LargeNumber, new FxLargeNumber(false, Long.MAX_VALUE), new FxLargeNumber(true, Long.MIN_VALUE)), new TestData<FxFloat>(FxDataType.Float, new FxFloat(false, 123213213213.2222221f), new FxFloat(true, 1f)), new TestData<FxDouble>(FxDataType.Double, new FxDouble(false, 0.000000000000001d), new FxDouble(true, 1d)), new TestData<FxBoolean>(FxDataType.Boolean, new FxBoolean(false, true), new FxBoolean(true, false)), new TestData<FxDate>(FxDataType.Date, new FxDate(false, gc_single_date.getTime()), new FxDate(true, gc_multi_date.getTime())), new TestData<FxDateTime>(FxDataType.DateTime, new FxDateTime(false, gc_single_datetime.getTime()), new FxDateTime(true, gc_multi_datetime.getTime())), new TestData<FxDateRange>(FxDataType.DateRange, new FxDateRange(false, new DateRange(gc_single_date.getTime(), gc_single_date2.getTime())), new FxDateRange(true, new DateRange(gc_multi_date.getTime(), gc_multi_date2.getTime()))), new TestData<FxDateTimeRange>(FxDataType.DateTimeRange, new FxDateTimeRange(false, new DateRange(gc_single_datetime.getTime(), gc_single_datetime2.getTime())), new FxDateTimeRange(true, new DateRange(gc_multi_datetime.getTime(), gc_multi_datetime2.getTime()))), new TestData<FxBinary>(FxDataType.Binary, new FxBinary(false, binary), new FxBinary(true, binary)), new TestData<FxReference>(FxDataType.Reference, new FxReference(false, new ReferencedContent(RPK1)), new FxReference(true, new ReferencedContent(RPK1))) }; FxType testType; StringBuilder sbErr = new StringBuilder(100); for (TestData test : data) { try { System.out.println("Testing " + test.dataType.name() + " ..."); test.testConsistency(); createProperty(test.dataType); testType = CacheAdmin.getEnvironment().getType(TYPE_NAME); FxContent content = co.initialize(testType.getId()); content.setValue("/VTS" + test.dataType.name() + "[1]", test._single.copy()); // content.getPropertyData("/VT" + test.dataType.name() + "[1]").createNew(FxPropertyData.POSITION_BOTTOM); content.setValue("/VTM" + test.dataType.name() + "[1]", test._multi.copy().setValueData(43)); FxPK pk = co.save(content); FxContent loaded = co.load(pk); FxValue loadedSingle = loaded.getPropertyData("/VTS" + test.dataType.name() + "[1]").getValue(); FxValue loadedMulti = loaded.getPropertyData("/VTM" + test.dataType.name() + "[1]").getValue(); test.testSingleValue(loadedSingle); test.testMultiValue(loadedMulti); Assert.assertEquals((int) loadedSingle.getValueData(), 42); Assert.assertEquals((int) loadedMulti.getValueData(), 43); pk = co.save(loaded); loaded = co.load(pk); loadedSingle = loaded.getPropertyData("/VTS" + test.dataType.name() + "[1]").getValue(); loadedMulti = loaded.getPropertyData("/VTM" + test.dataType.name() + "[1]").getValue(); test.testSingleValue(loadedSingle); test.testMultiValue(loadedMulti); Assert.assertEquals((int) loadedSingle.getValueData(), 42); Assert.assertEquals((int) loadedMulti.getValueData(), 43); co.remove(pk); if (test.dataType == FxDataType.Reference) { //additional tests content = co.initialize(testType.getId()); content.setValue("/VTM" + test.dataType.name() + "[1]", new FxReference(true, new ReferencedContent(RPK1))); try { //set to a new pk content.setValue("/VTS" + test.dataType.name() + "[1]", new FxReference(false, new ReferencedContent(new FxPK()))); co.save(content); //expected to fail Assert.fail("Invalid PK (new) for a reference should fail!"); } catch (Exception e) { //expected } try { //set to a non existing pk content.setValue("/VTS" + test.dataType.name() + "[1]", new FxReference(false, new ReferencedContent(new FxPK(123456)))); co.save(content); //expected to fail Assert.fail("Invalid PK (non existant) for a reference should fail!"); } catch (Exception e) { //expected } try { //set to an existing pk, but wrong type content.setValue("/VTS" + test.dataType.name() + "[1]", new FxReference(false, new ReferencedContent(RPK2))); co.save(content); //expected to fail Assert.fail("Invalid PK (wrong type) for a reference should fail!"); } catch (Exception e) { //expected } try { //set to an existing pk, but wrong type content.setValue("/VTS" + test.dataType.name() + "[1]", RPK1); co.save(content); //expected to work } catch (Exception e) { e.printStackTrace(); Assert.fail("Correct PK for a reference should not fail!"); //expected } } } catch (Throwable e) { sbErr.append("Failed DataType: [").append(test.dataType.name()).append("] with: ") .append(e.getMessage()).append("\n"); e.printStackTrace(); } finally { try { removeProperty(test.dataType); } catch (Exception e) { LOG.warn("Failed to remove property", e); } } } if (sbErr.length() > 0) Assert.fail(sbErr.toString()); }
From source file:org.apache.hadoop.hbase.regionserver.compactions.DateTieredCompactionPolicy.java
private static long getOldestToCompact(long maxAgeMillis, long now) { try {/* ww w . j a va 2 s. co m*/ return LongMath.checkedSubtract(now, maxAgeMillis); } catch (ArithmeticException ae) { LOG.warn("Value for " + CompactionConfiguration.DATE_TIERED_MAX_AGE_MILLIS_KEY + ": " + maxAgeMillis + ". All the files will be eligible for minor compaction."); return Long.MIN_VALUE; } }
From source file:org.apache.atlas.repository.graph.GraphHelper.java
/** * Returns the active edge for the given edge label. * If the vertex is deleted and there is no active edge, it returns the latest deleted edge * @param vertex//from w w w . j a v a2 s . c o m * @param edgeLabel * @return */ public AtlasEdge getEdgeForLabel(AtlasVertex vertex, String edgeLabel) { Iterator<AtlasEdge> iterator = getAdjacentEdgesByLabel(vertex, AtlasEdgeDirection.OUT, edgeLabel); AtlasEdge latestDeletedEdge = null; long latestDeletedEdgeTime = Long.MIN_VALUE; while (iterator != null && iterator.hasNext()) { AtlasEdge edge = iterator.next(); Id.EntityState edgeState = getState(edge); if (edgeState == null || edgeState == Id.EntityState.ACTIVE) { if (LOG.isDebugEnabled()) { LOG.debug("Found {}", string(edge)); } return edge; } else { Long modificationTime = edge.getProperty(Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, Long.class); if (modificationTime != null && modificationTime >= latestDeletedEdgeTime) { latestDeletedEdgeTime = modificationTime; latestDeletedEdge = edge; } } } if (LOG.isDebugEnabled()) { LOG.debug("Found {}", latestDeletedEdge == null ? "null" : string(latestDeletedEdge)); } //If the vertex is deleted, return latest deleted edge return latestDeletedEdge; }
From source file:net.ymate.platform.core.lang.TreeObject.java
/** * /* w w w . j a v a 2 s . c om*/ * * @param t * @param isTime ?UTC */ public TreeObject(Long t, boolean isTime) { _object = t != null ? t : Long.MIN_VALUE; _type = isTime ? TYPE_TIME : TYPE_LONG; }