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:org.apache.axis2.databinding.utils.ConverterUtil.java

/**
 * @param baseArrayClass/*from  w  ww. j  ava  2s.  c  om*/
 * @param objectList     -> for primitive type array conversion we assume the content to be
 *                       strings!
 * @return Returns Object.
 */
public static Object convertToArray(Class baseArrayClass, List objectList) {
    int listSize = objectList.size();
    Object returnArray = null;
    if (int.class.equals(baseArrayClass)) {
        int[] array = new int[listSize];
        for (int i = 0; i < listSize; i++) {
            Object o = objectList.get(i);
            if (o != null) {
                array[i] = Integer.parseInt(o.toString());
            } else {
                array[i] = Integer.MIN_VALUE;
            }
        }
        returnArray = array;
    } else if (float.class.equals(baseArrayClass)) {
        float[] array = new float[listSize];
        for (int i = 0; i < listSize; i++) {
            Object o = objectList.get(i);
            if (o != null) {
                array[i] = Float.parseFloat(o.toString());
            } else {
                array[i] = Float.NaN;
            }
        }
        returnArray = array;
    } else if (short.class.equals(baseArrayClass)) {
        short[] array = new short[listSize];
        for (int i = 0; i < listSize; i++) {
            Object o = objectList.get(i);
            if (o != null) {
                array[i] = Short.parseShort(o.toString());
            } else {
                array[i] = Short.MIN_VALUE;
            }
        }
        returnArray = array;
    } else if (byte.class.equals(baseArrayClass)) {
        byte[] array = new byte[listSize];
        for (int i = 0; i < listSize; i++) {
            Object o = objectList.get(i);
            if (o != null) {
                array[i] = Byte.parseByte(o.toString());
            } else {
                array[i] = Byte.MIN_VALUE;
            }
        }
        returnArray = array;
    } else if (long.class.equals(baseArrayClass)) {
        long[] array = new long[listSize];
        for (int i = 0; i < listSize; i++) {
            Object o = objectList.get(i);
            if (o != null) {
                array[i] = Long.parseLong(o.toString());
            } else {
                array[i] = Long.MIN_VALUE;
            }
        }
        returnArray = array;
    } else if (boolean.class.equals(baseArrayClass)) {
        boolean[] array = new boolean[listSize];
        for (int i = 0; i < listSize; i++) {
            Object o = objectList.get(i);
            if (o != null) {
                array[i] = o.toString().equalsIgnoreCase("true");
            }
        }
        returnArray = array;
    } else if (char.class.equals(baseArrayClass)) {
        char[] array = new char[listSize];
        for (int i = 0; i < listSize; i++) {
            Object o = objectList.get(i);
            if (o != null) {
                array[i] = o.toString().toCharArray()[0];
            }
        }
        returnArray = array;
    } else if (double.class.equals(baseArrayClass)) {
        double[] array = new double[listSize];
        for (int i = 0; i < listSize; i++) {
            Object o = objectList.get(i);
            if (o != null) {
                array[i] = Double.parseDouble(o.toString());
            } else {
                array[i] = Double.NaN;
            }
        }
        returnArray = array;
    } else if (Calendar.class.equals(baseArrayClass)) {
        Calendar[] array = new Calendar[listSize];
        for (int i = 0; i < listSize; i++) {
            Object o = objectList.get(i);
            if (o != null) {
                if (o instanceof String) {
                    array[i] = ConverterUtil.convertToDateTime(o.toString());
                } else if (o instanceof Calendar) {
                    array[i] = (Calendar) o;
                }
            }
        }
        returnArray = array;
    } else if (Date.class.equals(baseArrayClass)) {
        Date[] array = new Date[listSize];
        for (int i = 0; i < listSize; i++) {
            Object o = objectList.get(i);
            if (o != null) {
                if (o instanceof String) {
                    array[i] = ConverterUtil.convertToDate(o.toString());
                } else if (o instanceof Date) {
                    array[i] = (Date) o;
                }
            }
        }
        returnArray = array;
    } else {
        returnArray = Array.newInstance(baseArrayClass, listSize);
        ConvertToArbitraryObjectArray(returnArray, baseArrayClass, objectList);
    }
    return returnArray;
}

