Example usage for java.lang Double longValue

List of usage examples for java.lang Double longValue

Introduction

In this page you can find the example usage for java.lang Double longValue.

Prototype

public long longValue() 

Source Link

Document

Returns the value of this Double as a long after a narrowing primitive conversion.

Usage

From source file:org.openhab.persistence.influxdb.internal.InfluxDBPersistenceService.java

@Override
public Iterable<HistoricItem> query(FilterCriteria filter) {
    logger.debug("got a query");

    if (!isProperlyConfigured) {
        logger.warn("Configuration for influxdb not yet loaded or broken.");
        return Collections.emptyList();
    }/*from   ww  w  .j a  v a2 s .  com*/

    if (!isConnected()) {
        logger.warn("InfluxDB is not yet connected");
        return Collections.emptyList();
    }

    List<HistoricItem> historicItems = new ArrayList<HistoricItem>();

    StringBuffer query = new StringBuffer();
    query.append("select ");
    query.append(VALUE_COLUMN_NAME);
    query.append(", ");
    query.append(TIME_COLUMN_NAME);
    query.append(" ");
    query.append("from ");

    if (filter.getItemName() != null) {
        query.append(filter.getItemName());
    } else {
        query.append("/.*/");
    }

    logger.trace("filter itemname: {}", filter.getItemName());
    logger.trace("filter ordering: {}", filter.getOrdering().toString());
    logger.trace("filter state: {}", filter.getState());
    logger.trace("filter operator: {}", filter.getOperator());
    logger.trace("filter getBeginDate: {}", filter.getBeginDate());
    logger.trace("filter getEndDate: {}", filter.getEndDate());
    logger.trace("filter getPageSize: {}", filter.getPageSize());
    logger.trace("filter getPageNumber: {}", filter.getPageNumber());

    if ((filter.getState() != null && filter.getOperator() != null) || filter.getBeginDate() != null
            || filter.getEndDate() != null) {
        query.append(" where ");
        boolean foundState = false;
        boolean foundBeginDate = false;
        if (filter.getState() != null && filter.getOperator() != null) {
            String value = stateToString(filter.getState());
            if (value != null) {
                foundState = true;
                query.append(VALUE_COLUMN_NAME);
                query.append(" ");
                query.append(filter.getOperator().toString());
                query.append(" ");
                query.append(value);
            }
        }

        if (filter.getBeginDate() != null) {
            foundBeginDate = true;
            if (foundState) {
                query.append(" and");
            }
            query.append(" ");
            query.append(TIME_COLUMN_NAME);
            query.append(" > ");
            query.append(getTimeFilter(filter.getBeginDate()));
            query.append(" ");
        }

        if (filter.getEndDate() != null) {
            if (foundState || foundBeginDate) {
                query.append(" and");
            }
            query.append(" ");
            query.append(TIME_COLUMN_NAME);
            query.append(" < ");
            query.append(getTimeFilter(filter.getEndDate()));
            query.append(" ");
        }

    }

    // InfluxDB returns results in DESCENDING order by default
    // http://influxdb.com/docs/v0.7/api/query_language.html#select-and-time-ranges
    if (filter.getOrdering() == Ordering.ASCENDING) {
        query.append(" order asc");
    }

    int limit = (filter.getPageNumber() + 1) * filter.getPageSize();
    query.append(" limit " + limit);
    logger.trace("appending limit {}", limit);

    int totalEntriesAffected = ((filter.getPageNumber() + 1) * filter.getPageSize());
    int startEntryNum = totalEntriesAffected
            - (totalEntriesAffected - (filter.getPageSize() * filter.getPageNumber()));
    logger.trace("startEntryNum {}", startEntryNum);

    logger.debug("query string: {}", query.toString());
    List<Serie> results = Collections.emptyList();
    try {
        results = influxDB.query(dbName, query.toString(), TimeUnit.MILLISECONDS);
    } catch (RuntimeException e) {
        logger.error("query failed with database error");
        handleDatabaseException(e);
    }
    for (Serie result : results) {
        String historicItemName = result.getName();
        logger.trace("item name {}", historicItemName);
        int entryCount = 0;
        for (Map<String, Object> row : result.getRows()) {
            entryCount++;
            if (entryCount >= startEntryNum) {
                Double rawTime = (Double) row.get(TIME_COLUMN_NAME);
                Object rawValue = row.get(VALUE_COLUMN_NAME);
                logger.trace("adding historic item {}: time {} value {}", historicItemName, rawTime, rawValue);
                Date time = new Date(rawTime.longValue());
                State value = objectToState(rawValue, historicItemName);
                historicItems.add(new InfluxdbItem(historicItemName, value, time));
            } else {
                logger.trace("omitting item value for {}", historicItemName);
            }
        }
    }

    return historicItems;
}

