Example usage for java.lang Integer MIN_VALUE

List of usage examples for java.lang Integer MIN_VALUE

Introduction

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

Prototype

int MIN_VALUE

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

Click Source Link

Document

A constant holding the minimum value an int can have, -231.

Usage

From source file:fr.immotronic.ubikit.pems.enocean.impl.item.datahandler.EEPD201xxDataHandler.java

@Override
public void processNewIncomingData(int transmitterID, EnoceanData data) {
    byte[] dataBytes = data.getBytes();

    AbstractEvent event = null;/*from  w w  w . j  a v a  2 s.c o m*/
    SwitchState[] switchStates = sensorData.getSwitchStates();
    Date[] eventDates = ((EEPD201xxDataImpl) sensorData).getSwitchStateDates();

    // Reading Command Identifier
    switch (dataBytes[dataBytes.length - 1]) {
    // Actuator Status Response
    case 0x04:

        switch (EEPType) {
        case 0x0:
        case 0x6:
            // Reading switch state
            switchStates[0] = (dataBytes[0] == 0) ? SwitchState.OFF : SwitchState.UNKNOWN;
            if (switchStates[0] != SwitchState.OFF && dataBytes[0] <= 0x64)
                switchStates[0] = SwitchState.ON;

            eventDates[0] = data.getDate();

            // Does the state change since last data ?
            //if (switchState != ((EEPD201xxData.EEPD20106Data) sensorData).getSwitchState())
            //{
            if (switchStates[0] == SwitchState.ON)
                event = new SwitchOnEvent(itemUID, (byte) 0, data.getDate());
            else if (switchStates[0] == SwitchState.OFF)
                event = new SwitchOffEvent(itemUID, (byte) 0, data.getDate());
            //}

            // Remembering new state.
            sensorData = new EEPD201xxDataImpl(EEPType, switchStates, eventDates,
                    sensorData.getMeasurementValue(), sensorData.getMeasurementUnit(),
                    ((EEPD201xxDataImpl) sensorData).getValueDate(), Mode.NOT_APPLICABLE);
            break;

        case 0x2:
            // Reading dimmer value
            int dimmerValue = dataBytes[0];
            if (dimmerValue < 0 || dimmerValue > 0x64)
                dimmerValue = Integer.MIN_VALUE;

            eventDates[0] = data.getDate();

            // Does the value change since last data ?
            //if (dimmerValue != ((EEPD201xxData.EEPD20102Data) sensorData).getDimmerValue())
            //{
            event = new DimmingEvent(itemUID, dimmerValue, data.getDate());
            //}

            // Remembering new state.
            sensorData = new EEPD201xxDataImpl(EEPType, dimmerValue, eventDates,
                    sensorData.getMeasurementValue(), sensorData.getMeasurementUnit(),
                    ((EEPD201xxDataImpl) sensorData).getValueDate());
            break;

        case 0x11:
            // Reading switch state
            int channel_index = (dataBytes[1] & 0x1f);
            switchStates[channel_index] = (dataBytes[0] == 0) ? SwitchState.OFF : SwitchState.UNKNOWN;

            if (switchStates[channel_index] != SwitchState.OFF && dataBytes[0] <= 0x64) {
                switchStates[channel_index] = SwitchState.ON;
            }

            eventDates[channel_index] = data.getDate();

            // Send switch event
            if (switchStates[channel_index] == SwitchState.ON)
                event = new SwitchOnEvent(itemUID, (byte) channel_index, data.getDate());
            else if (switchStates[channel_index] == SwitchState.OFF)
                event = new SwitchOffEvent(itemUID, (byte) channel_index, data.getDate());

            // Remembering new state.
            sensorData = new EEPD201xxDataImpl(EEPType, switchStates, eventDates,
                    sensorData.getMeasurementValue(), sensorData.getMeasurementUnit(),
                    ((EEPD201xxDataImpl) sensorData).getValueDate(),
                    ((EEPD201xxDataImpl) sensorData).getMode());
            break;
        }

        break;

    // Actuator Measurement Response
    case 0x07:
        //Reading unit
        MeasurementUnit unit;
        byte unitByte = (byte) ((dataBytes[4] >> 5) & 0x7);
        switch (unitByte) {
        case 0x0:
            unit = MeasurementUnit.WATT_SECOND;
            break;
        case 0x1:
            unit = MeasurementUnit.WATT_HOUR;
            break;
        case 0x2:
            unit = MeasurementUnit.KILOWATT_HOUR;
            break;
        case 0x3:
        case 0x4:
        default:
            Logger.warn(LC.gi(), this,
                    "Received an unknown unit identifier. Check code and enocean EEP2.5 specs.");
            unit = MeasurementUnit.UNKNOWN;
            break;
        }

        // Reading measured value
        int value = (dataBytes[3] & 0xff) << 24 | (dataBytes[2] & 0xff) << 16 | (dataBytes[1] & 0xff) << 8
                | (dataBytes[0] & 0xff);

        // Does the value change since last data ?
        //if (unit != sensorData.getMeasurementUnit() || value != sensorData.getMeasurementValue())
        //{
        event = new MeteringEvent(itemUID, value, MeteringEvent.MeasurementUnit.valueOf(unit.name()), 0,
                data.getDate());
        //}

        // Remembering new state.
        switch (EEPType) {
        case 0x0:
        case 0x6:
            sensorData = new EEPD201xxDataImpl(EEPType, sensorData.getSwitchStates(),
                    ((EEPD201xxDataImpl) sensorData).getSwitchStateDates(), value, unit, data.getDate(),
                    Mode.NOT_APPLICABLE);
            break;
        case 0x2:
            sensorData = new EEPD201xxDataImpl(EEPType, sensorData.getDimmerValue(),
                    ((EEPD201xxDataImpl) sensorData).getSwitchStateDates(), value, unit, data.getDate());
            break;
        }

        break;

    default:
        Logger.warn(LC.gi(), this,
                "Unsupported CMD identifier from EEPD20106 Device received. Check code and enocean EEP2.5 specs.");
        return;
    }

    // And then, send the event, if any. Sending MUST be done after remembering received data, otherwise if an event listener performs
    // a getLastKnownData() on event reception, it might obtain non up-to-date data.
    if (event != null) {
        eventGate.postEvent(event);
    }
}