From source file:com.seleniumtests.reporter.SeleniumTestsReporter.java

public void generateSuiteSummaryReport(final List<ISuite> suites, final String suiteName) {
    final NumberFormat formatter = new DecimalFormat("#,##0.0");
    int qty_method = 0;
    int qty_pass_s = 0;
    int qty_skip = 0;
    int qty_fail = 0;
    long time_start = Long.MAX_VALUE;
    long time_end = Long.MIN_VALUE;

    final List<ShortTestResult> tests2 = new ArrayList<ShortTestResult>();
    for (final ISuite suite : suites) {
        final Map<String, ISuiteResult> tests = suite.getResults();
        for (final ISuiteResult r : tests.values()) {

            final ITestContext overview = r.getTestContext();
            final ShortTestResult mini = new ShortTestResult(overview.getName());

            int q;
            q = overview.getAllTestMethods().length;
            qty_method += q;/*from www.j  a v  a 2 s .c  om*/
            mini.setTotalMethod(q);
            q = overview.getPassedTests().size();
            qty_pass_s += q;
            mini.setInstancesPassed(q);
            q = skippedTests.get(overview.getName()).size();
            qty_skip += q;
            mini.setInstancesSkipped(q);
            if (isRetryHandleNeeded.get(overview.getName())) {
                q = failedTests.get(overview.getName()).size();
            } else {
                q = failedTests.get(overview.getName()).size()
                        + getNbInstanceForGroup(true, overview.getFailedConfigurations());
            }

            qty_fail += q;
            mini.setInstancesFailed(q);
            time_start = Math.min(overview.getStartDate().getTime(), time_start);
            time_end = Math.max(overview.getEndDate().getTime(), time_end);
            tests2.add(mini);
        }
    }

    final ShortTestResult total = new ShortTestResult("total");
    total.setTotalMethod(qty_method);
    total.setInstancesPassed(qty_pass_s);
    total.setInstancesFailed(qty_fail);
    total.setInstancesSkipped(qty_skip);

    try {
        final VelocityEngine ve = new VelocityEngine();
        ve.setProperty("resource.loader", "class");
        ve.setProperty("class.resource.loader.class",
                "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
        ve.init();

        final Template t = ve.getTemplate("/templates/report.part.summary.html");
        final VelocityContext context = new VelocityContext();
        context.put("suiteName", suiteName);
        context.put("totalRunTime", formatter.format((time_end - time_start) / 1000.) + " sec");

        final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE dd MMM HH:mm:ss zzz yyyy");
        context.put("TimeStamp", simpleDateFormat.format(new GregorianCalendar().getTime()));
        context.put("tests", tests2);
        context.put("total", total);

        final StringWriter writer = new StringWriter();
        t.merge(context, writer);
        m_out.write(writer.toString());

    } catch (final Exception e) {
        logger.error(e.getMessage());
    }

}

From source file:org.amanzi.awe.statistics.model.impl.StatisticsModel.java

@Override
public IStatisticsRow getSummuryRow(final IStatisticsGroup statisticsGroup) throws ModelException {
    try {/*  ww  w.j av a2  s  . c om*/
        StatisticsRow row = summuryCache.get(statisticsGroup);
        if (row == null) {

            row = (StatisticsRow) getStatisticsRowFromDatabase((StatisticsGroup) statisticsGroup, null,
                    Long.MAX_VALUE, Long.MIN_VALUE);
            final Node sRowNode = row.getNode();
            row.setSummury(true);
            getNodeService().updateProperty(sRowNode, statisticsNodeProperties.isSummuryProperty(), true);
            row.setStatisticsGroup(statisticsGroup);
            summuryCache.put((StatisticsGroup) statisticsGroup, row);
        }

        return row;
    } catch (final ServiceException e) {
        processException("can't get syummury row from group" + statisticsGroup, e);
    }
    return null;
}

From source file:android.support.v17.leanback.widget.GuidedActionsStylist.java

/**
 * Performs binding activator view value to action.  Default implementation supports
 * GuidedDatePickerAction, subclass may override to add support of other views.
 * @param vh ViewHolder of activator view.
 * @param action GuidedAction to bind.//from ww  w  .  j  a v a 2 s.  c  om
 */
public void onBindActivatorView(ViewHolder vh, GuidedAction action) {
    if (action instanceof GuidedDatePickerAction) {
        GuidedDatePickerAction dateAction = (GuidedDatePickerAction) action;
        DatePicker dateView = (DatePicker) vh.mActivatorView;
        dateView.setDatePickerFormat(dateAction.getDatePickerFormat());
        if (dateAction.getMinDate() != Long.MIN_VALUE) {
            dateView.setMinDate(dateAction.getMinDate());
        }
        if (dateAction.getMaxDate() != Long.MAX_VALUE) {
            dateView.setMaxDate(dateAction.getMaxDate());
        }
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(dateAction.getDate());
        dateView.updateDate(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH), false);
    }
}