From source file:org.openhab.persistence.influxdb08.internal.InfluxDBPersistenceService.java

@Override
public Iterable<HistoricItem> query(FilterCriteria filter) {
    logger.debug("got a query");

    if (!isProperlyConfigured) {
        logger.warn("Configuration for influxdb08 not yet loaded or broken.");
        return Collections.emptyList();
    }/*from  w  w w  .j a v a 2 s. c om*/

    if (!isConnected()) {
        logger.warn("InfluxDB is not yet connected");
        return Collections.emptyList();
    }

    List<HistoricItem> historicItems = new ArrayList<HistoricItem>();

    StringBuffer query = new StringBuffer();
    query.append("select ");
    query.append(VALUE_COLUMN_NAME);
    query.append(", ");
    query.append(TIME_COLUMN_NAME);
    query.append(" ");
    query.append("from ");

    if (filter.getItemName() != null) {
        query.append(filter.getItemName());
    } else {
        query.append("/.*/");
    }

    logger.trace("filter itemname: {}", filter.getItemName());
    logger.trace("filter ordering: {}", filter.getOrdering().toString());
    logger.trace("filter state: {}", filter.getState());
    logger.trace("filter operator: {}", filter.getOperator());
    logger.trace("filter getBeginDate: {}", filter.getBeginDate());
    logger.trace("filter getEndDate: {}", filter.getEndDate());
    logger.trace("filter getPageSize: {}", filter.getPageSize());
    logger.trace("filter getPageNumber: {}", filter.getPageNumber());

    if ((filter.getState() != null && filter.getOperator() != null) || filter.getBeginDate() != null
            || filter.getEndDate() != null) {
        query.append(" where ");
        boolean foundState = false;
        boolean foundBeginDate = false;
        if (filter.getState() != null && filter.getOperator() != null) {
            String value = stateToString(filter.getState());
            if (value != null) {
                foundState = true;
                query.append(VALUE_COLUMN_NAME);
                query.append(" ");
                query.append(filter.getOperator().toString());
                query.append(" ");
                query.append(value);
            }
        }

        if (filter.getBeginDate() != null) {
            foundBeginDate = true;
            if (foundState) {
                query.append(" and");
            }
            query.append(" ");
            query.append(TIME_COLUMN_NAME);
            query.append(" > ");
            query.append(getTimeFilter(filter.getBeginDate()));
            query.append(" ");
        }

        if (filter.getEndDate() != null) {
            if (foundState || foundBeginDate) {
                query.append(" and");
            }
            query.append(" ");
            query.append(TIME_COLUMN_NAME);
            query.append(" < ");
            query.append(getTimeFilter(filter.getEndDate()));
            query.append(" ");
        }

    }

    // InfluxDB returns results in DESCENDING order by default
    // http://influxdb.com/docs/v0.7/api/query_language.html#select-and-time-ranges
    if (filter.getOrdering() == Ordering.ASCENDING) {
        query.append(" order asc");
    }

    int limit = (filter.getPageNumber() + 1) * filter.getPageSize();
    query.append(" limit " + limit);
    logger.trace("appending limit {}", limit);

    int totalEntriesAffected = ((filter.getPageNumber() + 1) * filter.getPageSize());
    int startEntryNum = totalEntriesAffected
            - (totalEntriesAffected - (filter.getPageSize() * filter.getPageNumber()));
    logger.trace("startEntryNum {}", startEntryNum);

    logger.debug("query string: {}", query.toString());
    List<Serie> results = Collections.emptyList();
    try {
        results = influxDB.query(dbName, query.toString(), TimeUnit.MILLISECONDS);
    } catch (RuntimeException e) {
        logger.error("query failed with database error");
        handleDatabaseException(e);
    }
    for (Serie result : results) {
        String historicItemName = result.getName();
        logger.trace("item name {}", historicItemName);
        int entryCount = 0;
        for (Map<String, Object> row : result.getRows()) {
            entryCount++;
            if (entryCount >= startEntryNum) {
                Double rawTime = (Double) row.get(TIME_COLUMN_NAME);
                Object rawValue = row.get(VALUE_COLUMN_NAME);
                logger.trace("adding historic item {}: time {} value {}", historicItemName, rawTime, rawValue);
                Date time = new Date(rawTime.longValue());
                State value = objectToState(rawValue, historicItemName);
                historicItems.add(new InfluxdbItem(historicItemName, value, time));
            } else {
                logger.trace("omitting item value for {}", historicItemName);
            }
        }
    }

    return historicItems;
}

