Example usage for java.util LinkedList get

List of usage examples for java.util LinkedList get

Introduction

In this page you can find the example usage for java.util LinkedList get.

Prototype

public E get(int index) 

Source Link

Document

Returns the element at the specified position in this list.

Usage

From source file:de.vandermeer.asciitable.CWC_LongestLine.java

@Override
public int[] calculateColumnWidths(LinkedList<AT_Row> rows, int colNumbers, int tableWidth) {
    Validate.notNull(rows);/*from   w ww .  ja  v a 2 s. com*/

    int[] resultWidths = new int[colNumbers];

    // apply min width settings
    System.arraycopy(minWidths, 0, resultWidths, 0,
            minWidths.length > colNumbers ? colNumbers : minWidths.length);

    // iterate over all rows
    for (AT_Row row : rows) {
        if (row.getType() == TableRowType.CONTENT) {
            LinkedList<AT_Cell> cells = row.getCells();

            for (int i = 0; i < cells.size(); i++) {
                if (cells.get(i).getContent() != null) {
                    String[] lines = String_To_ConditionalBreak
                            .convert(Object_To_StrBuilder.convert(cells.get(i).getContent()).toString());

                    // measuring the width of each line within a cell
                    for (String line : lines) {
                        int lineWidth = line.length() + cells.get(i).getContext().getPaddingLeft()
                                + cells.get(i).getContext().getPaddingRight();
                        if (lineWidth > resultWidths[i]) {
                            int maxWidth = (maxWidths.length > i) ? maxWidths[i] : 0;
                            if (maxWidth < 1 || lineWidth < maxWidth) {
                                resultWidths[i] = lineWidth;
                            } else {
                                resultWidths[i] = maxWidth;
                            }
                        }
                    }
                }
            }
        }
    }
    return resultWidths;
}

From source file:com.tnc.android.graphite.activities.SavedActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.saved_graphs);

    ArrayList<String> savedGraphs = new ArrayList<String>();
    try {/*from  w ww.j  a  va 2  s.c  om*/
        LinkedList<GraphData> graphs = GraphStorage.getInstance().getGraphs();
        for (int i = 0; i < graphs.size(); ++i) {
            savedGraphs.add(graphs.get(i).getName());
        }

        SavedGraphsFragment fragment = (SavedGraphsFragment) getSupportFragmentManager()
                .findFragmentById(R.id.savedFragment);

        if (fragment != null && fragment.isInLayout()) {
            fragment.setContent(savedGraphs);
        }
    } catch (Exception e) {
        e.printStackTrace();
        UserNotification.displayRaw(this, e.toString());
        finish();
    }
}

From source file:soap.ui.stats.OverLaidBarChartFactory.java

public static JFreeChart createDualBarAndLineDiagram(String title, String categoryAxisLabel,
        String valueAxisLabel, CategoryDataset barDiagramDataset, LinkedList lineDiagramDatasets) {
    CategoryPlot plot = new CategoryPlot();
    int inc = 0;/*from ww w  .j a va 2  s . co m*/
    BarRenderer barRenderer = null;
    if (barDiagramDataset != null) {
        plot.setDataset(barDiagramDataset);
        barRenderer = new BarRenderer3D();
        barRenderer.setToolTipGenerator(new StandardCategoryToolTipGenerator());
        plot.setRenderer(barRenderer);
        inc = 1;
        plot.setDomainAxis(new CategoryAxis3D(categoryAxisLabel));
        plot.setRangeAxis(new NumberAxis3D(valueAxisLabel));
    } else {
        plot.setDomainAxis(new CategoryAxis(categoryAxisLabel));
        plot.setRangeAxis(new NumberAxis(valueAxisLabel));
    }
    plot.mapDatasetToRangeAxis(0, 0);

    plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    plot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    CategoryItemRenderer renderers[] = new LineAndShapeRenderer[lineDiagramDatasets.size()];

    for (int i = 0; i < lineDiagramDatasets.size(); i++) {
        CategoryDataset lineDiagramDataset = (CategoryDataset) lineDiagramDatasets.get(i);
        plot.setDataset(i + inc, lineDiagramDataset);
        plot.mapDatasetToRangeAxis(i + inc, 0);
        if (barDiagramDataset != null && i < barDiagramDataset.getRowCount()) {
            renderers[i] = new LineAndShapeRendererMapToBar(barRenderer, i);
        } else {
            renderers[i] = new LineAndShapeRenderer();
        }
        renderers[i].setToolTipGenerator(new StandardCategoryToolTipGenerator());
        renderers[i].setSeriesStroke(0, new BasicStroke(1.5f));
        renderers[i].setSeriesStroke(1, new BasicStroke(1.5f));
        plot.setRenderer(i + inc, renderers[i]);
    }

    CategoryDataset dataset;
    if (lineDiagramDatasets.size() > 0)
        dataset = (CategoryDataset) lineDiagramDatasets.get(0);
    else
        dataset = barDiagramDataset;
    for (int i = 0; i < dataset.getColumnCount(); i++)
        plot.getDomainAxis().addCategoryLabelToolTip(dataset.getColumnKey(i), (String) dataset.getColumnKey(i));

    plot.setRangeGridlinePaint(Color.black);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    JFreeChart chart = new JFreeChart(plot);
    chart.setTitle(title);
    chart.setLegend(new StandardLegend());

    return chart;
}

From source file:cso.AdvancedBox.java

