Example usage for java.util List set

List of usage examples for java.util List set

Introduction

In this page you can find the example usage for java.util List set.

Prototype

E set(int index, E element);

Source Link

Document

Replaces the element at the specified position in this list with the specified element (optional operation).

Usage

From source file:com.htmlhifive.pitalium.core.selenium.PtlFirefoxDriver.java

@Override
protected void trimMovePadding(WebElement el, List<BufferedImage> images) {
    LOG.trace("[Trim move element's padding]");
    // firefox?textarea?padding?????????padding?
    if ("textarea".equals(el.getTagName())) {
        for (int i = 0; i < images.size(); i++) {
            images.set(i, trimTargetPadding(el, images.get(i), i, images.size()));
        }//from w  w w .  j  av a2s .c  o m
    }
}

From source file:com.consol.citrus.admin.process.ProcessLauncherTest.java

private ProcessListener getProcessListener(final List<Boolean> callbacks) {
    // reset callbacks
    for (int i = 0; i < callbacks.size(); i++) {
        callbacks.set(i, false);
    }//from ww  w .j a v a  2 s  .  co  m

    return new ProcessListener() {
        public void onProcessStart(String processId) {
            System.out.println("Starting:" + processId + ", " + new Date());
            callbacks.set(0, Boolean.TRUE);
        }

        public void onProcessSuccess(String processId) {
            System.out.println("Success:" + processId);
            callbacks.set(1, Boolean.TRUE);
        }

        public void onProcessFail(String processId, int exitCode) {
            System.err.println("Failed:" + processId + ", errorCode:" + exitCode);
            callbacks.set(2, Boolean.TRUE);
        }

        public void onProcessFail(String processId, Throwable e) {
            System.err.println("Failed:" + processId + ", ex:" + e.getLocalizedMessage());
            log.error("Failed", e);
            callbacks.set(3, Boolean.TRUE);
        }

        public void onProcessOutput(String processId, String output) {
            //do nothing as activity was already printed
        }

        public void onProcessActivity(String processId, String output) {
            System.out.println(processId + ":" + output);
        }
    };
}

From source file:techtonic.PlotGraphListener.java

@Override
public void actionPerformed(ActionEvent e) {

    Vector<String> v = new Vector<String>(Arrays.asList(trajectoryQuality));
    Techtonic.setEnablejcbX_Axis(true);//from   w ww.j ava2 s.  co  m
    Techtonic.setEnablejcbY_Axis(true);
    Techtonic.setjcbX_Axis(v);
    Techtonic.setjcbY_Axis(v);
    List<WitsmlTrajectoryStation> stationsAsList = Arrays
            .asList(new WitsmlTrajectoryStation[trajectory.getStations().size()]);
    for (WitsmlTrajectoryStation s : trajectory.getStations()) {
        stationsAsList.set(s.getStationNo(), s);
    }
    Techtonic.setEnablejcbX_Axis(true);
    Techtonic.setPropertyBtn(true);
    Techtonic.setEnablejcbY_Axis(true);
    Techtonic.setjcbX_Axis(v);
    Techtonic.setjcbY_Axis(v);
    Techtonic.setEnableRenderBtn(true);
    XYSeries series = new XYSeries(trajectory.getName());
    String xu = "";
    String yu = "";
    // add data to Dataset (here assume data is in ArrayLists x and y
    int count = 1;
    for (WitsmlTrajectoryStation station : stationsAsList) {

        Value tvd = station.getTvd();

        if (tvd == null) {
            continue;
        }
        xu = tvd.getUnit();
        Value md = station.getNorth();

        if (md == null) {
            continue;
        }
        yu = md.getUnit();
        //  System.out.println(count + " : ===>> tvd : "+tvd.getValue()+ "; md "+md.getValue());
        series.add(md.getValue(), tvd.getValue());
        count++;
    }
    XYSeriesCollection data = new XYSeriesCollection();
    data.addSeries(series);
    Techtonic.setCurrentStations(stationsAsList);
    // create a chart using the createYLineChart method...
    JFreeChart chart = ChartFactory.createXYLineChart(trajectory.getName(), // chart title
            xu, yu, // x and y axis labels
            data);
    //            XYPlot plot = (XYPlot) chart.getPlot();
    //             XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    //        renderer.setSeriesLinesVisible(0, true);
    //        renderer.setSeriesShapesVisible(1, true);
    //        renderer.setSeriesLinesVisible(1, false);
    //        renderer.setSeriesShapesVisible(1, true);        
    //           plot.setRenderer(renderer);

    ChartPanel cp = new ChartPanel(chart);
    //            JFrame fr = new JFrame();
    //            fr.add(cp);
    //            fr.pack();
    //            fr.setVisible(true);
    //cp.setMouseZoomable(true, true);  
    //     Techtonic.setTrajName(trajectory.getName());
    Techtonic.setFreeChart(chart);
    Techtonic.setDisplayArea(cp);
    //            chartPanel.setLayout(new java.awt.BorderLayout());
    //            chartPanel.add(cp,BorderLayout.CENTER);
    //            chartPanel.validate();
    //            chartPanel.repaint();`
}

