Example usage for java.lang Long MIN_VALUE

List of usage examples for java.lang Long MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Long MIN_VALUE.

Prototype

long MIN_VALUE

To view the source code for java.lang Long MIN_VALUE.

Click Source Link

Document

A constant holding the minimum value a long can have, -263.

Usage

From source file:com.haulmont.chile.core.datatypes.impl.LongDatatype.java

protected boolean hasValidLongRange(Number result) throws ParseException {
    if (result instanceof Double) {
        Double doubleResult = (Double) result;
        if (doubleResult > Long.MAX_VALUE || doubleResult < Long.MIN_VALUE) {
            return false;
        }//from  w  w w .  j a  v  a 2s.  c  om
    }
    return true;
}

From source file:org.alfresco.repo.node.GetNodesWithAspectCannedQuery.java

@Override
protected List<NodeRef> queryAndFilter(CannedQueryParameters parameters) {
    Long start = (logger.isDebugEnabled() ? System.currentTimeMillis() : null);

    // Get parameters
    GetNodesWithAspectCannedQueryParams paramBean = (GetNodesWithAspectCannedQueryParams) parameters
            .getParameterBean();// ww w .j av a2 s .  c  om

    // Get store, if requested
    final StoreRef storeRef = paramBean.getStoreRef();

    // Note - doesn't currently support sorting 

    // Get filter details
    final Set<QName> aspectQNames = paramBean.getAspectQNames();

    // Find all the available nodes
    // Doesn't limit them here, as permissions will be applied post-query
    // TODO Improve this to permission check and page in-line, so we
    //  can stop the query earlier if possible
    final List<NodeRef> result = new ArrayList<NodeRef>(100);

    nodeDAO.getNodesWithAspects(aspectQNames, Long.MIN_VALUE, Long.MAX_VALUE, new NodeRefQueryCallback() {
        @Override
        public boolean handle(Pair<Long, NodeRef> nodePair) {
            NodeRef nodeRef = nodePair.getSecond();
            if (storeRef == null || nodeRef.getStoreRef().equals(storeRef)) {
                result.add(nodeRef);
            }

            // Always ask for the next one
            return true;
        }
    });

    if (start != null) {
        logger.debug("Base query: " + result.size() + " in " + (System.currentTimeMillis() - start) + " msecs");
    }

    return result;
}

From source file:ac.elements.parser.SimpleDBConverter.java

/**
 * Encodes real long value into a string by offsetting and zero-padding
 * number up to the specified number of digits. Use this encoding method if
 * the data range set includes both positive and negative values.
 * //www.  j a  v a 2  s  .  c o  m
 * com.xerox.amazonws.sdb.DataUtils
 * 
 * @param number
 *            long to be encoded
 * @return string representation of the long
 */
private static String encodeLong(long number) {
    int maxNumDigits = BigInteger.valueOf(Long.MAX_VALUE).subtract(BigInteger.valueOf(Long.MIN_VALUE))
            .toString(RADIX).length();
    long offsetValue = Long.MIN_VALUE;

    BigInteger offsetNumber = BigInteger.valueOf(number).subtract(BigInteger.valueOf(offsetValue));

    String longString = offsetNumber.toString(RADIX);
    int numZeroes = maxNumDigits - longString.length();
    StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length());
    for (int i = 0; i < numZeroes; i++) {
        strBuffer.insert(i, '0');
    }
    strBuffer.append(longString);
    return strBuffer.toString();
}

From source file:net.aksingh.owmjapis.CurrentWeather.java