From source file:com.jgeppert.struts2.jquery.chart.components.ChartData.java

@SuppressWarnings("rawtypes")
public void evaluateExtraParams() {
    super.evaluateExtraParams();
    if (color != null)
        addParameter("color", findString(color));
    if (label != null)
        addParameter("label", findString(label));
    if (lines != null)
        addParameter("lines", findString(lines));
    if (bars != null)
        addParameter("bars", findString(bars));
    if (points != null)
        addParameter("points", findString(points));
    if (xaxis != null)
        addParameter("xaxis", findValue(xaxis, Integer.class));
    if (yaxis != null)
        addParameter("yaxis", findValue(yaxis, Integer.class));
    if (clickable != null)
        addParameter("clickable", findValue(this.clickable, Boolean.class));
    if (hoverable != null)
        addParameter("hoverable", findValue(this.hoverable, Boolean.class));
    if (shadowSize != null)
        addParameter("shadowSize", findValue(shadowSize, Integer.class));
    if (fillBetween != null)
        addParameter("fillBetween", findString(fillBetween));
    if (curvedLines != null)
        addParameter("curvedLines", findValue(this.curvedLines, Boolean.class));
    if (curvedLinesFit != null)
        addParameter("curvedLinesFit", findValue(this.curvedLinesFit, Boolean.class));
    if (curvedLinesFill != null)
        addParameter("curvedLinesFill", findValue(this.curvedLinesFill, Boolean.class));
    if (curvedLinesFillColor != null)
        addParameter("curvedLinesFillColor", findString(curvedLinesFillColor));
    if (curvedLinesLineWidth != null)
        addParameter("curvedLinesLineWidth", findValue(curvedLinesLineWidth, Integer.class));
    if (stack != null)
        addParameter("stack", findString(stack));

    if ((this.id == null || this.id.length() == 0)) {
        // resolves Math.abs(Integer.MIN_VALUE) issue reported by FindBugs
        // http://findbugs.sourceforge.net/bugDescriptions.html#RV_ABSOLUTE_VALUE_OF_RANDOM_INT
        int nextInt = RANDOM.nextInt();
        nextInt = nextInt == Integer.MIN_VALUE ? Integer.MAX_VALUE : Math.abs(nextInt);
        this.id = "chartdata" + String.valueOf(nextInt);
        addParameter("id", this.id);
    }// ww  w.j a v  a 2 s  . co m

    Chart chart = (Chart) findAncestor(Chart.class);
    if (chart != null) {
        addParameter("chart", chart.getId());
    }

    if (this.href != null && !this.href.equals("#")) {
        if (list != null) {
            addParameter("remoteList", findString(list.toString()));
        }
        if (listKey != null) {
            addParameter("remoteListKey", findString(listKey));
        }
        if (listValue != null) {
            addParameter("remoteListValue", findString(listValue));
        }
    } else if (data != null) {
        addParameter("data", findString(data));
    } else {
        if (list == null) {
            list = parameters.get("list");
        }

        Object listObject = findValue(list.toString());

        if (listObject instanceof String) {
            addParameter("data", listObject);
        } else if (listObject instanceof Map) {
            Map map = (Map) listObject;
            Set keySet = map.keySet();

            StringBuffer data = new StringBuffer();
            data.append("[");

            boolean setComma = false;
            for (Object key : keySet) {
                if (setComma) {
                    data.append(",");
                }
                if (!setComma) {
                    setComma = true;
                }
                data.append("[");
                if (key instanceof Date) {
                    data.append(((Date) key).getTime());
                } else {
                    data.append(key.toString());
                }
                data.append(",");
                data.append(map.get(key));
                data.append("]");
            }
            data.append("]");
            addParameter("data", data.toString());
        } else {
            Iterator iterator = null;
            if (listObject instanceof Collection) {
                iterator = ((Collection) listObject).iterator();
            } else {
                iterator = MakeIterator.convert(listObject);
            }

            if (iterator != null) {
                StringBuffer data = new StringBuffer();
                data.append("[");

                Object item = iterator.next();
                boolean iterat = true;
                int count = 0;
                while (iterat) {
                    count++;
                    if (item == null) {
                        data.append("null");
                    } else {
                        if (item instanceof Point) {
                            data.append("[");
                            Point point = (Point) item;
                            data.append(point.getX());
                            data.append(",");
                            data.append(point.getY());
                            data.append("]");
                        } else {
                            data.append("[");
                            if (listKey != null) {
                                String key = findString(listKey);
                                Object itemKey = null;
                                try {
                                    itemKey = PropertyUtils.getSimpleProperty(item, key);
                                } catch (IllegalAccessException e) {
                                    LOG.warn("Cannot read listKey", e);
                                } catch (InvocationTargetException e) {
                                    LOG.warn("Cannot read listKey", e);
                                } catch (NoSuchMethodException e) {
                                    LOG.warn("Cannot read listKey", e);
                                }

                                if (itemKey != null) {
                                    if (itemKey instanceof Date) {
                                        data.append(((Date) itemKey).getTime());
                                    } else {
                                        data.append(itemKey.toString());
                                    }
                                } else {
                                    data.append(count);
                                }
                            } else {
                                data.append(count);
                            }

                            data.append(",");

                            if (listValue != null) {
                                String value = findString(listValue);
                                Object itemValue = null;
                                try {
                                    itemValue = PropertyUtils.getSimpleProperty(item, value);
                                } catch (IllegalAccessException e) {
                                    LOG.warn("Cannot read listValue", e);
                                } catch (InvocationTargetException e) {
                                    LOG.warn("Cannot read listValue", e);
                                } catch (NoSuchMethodException e) {
                                    LOG.warn("Cannot read listValue", e);
                                }

                                if (itemValue != null) {
                                    if (itemValue instanceof Date) {
                                        data.append(((Date) itemValue).getTime());
                                    } else {
                                        data.append(itemValue.toString());
                                    }
                                } else {
                                    data.append(item.toString());
                                }
                            } else {
                                data.append(item.toString());
                            }
                            data.append("]");
                        }
                    }

                    if (iterator.hasNext()) {
                        data.append(",");
                        item = iterator.next();
                    } else {
                        iterat = false;
                    }
                }

                data.append("]");
                addParameter("data", data.toString());
            }
        }
    }
}