public void setToApplicantBox() {
    String[] dataformats = { "asdp", "jpeg" };
    LinkedList<File> j = (LinkedList<File>) FileUtils.listFiles(new File("applicants"), dataformats, false);
    String[] al = new String[j.size()];
    for (int i = 0; i < j.size(); i++) {
        al[i] = (j.get(i).getName().toString().replace(".asdp", ""));
    }/*from  w  w  w .j  av a 2  s . c om*/
    this.setModel(new javax.swing.DefaultComboBoxModel(al));
    type = "applicant";
}

From source file:org.apache.sysml.runtime.controlprogram.parfor.mqo.PiggybackingWorker.java

protected synchronized void putJobResults(LinkedList<Long> ids, LinkedList<JobReturn> results) {
    //make job returns available
    for (int i = 0; i < ids.size(); i++)
        _results.put(ids.get(i), results.get(i));

    //notify all waiting threads
    notifyAll();/*from w w  w. java2s. c om*/
}

From source file:com.edsoft.teknosaproject.bean.TreeNodeBean.java

private void rec(List<TreeNode> children, LinkedList<File> fileList, int i, File parent, TreeNode root) {
    if (i == fileList.size()) {
        return;//from ww w .  j  a va  2 s.  c  o  m
    }
    File file = fileList.get(i);
    TreeNode node;
    if (file.getParentFile().equals(parent)) {
        node = new DefaultTreeNode(file.getName());
        children.add(node);
        if (!fileList.get(i).isFile()) {
            i++;
            rec(node.getChildren(), fileList, i, file, node);
        } else {
            i++;
            rec(node.getParent().getChildren(), fileList, i, file.getParentFile(), node.getParent());
        }
    } else {
        node = root;
        file = parent;
        rec(node.getParent().getChildren(), fileList, i, file.getParentFile(), node.getParent());
    }
}

From source file:edu.uci.ics.hyracks.algebricks.rewriter.rules.EliminateSubplanRule.java

private void elimSubplanOverEts(Mutable<ILogicalOperator> opRef, IOptimizationContext ctx)
        throws AlgebricksException {
    SubplanOperator subplan = (SubplanOperator) opRef.getValue();
    for (ILogicalPlan p : subplan.getNestedPlans()) {
        for (Mutable<ILogicalOperator> r : p.getRoots()) {
            OperatorManipulationUtil.ntsToEts(r, ctx);
        }/*from  www. ja v  a  2 s.c om*/
    }
    LinkedList<Mutable<ILogicalOperator>> allRoots = subplan.allRootsInReverseOrder();
    if (allRoots.size() == 1) {
        opRef.setValue(allRoots.get(0).getValue());
    } else {
        ILogicalOperator topOp = null;
        for (Mutable<ILogicalOperator> r : allRoots) {
            if (topOp == null) {
                topOp = r.getValue();
            } else {
                LeftOuterJoinOperator j = new LeftOuterJoinOperator(
                        new MutableObject<ILogicalExpression>(ConstantExpression.TRUE));
                j.getInputs().add(new MutableObject<ILogicalOperator>(topOp));
                j.getInputs().add(r);
                ctx.setOutputTypeEnvironment(j, j.computeOutputTypeEnvironment(ctx));
                topOp = j;
            }
        }
        opRef.setValue(topOp);
    }
}

From source file:org.apache.hyracks.algebricks.rewriter.rules.subplan.EliminateSubplanRule.java

private void elimSubplanOverEts(Mutable<ILogicalOperator> opRef, IOptimizationContext ctx)
        throws AlgebricksException {
    SubplanOperator subplan = (SubplanOperator) opRef.getValue();
    for (ILogicalPlan p : subplan.getNestedPlans()) {
        for (Mutable<ILogicalOperator> r : p.getRoots()) {
            OperatorManipulationUtil.ntsToEts(r, ctx);
        }/*from  w  w  w. j  av  a  2s. c om*/
    }
    LinkedList<Mutable<ILogicalOperator>> allRoots = subplan.allRootsInReverseOrder();
    if (allRoots.size() == 1) {
        opRef.setValue(allRoots.get(0).getValue());
    } else {
        ILogicalOperator topOp = null;
        for (Mutable<ILogicalOperator> r : allRoots) {
            if (topOp == null) {
                topOp = r.getValue();
            } else {
                InnerJoinOperator j = new InnerJoinOperator(
                        new MutableObject<ILogicalExpression>(ConstantExpression.TRUE));
                j.getInputs().add(new MutableObject<ILogicalOperator>(topOp));
                j.getInputs().add(r);
                ctx.setOutputTypeEnvironment(j, j.computeOutputTypeEnvironment(ctx));
                topOp = j;
            }
        }
        opRef.setValue(topOp);
    }
}

From source file:com.ibm.bi.dml.runtime.controlprogram.parfor.mqo.PiggybackingWorker.java

/**
 * //  w w  w. j a v a  2 s.c o  m
 * @param ids
 * @param results
 */
protected synchronized void putJobResults(LinkedList<Long> ids, LinkedList<JobReturn> results) {
    //make job returns available
    for (int i = 0; i < ids.size(); i++)
        _results.put(ids.get(i), results.get(i));

    //notify all waiting threads
    notifyAll();
}

From source file:ch.zhaw.icclab.tnova.expressionsolver.OTFlyEval.java

String evalGT(LinkedList<Double> paramList, double threshold) {
    String result = "false";
    if (paramList.get(0).doubleValue() > threshold)
        result = "true";
    return result;
}