Example usage for java.util Vector addAll

List of usage examples for java.util Vector addAll

Introduction

In this page you can find the example usage for java.util Vector addAll.

Prototype

public boolean addAll(Collection<? extends E> c) 

Source Link

Document

Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator.

Usage

From source file:oscar.oscarRx.util.RxUtil.java

public static String findInterDrugStr(final UserPropertyDAO propDAO, String provider,
        final RxSessionBean bean) {
    //quiry mydrugref database to get a vector with all interacting drugs
    //if effect is not null or effect is not empty string
    //get a list of all pending prescriptions' ATC codes
    //compare if anyone match,
    //if yes, get it's randomId and set an session attribute
    //if not, do nothing

    UserProperty prop = propDAO.getProp(provider, UserProperty.MYDRUGREF_ID);
    String myDrugrefId = null;/*from  ww w  .j a  va 2 s.c o m*/
    if (prop != null) {
        myDrugrefId = prop.getValue();
        MiscUtils.getLogger().debug("3myDrugrefId" + myDrugrefId);
    }
    RxPrescriptionData.Prescription[] rxs = bean.getStash();
    //acd contains all atccodes in stash
    Vector<String> acd = new Vector<String>();
    for (RxPrescriptionData.Prescription rxItem : rxs) {
        acd.add(rxItem.getAtcCode());
    }
    logger.debug("3acd=" + acd);

    String[] str = new String[] { "warnings_byATC,bulletins_byATC,interactions_byATC,get_guidelines" }; //NEW more efficent way of sending multiple requests at the same time.
    Vector allInteractions = new Vector();
    for (String command : str) {
        try {
            Vector v = getMyDrugrefInfo(command, acd, myDrugrefId);
            MiscUtils.getLogger().debug("2v in for loop: " + v);
            if (v != null && v.size() > 0) {
                allInteractions.addAll(v);
            }
            MiscUtils.getLogger().debug("3after all.addAll(v): " + allInteractions);
        } catch (Exception e) {
            log2.debug("3command :" + command + " " + e.getMessage());
            MiscUtils.getLogger().error("Error", e);
        }
    }
    String retStr = "";
    HashMap rethm = new HashMap();
    for (RxPrescriptionData.Prescription rxItem : rxs) {
        MiscUtils.getLogger().debug("rxItem=" + rxItem.getDrugName());
        Vector uniqueDrugNameList = new Vector();
        for (int i = 0; i < allInteractions.size(); i++) {
            Hashtable hb = (Hashtable) allInteractions.get(i);
            String interactingAtc = (String) hb.get("atc");
            String interactingDrugName = (String) hb.get("drug2");
            String effectStr = (String) hb.get("effect");
            String sigStr = (String) hb.get("significance");
            MiscUtils.getLogger().debug("findInterDrugStr=" + hb);
            if (sigStr != null) {
                if (sigStr.equals("1")) {
                    sigStr = "minor";
                } else if (sigStr.equals("2")) {
                    sigStr = "moderate";
                } else if (sigStr.equals("3")) {
                    sigStr = "major";
                } else {
                    sigStr = "unknown";
                }
            } else {
                sigStr = "unknown";
            }
            if (interactingAtc != null && interactingDrugName != null
                    && rxItem.getAtcCode().equals(interactingAtc) && effectStr != null && effectStr.length() > 0
                    && !effectStr.equalsIgnoreCase("N") && !effectStr.equals(" ")) {
                MiscUtils.getLogger().debug("interactingDrugName=" + interactingDrugName);
                RxPrescriptionData.Prescription rrx = findRxFromDrugNameOrGN(rxs, interactingDrugName);

                if (rrx != null && !uniqueDrugNameList.contains(rrx.getDrugName())) {
                    MiscUtils.getLogger().debug("rrx.getDrugName()=" + rrx.getDrugName());
                    uniqueDrugNameList.add(rrx.getDrugName());

                    String key = sigStr + "_" + rxItem.getRandomId();

                    if (rethm.containsKey(key)) {
                        String val = (String) rethm.get(key);
                        val += ";" + rrx.getDrugName();
                        rethm.put(key, val);
                    } else {
                        rethm.put(key, rrx.getDrugName());
                    }

                    key = sigStr + "_" + rrx.getRandomId();
                    if (rethm.containsKey(key)) {
                        String val = (String) rethm.get(key);
                        val += ";" + rxItem.getDrugName();
                        rethm.put(key, val);
                    } else {
                        rethm.put(key, rxItem.getDrugName());
                    }
                }
            }
        }
        MiscUtils.getLogger().debug("***next rxItem***");
    }
    MiscUtils.getLogger().debug("rethm=" + rethm);
    retStr = rethm.toString();
    retStr = retStr.replace("}", "");
    retStr = retStr.replace("{", "");

    return retStr;
}

