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.linkedin.pinot.core.query.utils.SimpleSegmentMetadata.java
@Override public long getRefreshTime() { return Long.MIN_VALUE; }
From source file:com.gsma.mobileconnect.cache.DiscoveryCacheHashMapImplTest.java
@Test public void get_shouldReturnCopiesOfData() { // GIVEN/* w w w .ja va 2 s . co m*/ ObjectMapper mapper = new ObjectMapper(); ObjectNode root = mapper.createObjectNode(); String field1 = "field1"; String expectedFieldValue1 = "value1"; String expectedNewFieldValue1 = "new_value1"; root.put(field1, expectedFieldValue1); String field2 = "field2"; String expectedFieldValue2 = "value2"; root.put(field2, expectedFieldValue2); DiscoveryCacheKey key = DiscoveryCacheKey.newWithDetails("a", "a"); IDiscoveryCache cache = Factory.getDefaultDiscoveryCache(); DiscoveryCacheValue value = new DiscoveryCacheValue(new Date(Long.MAX_VALUE), root); // WHEN cache.add(key, value); // Change the returned value DiscoveryCacheValue cachedValue1 = cache.get(key); ObjectNode cachedRoot = (ObjectNode) cachedValue1.getValue(); cachedRoot.remove(field2); cachedRoot.put(field1, expectedNewFieldValue1); cachedValue1.getTtl().setTime(Long.MIN_VALUE); // Get from the cache again DiscoveryCacheValue cachedValue2 = cache.get(key); // THEN // cacheValue1 should reflect the changes assertNotNull(cachedValue1); assertEquals(expectedNewFieldValue1, cachedValue1.getValue().get(field1).textValue()); assertNull(cachedValue1.getValue().get(field2)); assertEquals(Long.MIN_VALUE, cachedValue1.getTtl().getTime()); // cacheValue2 should not reflect the changes assertNotNull(cachedValue2); assertEquals(expectedFieldValue1, cachedValue2.getValue().get(field1).textValue()); assertEquals(expectedFieldValue2, cachedValue2.getValue().get(field2).textValue()); assertEquals(Long.MAX_VALUE, cachedValue2.getTtl().getTime()); }
From source file:com.amazonaws.mobileconnectors.pinpoint.analytics.Session.java
/** * Used by deserealizer//from w ww . j a v a 2 s . co m * * @param sessionID * @param startTime * @param stopTime */ protected Session(final String sessionID, final String startTime, final String stopTime) { this.sessionIdTimeFormat = new SimpleDateFormat( SESSION_ID_DATE_FORMAT + SESSION_ID_DELIMITER + SESSION_ID_TIME_FORMAT, Locale.US); this.sessionIdTimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Scanner s = new Scanner(startTime); this.startTime = s.nextLong(); s = new Scanner(stopTime); this.stopTime = s.nextLong(); this.sessionID = sessionID; if (this.stopTime == Long.MIN_VALUE) { this.stopTime = null; } }
From source file:io.pravega.controller.store.stream.InMemoryStream.java
@Override CompletableFuture<CreateStreamResponse> checkStreamExists(StreamConfiguration configuration, long timestamp) { CompletableFuture<CreateStreamResponse> result = new CompletableFuture<>(); final long time; final StreamConfiguration config; final Data<Integer> currentState; synchronized (lock) { time = creationTime.get();// w ww . j a va 2 s. com config = this.configuration; currentState = this.state; } if (time != Long.MIN_VALUE) { if (config != null) { handleStreamMetadataExists(timestamp, result, time, config, currentState); } else { result.complete( new CreateStreamResponse(CreateStreamResponse.CreateStatus.NEW, configuration, time)); } } else { result.complete( new CreateStreamResponse(CreateStreamResponse.CreateStatus.NEW, configuration, timestamp)); } return result; }
From source file:su90.mybatisdemo.dao.RegionsMapperTest.java
@Test(groups = { "insert" }, enabled = false) @Transactional//w w w . ja v a 2s. com public void testInsertAnotherRegions() { Region newregion = new Region(Long.MIN_VALUE, "Artic"); regionsMapper.insertOne(newregion); assertNotNull(newregion.getId()); assertTrue(newregion.getId() > 0); List<Region> result = regionsMapper.findByName("artic"); assertEquals(result.size(), 1); assertEquals(result.get(0).getName(), "Artic"); }
From source file:ai.grakn.graql.internal.analytics.GraknMapReduce.java
final Number minValue() { return usingLong() ? Long.MIN_VALUE : Double.MIN_VALUE; }
From source file:com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService.java
@Override public Map<Cell, Value> getRows(String tableName, Iterable<byte[]> rows, ColumnSelection columnSelection, long timestamp) { Map<Cell, Value> result = Maps.newHashMap(); ConcurrentSkipListMap<Key, byte[]> table = getTableMap(tableName).entries; for (byte[] row : rows) { Cell rowBegin = Cells.createSmallestCellForRow(row); Cell rowEnd = Cells.createLargestCellForRow(row); PeekingIterator<Entry<Key, byte[]>> entries = Iterators.peekingIterator(table .subMap(new Key(rowBegin, Long.MIN_VALUE), new Key(rowEnd, timestamp)).entrySet().iterator()); while (entries.hasNext()) { Entry<Key, byte[]> entry = entries.peek(); Key key = entry.getKey(); Iterator<Entry<Key, byte[]>> cellIter = takeCell(entries, key); if (columnSelection.contains(key.col)) { Entry<Key, byte[]> lastEntry = null; while (cellIter.hasNext()) { Entry<Key, byte[]> curEntry = cellIter.next(); if (curEntry.getKey().ts >= timestamp) { break; }//from ww w . j a v a2 s.c o m lastEntry = curEntry; } if (lastEntry != null) { long ts = lastEntry.getKey().ts; byte[] value = lastEntry.getValue(); result.put(Cell.create(row, key.col), Value.create(value, ts)); } } Iterators.size(cellIter); } } return result; }
From source file:edu.snu.leader.hierarchy.simple.DefaultReporter.java
/** * Report the final results of the simulation * * @see edu.snu.leader.hierarchy.simple.Reporter#reportFinalResults() *//*from w w w. j a va2 s.c o m*/ @Override public void reportFinalResults() { // Create some handy variables long firstActiveTimestep = Long.MAX_VALUE; long lastActiveTimestep = Long.MIN_VALUE; int initiatorCount = 0; // Gather some statistics DescriptiveStatistics immediateFollowerStats = new DescriptiveStatistics(); DescriptiveStatistics initiatorDistanceStats = new DescriptiveStatistics(); DescriptiveStatistics activeTimestepStats = new DescriptiveStatistics(); // Iterate through all the individuals Iterator<Individual> indIter = _simState.getAllIndividuals().iterator(); while (indIter.hasNext()) { Individual ind = indIter.next(); // Get some statistics immediateFollowerStats.addValue(ind.getImmediateFollowerCount()); initiatorDistanceStats.addValue(ind.getDistanceToInitiator()); activeTimestepStats.addValue(ind.getActiveTimestep()); // Build the prefix String prefix = "individual." + ind.getID() + "."; // Log out important information _writer.println(prefix + "group-id = " + ind.getGroupID()); _writer.println(prefix + "active-timestep = " + ind.getActiveTimestep()); _writer.println(prefix + "immediate-follower-count = " + ind.getImmediateFollowerCount()); _writer.println(prefix + "total-follower-count = " + ind.getTotalFollowerCount()); _writer.println(prefix + "distance-to-initiator = " + ind.getDistanceToInitiator()); _writer.println(prefix + "location = " + ind.getLocation().getX() + " " + ind.getLocation().getY()); _writer.println(prefix + "threshold = " + ind.getThreshold()); _writer.println(prefix + "skill = " + ind.getSkill()); _writer.println(prefix + "confidence = " + ind.getConfidence()); _writer.println(prefix + "reputation = " + ind.getReputation()); _writer.println(prefix + "boldness = " + ind.getBoldness()); // Get the leader's ID, if it exists Object leaderID = ""; if (null != ind.getLeader()) { leaderID = ind.getLeader().getIndividual().getID(); } else { ++initiatorCount; } _writer.println(prefix + "leader = " + leaderID); // Build the list of neighbor ID's StringBuilder builder = new StringBuilder(); Iterator<Neighbor> neighborIter = ind.getNearestNeighbors().iterator(); while (neighborIter.hasNext()) { builder.append(neighborIter.next().getIndividual().getID()); builder.append(" "); } _writer.println(prefix + "nearest-neighbors = " + builder.toString()); // Build the list of follower ID's builder = new StringBuilder(); neighborIter = ind.getFollowers().iterator(); while (neighborIter.hasNext()) { builder.append(neighborIter.next().getIndividual().getID()); builder.append(" "); } _writer.println(prefix + "immediate-followers = " + builder.toString()); // Check the activity time if (firstActiveTimestep > ind.getActiveTimestep()) { firstActiveTimestep = ind.getActiveTimestep(); } if (lastActiveTimestep < ind.getActiveTimestep()) { lastActiveTimestep = ind.getActiveTimestep(); } _writer.println(); } // Log the simulation information _writer.println("simulation.first-active-timestep = " + firstActiveTimestep); _writer.println("simulation.last-active-timestep = " + lastActiveTimestep); _writer.println("simulation.initiator-count = " + initiatorCount); // Log the stats _writer.println("statistics.immediate-followers.mean = " + immediateFollowerStats.getMean()); _writer.println( "statistics.immediate-followers.std-dev = " + immediateFollowerStats.getStandardDeviation()); _writer.println("statistics.immediate-followers.min = " + immediateFollowerStats.getMin()); _writer.println("statistics.immediate-followers.max = " + immediateFollowerStats.getMax()); _writer.println("statistics.initiator-distance.mean = " + initiatorDistanceStats.getMean()); _writer.println("statistics.initiator-distance.std-dev = " + initiatorDistanceStats.getStandardDeviation()); _writer.println("statistics.initiator-distance.min = " + initiatorDistanceStats.getMin()); _writer.println("statistics.initiator-distance.max = " + initiatorDistanceStats.getMax()); _writer.println("statistics.active-timestep.mean = " + activeTimestepStats.getMean()); _writer.println("statistics.active-timestep.std-dev = " + activeTimestepStats.getStandardDeviation()); _writer.println("statistics.active-timestep.min = " + activeTimestepStats.getMin()); _writer.println("statistics.active-timestep.max = " + activeTimestepStats.getMax()); // Log out the stop time _writer.println(); _writer.println(_STATS_SPACER); _writer.println("# Finished: " + (new Date())); // Close out the writer _writer.close(); }
From source file:lapin.load.Loader.java
/** * Loads a file denoted by <code>in</code> onto the lisp environment. * @param in Name of the input file./*from www.j av a 2 s . com*/ * If a file extension is either ".lisp" or ".fasl", then this * method loads a file specified by <code>in</code>. * Else, the method creates two pathname * <code>in + ".fasl"</code>, <code>in + ".lisp"</code> * and for each pathname tests whether a file denoted by the * pathname exists. If none of these files exist, then the method * throws {@link lapin.io.FileException}. Else if either of these * files exists (but not both), then the method loads the existing * one. Else, by comparing a timestamp of these files, this method * loads the newer one. * @param inFileEnc Character encoding for the input file. * If NIL is specified, then the platform's default * character encoding is used. * @param env * @return T * @throws lapin.io.FileException * @throws lapin.io.StreamException * @throws lapin.eval.Evaluator.Exception */ static public Object loadFile(String in, Object inFileEnc, Env env) { if (Logger.debuglevelp(env)) { Logger.debug("[loadFile] in: ~S", Lists.list(in), env); Logger.debug("[loadFile] inFileEnc: ~S", Lists.list(inFileEnc), env); } String inLisp, inFasl; if (in.endsWith(".lisp")) { inLisp = in; inFasl = null; } else if (in.endsWith(".fasl")) { inLisp = null; inFasl = in; } else { inLisp = in + ".lisp"; inFasl = in + ".fasl"; } File dir = IO.dir(Symbols.LOAD_DIR, env); File inFile; if (inLisp != null && inFasl == null) inFile = new File(dir, inLisp); else if (inLisp == null && inFasl != null) inFile = new File(dir, inFasl); else { File inLispFile = new File(dir, inLisp); File inFaslFile = new File(dir, inFasl); boolean inLispFileExists = inLispFile.exists(); boolean inFaslFileExists = inFaslFile.exists(); long inLispLastMod = inLispFileExists ? inLispFile.lastModified() : Long.MIN_VALUE; long inFaslLastMod = inFaslFileExists ? inFaslFile.lastModified() : Long.MIN_VALUE; if (inLispLastMod < inFaslLastMod) { inFile = inFaslFile; } else { if (inLispFileExists && inFaslFileExists) Logger.warn("[loadFile] ~S is older than ~S.~%" + "Loading LISP file...~%", Lists.list(inFasl, inLisp), env); inFile = inLispFile; } } if (Logger.debuglevelp(env)) Logger.debug("[loadFile] inFile=~S", Lists.list(inFile), env); Package currpkg = Package.get(env); { Env newenv = env.child(); // bind Loader.MyClassLoader bindInternalClassLoader(newenv); // preserve current package newenv.bind(Symbols.PACKAGE, currpkg); InputStream inputStream = null; try { inputStream = IO.openInputStream(inFile); java.io.Reader r; r = IO.toReader(inputStream, inFileEnc); r = IO.wrapReader(r, Symbols.T); Object exp; while (true) { exp = Reader.read(r, Symbols.NIL, IO.EOF, Symbols.NIL, newenv); if (exp == IO.EOF) { return Symbols.T; } Evaluator.eval(exp, newenv); } } finally { IO.close(inputStream); } } }
From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java
@Test public void testInt64EncodeMinValue() throws IOException { StringWriter out = new StringWriter(); JsonGenerator g = f.createGenerator(out); JsonValueHandler.INT64.writeValue(Long.MIN_VALUE, g); g.flush();//w w w. j a v a2 s. com assertEquals("-9223372036854775808", out.toString()); }