List of usage examples for java.util LinkedList get
public E get(int index)
From source file:universal.MMatrix.java
public void MultiplyAndAdd(Coordinate to, Coordinate from, Fraction scalar) { LinkedList<Fraction> row = matrix.get(to.row); LinkedList<Fraction> rowMultiplied = matrix.get(from.row); for (int i = 0; i < numCols; i++) { row.set(i, row.get(i).add((rowMultiplied.get(i).multiply(scalar)))); }/*from w ww . j a va2s . com*/ }
From source file:panels.SelectionPanel.java
public void setRightBox(String folder) { LinkedList<File> j = (LinkedList<File>) FileUtils.listFiles(new File(folder), dataformats, false); String[] al = new String[j.size()]; for (int i = 0; i < j.size(); i++) { String data = j.get(i).getName().toString(); //Get data for (int k = 0; k < dataformats.length; k++) { data = data.replace("." + dataformats[k], ""); //was the file ending }//from w w w . ja v a 2s . c o m al[i] = (data); //Add to array } rightBox.setModel(new javax.swing.DefaultComboBoxModel(al)); //Add array as model for the combo box }
From source file:org.exoplatform.social.xmlprocessor.core.DOMContentEscapeFilter.java
private void nodeFilter(Node node) { LinkedList<Node> currentChildNode = node.getChildNodes(); if (node.getParentNode() != null) { if (!node.getContent().equals("")) { node.setContent(StringEscapeUtils.escapeHtml(node.getContent())); }/*from w w w . j a v a 2s . c o m*/ } for (int i = 0; i < currentChildNode.size(); i++) { nodeFilter(currentChildNode.get(i)); } }
From source file:panels.SelectionPanel.java
public void setLeftBox(String folder) throws Exception { LinkedList<File> j = (LinkedList<File>) FileUtils.listFiles(new File(folder), dataformats, false); String[] al = new String[j.size()]; for (int i = 0; i < j.size(); i++) { String data = j.get(i).getName().toString(); //Get data for (int k = 0; k < dataformats.length; k++) { data = data.replace("." + dataformats[k], ""); //was the file ending }//from w w w . ja va 2s . com al[i] = data; //Add to array //al[i] = (j.get(i).getName().toString().replace(".pdf", "")); } leftBox.setModel(new javax.swing.DefaultComboBoxModel(al)); leftBox.setSelectedIndex(leftIndex); }
From source file:edu.cmu.cs.in.hadoop.HoopWholeFileRecordReader.java
/** * Primarily this key generated is designed to turn document file names like * the ones of the form wiki-doc10.txt into a long integer 10. The code is * somewhat elaborate but this way it can extract any number from an encoded * filename and not just from the wiki dataset. *///from w w w . j a v a 2s.c o m private String createKeyFromName(String aFileName) { String cleaned = aFileName.toLowerCase(); //debug ("createKey ("+cleaned+")"); LinkedList<String> numbers = HoopStringTools.StringToNumbers(cleaned); if (numbers == null) key.set(fileSize); internalKey = numbers.get(0); return (internalKey); }
From source file:org.exoplatform.social.common.xmlprocessor.filters.DOMContentEscapeFilterPlugin.java
/** * Filter by nodes.//from www . j a va2 s .c o m * * @param node a node */ private void nodeFilter(Node node) { LinkedList<Node> currentChildNode = node.getChildNodes(); if (node.getParentNode() != null) { if (!node.getContent().isEmpty()) { node.setContent(StringEscapeUtils.escapeHtml(node.getContent())); } } for (int i = 0; i < currentChildNode.size(); i++) { nodeFilter(currentChildNode.get(i)); } }
From source file:de.ks.activity.initialization.ActivityInitialization.java
public Node getViewForController(Class<?> targetController) { if (!controllers.containsKey(targetController)) { throw new IllegalArgumentException("Controller " + targetController.getName() + " is not registered. Registered are " + controllers.keySet()); }/* ww w .j ava 2 s .co m*/ LinkedList<Pair<Object, Node>> ctrls = controllers.get(targetController); if (ctrls.isEmpty()) { return null; } else if (ctrls.size() == 1) { return ctrls.get(0).getRight(); } else { throw new IllegalArgumentException( "There are " + ctrls.size() + " instances registered for the given controller"); } }
From source file:at.ac.tuwien.dsg.utility.DesignChart.java
public void chart(LinkedList<String> xValue, LinkedList<String> yValue) throws Exception { XYSeries series = new XYSeries("Sensory Data"); final JFreeChart chart; //data assignment in the chart {// w w w. j a v a 2 s . c o m for (int i = 0; i < xValue.size(); i++) { series.add(Double.parseDouble(xValue.get(i)), Double.parseDouble(yValue.get(i))); } final XYSeriesCollection data = new XYSeriesCollection(series); chart = ChartFactory.createXYLineChart("Graph Visualization", "collection_time", "collection_data", data, PlotOrientation.VERTICAL, true, true, false); } //design the plot of the chart { XYPlot xyPlot = chart.getXYPlot(); NumberAxis xAxis = (NumberAxis) xyPlot.getDomainAxis(); NumberAxis yAxis = (NumberAxis) xyPlot.getRangeAxis(); xAxis.setRange(20, 120); xAxis.setTickUnit(new NumberTickUnit(15)); yAxis.setRange(947, 950); yAxis.setTickUnit(new NumberTickUnit(0.5)); } //generation of the image { try { BufferedImage img = chart.createBufferedImage(300, 200); //File outputfile = new File("./example/Sample.png"); File outputfile = new File( "/Users/dsg/Documents/phd/Big Demo/CloudLyra/Utils/JBPMEngine/example/Sample.png"); ImageIO.write(img, "png", outputfile); } catch (Exception e) { System.out.println("exception occured in tomcat: " + e); } } }
From source file:de.ks.activity.initialization.ActivityInitialization.java
@SuppressWarnings("unchecked") public <T> T getControllerInstance(Class<T> targetController) { if (!controllers.containsKey(targetController)) { throw new IllegalArgumentException("Controller " + targetController + " is not registered. Registered are " + controllers.keySet()); }//from ww w. ja va2 s . com LinkedList<Pair<Object, Node>> ctrls = controllers.get(targetController); if (ctrls.isEmpty()) { return null; } else if (ctrls.size() == 1) { return (T) ctrls.get(0).getLeft(); } else { throw new IllegalArgumentException( "There are " + ctrls.size() + " instances registered for the given controller"); } }
From source file:pl.exsio.ca.app.report.terraincard.view.TerrainCardsView.java
@Override protected void buildPdfDocument(Map<String, Object> map, Document dcmnt, PdfWriter writer, HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception { LinkedList<TerrainCardPage> pages = this.viewModel.getPages(map); int pagesCount = pages.size(); for (int i = 0; i < pagesCount; i++) { dcmnt.add(this.getHeader(map)); dcmnt.add(this.buildTable(pages.get(i))); dcmnt.add(this.getCreationDate(new Date())); dcmnt.add(this.getPageCounter(pagesCount, i + 1)); if (i < pages.size() - 1) { dcmnt.newPage();//from w w w.j a va 2s.co m } } }