From source file:com.github.hdl.tensorflow.yarn.app.TFAmContainer.java

public StringBuilder makeCommands(long amMemory, String appMasterMainClass, int containerMemory,
        int containerVirtualCores, int workerNumContainers, int psNumContainers, String jarDfsPath,
        Vector<CharSequence> containerRetryOptions, String jniSoDfsPath) {
    // Set the necessary command to execute the application master
    Vector<CharSequence> vargs = new Vector<CharSequence>(30);

    // Set java executable command
    LOG.info("Setting up app master command");
    vargs.add(ApplicationConstants.Environment.JAVA_HOME.$$() + "/bin/java");
    // Set Xmx based on am memory size
    vargs.add("-Xmx" + amMemory + "m");
    // Set class name
    vargs.add(appMasterMainClass);//w  w w .  j  ava2s  .c o m
    // Set params for Application Master
    vargs.add("--container_memory " + String.valueOf(containerMemory));
    vargs.add("--container_vcores " + String.valueOf(containerVirtualCores));
    vargs.add(TFApplication.makeOption(TFApplication.OPT_TF_WORKER_NUM, String.valueOf(workerNumContainers)));
    vargs.add(TFApplication.makeOption(TFApplication.OPT_TF_PS_NUM, String.valueOf(psNumContainers)));
    vargs.add("--" + TFApplication.OPT_TF_SERVER_JAR + " " + String.valueOf(jarDfsPath));
    if (jniSoDfsPath != null && !jniSoDfsPath.equals("")) {
        vargs.add(TFApplication.makeOption(TFApplication.OPT_TF_JNI_SO, jniSoDfsPath));
    }

    vargs.addAll(containerRetryOptions);

    vargs.add("1>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/AppMaster.stdout");
    vargs.add("2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/AppMaster.stderr");

    // Get final commmand
    StringBuilder command = new StringBuilder();
    for (CharSequence str : vargs) {
        command.append(str).append(" ");
    }
    return command;
}

From source file:edu.ku.brc.af.ui.forms.IconViewObj.java

public synchronized void setDataIntoUI() {
    ignoreChanges = true;/*from   ww w  .j  a  v a2s. c  o  m*/

    if (mainComp == null) {
        initMainComp();
    }

    iconTray.removeAllItems();

    Vector<Object> dataObjects = new Vector<Object>();
    dataObjects.addAll(dataSet);
    if (this.orderableDataClass) {
        Vector<Orderable> sortedDataObjects = new Vector<Orderable>();
        for (Object obj : dataObjects) {
            if (obj instanceof Orderable) {
                sortedDataObjects.add((Orderable) obj);
            }
        }
        Collections.sort(sortedDataObjects, new OrderableComparator());

        dataObjects.clear();
        dataObjects.addAll(sortedDataObjects);
    }

    for (Object o : dataObjects) {
        if (!(o instanceof FormDataObjIFace)) {
            log.error("Icon view data set contains non-FormDataObjIFace objects.  Item being ignored.");
            mainComp.removeAll();
            JLabel lbl = createLabel(getResourceString("Error"));
            mainComp.add(lbl);

            dataTypeError = true;
            return;
        }

        FormDataObjIFace formDataObj = (FormDataObjIFace) o;
        iconTray.addItem(formDataObj);
    }
    ignoreChanges = false;

}

From source file:edu.ku.brc.specify.tasks.subpane.wb.FormPane.java