From source file:org.onebusaway.android.ui.TripPlanFragment.java

private void advancedSettings() {

    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());

    final TypedArray transitModeResource = getContext().getResources()
            .obtainTypedArray(R.array.transit_mode_array);
    final boolean unitsAreImperial = !PreferenceUtils.getUnitsAreMetricFromPreferences(getContext());

    dialogBuilder.setTitle(R.string.trip_plan_advanced_settings)
            .setView(R.layout.trip_plan_advanced_settings_dialog);

    dialogBuilder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
        @Override/*from  www .  j  a va2  s . c o m*/
        public void onClick(DialogInterface dialogInterface, int which) {

            Dialog dialog = (Dialog) dialogInterface;

            boolean optimizeTransfers = ((CheckBox) dialog.findViewById(R.id.checkbox_minimize_transfers))
                    .isChecked();

            Spinner spinnerTravelBy = (Spinner) dialog.findViewById(R.id.spinner_travel_by);

            int modeId = transitModeResource.getResourceId(spinnerTravelBy.getSelectedItemPosition(), 0);

            boolean wheelchair = ((CheckBox) dialog.findViewById(R.id.checkbox_wheelchair_acccesible))
                    .isChecked();

            String maxWalkString = ((EditText) dialog.findViewById(R.id.number_maximum_walk_distance)).getText()
                    .toString();
            double maxWalkDistance;
            if (TextUtils.isEmpty(maxWalkString)) {
                maxWalkDistance = Double.MAX_VALUE;
            } else {
                double d = Double.parseDouble(maxWalkString);
                maxWalkDistance = unitsAreImperial ? ConversionUtils.feetToMeters(d) : d;
            }

            mBuilder.setOptimizeTransfers(optimizeTransfers).setModeSetById(modeId)
                    .setWheelchairAccessible(wheelchair).setMaxWalkDistance(maxWalkDistance);

            checkRequestAndSubmit();
        }
    });

    final AlertDialog dialog = dialogBuilder.create();

    dialog.show();

    CheckBox minimizeTransfersCheckbox = (CheckBox) dialog.findViewById(R.id.checkbox_minimize_transfers);
    Spinner spinnerTravelBy = (Spinner) dialog.findViewById(R.id.spinner_travel_by);
    CheckBox wheelchairCheckbox = (CheckBox) dialog.findViewById(R.id.checkbox_wheelchair_acccesible);
    EditText maxWalkEditText = (EditText) dialog.findViewById(R.id.number_maximum_walk_distance);

    minimizeTransfersCheckbox.setChecked(mBuilder.getOptimizeTransfers());

    wheelchairCheckbox.setChecked(mBuilder.getWheelchairAccessible());

    ArrayAdapter adapter = ArrayAdapter.createFromResource(getActivity(), R.array.transit_mode_array,
            android.R.layout.simple_spinner_item);

    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerTravelBy.setAdapter(adapter);

    int modeSetId = mBuilder.getModeSetId();
    if (modeSetId != -1) {
        for (int i = 0; i < transitModeResource.length(); i++) {
            if (transitModeResource.getResourceId(i, -1) == modeSetId) {
                spinnerTravelBy.setSelection(i);
                break;
            }
        }
    }

    Double maxWalk = mBuilder.getMaxWalkDistance();
    if (maxWalk != null && Double.MAX_VALUE != maxWalk) {
        if (unitsAreImperial) {
            maxWalk = ConversionUtils.metersToFeet(maxWalk);
        }
        maxWalkEditText.setText(String.format("%d", maxWalk.longValue()));
    }

    if (unitsAreImperial) {
        TextView label = (TextView) dialog.findViewById(R.id.label_minimum_walk_distance);
        label.setText(getString(R.string.feet_abbreviation));
    }
}