From source file:com.github.cambierr.lorawanpacket.semtech.Txpk.java

private Txpk() {
    imme = false;//from  ww  w  .j  a v a2 s. c  o m
    tmst = Integer.MIN_VALUE;
    time = null;
    freq = Double.MIN_VALUE;
    rfch = Integer.MIN_VALUE;
    powe = Integer.MIN_VALUE;
    modu = null;
    datr = null;
    codr = null;
    fdev = Integer.MIN_VALUE;
    ipol = false;
    prea = Integer.MIN_VALUE;
    size = Integer.MIN_VALUE;
    data = null;
    ncrc = false;
}

From source file:org.literacyapp.web.content.multimedia.image.ImageEditController.java

@RequestMapping(value = "/{id}", method = RequestMethod.POST)
public String handleSubmit(HttpSession session, Image image, @RequestParam("bytes") MultipartFile multipartFile,
        BindingResult result, Model model) {
    logger.info("handleSubmit");

    if (StringUtils.isBlank(image.getTitle())) {
        result.rejectValue("title", "NotNull");
    } else {//  w ww  . ja  v a2 s . c  o  m
        Image existingImage = imageDao.read(image.getTitle(), image.getLocale());
        if ((existingImage != null) && !existingImage.getId().equals(image.getId())) {
            result.rejectValue("title", "NonUnique");
        }
    }

    try {
        byte[] bytes = multipartFile.getBytes();
        if (multipartFile.isEmpty() || (bytes == null) || (bytes.length == 0)) {
            result.rejectValue("bytes", "NotNull");
        } else {
            String originalFileName = multipartFile.getOriginalFilename();
            logger.info("originalFileName: " + originalFileName);
            if (originalFileName.toLowerCase().endsWith(".png")) {
                image.setImageFormat(ImageFormat.PNG);
            } else if (originalFileName.toLowerCase().endsWith(".jpg")
                    || originalFileName.toLowerCase().endsWith(".jpeg")) {
                image.setImageFormat(ImageFormat.JPG);
            } else if (originalFileName.toLowerCase().endsWith(".gif")) {
                image.setImageFormat(ImageFormat.GIF);
            } else {
                result.rejectValue("bytes", "typeMismatch");
            }

            if (image.getImageFormat() != null) {
                String contentType = multipartFile.getContentType();
                logger.info("contentType: " + contentType);
                image.setContentType(contentType);

                image.setBytes(bytes);

                if (image.getImageFormat() != ImageFormat.GIF) {
                    int width = ImageHelper.getWidth(bytes);
                    logger.info("width: " + width + "px");

                    if (width < ImageHelper.MINIMUM_WIDTH) {
                        result.rejectValue("bytes", "image.too.small");
                        image.setBytes(null);
                    } else {
                        if (width > ImageHelper.MINIMUM_WIDTH) {
                            bytes = ImageHelper.scaleImage(bytes, ImageHelper.MINIMUM_WIDTH);
                            image.setBytes(bytes);
                        }
                    }
                }
            }
        }
    } catch (IOException e) {
        logger.error(e);
    }

    if (result.hasErrors()) {
        model.addAttribute("image", image);
        model.addAttribute("contentLicenses", ContentLicense.values());
        model.addAttribute("literacySkills", LiteracySkill.values());
        model.addAttribute("numeracySkills", NumeracySkill.values());
        model.addAttribute("contentCreationEvents", contentCreationEventDao.readAll(image));
        return "content/multimedia/image/edit";
    } else {
        image.setTitle(image.getTitle().toLowerCase());
        image.setTimeLastUpdate(Calendar.getInstance());
        image.setRevisionNumber(Integer.MIN_VALUE);
        imageDao.update(image);

        Contributor contributor = (Contributor) session.getAttribute("contributor");

        ContentCreationEvent contentCreationEvent = new ContentCreationEvent();
        contentCreationEvent.setContributor(contributor);
        contentCreationEvent.setContent(image);
        contentCreationEvent.setCalendar(Calendar.getInstance());
        contentCreationEventDao.update(contentCreationEvent);

        if (EnvironmentContextLoaderListener.env == Environment.PROD) {
            String text = URLEncoder
                    .encode(contributor.getFirstName() + " just edited an Image:\n" + " Language: "
                            + image.getLocale().getLanguage() + "\n" + " Title: \"" + image.getTitle()
                            + "\"\n" + " Image format: " + image.getImageFormat() + "\n" + "See ")
                    + "http://literacyapp.org/content/multimedia/image/list";
            String iconUrl = contributor.getImageUrl();
            SlackApiHelper.postMessage(Team.CONTENT_CREATION, text, iconUrl, "http://literacyapp.org/image/"
                    + image.getId() + "." + image.getImageFormat().toString().toLowerCase());
        }

        return "redirect:/content/multimedia/image/list";
    }
}