protected Vector<Object> getValues(final WorkbenchTemplateMappingItem wbtmi) {
    Vector<WorkbenchTemplateMappingItem> wbtmis = new Vector<WorkbenchTemplateMappingItem>();
    wbtmis.addAll(workbench.getWorkbenchTemplate().getWorkbenchTemplateMappingItems());
    Collections.sort(wbtmis);/*w w  w  .  j a va 2  s  .c om*/
    int wbCol = -1;
    for (int c = 0; c < wbtmis.size(); c++) {
        if (wbtmis.get(c) == wbtmi) {
            wbCol = c;
            break;
        }
    }
    if (wbCol != -1) {
        if (workbenchPane.getSpreadSheet().getColumnModel().getColumn(wbCol)
                .getCellEditor() instanceof WorkbenchPaneSS.GridCellListEditor) {
            ComboBoxModel model = ((WorkbenchPaneSS.GridCellListEditor) workbenchPane.getSpreadSheet()
                    .getColumnModel().getColumn(wbCol).getCellEditor()).getList();
            Vector<Object> result = new Vector<Object>();
            for (int i = 0; i < model.getSize(); i++) {
                result.add(model.getElementAt(i));
            }
            return result;
        }
    }
    return null;
}

From source file:com.dien.upload.server.UploadServlet.java

/**
 * This method parses the submit action, puts in session a listener where the
 * progress status is updated, and eventually stores the received data in
 * the user session.//from   w  ww.jav  a 2s.  c om
 * 
 * returns null in the case of success or a string with the error
 * 
 */
@SuppressWarnings("unchecked")
protected String parsePostRequest(HttpServletRequest request, HttpServletResponse response) {

    try {
        String delay = request.getParameter(PARAM_DELAY);
        uploadDelay = Integer.parseInt(delay);
    } catch (Exception e) {
    }

    HttpSession session = request.getSession();

    logger.debug("UPLOAD-SERVLET (" + session.getId() + ") new upload request received.");

    AbstractUploadListener listener = getCurrentListener(request);
    if (listener != null) {
        if (listener.isFrozen() || listener.isCanceled() || listener.getPercent() >= 100) {
            removeCurrentListener(request);
        } else {
            String error = getMessage("busy");
            logger.error("UPLOAD-SERVLET (" + session.getId() + ") " + error);
            return error;
        }
    }
    // Create a file upload progress listener, and put it in the user session,
    // so the browser can use ajax to query status of the upload process
    listener = createNewListener(request);

    List<FileItem> uploadedItems;
    try {

        // Call to a method which the user can override
        checkRequest(request);

        // Create the factory used for uploading files,
        FileItemFactory factory = getFileItemFactory(request.getContentLength());
        ServletFileUpload uploader = new ServletFileUpload(factory);
        uploader.setSizeMax(maxSize);
        uploader.setProgressListener(listener);

        // Receive the files
        logger.debug("UPLOAD-SERVLET (" + session.getId() + ") parsing HTTP POST request ");
        uploadedItems = uploader.parseRequest(request);
        logger.debug("UPLOAD-SERVLET (" + session.getId() + ") parsed request, " + uploadedItems.size()
                + " items received.");

        // Received files are put in session
        Vector<FileItem> sessionFiles = (Vector<FileItem>) getSessionFileItems(request);
        if (sessionFiles == null) {
            sessionFiles = new Vector<FileItem>();
        }

        String error = "";
        session.setAttribute(SESSION_LAST_FILES, uploadedItems);

        if (uploadedItems.size() > 0) {
            sessionFiles.addAll(uploadedItems);
            String msg = "";
            for (FileItem i : sessionFiles) {
                msg += i.getFieldName() + " => " + i.getName() + "(" + i.getSize() + " bytes),";
            }
            logger.debug("UPLOAD-SERVLET (" + session.getId() + ") puting items in session: " + msg);
            session.setAttribute(SESSION_FILES, sessionFiles);
        } else {
            logger.error("UPLOAD-SERVLET (" + session.getId() + ") error NO DATA received ");
            error += getMessage("no_data");
        }

        return error.length() > 0 ? error : null;

    } catch (SizeLimitExceededException e) {
        RuntimeException ex = new UploadSizeLimitException(e.getPermittedSize(), e.getActualSize());
        listener.setException(ex);
        throw ex;
    } catch (UploadSizeLimitException e) {
        listener.setException(e);
        throw e;
    } catch (UploadCanceledException e) {
        listener.setException(e);
        throw e;
    } catch (UploadTimeoutException e) {
        listener.setException(e);
        throw e;
    } catch (Exception e) {
        logger.error("UPLOAD-SERVLET (" + request.getSession().getId() + ") Unexpected Exception -> "
                + e.getMessage() + "\n" + stackTraceToString(e));
        e.printStackTrace();
        RuntimeException ex = new UploadException(e);
        listener.setException(ex);
        throw ex;
    }
}