From source file:com.alvermont.terraj.util.ui.HiddenTableModel.java

/**
 * Set the object at a particular row and column of the model
 *
 * @param rowIndex The row number of the object to be set
 * @param columnIndex The column number of the object to be set
 * @param aValue The new value to be stored at the given row and column in the model
 *//*from  www  .  j a  v a  2  s  .  c  om*/
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
    final List<Object> row = this.data.get(rowIndex);

    row.set(columnIndex, aValue);
}

From source file:edu.scripps.fl.hibernate.BooleanListStringType.java

public List<Boolean> getListFromString(String list) {
    List<Boolean> ids = newList(list.length());
    for (int ii = 0; ii < list.length(); ii++) {
        Boolean bool = null;//  w  w  w  .  j a v a 2s .  c o m
        if ('0' == list.charAt(ii))
            bool = Boolean.FALSE;
        else if ('1' == list.charAt(ii))
            bool = Boolean.TRUE;
        else
            bool = null;
        ids.set(ii, bool);
    }
    return ids;
}

From source file:com.github.htfv.maven.plugins.buildconfigurator.core.ModelInterpolator.java

/**
 * Interpolates strings.// w  w w .  j a v  a2s  . c o m
 *
 * @param strings
 *            collection of strings to interpolate.
 */
private void interpolateStrings(final List<String> strings) {
    for (int i = 0; i < strings.size(); i++) {
        strings.set(i, interpolateString(strings.get(i)));
    }
}

From source file:de.weltraumschaf.jebnf.ast.visitor.TextSyntaxTreeVisitor.java

/**
 * Generates the string contents  in the row of the visited node.
 *
 * @param visitable Visited node.//from   w  ww  .  ja  v  a 2 s .c o m
 */
@Override
public void visit(final Visitable visitable) {
    final List<String> row = createRow(depth);

    if (level > 0) {
        for (int i = 0; i < level - 1; ++i) {
            row.set(i, BLANK);
        }

        row.set(level - 1, BRANCH);
        row.set(level, formatNode((Node) visitable));
    }

    row.set(level, formatNode((Node) visitable));
    matrix.add(row);
}

From source file:org.apache.solr.handler.component.AlfrescoHttpShardHandlerFactory.java

/**
 * Creates a randomized list of urls for the given shard.
 *
 * @param shard the urls for the shard, separated by '|'
 * @return A list of valid urls (including protocol) that are replicas for the shard
 *//*w w w.  j  av a2  s. c  om*/
public List<String> makeURLList(String shard) {
    List<String> urls = StrUtils.splitSmart(shard, "|", true);

    // convert shard to URL
    for (int i = 0; i < urls.size(); i++) {
        urls.set(i, buildUrl(urls.get(i)));
    }

    //
    // Shuffle the list instead of use round-robin by default.
    // This prevents accidental synchronization where multiple shards could get in sync
    // and query the same replica at the same time.
    //
    if (urls.size() > 1)
        Collections.shuffle(urls, r);

    return urls;
}

From source file:it.tidalwave.bluemarine2.metadata.impl.audio.musicbrainz.MusicBrainzAudioMedatataImporter.java

/*******************************************************************************************************************
 *
 * Sweeps the given {@link ReleaseMediumDisk}s and marks as alternative all the items after a not alternative item.
 *
 * @param   rmds    the incoming {@code ReleaseMediumDisk}
 * @return          the processed {@code ReleaseMediumDisk}
 *
 ******************************************************************************************************************/
@Nonnull//from w w  w .j a  v  a2  s.c om
private static List<ReleaseMediumDisk> excessKeepersMarkedAlternative(
        final @Nonnull List<ReleaseMediumDisk> rmds) {
    if (countOfNotAlternative(rmds) > 1) {
        boolean foundGoodOne = false;
        // FIXME: should be sorted for test consistency
        for (int i = 0; i < rmds.size(); i++) {
            rmds.set(i, rmds.get(i).alternativeIf(foundGoodOne));
            foundGoodOne |= !rmds.get(i).isAlternative();
        }
    }

    return rmds;
}

From source file:com.demo.db.dao.impl.DriverDaoImpl.java

@Override
public int updateById(Driver driver) {
    QueryRunner queryRunner = dbHelper.getRunner();

    try {//  ww w  . j  a va2  s . c o m
        List<String> columnList = new LinkedList<String>();
        columnList.add("name");
        for (int i = 0; i < columnList.size(); i++) {
            String strColumn = columnList.get(i);
            columnList.set(i, strColumn + "=?");
        }
        final String strUpdateSet = StringUtils.join(columnList.toArray(), ",");
        if (StringUtils.isBlank(strUpdateSet)) {
            throw new RuntimeException("");
        }
        StringBuilder sb = new StringBuilder();
        sb.append("update demo_driver set ");
        sb.append(strUpdateSet);
        sb.append(" where id=?");
        int rows = queryRunner.update(dbHelper.getConnection(), sb.toString(), driver.getName(),
                driver.getId());
        return rows;
    } catch (SQLException e) {
        LOGGER.error(" ?{}", driver);
        throw new RuntimeException("", e);
    }
}