From source file:LayeredPaneDemo2.java

protected void setupCapturePanel() {
    CapturePanel mouseTrap = new CapturePanel();
    m_rootPane.getLayeredPane().add(mouseTrap, new Integer(Integer.MIN_VALUE));
    mouseTrap.setBounds(0, 0, 10000, 10000);
}

From source file:IntVector.java

/**
 * Inserts the specified node in this vector at the specified index.
 * Each component in this vector with an index greater or equal to
 * the specified index is shifted upward to have an index one greater
 * than the value it had previously.//from   ww w  .  j  a  v a  2  s .co m
 */
public final void removeAllElements() {

    for (int i = 0; i < m_firstFree; i++) {
        m_map[i] = java.lang.Integer.MIN_VALUE;
    }

    m_firstFree = 0;
}

From source file:com.hunch.api.HunchResult.java

static HunchResult buildFromJSON(JSONObject json) {
    HunchResult.Builder builder = getBuilder();

    // build the HunchQuestion object
    int id = Integer.MIN_VALUE, topicId = Integer.MIN_VALUE;
    try {/*from  ww  w.ja  v  a 2 s .c  o  m*/
        id = Integer.parseInt(json.getString("id"));
        topicId = Integer.parseInt(json.getString("topicId"));

        builder.init(json).setId(id).setTopicId(topicId).setImageUrl(json.getString("imageUrl"))
                .setType(json.getString("type")).setDescription(json.getString("description"))
                .setName(json.getString("name")).setUrlName(json.getString("urlName"))
                .setHunchUrl(json.getString("hunchUrl"));

        // read more url may be omitted
        try {
            builder.setReadMoreUrl(json.getString("readMoreUrl"));
        } catch (JSONException e) {
            Log.v(Const.TAG, "No read more URL in Hunch result! This is usually OK.");
        }

        // add affiliate links (may be omitted)
        JSONArray affiliateLinks = null;
        try {
            affiliateLinks = json.getJSONArray("affiliateLinks");
        } catch (JSONException e) {
            Log.v(Const.TAG, "building result with no affiliate links [HunchResult]");
        }

        if (affiliateLinks == null)
            return builder.build();

        for (int i = 0; i < affiliateLinks.length(); i++) {
            builder.addAffiliateLink(affiliateLinks.getJSONObject(i));
        }

    } catch (NumberFormatException e) {
        throw new RuntimeException("Couldn't build HunchResult!", e);
    } catch (JSONException e) {
        throw new RuntimeException("Couldn't build HunchResult!", e);
    }

    return builder.build();
}