From source file:it.classhidra.core.controller.bsController.java

public static Vector getActionStreams_(String id_action) {

    Vector _streams_orig = (Vector) getAction_config().get_streams_apply_to_actions().get("*");

    //Modifica 20100521 Warning 
    /*/*ww w . j a va  2 s . co  m*/
       try{
          _streams = (Vector)util_cloner.clone(_streams_orig);
       }catch(Exception e){
       }
    */
    Vector _streams4action = (Vector) getAction_config().get_streams_apply_to_actions().get(id_action);
    if (_streams4action == null)
        return (_streams_orig == null) ? new Vector() : _streams_orig;
    else {
        Vector _streams = new Vector();
        if (_streams_orig != null)
            _streams.addAll(_streams_orig);
        Vector _4add = new Vector();
        HashMap _4remove = new HashMap();
        for (int i = 0; i < _streams4action.size(); i++) {
            info_stream currentis = (info_stream) _streams4action.get(i);
            if (currentis.get_apply_to_action() != null) {
                info_apply_to_action currentiata = (info_apply_to_action) currentis.get_apply_to_action()
                        .get(id_action);
                if (currentiata.getExcluded() != null && currentiata.getExcluded().equalsIgnoreCase("true"))
                    _4remove.put(currentis.getName(), currentis.getName());
                else
                    _4add.add(currentis);
            }
        }
        _streams.addAll(_4add);
        if (_4remove.size() > 0) {
            int i = 0;
            while (i < _streams.size()) {
                info_stream currentis = (info_stream) _streams.get(i);
                if (_4remove.get(currentis.getName()) != null)
                    _streams.remove(i);
                else
                    i++;
            }
        }
        _streams = new util_sort().sort(_streams, "int_order", "A");
        return _streams;
    }
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.reporting.AnnotationReportCanvas.java

public void copy() {
    Vector<Glycan> sel_structures = new Vector<Glycan>();
    for (AnnotationObject a : selections)
        sel_structures.addAll(a.getStructures());
    ClipUtils.setContents(new GlycanSelection(theGlycanRenderer, sel_structures));
}

From source file:es.emergya.ui.plugins.AdminPanel.java

/**
 * //from w ww  .j  av a 2  s .c o  m
 * @param columnNames
 *            nombres de las columnas de la tabla
 * @param filterOptions
 *            lista de opciones de un combobox. Si esta vacio entonces es un
 *            textfield
 * @param noFiltrarAction
 * @param filtrarAction
 */
public void generateTable(String[] columnNames, Object[][] filterOptions,
        AdminPanel.NoFiltrarAction noFiltrarAction, AdminPanel.FiltrarAction filtrarAction) {

    if (columnNames == null) {
        columnNames = new String[] {};
    }
    if (filterOptions == null) {
        filterOptions = new Object[][] {};
    }

    String filterString = "[";
    for (Object[] o : filterOptions) {
        filterString += Arrays.toString(o) + " ";
    }
    filterString += "]";

    log.debug("generateTable( columnNames = " + Arrays.toString(columnNames) + ", filterOptions = "
            + filterString + ")");

    tablePanel.removeAll();
    int columnNamesLength = columnNames.length;
    if (!getCanDelete())
        columnNamesLength++;
    MyTableModel dataModel = new MyTableModel(1, columnNamesLength + 2) {

        private static final long serialVersionUID = 1348355328684460769L;

        @Override
        public boolean isCellEditable(int row, int column) {
            return column != 0 && !invisibleFilterCols.contains(column);
        }
    };
    filters = new JTable(dataModel) {

        private static final long serialVersionUID = -8266991359840905405L;

        @Override
        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);

            if (isCellEditable(row, column) && column != getColumnCount() - 1) {
                if (c instanceof JTextField) {
                    ((JTextField) c).setBorder(new MatteBorder(1, 1, 1, 1, Color.BLACK));
                } else if (c instanceof JComboBox) {
                    ((JComboBox) c).setBorder(new MatteBorder(1, 1, 1, 1, Color.BLACK));
                } else if (c instanceof JLabel) {
                    ((JLabel) c).setBorder(new MatteBorder(1, 1, 1, 1, Color.BLACK));
                }
            }
            return c;
        }
    };
    filters.setSurrendersFocusOnKeystroke(true);
    filters.setShowGrid(false);
    filters.setRowHeight(22);
    filters.setOpaque(false);

    for (Integer i = 0; i < filterOptions.length; i++) {
        final Object[] items = filterOptions[i];
        if (items != null && items.length > 1) {
            setComboBoxEditor(i, items);
        } else {
            final DefaultCellEditor defaultCellEditor = new DefaultCellEditor(new JTextField());
            defaultCellEditor.setClickCountToStart(1);
            filters.getColumnModel().getColumn(i + 1).setCellEditor(defaultCellEditor);
        }
    }

    filters.setRowSelectionAllowed(false);
    filters.setDragEnabled(false);
    filters.setColumnSelectionAllowed(false);
    filters.setDefaultEditor(JButton.class, new JButtonCellEditor());

    filters.setDefaultRenderer(Object.class, new DefaultTableRenderer() {
        private static final long serialVersionUID = -4811729559786534118L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if (invisibleFilterCols.contains(column))
                c = new JLabel("");
            return c;
        }

    });

    filters.setDefaultRenderer(JButton.class, new TableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            JButton b = (JButton) value;
            b.setBorderPainted(false);
            b.setContentAreaFilled(false);
            return b;
        }
    });
    filters.setDefaultRenderer(JLabel.class, new TableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            return (JLabel) value;
        }
    });
    filters.setDefaultEditor(JButton.class, new JButtonCellEditor());
    filters.getModel().setValueAt(new JLabel(""), 0, 0);
    JButton jButton2 = new JButton(noFiltrarAction);
    JButton jButton = new JButton(filtrarAction);
    jButton.setBorderPainted(false);
    jButton2.setBorderPainted(false);
    jButton.setContentAreaFilled(false);
    jButton2.setContentAreaFilled(false);
    if (jButton.getIcon() != null)
        jButton.setPreferredSize(
                new Dimension(jButton.getIcon().getIconWidth(), jButton.getIcon().getIconHeight()));
    if (jButton2.getIcon() != null)
        jButton2.setPreferredSize(
                new Dimension(jButton2.getIcon().getIconWidth(), jButton2.getIcon().getIconHeight()));

    filters.getModel().setValueAt(jButton, 0, columnNamesLength - 1);
    filters.getColumnModel().getColumn(columnNamesLength - 1).setMinWidth(jButton.getWidth() + 24);
    filters.getModel().setValueAt(jButton2, 0, columnNamesLength);
    filters.getColumnModel().getColumn(columnNamesLength).setMinWidth(jButton2.getWidth() + 14);
    cuenta.setHorizontalAlignment(JLabel.CENTER);
    cuenta.setText("?/?");
    filters.getModel().setValueAt(cuenta, 0, columnNamesLength + 1);

    tablePanel.add(filters, BorderLayout.NORTH);

    Vector<String> headers = new Vector<String>();
    headers.add("");
    headers.addAll(Arrays.asList(columnNames));
    MyTableModel model = new MyTableModel(headers, 0);
    table = new JTable(model) {

        private static final long serialVersionUID = 949284378605881770L;
        private int highLightedRow = -1;
        private Rectangle dirtyRegion = null;

        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);
            try {
                if (AdminPanel.this.myRendererColoring != null)
                    c.setBackground(AdminPanel.this.myRendererColoring
                            .getColor(AdminPanel.this.table.getValueAt(row, 1)));
            } catch (Throwable t) {
                log.error("Error al colorear la celda: " + t);
            }
            return c;
        }

        @Override
        protected void processMouseMotionEvent(MouseEvent e) {
            try {
                int row = rowAtPoint(e.getPoint());
                Graphics g = getGraphics();
                if (row == -1) {
                    highLightedRow = -1;
                }

                // row changed
                if (highLightedRow != row) {
                    if (null != dirtyRegion) {
                        paintImmediately(dirtyRegion);
                    }
                    for (int j = 0; j < getRowCount(); j++) {
                        if (row == j) {
                            // highlight
                            Rectangle firstRowRect = getCellRect(row, 0, false);
                            Rectangle lastRowRect = getCellRect(row, getColumnCount() - 1, false);
                            dirtyRegion = firstRowRect.union(lastRowRect);
                            g.setColor(new Color(0xff, 0xff, 0, 100));
                            g.fillRect((int) dirtyRegion.getX(), (int) dirtyRegion.getY(),
                                    (int) dirtyRegion.getWidth(), (int) dirtyRegion.getHeight());
                            highLightedRow = row;
                        }

                    }
                }
            } catch (Exception ex) {
            }
            super.processMouseMotionEvent(e);
        }
    };

    table.setRowHeight(22);

    table.setOpaque(false);
    // table.setAutoCreateRowSorter(true);

    table.setDragEnabled(false);
    table.getTableHeader().setReorderingAllowed(false);
    table.getTableHeader().setResizingAllowed(false);

    table.setDefaultEditor(JButton.class, new JButtonCellEditor());
    table.setDefaultRenderer(JButton.class, new TableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            JButton b = (JButton) value;
            if (b != null) {
                b.setBorderPainted(false);
                b.setContentAreaFilled(false);
            }
            return b;
        }
    });

    JScrollPane jScrollPane = new JScrollPane(table);
    jScrollPane.setOpaque(false);
    jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    jScrollPane.getViewport().setOpaque(false);
    tablePanel.add(jScrollPane, BorderLayout.CENTER);
}