CurrentWeather(JSONObject jsonObj) {
    super(jsonObj);

    this.base = (jsonObj != null) ? jsonObj.optString(JSON_BASE, null) : null;
    this.cityId = (jsonObj != null) ? jsonObj.optLong(JSON_CITY_ID, Long.MIN_VALUE) : Long.MIN_VALUE;
    this.cityName = (jsonObj != null) ? jsonObj.optString(JSON_CITY_NAME, null) : null;

    JSONObject cloudsObj = (jsonObj != null) ? jsonObj.optJSONObject(JSON_CLOUDS) : null;
    this.clouds = (cloudsObj != null) ? new Clouds(cloudsObj) : null;

    JSONObject coordObj = (jsonObj != null) ? jsonObj.optJSONObject(JSON_COORD) : null;
    this.coord = (coordObj != null) ? new Coord(coordObj) : null;

    JSONObject mainObj = (jsonObj != null) ? jsonObj.optJSONObject(JSON_MAIN) : null;
    this.main = (mainObj != null) ? new Main(mainObj) : null;

    JSONObject rainObj = (jsonObj != null) ? jsonObj.optJSONObject(JSON_RAIN) : null;
    this.rain = (rainObj != null) ? new Rain(rainObj) : null;

    JSONObject snowObj = (jsonObj != null) ? jsonObj.optJSONObject(JSON_SNOW) : null;
    this.snow = (snowObj != null) ? new Snow(snowObj) : null;

    JSONObject sysObj = (jsonObj != null) ? jsonObj.optJSONObject(JSON_SYS) : null;
    this.sys = (sysObj != null) ? new Sys(sysObj) : null;

    JSONObject windObj = (jsonObj != null) ? jsonObj.optJSONObject(JSON_WIND) : null;
    this.wind = (windObj != null) ? new Wind(windObj) : null;
}

From source file:com.fullmeadalchemist.mustwatch.ui.batch.detail.BatchDetailFragment.java

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    initClickListeners();/*from w  w  w.j a v a 2 s  .  c  om*/

    Bundle bundle = this.getArguments();
    if (bundle != null) {

        long batchId = bundle.getLong(BATCH_ID, Long.MIN_VALUE);
        Timber.i("Got Batch ID %d from the NavigationController. Acting as a Batch Editor.", batchId);

        if (batchId != Long.MIN_VALUE) {
            if (viewModel.batch != null) {
                Timber.v("Reusing viewmodel data");
                dataBinding.setBatch(viewModel.batch);
                updateBatchUiInfo();
                updateIngredientUiInfo();
            } else {

                viewModel.getBatch(batchId).observe(this, batch -> {
                    if (batch != null) {
                        dataBinding.setBatch(batch);
                        viewModel.batch = batch;
                        updateBatchUiInfo();

                        viewModel.getBatchIngredients(batchId).observe(this, batchIngredients -> {
                            if (batchIngredients != null) {
                                Timber.v("Loaded %s Batch ingredients", batchIngredients.size());
                                viewModel.batch.ingredients = batchIngredients;
                                updateIngredientUiInfo();
                                updateBatchUiInfo();
                            } else {
                                Timber.w(
                                        "Received nothing from the RecipeRepository when trying to get ingredients for Batch %s",
                                        batchId);
                            }
                            Timber.i("Loaded Batch with ID %d:\n%s", batch.id, batch);
                        });

                    } else {
                        Timber.w("Received a null Batch from the RecipeDetailViewModel.");
                    }
                });
                viewModel.getLogsForBatch(batchId).observe(this, batches -> {
                    // update UI
                    logsAdapter.dataSet = batches;
                    logsAdapter.notifyDataSetChanged();
                });
            }
        }
    } else {
        Timber.i("No Batch ID was received. Redirecting to the Batch Creation form.");
        navigationController.navigateToAddBatch();
    }

    logsRecyclerView = getActivity().findViewById(R.id.logs_list);
    logsRecyclerView.setHasFixedSize(true);

    LinearLayoutManager llm = new LinearLayoutManager(getContext());
    llm.setOrientation(LinearLayoutManager.VERTICAL);

    logsRecyclerView.setLayoutManager(llm);
    logsRecyclerView.setAdapter(logsAdapter);
}

From source file:org.apache.cassandra.db.clock.IncrementCounterContext.java

public byte[] createMin() {
    byte[] rv = new byte[HEADER_LENGTH];
    FBUtilities.copyIntoBytes(rv, 0, Long.MIN_VALUE);
    FBUtilities.copyIntoBytes(rv, TIMESTAMP_LENGTH, 0L);
    return rv;//from w ww  .  j  a  va2  s  . c  o  m
}

From source file:io.fabric8.insight.log.service.LogQuery.java