From source file:com.koda.integ.hbase.storage.FileExtMultiStorage.java

public int getMaxId() {
    int max = Integer.MIN_VALUE;
    for (FileExtStorage stor : storages) {
        int v = stor.getMaxId().get();
        if (v > max)
            max = v;/*from  w ww  . ja v a 2  s.co  m*/
    }
    return max;
}

From source file:com.cloudera.oryx.app.serving.als.model.ALSServingModel.java

public float[] getItemVector(String item) {
    int partition;
    try (AutoLock al = yPartitionMapLock.autoReadLock()) {
        partition = yPartitionMap.getOrDefault(item, Integer.MIN_VALUE);
    }//from www .j av a  2  s  . c o  m
    if (partition < 0) {
        return null;
    }
    return Y[partition].getVector(item);
}

From source file:edu.stanford.slac.archiverappliance.PB.data.StatusSeverityTest.java

private DBR getJCASampleValue(ArchDBRTypes type, int value, int severity, int status) {
    switch (type) {
    case DBR_SCALAR_STRING:
        DBR_TIME_String retvalss = new DBR_TIME_String(new String[] { Integer.toString(value) });
        retvalss.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalss.setSeverity(severity);/* w w w  .j a  v  a2  s . c  o  m*/
        retvalss.setStatus(status);
        return retvalss;
    case DBR_SCALAR_SHORT:
        DBR_TIME_Short retvalsh;
        if (0 <= value && value < 1000) {
            // Check for some numbers around the minimum value
            retvalsh = new DBR_TIME_Short(new short[] { (short) (Short.MIN_VALUE + value) });
        } else if (1000 <= value && value < 2000) {
            // Check for some numbers around the maximum value
            retvalsh = new DBR_TIME_Short(new short[] { (short) (Short.MAX_VALUE - (value - 1000)) });
        } else {
            // Check for some numbers around 0
            retvalsh = new DBR_TIME_Short(new short[] { (short) (value - 2000) });
        }
        retvalsh.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalsh.setSeverity(severity);
        retvalsh.setStatus(status);
        return retvalsh;
    case DBR_SCALAR_FLOAT:
        DBR_TIME_Float retvalfl;
        if (0 <= value && value < 1000) {
            // Check for some numbers around the minimum value
            retvalfl = new DBR_TIME_Float(new float[] { Float.MIN_VALUE + value });
        } else if (1000 <= value && value < 2000) {
            // Check for some numbers around the maximum value
            retvalfl = new DBR_TIME_Float(new float[] { Float.MAX_VALUE - (value - 1000) });
        } else {
            // Check for some numbers around 0. Divide by a large number to make sure we cater to the number of precision digits
            retvalfl = new DBR_TIME_Float(new float[] { (value - 2000.0f) / value });
        }
        retvalfl.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalfl.setSeverity(severity);
        retvalfl.setStatus(status);
        return retvalfl;
    case DBR_SCALAR_ENUM:
        DBR_TIME_Enum retvalen;
        retvalen = new DBR_TIME_Enum(new short[] { (short) (value) });
        retvalen.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalen.setSeverity(severity);
        retvalen.setStatus(status);
        return retvalen;
    case DBR_SCALAR_BYTE:
        DBR_TIME_Byte retvalby;
        retvalby = new DBR_TIME_Byte(new byte[] { ((byte) (value % 255)) });
        retvalby.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalby.setSeverity(severity);
        retvalby.setStatus(status);
        return retvalby;
    case DBR_SCALAR_INT:
        DBR_TIME_Int retvalint;
        if (0 <= value && value < 1000) {
            // Check for some numbers around the minimum value
            retvalint = new DBR_TIME_Int(new int[] { Integer.MIN_VALUE + value });
        } else if (1000 <= value && value < 2000) {
            // Check for some numbers around the maximum value
            retvalint = new DBR_TIME_Int(new int[] { Integer.MAX_VALUE - (value - 1000) });
        } else {
            // Check for some numbers around 0
            retvalint = new DBR_TIME_Int(new int[] { (value - 2000) });
        }
        retvalint.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvalint.setSeverity(severity);
        retvalint.setStatus(status);
        return retvalint;
    case DBR_SCALAR_DOUBLE:
        DBR_TIME_Double retvaldb;
        if (0 <= value && value < 1000) {
            // Check for some numbers around the minimum value
            retvaldb = new DBR_TIME_Double(new double[] { (Double.MIN_VALUE + value) });
        } else if (1000 <= value && value < 2000) {
            // Check for some numbers around the maximum value
            retvaldb = new DBR_TIME_Double(new double[] { (Double.MAX_VALUE - (value - 1000)) });
        } else {
            // Check for some numbers around 0. Divide by a large number to make sure we cater to the number of precision digits
            retvaldb = new DBR_TIME_Double(new double[] { ((value - 2000.0) / (value * 1000000)) });
        }
        retvaldb.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvaldb.setSeverity(severity);
        retvaldb.setStatus(status);
        return retvaldb;
    case DBR_WAVEFORM_STRING:
        DBR_TIME_String retvst;
        // Varying number of copies of a typical value
        retvst = new DBR_TIME_String(
                Collections.nCopies(value, Integer.toString(value)).toArray(new String[0]));
        retvst.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvst.setSeverity(severity);
        retvst.setStatus(status);
        return retvst;
    case DBR_WAVEFORM_SHORT:
        DBR_TIME_Short retvsh;
        retvsh = new DBR_TIME_Short(
                ArrayUtils.toPrimitive(Collections.nCopies(1, (short) value).toArray(new Short[0])));
        retvsh.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvsh.setSeverity(severity);
        retvsh.setStatus(status);
        return retvsh;
    case DBR_WAVEFORM_FLOAT:
        DBR_TIME_Float retvf;
        // Varying number of copies of a typical value
        retvf = new DBR_TIME_Float(ArrayUtils.toPrimitive(
                Collections.nCopies(value, (float) Math.cos(value * Math.PI / 3600)).toArray(new Float[0])));
        retvf.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvf.setSeverity(severity);
        retvf.setStatus(status);
        return retvf;
    case DBR_WAVEFORM_ENUM:
        DBR_TIME_Enum retven;
        retven = new DBR_TIME_Enum(
                ArrayUtils.toPrimitive(Collections.nCopies(1024, (short) value).toArray(new Short[0])));
        retven.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retven.setSeverity(severity);
        retven.setStatus(status);
        return retven;
    case DBR_WAVEFORM_BYTE:
        DBR_TIME_Byte retvb;
        // Large number of elements in the array
        retvb = new DBR_TIME_Byte(ArrayUtils
                .toPrimitive(Collections.nCopies(65536 * value, ((byte) (value % 255))).toArray(new Byte[0])));
        retvb.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvb.setSeverity(severity);
        retvb.setStatus(status);
        return retvb;
    case DBR_WAVEFORM_INT:
        DBR_TIME_Int retvint;
        // Varying number of copies of a typical value
        retvint = new DBR_TIME_Int(
                ArrayUtils.toPrimitive(Collections.nCopies(value, value * value).toArray(new Integer[0])));
        retvint.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvint.setSeverity(severity);
        retvint.setStatus(status);
        return retvint;
    case DBR_WAVEFORM_DOUBLE:
        DBR_TIME_Double retvd;
        // Varying number of copies of a typical value
        retvd = new DBR_TIME_Double(ArrayUtils.toPrimitive(
                Collections.nCopies(value, Math.sin(value * Math.PI / 3600)).toArray(new Double[0])));
        retvd.setTimeStamp(convertSecondsIntoYear2JCATimeStamp(value));
        retvd.setSeverity(severity);
        retvd.setStatus(status);
        return retvd;
    case DBR_V4_GENERIC_BYTES:
        throw new RuntimeException("Currently don't support " + type + " when generating sample data");
    default:
        throw new RuntimeException("We seemed to have missed a DBR type when generating sample data");
    }
}