From source file:ropes.MainWindow.java

private void jButton_writeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_writeActionPerformed

    String storeSpace_option = null;
    File encrypted_file = null;/*  w ww. java  2  s.c  om*/
    List<File> files = new ArrayList<File>();

    if (!validateFileds()) {
        JOptionPane.showMessageDialog(this, "Some fileds are invalid", "Error", JOptionPane.WARNING_MESSAGE);
        return;
    }

    if (jRadioButton_allSpace.isSelected()) {
        storeSpace_option = "all avalible space";
    } else {
        storeSpace_option = String.valueOf(jSlider_size_select.getValue()) + " Mb of space";
    }

    int dialogResult = JOptionPane
            .showConfirmDialog(null,
                    "Are you sure you want to fill\n" + storeSpace_option + " at the media you selected:\n"
                            + jComboBox_media.getSelectedItem().toString(),
                    "Warning", JOptionPane.YES_NO_OPTION);
    if (dialogResult == JOptionPane.YES_OPTION) {
        //get all added files and perent directories 
        DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) jTree_fileList.getModel().getRoot();
        int chiledCount = rootNode.getChildCount();
        for (int i = 0; i < chiledCount; i++) {
            String path = jTree_fileList.getModel().getChild(rootNode, i).toString();
            files.add(new File(path));
            System.out.println(path);
        }
        if (validateFileds()) {
            encrypted_file = compressAndEncrypt(String.valueOf(jPasswordField_master_password.getPassword()),
                    files);
        } else {
            System.err.println("some fields are invalid");
            return;
        }

        Double size_select_bytes = jSlider_size_select.getValue() * Math.pow(1024, 2);
        Long size_select = size_select_bytes.longValue();
        if (encrypted_file.exists()) {
            Long fileSize = encrypted_file.length();
            if (jRadioButton_allSpace.isSelected()) {
                size_select_bytes = jSlider_size_select.getMaximum() * Math.pow(1024, 2);
                createIso(encrypted_file, size_select_bytes.longValue(), initIv, salt);
            } else if (size_select > 0 && size_select > fileSize)
                createIso(encrypted_file, size_select, initIv, salt);
        }

    }

}

From source file:org.n52.ifgicopter.spf.input.GpxInputPlugin.java

/**
 * @return//from  www.  j av a 2 s .  co  m
 * 
 */
private JPanel makeControlPanel() {
    if (this.controlPanel == null) {
        this.controlPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));

        JButton startButton = new JButton("Start");
        startButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        start();
                    }
                });
            }
        });
        this.controlPanel.add(startButton);
        JButton stopButton = new JButton("Stop");
        stopButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        stop();
                    }
                });
            }
        });
        this.controlPanel.add(stopButton);
        JButton selectFileButton = new JButton("Select GPX File");
        selectFileButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                selectGpxFileAction();
            }
        });
        this.controlPanel.add(selectFileButton);

        JLabel sleepTimeLabel = new JLabel("Time between points in seconds:");
        this.controlPanel.add(sleepTimeLabel);
        double spinnerMin = 0.5d;
        double spinnerMax = 10000.0d;
        SpinnerModel model = new SpinnerNumberModel(2.0d, spinnerMin, spinnerMax, 0.1d);
        JSpinner sleepTimeSpinner = new JSpinner(model);
        sleepTimeSpinner.setToolTipText("Select time using controls or manual input within the range of "
                + spinnerMin + " to " + spinnerMax + ".");

        sleepTimeSpinner.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                Object source = e.getSource();
                if (source instanceof JSpinner) {
                    final JSpinner spinner = (JSpinner) source;

                    EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            Double value = (Double) spinner.getValue();
                            value = Double.valueOf(value.doubleValue() * SECONDS_TO_MILLISECONDS);
                            setSleepTimeMillis(value.longValue());
                        }
                    });
                } else
                    getLog().warn("Unsupported ChangeEvent, need JSpinner as source: " + e);
            }
        });
        // catch text change events without loosing the focus
        // JSpinner.DefaultEditor editor = (DefaultEditor) sleepTimeSpinner.getEditor();
        // not implemented, can be done using KeyEvent, but then it hast to be checked where in the text
        // field the keystroke was etc. --> too complicated.

        this.controlPanel.add(sleepTimeSpinner);
    }

    return this.controlPanel;
}