From source file:webServices.RestServiceImpl.java

@GET
@Path("/findTwittsRest")
@Produces({ MediaType.TEXT_PLAIN })/*  w w  w  .  j av  a  2s.  c om*/
public String twitterSearchRest(@QueryParam("keys") String searchKeys, @QueryParam("sinceId") long sinceId,
        @QueryParam("maxId") long maxId, @QueryParam("update") boolean update,
        @QueryParam("location") String location) {

    final Vector<String> results = new Vector<String>();
    String output = "";
    long higherStatusId = Long.MIN_VALUE;
    long lowerStatusId = Long.MAX_VALUE;

    Query searchQuery = new Query(searchKeys);
    searchQuery.setCount(50);
    searchQuery.setResultType(Query.ResultType.recent);

    if (sinceId != 0) {
        if (update) {
            searchQuery.setSinceId(sinceId);
        }
        higherStatusId = sinceId;
    }
    if (maxId != 0) {
        if (!update) {
            searchQuery.setMaxId(maxId);
        }
        lowerStatusId = maxId;
    }
    if (location != null) {
        double lat = Double.parseDouble(location.substring(0, location.indexOf(",")));
        double lon = Double.parseDouble(location.substring(location.indexOf(",") + 1, location.length()));

        searchQuery.setGeoCode(new GeoLocation(lat, lon), 10, Query.KILOMETERS);
    }

    try {
        QueryResult qResult = twitter.search(searchQuery);

        for (Status status : qResult.getTweets()) {
            //System.out.println(Long.toString(status.getId())+"  ***  "+Long.toString(status.getUser().getId())+"  ***  "+status.isRetweet()+"  ***  "+status.isRetweeted());

            higherStatusId = Math.max(status.getId(), higherStatusId);
            lowerStatusId = Math.min(status.getId(), lowerStatusId);

            if (!status.isRetweet()) {
                if (status.getGeoLocation() != null) {
                    System.out.println(Long.toString(status.getId()) + "@"
                            + Double.toString(status.getGeoLocation().getLatitude()) + ","
                            + Double.toString(status.getGeoLocation().getLongitude()));
                    results.add(Long.toString(status.getId()) + "@"
                            + Double.toString(status.getGeoLocation().getLatitude()) + ","
                            + Double.toString(status.getGeoLocation().getLongitude()));
                } else {
                    results.add(Long.toString(status.getId()) + "@null");
                }
            }
        }

    } catch (TwitterException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    TwitterResults resultsObj = new TwitterResults(results.toString(), higherStatusId, lowerStatusId);
    ObjectMapper mapper = new ObjectMapper();
    try {
        output = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(resultsObj);
    } catch (JsonProcessingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return output;
}

From source file:com.google.android.apps.forscience.whistlepunk.review.RunReviewFragment.java

private void onDataLoaded(long firstTimestamp, long lastTimestamp, long previousXMin, long previousXMax,
        long overlayTimestamp) {
    // Show the replay play button
    mRunReviewPlaybackButton.setVisibility(View.VISIBLE);

    // Add the labels after all the data is loaded
    // so that they are interpolated correctly.
    mChartController.setLabels(mPinnedNoteAdapter.getPinnedNotes());
    mChartController.setShowProgress(false);

    // Buffer the endpoints a bit so they look nice.
    long buffer = (long) (ExternalAxisController.EDGE_POINTS_BUFFER_FRACTION
            * (lastTimestamp - firstTimestamp));
    long renderedXMin = firstTimestamp - buffer;
    long renderedXMax = lastTimestamp + buffer;
    if (previousXMax == Long.MIN_VALUE) {
        // This is the first load. Zoom to fit the run.
        mChartController.setXAxis(renderedXMin, renderedXMax);
        // Display the the graph and overlays.
        mExternalAxis.setReviewData(firstTimestamp, renderedXMin, renderedXMax, mRunReviewOverlay.getSeekbar());
        mExternalAxis.zoomTo(mChartController.getRenderedXMin(), mChartController.getRenderedXMax());
        mRunReviewOverlay.setActiveTimestamp(firstTimestamp);
    } else {//w ww.j  a v  a  2s  . c  om
        mExternalAxis.zoomTo(previousXMin, previousXMax);
        mExternalAxis.setReviewData(firstTimestamp, renderedXMin, renderedXMax, mRunReviewOverlay.getSeekbar());
    }
    adjustYAxis();

    if (overlayTimestamp != RunReviewOverlay.NO_TIMESTAMP_SELECTED) {
        mRunReviewOverlay.setActiveTimestamp(overlayTimestamp);
        mRunReviewOverlay.setVisibility(View.VISIBLE);
    }
}

From source file:org.syncope.core.rest.UserTestITCase.java

@Test
public void verifyTaskRegistration() {
    // get task list
    List<PropagationTaskTO> tasks = Arrays
            .asList(restTemplate.getForObject(BASE_URL + "task/propagation/list", PropagationTaskTO[].class));

    assertNotNull(tasks);//w  w  w . ja  v  a 2 s.  c  om
    assertFalse(tasks.isEmpty());

    // get max task id
    long maxId = Long.MIN_VALUE;
    for (PropagationTaskTO task : tasks) {
        if (task.getId() > maxId) {
            maxId = task.getId();
        }
    }

    // --------------------------------------
    // Create operation
    // --------------------------------------

    UserTO userTO = getSampleTO("task@propagation.mode");

    // add a membership
    MembershipTO membershipTO = new MembershipTO();
    membershipTO.setRoleId(8L);
    userTO.addMembership(membershipTO);

    // 1. create user
    userTO = restTemplate.postForObject(BASE_URL + "user/create", userTO, UserTO.class);
    assertNotNull(userTO);

    // get the new task list
    tasks = Arrays
            .asList(restTemplate.getForObject(BASE_URL + "task/propagation/list", PropagationTaskTO[].class));

    assertNotNull(tasks);
    assertFalse(tasks.isEmpty());

    // get max task id
    long newMaxId = Long.MIN_VALUE;
    for (PropagationTaskTO task : tasks) {
        if (task.getId() > newMaxId) {
            newMaxId = task.getId();
        }
    }

    // default configuration for ws-target-resource2:
    //             only failed executions have to be registered
    // --> no more tasks/executions should be added
    assertEquals(newMaxId, maxId);

    // --------------------------------------
    // Update operation
    // --------------------------------------
    UserMod userMod = new UserMod();
    userMod.setId(userTO.getId());

    AttributeMod attributeMod = new AttributeMod();
    attributeMod.setSchema("surname");
    attributeMod.addValueToBeAdded("surname");
    userMod.addAttributeToBeUpdated(attributeMod);

    userTO = restTemplate.postForObject(BASE_URL + "user/update", userMod, UserTO.class);

    assertNotNull(userTO);

    // get the new task list
    tasks = Arrays
            .asList(restTemplate.getForObject(BASE_URL + "task/propagation/list", PropagationTaskTO[].class));

    // get max task id
    maxId = newMaxId;
    newMaxId = Long.MIN_VALUE;
    for (PropagationTaskTO task : tasks) {
        if (task.getId() > newMaxId) {
            newMaxId = task.getId();
        }
    }

    // default configuration for ws-target-resource2:
    //             all update executions have to be registered
    assertTrue(newMaxId > maxId);

    // --------------------------------------
    // Delete operation
    // --------------------------------------
    restTemplate.getForObject(BASE_URL + "user/delete/{userId}", UserTO.class, userTO.getId());

    // get the new task list
    tasks = Arrays
            .asList(restTemplate.getForObject(BASE_URL + "task/propagation/list", PropagationTaskTO[].class));

    // get max task id
    maxId = newMaxId;
    newMaxId = Long.MIN_VALUE;
    for (PropagationTaskTO task : tasks) {
        if (task.getId() > newMaxId) {
            newMaxId = task.getId();
        }
    }

    // default configuration for ws-target-resource2:
    //             no delete executions have to be registered
    // --> no more tasks/executions should be added
    assertEquals(newMaxId, maxId);
}

From source file:com.google.uzaygezen.core.BitVectorTest.java

private void checkToLongArrayForSingleWord(Function<Integer, BitVector> factory) {
    for (int size = 0; size < 10; ++size) {
        BitVector v = factory.apply(size);
        for (long i = 1 << size; --i >= 0;) {
            checkToLongArrayForSingleWord(v, i);
        }//from  w ww  . j  a  v a  2 s  . com
    }
    BitVector v2 = factory.apply(64);
    for (long i = Long.MIN_VALUE; --i >= Long.MAX_VALUE - 1024;) {
        checkToLongArrayForSingleWord(v2, i);
    }
    for (long i = Long.MIN_VALUE; ++i <= Long.MIN_VALUE + 1024;) {
        checkToLongArrayForSingleWord(v2, i);
    }
}

From source file:net.tourbook.tour.photo.TourPhotoManager.java

void resetTourStartEnd() {

    if (_sqlConnection != null) {

        Util.closeSql(_sqlStatement);
        Util.closeSql(_sqlConnection);

        _sqlStatement = null;// w ww .  ja va 2  s .  co m
        _sqlConnection = null;

        // force reloading cached start/end
        _sqlTourStart = Long.MAX_VALUE;
        _sqlTourEnd = Long.MIN_VALUE;
    }
}

From source file:com.google.uzaygezen.core.BitVectorTest.java

private void checkToBigEndianByteArrayForSingleWord(Function<Integer, BitVector> factory) {
    for (int size = 0; size < 10; ++size) {
        BitVector v = factory.apply(size);
        for (long i = 1 << size; --i >= 0;) {
            checkToBigEndianByteArrayForSingleWord(v, i);
        }// w  w  w  .java 2  s .  c  o  m
    }
    BitVector v2 = factory.apply(64);
    for (long i = Long.MIN_VALUE; --i >= Long.MAX_VALUE - 1024;) {
        checkToBigEndianByteArrayForSingleWord(v2, i);
    }
    for (long i = Long.MIN_VALUE; ++i <= Long.MIN_VALUE + 1024;) {
        checkToBigEndianByteArrayForSingleWord(v2, i);
    }
}