From source file:gda.scan.ScanDataPoint.java

/**
 * Just returns array of positions. Strings will be an empty element.
 * /*from www  . j a va2 s .  c o  m*/
 * @return all scannable positions.
 */
@Override
public Double[] getPositionsAsDoubles() {
    Vector<Double> vals = new Vector<Double>();
    if (getPositions() != null) {
        for (Object data : getPositions()) {
            PlottableDetectorData wrapper = new DetectorDataWrapper(data);
            Double[] dvals = wrapper.getDoubleVals();
            vals.addAll(Arrays.asList(dvals));
        }
    }
    if (vals.size() != getPositionHeader().size()) {
        throw new IllegalArgumentException("Position data does not hold the expected number of fields");
    }
    return vals.toArray(new Double[] {});
}

From source file:gda.data.scan.datawriter.scannablewriter.SingleScannableWriter.java

@Override
public Collection<? extends SelfCreatingLink> makeScannable(final NeXusFileInterface file, final Scannable s,
        final Object position, final int[] dim) throws NexusException {

    final Vector<SelfCreatingLink> sclc = new Vector<SelfCreatingLink>();
    resetComponentWriters();//w w w  .  j  a v  a2 s  .c  om

    for (int i = 0; i < componentsFor(s); i++) {
        try {
            if (getPaths() == null || getPaths().length <= i || getPaths()[i].isEmpty()) {
                continue;
            }
            final String componentName = componentNameFor(s, i);

            final String unit;
            if (getUnits() != null && getUnits().length > i) {
                unit = getUnits()[i];
            } else if (s instanceof ScannableMotionUnits) {
                unit = ((ScannableMotionUnits) s).getUserUnits();
            } else {
                unit = null;
            }

            final Object componentObject = getComponentObject(s, position, i);
            final ComponentWriter cw = getComponentWriter(s, componentName, componentObject);
            final Collection<SelfCreatingLink> compLinks = cw.makeComponent(file, dim, getPaths()[i],
                    s.getName(), componentName, componentObject, unit);
            if (cw != null) {
                sclc.addAll(compLinks);
            }

        } catch (final Exception e) {
            LOGGER.error("error converting scannable data", e);
        }
    }

    return sclc;
}