From source file:com.mortardata.pig.storage.DynamoDBStorage.java

long getMaxWriteCapacity() throws IOException {
    // grab the full capacity of the dynamo table
    long fullTableWriteCapacity = getDynamoTableWriteCapacity();

    // grab the number of tasks for our portion of the Job
    int numTasksForStore = this.hadoopJobInfo.getNumTasksForStore();

    // grab the max number of tasks that could run at once
    int maxSlotsForStore = this.hadoopJobInfo.getNumSlotsForStore();

    // the maximum number of concurrent tasks will be
    // the minimum of the tasks in the job and the slots available to run them
    int maxConcurrentTasks = Math.min(numTasksForStore, maxSlotsForStore);

    // calculate full table write capacity per running task
    double fullCapacityPerTask = new Double(fullTableWriteCapacity) / new Double(maxConcurrentTasks);

    // modulate this by the amount of write capacity requested by the user
    // and cast down to a long to truncate (be conservative)
    Double capacityPerTaskDbl = fullCapacityPerTask * this.throughputWritePercent;
    long capacityPerTask = Math.max(capacityPerTaskDbl.longValue(), 1);

    log.info("Allocating [" + capacityPerTask + "] write capacity units to this "
            + this.hadoopJobInfo.getMapOrReduce() + " task; full table capacity: [" + fullTableWriteCapacity
            + "]," + " numTasksForStore: [" + numTasksForStore + "]," + " maxSlotsForStore: ["
            + maxSlotsForStore + "]" + " requested write throughput pct: [" + this.throughputWritePercent
            + "]");

    return capacityPerTask;
}

From source file:com.irccloud.android.CollapsedEventsList.java

public String formatNick(String nick, String from_mode, boolean colorize) {
    ObjectNode PREFIX = null;//from www .  j  a va  2  s . c  o m
    if (server != null)
        PREFIX = server.PREFIX;

    if (PREFIX == null) {
        PREFIX = new ObjectMapper().createObjectNode();
        PREFIX.put(server != null ? server.MODE_OPER : "Y", "!");
        PREFIX.put(server != null ? server.MODE_OWNER : "q", "~");
        PREFIX.put(server != null ? server.MODE_ADMIN : "a", "&");
        PREFIX.put(server != null ? server.MODE_OP : "o", "@");
        PREFIX.put(server != null ? server.MODE_HALFOP : "h", "%");
        PREFIX.put(server != null ? server.MODE_VOICED : "v", "+");
    }

    String[] colors = { "fc009a", "ff1f1a", "d20004", "fd6508", "880019", "c7009c", "804fc4", "5200b7",
            "123e92", "1d40ff", "108374", "2e980d", "207607", "196d61" };
    String color = null;

    if (colorize) {
        // Normalise a bit
        // typically ` and _ are used on the end alone
        String normalizedNick = nick.toLowerCase().replaceAll("[`_]+$", "");
        //remove |<anything> from the end
        normalizedNick = normalizedNick.replaceAll("|.*$", "");

        Double hash = 0.0;

        for (int i = 0; i < normalizedNick.length(); i++) {
            hash = ((int) normalizedNick.charAt(i)) + (double) ((int) (hash.longValue()) << 6)
                    + (double) ((int) (hash.longValue()) << 16) - hash;
        }

        color = colors[(int) Math.abs(hash.longValue() % 14)];
    }

    StringBuilder output = new StringBuilder();
    boolean showSymbol = false;
    try {
        if (NetworkConnection.getInstance().getUserInfo() != null
                && NetworkConnection.getInstance().getUserInfo().prefs != null)
            showSymbol = NetworkConnection.getInstance().getUserInfo().prefs.getBoolean("mode-showsymbol");
    } catch (Exception e) {
    }
    String mode = "";
    if (from_mode != null && from_mode.length() > 0) {
        if (from_mode.contains(server != null ? server.MODE_OPER : "Y"))
            mode = server != null ? server.MODE_OPER : "Y";
        else if (from_mode.contains(server != null ? server.MODE_OWNER : "q"))
            mode = server != null ? server.MODE_OWNER : "q";
        else if (from_mode.contains(server != null ? server.MODE_ADMIN : "a"))
            mode = server != null ? server.MODE_ADMIN : "a";
        else if (from_mode.contains(server != null ? server.MODE_OP : "o"))
            mode = server != null ? server.MODE_OP : "o";
        else if (from_mode.contains(server != null ? server.MODE_HALFOP : "h"))
            mode = server != null ? server.MODE_HALFOP : "h";
        else if (from_mode.contains(server != null ? server.MODE_VOICED : "v"))
            mode = server != null ? server.MODE_VOICED : "v";
        else
            mode = from_mode.substring(0, 1);
    }
    if (mode != null && mode.length() > 0) {
        if (mode_colors.containsKey(mode))
            output.append("\u0004").append(mode_colors.get(mode)).append("\u0002");
        else
            output.append("\u0002");
        if (showSymbol) {
            if (PREFIX.has(mode))
                output.append(TextUtils.htmlEncode(PREFIX.get(mode).asText()));
        } else {
            output.append("");
        }
        output.append("\u000f ");
    }

    if (color != null)
        output.append("\u0004").append(color);
    output.append(nick);
    if (color != null)
        output.append("\u0004");
    return output.toString();
}

