List of usage examples for java.util Vector size
public synchronized int size()
From source file:com.globalsight.everest.usermgr.UserLdapHelper.java
/** * Get email address arrays for the given user objects. *//*from ww w. j a v a2 s . c o m*/ static String[] getEmails(Vector p_users) { String[] emails = null; if (p_users != null) { int size = p_users.size(); emails = new String[size]; String tmp; for (int i = 0; i < size; i++) { tmp = ((User) p_users.elementAt(i)).getEmail(); // ignore empty email -- ??? if (tmp != null && tmp.length() != 0) { emails[i] = tmp; } } } return emails; }
From source file:net.nosleep.superanalyzer.analysis.views.WordView.java
private void refreshDataset() { // get the most common wong words, up to 25 of them Vector pairs = _analysis.getMostCommonWords(); // Collections.sort(pairs, new CommonWordComparator()); for (int i = 0; i < pairs.size(); i++) { WordCounterMemory.CommonWord item = (WordCounterMemory.CommonWord) pairs.elementAt(i); _dataset.addValue(item.Count, Misc.getString("WORD"), item.Word); }/*from w w w.j a v a 2 s . co m*/ }
From source file:com.globalsight.everest.webapp.pagehandler.projects.workflows.WorkflowHandlerHelper.java
/** * Converts the vector of workflow instance tasks to an array. * /*from www. j ava 2s .c o m*/ * @param p_wfInstanceTasks * - the workflow instance tasks. * * @return an array of the workflow instance tasks. */ public static WorkflowTaskInstance[] convertToArray(Vector p_wfInstanceTasks) { WorkflowTaskInstance[] taskInstances = new WorkflowTaskInstance[p_wfInstanceTasks.size()]; Enumeration e = p_wfInstanceTasks.elements(); int i = 0; while (e.hasMoreElements()) { taskInstances[i++] = (WorkflowTaskInstance) e.nextElement(); } return taskInstances; }
From source file:net.nosleep.superanalyzer.analysis.views.MostPlayedAAView.java
private void refreshDataset() { Vector<StringInt> artists = _analysis.getMostPlayedArtists(); _artistDataset.clear();/*from w w w.ja v a2s .co m*/ for (int i = 0; i < artists.size(); i++) { StringInt artist = artists.elementAt(i); _artistDataset.addValue(artist.IntVal, Misc.getString("ARTISTS"), artist.StringVal); } Vector<StringInt> albums = _analysis.getMostPlayedAlbums(); _albumDataset.clear(); for (int i = 0; i < albums.size(); i++) { StringInt album = albums.elementAt(i); _albumDataset.addValue(album.IntVal, Misc.getString("ALBUMS"), album.StringVal.replace(Album.Separator, " " + Misc.getString("BY") + " ")); } }
From source file:net.nosleep.superanalyzer.analysis.views.MostPlayedDGView.java
private void refreshDataset() { Vector<StringInt> decades = _analysis.getMostPlayedDecades(); _decadeDataset.clear();/* www . j a v a 2 s.co m*/ for (int i = 0; i < decades.size(); i++) { StringInt decade = decades.elementAt(i); _decadeDataset.addValue(decade.IntVal, Misc.getString("DECADE"), decade.StringVal); } Vector<StringInt> genres = _analysis.getMostPlayedGenres(); _genreDataset.clear(); for (int i = 0; i < genres.size(); i++) { StringInt genre = genres.elementAt(i); _genreDataset.addValue(genre.IntVal, Misc.getString("ARTISTS"), genre.StringVal); } }
From source file:fr.sanofi.fcl4transmart.controllers.listeners.clinicalData.SetUnitsListener.java
private boolean checkValues(Vector<String> columns, Vector<String> units) { File wmf = ((ClinicalData) this.dataType).getWMF(); for (int i = 0; i < columns.size(); i++) { File rawFile = new File(this.dataType.getPath() + File.separator + columns.get(i).split(" - ", 2)[0]); String headColumn = columns.get(i).split(" - ", 2)[1]; String headUnit = units.get(i).split(" - ", 2)[1]; int numberColumn = FileHandler.getHeaderNumber(rawFile, headColumn); if (!FileHandler.isColumnNumerical(rawFile, wmf, numberColumn)) { this.setUnitsUI.displayMessage("Values have to be numerical (term mapping considered).\nAt least '" + headColumn + "' is not numerical"); return false; }/*from w ww. j a v a 2 s. c o m*/ int numberUnit = FileHandler.getHeaderNumber(rawFile, headUnit); if (FileHandler.isColumnNumerical(rawFile, wmf, numberUnit)) { this.setUnitsUI.displayMessage( "Units have to be non numerical.\nAt lease '" + headUnit + "' is numerical"); return false; } } return true; }
From source file:FileUtil.java
public void vectorToFile(Vector v, String fileName) { for (int i = 0; i < v.size(); i++) { writeToFile(fileName, (String) v.elementAt(i), true, true); }/*from ww w . j av a 2s .co m*/ }
From source file:org.esgf.globusonline.GOFormView2Controller.java
private String[] getDestinationEndpointNames(Vector<EndpointInfo> endpoints) { int numEndpoints = endpoints.size(); String[] endPointNames = new String[numEndpoints]; for (int i = 0; i < numEndpoints; i++) { endPointNames[i] = endpoints.get(i).getEPName(); }//from ww w. j a va2 s .c o m return endPointNames; }
From source file:net.firejack.platform.core.utils.StringUtils.java
/** * @param text//ww w.j a v a 2 s. co m * @param len * @return */ public static String[] wrapText(String text, int len) { // return empty array for null text if (text == null) return new String[] {}; // return text if len is zero or less if (len <= 0) return new String[] { text }; // return text if less than length if (text.length() <= len) return new String[] { text }; char[] chars = text.toCharArray(); Vector lines = new Vector(); StringBuilder line = new StringBuilder(); StringBuilder word = new StringBuilder(); for (char aChar : chars) { word.append(aChar); if (aChar == ' ') { if ((line.length() + word.length()) > len) { lines.add(line.toString()); line.delete(0, line.length()); } line.append(word); word.delete(0, word.length()); } } // handle any extra chars in current word if (word.length() > 0) { if ((line.length() + word.length()) > len) { lines.add(line.toString()); line.delete(0, line.length()); } line.append(word); } // handle extra line if (line.length() > 0) { lines.add(line.toString()); } String[] ret = new String[lines.size()]; int c = 0; // counter for (Enumeration e = lines.elements(); e.hasMoreElements(); c++) { ret[c] = (String) e.nextElement(); } return ret; }
From source file:agentlogfileanalyzer.gui.ComparisonFrame.java
/** * Creates a chart frame for comparing a selected classifier to a set of * other classifiers.//from w w w . ja va 2 s . c o m * * @param firstTitle * the first line of the chart title * @param secondTitle * the second line of the chart title * @param compDataForColumns * the data the will be displayed in the chart */ public ComparisonFrame(String firstTitle, String secondTitle, Vector<ComparisonDataSet> compDataForColumns) { super("Classifier comparison"); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < compDataForColumns.size(); i++) { ComparisonDataSet mms = compDataForColumns.get(i); dataset.addValue(mms.getMax(), "max", mms.getColumnName()); dataset.addValue(mms.getMin(), "min", mms.getColumnName()); dataset.addValue(mms.getSelected(), "selected", mms.getColumnName()); } JFreeChart jfreechart = ChartFactory.createBarChart("", // title "", // x-axis title "", // y-axis title dataset, PlotOrientation.VERTICAL, true, true, false); TextTitle subtitle1 = new TextTitle(firstTitle, new Font("SansSerif", Font.BOLD, 12)); TextTitle subtitle2 = new TextTitle(secondTitle, new Font("SansSerif", Font.BOLD, 12)); jfreechart.addSubtitle(0, subtitle1); jfreechart.addSubtitle(1, subtitle2); jfreechart.setBackgroundPaint(Color.white); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setBackgroundPaint(Color.lightGray); categoryplot.setRangeGridlinePaint(Color.white); MinMaxCategoryRenderer minmaxcategoryrenderer = new MinMaxCategoryRenderer(); categoryplot.setRenderer(minmaxcategoryrenderer); ChartPanel chartpanel = new ChartPanel(jfreechart); chartpanel.setPreferredSize(new Dimension(500, 270)); setContentPane(chartpanel); }