public LogResults getLogEventList(int count, Predicate<PaxLoggingEvent> predicate) {
    LogResults answer = new LogResults();
    answer.setHost(getHostName());//from  w  ww.j a v a2 s  .  co m

    long from = Long.MAX_VALUE;
    long to = Long.MIN_VALUE;
    if (appender != null) {
        LruList events = appender.getEvents();
        if (events != null) {
            Iterable<PaxLoggingEvent> iterable = events.getElements();
            if (iterable != null) {
                int matched = 0;
                for (PaxLoggingEvent event : iterable) {
                    if (event != null) {
                        long timestamp = event.getTimeStamp();
                        if (timestamp > to) {
                            to = timestamp;
                        }
                        if (timestamp < from) {
                            from = timestamp;
                        }
                        if (predicate == null || predicate.matches(event)) {
                            answer.addEvent(Logs.newInstance(event));
                            matched += 1;
                            if (count > 0 && matched >= count) {
                                break;
                            }
                        }
                    }
                }
            }
        }
    } else {
        LOG.warn("No VmLogAppender available!");
    }
    answer.setFromTimestamp(from);
    answer.setToTimestamp(to);
    return answer;
}

From source file:su90.mybatisdemo.dao.RegionsMapperTest.java

@Test(groups = { "insert" }, enabled = false)
@Transactional/*from  w  w w.j a  v a  2s  .c om*/
public void testInsertOneRegions() {
    Region newregion = new Region(Long.MIN_VALUE, "Pacific");
    regionsMapper.insertOne(newregion);
    assertNotNull(newregion.getId());
    assertTrue(newregion.getId() > 0);

    List<Region> result = regionsMapper.findByName("pacific");
    assertEquals(result.size(), 1);
    assertEquals(result.get(0).getName(), "Pacific");
}

From source file:com.opengamma.util.timeseries.fast.longint.object.FastArrayLongObjectTimeSeries.java

@SuppressWarnings("unchecked")
public FastArrayLongObjectTimeSeries(final DateTimeNumericEncoding encoding, final List<Long> times,
        final List<T> values) {
    super(encoding);
    if (times.size() != values.size()) {
        throw new IllegalArgumentException("lists are of different sizes");
    }/*  w w  w . j  a v  a 2s  .  c  o m*/
    _times = new long[times.size()];
    _values = (T[]) new Object[values.size()];
    final Iterator<T> iter = values.iterator();
    int i = 0;
    long maxTime = Long.MIN_VALUE; // for checking the dates are sorted.
    for (final long time : times) {
        final T value = iter.next();
        if (maxTime < time) {
            _times[i] = time;
            _values[i] = value;
            maxTime = time;
        } else {
            throw new IllegalArgumentException("dates must be ordered");
        }
        i++;
    }
}

From source file:eu.stratosphere.nephele.io.channels.LocalChannelWithAccessInfo.java

@Override
public int decrementReferences() {

    int current = this.referenceCounter.get();
    while (true) {
        if (current <= 0) {
            // this is actually an error case, because the channel was deleted before
            throw new IllegalStateException("The references to the file were already at zero.");
        }/*  w  w  w . j av a  2  s  .  co  m*/

        if (current == 1) {
            // this call decrements to zero, so mark it as deleted
            if (this.referenceCounter.compareAndSet(current, Integer.MIN_VALUE)) {
                current = 0;
                break;
            }
        } else if (this.referenceCounter.compareAndSet(current, current - 1)) {
            current = current - 1;
            break;
        }
        current = this.referenceCounter.get();
    }

    if (current > 0) {
        return current;
    } else if (current == 0) {
        // delete the channel
        this.referenceCounter.set(Integer.MIN_VALUE);
        this.reservedWritePosition.set(Long.MIN_VALUE);
        try {
            this.channel.close();
        } catch (IOException ioex) {
            if (LOG.isErrorEnabled()) {
                LOG.error("Error while closing spill file for file buffers: " + ioex.getMessage(), ioex);
            }
        }
        if (this.deleteOnClose.get()) {
            this.file.delete();
        }
        return current;
    } else {
        throw new IllegalStateException("The references to the file were already at zero.");
    }
}