From source file:form.house.NewHouseForm.java

private Long stringToLong(String number) {
    if (!StringUtils.isNumeric(number))
        return 0l;
    Double result = Double.valueOf(number) * 100;
    return result.longValue();
}

From source file:org.apache.pig.builtin.Utf8StorageConverter.java

@Override
public Long bytesToLong(byte[] b) throws IOException {
    if (b == null || b.length == 0) {
        return null;
    }//from   w  ww .ja  v a 2 s  .  co  m

    String s = new String(b).trim();
    if (s.endsWith("l") || s.endsWith("L")) {
        s = s.substring(0, s.length() - 1);
    }

    // See PIG-2835. Using exception handling to check if it's a double is very expensive.
    // So we write our sanity check.
    Long ret = null;
    if (sanityCheckIntegerLong(s)) {
        try {
            ret = Long.valueOf(s);
        } catch (NumberFormatException nfe) {
        }
    }

    if (ret == null) {
        // It's possible that this field can be interpreted as a double.
        // Unfortunately Java doesn't handle this in Long.valueOf.  So
        // we need to try to convert it to a double and if that works then
        // go to an long.
        try {
            Double d = Double.valueOf(s);
            // Need to check for an overflow error
            if (Double.compare(d.doubleValue(), mMaxLong.doubleValue() + 1) > 0
                    || Double.compare(d.doubleValue(), mMinLong.doubleValue() - 1) < 0) {
                LogUtils.warn(this, "Value " + d + " too large for long", PigWarning.TOO_LARGE_FOR_INT, mLog);
                return null;
            }
            return Long.valueOf(d.longValue());
        } catch (NumberFormatException nfe2) {
            LogUtils.warn(this,
                    "Unable to interpret value " + Arrays.toString(b) + " in field being "
                            + "converted to long, caught NumberFormatException <" + nfe2.getMessage()
                            + "> field discarded",
                    PigWarning.FIELD_DISCARDED_TYPE_CONVERSION_FAILED, mLog);
            return null;
        }
    }
    return ret;
}

From source file:org.opentaps.common.util.UtilCommon.java

/**
 * Gets the <code>Timestamp</code> which time is the given milliseconds after the given <code>Timestamp</code>.
 * @param ts the reference <code>Timestamp</code>
 * @param milliseconds number of milliseconds after ts for which to return
 * @return a <code>Timestamp</code>, <code>null</code> if ts is <code>null</code>
 */// ww w  .  jav a  2  s  .c  o m
public static Timestamp afterMillisecs(Timestamp ts, Double milliseconds) {
    if (milliseconds == null) {
        milliseconds = new Double(0);
    }
    return afterMillisecs(ts, milliseconds.longValue());
}