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:gsn.webservice.standard.GSNWebServiceSkeleton.java
/** * Auto generated method signature//from ww w . j a v a2 s.co m * * @param getLatestMultiData */ public gsn.webservice.standard.GetLatestMultiDataResponse getLatestMultiData( gsn.webservice.standard.GetLatestMultiData getLatestMultiData) { //throw new java.lang.UnsupportedOperationException("Please implement " + this.getClass().getName() + "#getLatestMultiData"); GetLatestMultiDataResponse response = new GetLatestMultiDataResponse(); // GetMultiData input = new GetMultiData(); input.setFieldSelector(getLatestMultiData.getFieldSelector()); input.setTo(Long.MIN_VALUE); input.setFrom(Long.MIN_VALUE); input.setNb(1); input.setAcDetails(getLatestMultiData.getAcDetails()); // response.setQueryResult(getMultiData(input).getQueryResult()); // return response; }
From source file:com.social.solution.fragment.MyFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.tweet_list, container, false); lastTimeStamp = System.currentTimeMillis(); mSwipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_layout); mSwipeLayout.setProgressViewOffset(false, 150, 200); mSwipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override//w w w. j av a 2s . c o m public void onRefresh() { long currentTimeStamp = System.currentTimeMillis(); if ((currentTimeStamp - lastTimeStamp) / 1000 > 10) { System.out.println("load recent pranjal"); LoadRecentTweets(); } } }); Activity parentActivity = getActivity(); Fabric.with(getActivity(), new TweetUi()); Bundle bd = getArguments(); if (bd != null) { filterTweets = bd.getBoolean("filter"); position = bd.getInt("position"); } else { filterTweets = false; position = 0; } //Toast.makeText(this, "Filter : "+filterTweets+" Position : "+position, Toast.LENGTH_SHORT).show(); System.out.println("Filter : " + filterTweets + " Position : " + position); linlaHeaderProgress = (LinearLayout) view.findViewById(R.id.linlaHeaderProgress); listView = (ObservableListView) view.findViewById(R.id.mylist); final EnumSet<RequestParameters.NativeAdAsset> desiredAssets = EnumSet.of( RequestParameters.NativeAdAsset.TITLE, RequestParameters.NativeAdAsset.TEXT, RequestParameters.NativeAdAsset.ICON_IMAGE, RequestParameters.NativeAdAsset.MAIN_IMAGE, RequestParameters.NativeAdAsset.CALL_TO_ACTION_TEXT); mRequestParameters = new RequestParameters.Builder() //.location(location) .keywords("food").desiredAssets(desiredAssets).build(); setmydata(listView, inflater.inflate(R.layout.padding, listView, false)); listView.setAdapter(tweetadapter); linlaHeaderProgress.setBackgroundColor(-1); linlaHeaderProgress.setVisibility(View.VISIBLE); if (parentActivity instanceof ObservableScrollViewCallbacks) { // Scroll to the specified position after layout Bundle args = getArguments(); if (args != null && args.containsKey(ARG_INITIAL_POSITION)) { final int initialPosition = args.getInt(ARG_INITIAL_POSITION, 0); ScrollUtils.addOnGlobalLayoutListener(listView, new Runnable() { @Override public void run() { // scrollTo() doesn't work, should use setSelection() listView.setSelection(initialPosition); } }); } // TouchInterceptionViewGroup should be a parent view other than ViewPager. // This is a workaround for the issue #117: // https://github.com/ksoichiro/Android-ObservableScrollView/issues/117 listView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.root)); listView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity); } ConfigurationBuilder config = new ConfigurationBuilder().setOAuthConsumerKey(custkey) .setOAuthConsumerSecret(custsecret).setOAuthAccessToken(accesstoken) .setOAuthAccessTokenSecret(accesssecret); twitter1 = new TwitterFactory(config.build()).getInstance(); tweetlist = new ArrayList<Tweet>(); loadingTweets = new ArrayList<Tweet>(); lastDisplayTweetId = Long.MAX_VALUE; firstDisplayTweetId = Long.MIN_VALUE; return view; }
From source file:org.openmrs.module.pharmacyapi.api.prescription.util.PrescriptionUtils.java
public Date calculatePrescriptionExpirationDate(final List<DrugOrder> drugOrders) { final Calendar maximumCalendarExpirationDate = Calendar.getInstance(); maximumCalendarExpirationDate.setTime(new Date(Long.MIN_VALUE)); Date maximumExpirationDate = maximumCalendarExpirationDate.getTime(); for (final DrugOrder drugOrder : drugOrders) { if (drugOrder.getAutoExpireDate().after(maximumExpirationDate)) { maximumCalendarExpirationDate.setTime(drugOrder.getAutoExpireDate()); maximumExpirationDate = maximumCalendarExpirationDate.getTime(); }/*from w w w . j a va2 s . co m*/ } return maximumExpirationDate; }
From source file:io.warp10.script.functions.FETCH.java
@Override public Object apply(WarpScriptStack stack) throws WarpScriptException { //// ww w . ja v a 2 s . c o m // Extract parameters from the stack // Object top = stack.peek(); // // Handle the new (as of 20150805) parameter passing mechanism as a map // Map<String, Object> params = null; if (top instanceof Map) { stack.pop(); params = paramsFromMap(stack, (Map<String, Object>) top); } if (top instanceof List) { if (5 != ((List) top).size()) { stack.drop(); throw new WarpScriptException(getName() + " expects 5 parameters."); } // // Explode list and remove its size // listTo.apply(stack); stack.drop(); } if (null == params) { params = new HashMap<String, Object>(); // // Extract time span // Object oStop = stack.pop(); Object oStart = stack.pop(); long endts; long timespan; if (oStart instanceof String && oStop instanceof String) { long start = fmt.parseDateTime((String) oStart).getMillis() * Constants.TIME_UNITS_PER_MS; long stop = fmt.parseDateTime((String) oStop).getMillis() * Constants.TIME_UNITS_PER_MS; if (start < stop) { endts = stop; timespan = stop - start; } else { endts = start; timespan = start - stop; } } else if (oStart instanceof Long && oStop instanceof Long) { endts = (long) oStart; timespan = (long) oStop; } else { throw new WarpScriptException("Invalid timespan specification."); } params.put(PARAM_END, endts); if (timespan < 0) { params.put(PARAM_COUNT, -timespan); } else { params.put(PARAM_TIMESPAN, timespan); } // // Extract labels selector // Object oLabelsSelector = stack.pop(); if (!(oLabelsSelector instanceof Map)) { throw new WarpScriptException("Label selectors must be a map."); } Map<String, String> labelSelectors = (Map<String, String>) oLabelsSelector; params.put(PARAM_LABELS, labelSelectors); // // Extract class selector // Object oClassSelector = stack.pop(); if (!(oClassSelector instanceof String)) { throw new WarpScriptException("Class selector must be a string."); } String classSelector = (String) oClassSelector; params.put(PARAM_CLASS, classSelector); // // Extract token // Object oToken = stack.pop(); if (!(oToken instanceof String)) { throw new WarpScriptException("Token must be a string."); } String token = (String) oToken; params.put(PARAM_TOKEN, token); } StoreClient gtsStore = stack.getStoreClient(); DirectoryClient directoryClient = stack.getDirectoryClient(); GeoTimeSerie base = null; GeoTimeSerie[] bases = null; String typelabel = (String) params.get(PARAM_TYPEATTR); if (null != typelabel) { bases = new GeoTimeSerie[4]; } ReadToken rtoken = Tokens.extractReadToken(params.get(PARAM_TOKEN).toString()); List<String> clsSels = new ArrayList<String>(); List<Map<String, String>> lblsSels = new ArrayList<Map<String, String>>(); if (params.containsKey(PARAM_SELECTOR_PAIRS)) { for (Pair<Object, Object> pair : (List<Pair<Object, Object>>) params.get(PARAM_SELECTOR_PAIRS)) { clsSels.add(pair.getLeft().toString()); Map<String, String> labelSelectors = (Map<String, String>) pair.getRight(); labelSelectors.putAll(Tokens.labelSelectorsFromReadToken(rtoken)); lblsSels.add((Map<String, String>) labelSelectors); } } else { Map<String, String> labelSelectors = (Map<String, String>) params.get(PARAM_LABELS); labelSelectors.putAll(Tokens.labelSelectorsFromReadToken(rtoken)); clsSels.add(params.get(PARAM_CLASS).toString()); lblsSels.add(labelSelectors); } List<Metadata> metadatas = null; Iterator<Metadata> iter = null; try { metadatas = directoryClient.find(clsSels, lblsSels); iter = metadatas.iterator(); } catch (IOException ioe) { try { iter = directoryClient.iterator(clsSels, lblsSels); } catch (Exception e) { throw new WarpScriptException(e); } } metadatas = new ArrayList<Metadata>(); List<GeoTimeSerie> series = new ArrayList<GeoTimeSerie>(); AtomicLong fetched = (AtomicLong) stack.getAttribute(WarpScriptStack.ATTRIBUTE_FETCH_COUNT); long fetchLimit = (long) stack.getAttribute(WarpScriptStack.ATTRIBUTE_FETCH_LIMIT); long gtsLimit = (long) stack.getAttribute(WarpScriptStack.ATTRIBUTE_GTS_LIMIT); AtomicLong gtscount = (AtomicLong) stack.getAttribute(WarpScriptStack.ATTRIBUTE_GTS_COUNT); try { while (iter.hasNext()) { metadatas.add(iter.next()); if (gtscount.incrementAndGet() > gtsLimit) { throw new WarpScriptException(getName() + " exceeded limit of " + gtsLimit + " Geo Time Series, current count is " + gtscount); } if (metadatas.size() < EgressFetchHandler.FETCH_BATCHSIZE && iter.hasNext()) { continue; } // // Filter the retrieved Metadata according to geo // if (params.containsKey(PARAM_GEO)) { GeoDirectoryClient geoclient = stack.getGeoDirectoryClient(); long end = (long) params.get(PARAM_END); long start = Long.MIN_VALUE; if (params.containsKey(PARAM_TIMESPAN)) { start = end - (long) params.get(PARAM_TIMESPAN); } boolean inside = false; if (PARAM_GEOOP_IN.equals(params.get(PARAM_GEOOP))) { inside = true; } try { metadatas = geoclient.filter((String) params.get(PARAM_GEODIR), metadatas, (GeoXPShape) params.get(PARAM_GEO), inside, start, end); } catch (IOException ioe) { throw new WarpScriptException(ioe); } } // // Generate extra Metadata if PARAM_EXTRA is set // if (params.containsKey(PARAM_EXTRA)) { Set<Metadata> withextra = new HashSet<Metadata>(); withextra.addAll(metadatas); for (Metadata meta : metadatas) { for (String cls : (Set<String>) params.get(PARAM_EXTRA)) { // The following is safe, the constructor allocates new maps Metadata metadata = new Metadata(meta); metadata.setName(cls); metadata.setClassId(GTSHelper.classId(this.SIPHASH_CLASS, cls)); metadata.setLabelsId(GTSHelper.labelsId(this.SIPHASH_LABELS, metadata.getLabels())); withextra.add(metadata); } } metadatas.clear(); metadatas.addAll(withextra); } // // We assume that GTS will be fetched in a continuous way, i.e. without having a GTSDecoder from one // then one from another, then one from the first one. // long timespan = params.containsKey(PARAM_TIMESPAN) ? (long) params.get(PARAM_TIMESPAN) : -((long) params.get(PARAM_COUNT)); TYPE type = (TYPE) params.get(PARAM_TYPE); if (null != this.forcedType) { if (null != type) { throw new WarpScriptException(getName() + " type of fetched GTS cannot be changed."); } type = this.forcedType; } boolean writeTimestamp = Boolean.TRUE.equals(params.get(PARAM_WRITE_TIMESTAMP)); boolean showUUID = Boolean.TRUE.equals(params.get(PARAM_SHOWUUID)); try (GTSDecoderIterator gtsiter = gtsStore.fetch(rtoken, metadatas, (long) params.get(PARAM_END), timespan, fromArchive, writeTimestamp)) { while (gtsiter.hasNext()) { GTSDecoder decoder = gtsiter.next(); GeoTimeSerie gts; // // If we should ventilate per type, do so now // if (null != typelabel) { Map<String, String> labels = new HashMap<String, String>( decoder.getMetadata().getLabels()); labels.remove(Constants.PRODUCER_LABEL); labels.remove(Constants.OWNER_LABEL); java.util.UUID uuid = null; if (showUUID) { uuid = new java.util.UUID(decoder.getClassId(), decoder.getLabelsId()); } long count = 0; Metadata decoderMeta = decoder.getMetadata(); while (decoder.next()) { count++; long ts = decoder.getTimestamp(); long location = decoder.getLocation(); long elevation = decoder.getElevation(); Object value = decoder.getValue(); int gtsidx = 0; String typename = "DOUBLE"; if (value instanceof Long) { gtsidx = 1; typename = "LONG"; } else if (value instanceof Boolean) { gtsidx = 2; typename = "BOOLEAN"; } else if (value instanceof String) { gtsidx = 3; typename = "STRING"; } base = bases[gtsidx]; if (null == base || !base.getMetadata().getName().equals(decoderMeta.getName()) || !base.getMetadata().getLabels().equals(decoderMeta.getLabels())) { bases[gtsidx] = new GeoTimeSerie(); base = bases[gtsidx]; series.add(base); base.setLabels(decoder.getLabels()); base.getMetadata().putToAttributes(typelabel, typename); base.setName(decoder.getName()); if (null != uuid) { base.getMetadata().putToAttributes(Constants.UUID_ATTRIBUTE, uuid.toString()); } } GTSHelper.setValue(base, ts, location, elevation, value, false); } if (fetched.addAndGet(count) > fetchLimit) { Map<String, String> sensisionLabels = new HashMap<String, String>(); sensisionLabels.put(SensisionConstants.SENSISION_LABEL_CONSUMERID, Tokens.getUUID(rtoken.getBilledId())); Sensision.update(SensisionConstants.SENSISION_CLASS_EINSTEIN_FETCHCOUNT_EXCEEDED, sensisionLabels, 1); throw new WarpScriptException(getName() + " exceeded limit of " + fetchLimit + " datapoints, current count is " + fetched.get()); } continue; } if (null != type) { gts = decoder.decode(type); } else { gts = decoder.decode(); } // // Remove producer/owner labels // // // Add a .uuid attribute if instructed to do so // if (showUUID) { java.util.UUID uuid = new java.util.UUID(gts.getClassId(), gts.getLabelsId()); gts.getMetadata().putToAttributes(Constants.UUID_ATTRIBUTE, uuid.toString()); } Map<String, String> labels = new HashMap<String, String>(); labels.putAll(gts.getMetadata().getLabels()); labels.remove(Constants.PRODUCER_LABEL); labels.remove(Constants.OWNER_LABEL); gts.setLabels(labels); // // If it's the first GTS, take it as is. // if (null == base) { base = gts; } else { // // If name and labels are identical to the previous GTS, merge them // Otherwise add 'base' to the stack and set it to 'gts'. // if (!base.getMetadata().getName().equals(gts.getMetadata().getName()) || !base.getMetadata().getLabels().equals(gts.getMetadata().getLabels())) { series.add(base); base = gts; } else { base = GTSHelper.merge(base, gts); } } if (fetched.addAndGet(gts.size()) > fetchLimit) { Map<String, String> sensisionLabels = new HashMap<String, String>(); sensisionLabels.put(SensisionConstants.SENSISION_LABEL_CONSUMERID, Tokens.getUUID(rtoken.getBilledId())); Sensision.update(SensisionConstants.SENSISION_CLASS_EINSTEIN_FETCHCOUNT_EXCEEDED, sensisionLabels, 1); throw new WarpScriptException(getName() + " exceeded limit of " + fetchLimit + " datapoints, current count is " + fetched.get()); //break; } } } catch (WarpScriptException ee) { throw ee; } catch (Exception e) { e.printStackTrace(); } // // If there is one current GTS, push it onto the stack (only if not ventilating per type) // if (null != base && null == typelabel) { series.add(base); } // // Reset state // base = null; metadatas.clear(); } } catch (Throwable t) { throw t; } finally { if (iter instanceof MetadataIterator) { try { ((MetadataIterator) iter).close(); } catch (Exception e) { } } } stack.push(series); // // Apply a possible postfetch hook // if (rtoken.getHooksSize() > 0 && rtoken.getHooks().containsKey(POSTFETCH_HOOK)) { stack.execMulti(rtoken.getHooks().get(POSTFETCH_HOOK)); } return stack; }
From source file:byps.test.TestSerializePrimitiveTypes.java
@Test public void testPrimitiveTypesLong() throws RemoteException { ArrayList<Long> ints = new ArrayList<Long>(); ints.add((long) 0); ints.add((long) 1); ints.add((long) 2); int a = 0;//w w w .ja v a 2s. c om for (int i = 0; i < 63 - 7; i += 7) { ints.add((long) ((0x7E << i) | a)); ints.add((long) ((0x7F << i) | a)); ints.add((long) ((0x80 << i) | a)); ints.add((long) ((0x81 << i) | a)); a <<= 7; a |= 0x5D; } for (int i = 0; i < ints.size(); i++) { internalTestLong(ints.get(i)); internalTestLong(-ints.get(i)); } internalTestLong(Long.MAX_VALUE); internalTestLong(Long.MIN_VALUE); }
From source file:gedi.util.ArrayUtils.java
public static long max(long[] a, int start, int end) { long re = Long.MIN_VALUE; for (int i = start; i < end; i++) re = Math.max(re, a[i]);/*from w w w. ja v a 2 s .c o m*/ return re; }
From source file:cz.filmtit.userspace.Session.java
/** * Sets the database ID fo the session if it has not been set before. Used * by Hibernate only at the time the log about the session is saved. * * @param databaseId//from w ww.j av a 2s . c om */ private void setDatabaseId(long databaseId) { if (this.databaseId == databaseId) { return; } if (this.databaseId == Long.MIN_VALUE) { this.databaseId = databaseId; return; } throw new UnsupportedOperationException("Once the database ID is set, it can't be changed."); }
From source file:org.apache.hadoop.hbase.coprocessor.TestAggregateProtocol.java
@Test(timeout = 300000) public void testMaxWithInvalidRange() { AggregationClient aClient = new AggregationClient(conf); final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci = new LongColumnInterpreter(); Scan scan = new Scan(); scan.setStartRow(ROWS[4]);/*from w ww .ja va 2 s . c o m*/ scan.setStopRow(ROWS[2]); scan.addColumn(TEST_FAMILY, TEST_QUALIFIER); long max = Long.MIN_VALUE; try { max = aClient.max(TEST_TABLE, ci, scan); } catch (Throwable e) { max = 0; } assertEquals(0, max);// control should go to the catch block }
From source file:com.android.messaging.datamodel.MessageNotificationState.java
protected MessageNotificationState(final ConversationInfoList convList) { super(makeConversationIdSet(convList)); mConvList = convList;//w w w . j a v a 2s.c o m mType = PendingIntentConstants.SMS_NOTIFICATION_ID; mLatestReceivedTimestamp = Long.MIN_VALUE; if (convList != null) { for (final ConversationLineInfo info : convList.mConvInfos) { mLatestReceivedTimestamp = Math.max(mLatestReceivedTimestamp, info.mReceivedTimestamp); } } }
From source file:org.apache.cassandra.db.SystemKeyspace.java
public static long getTruncatedAt(UUID cfId) { Pair<ReplayPosition, Long> record = getTruncationRecord(cfId); return record == null ? Long.MIN_VALUE : record.right; }