List of usage examples for java.util Vector get
public synchronized E get(int index)
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 w ww.j a va2s. c o m*/ return endPointNames; }
From source file:cc.abstra.trantor.security.ssl.OwnSSLProtocolSocketFactory.java
/** * Parses a X.500 distinguished name for the value of the * "Common Name" field.//from w ww.ja v a2 s. co m * This is done a bit sloppy right now and should probably be done a bit * more according to <code>RFC 2253</code>. * * @param dn a X.500 distinguished name. * @return the value of the "Common Name" field. */ private String getCN(String dn) { X509Name name = new X509Name(dn); Vector<?> vector = name.getValues(X509Name.CN); if ((vector != null) && (vector.size() > 0)) { return (String) vector.get(0); } else { return null; } }
From source file:com.alfaariss.oa.profile.aselect.binding.protocol.cgi.CGIResponse.java
/** * Sets the supplied parameter with the supplied value. * Supports <code>String<code> and <code>Vector</code> objects as value. * The parameter names must be unique./* w w w . j a va 2 s.c o m*/ * @see IResponse#setParameter(java.lang.String, java.lang.Object) */ public void setParameter(String sName, Object oValue) throws BindingException { try { sName = URLEncoder.encode(sName, ASelectProcessor.CHARSET); if (_sbResponse.length() > 0) _sbResponse.append("&"); if (oValue instanceof Vector) { StringBuffer sbEncName = new StringBuffer(sName); sbEncName.append(CGIBinding.ENCODED_BRACES); sbEncName.append("="); if (_sbResponse.indexOf(sbEncName.toString()) > -1) { _logger.error("The response already contains an array parameter with name: " + sName); throw new BindingException(SystemErrors.ERROR_INTERNAL); } Vector vValues = (Vector) oValue; for (int i = 0; i < vValues.size(); i++) { if (i > 0) _sbResponse.append("&"); _sbResponse.append(sbEncName.toString()); _sbResponse.append(URLEncoder.encode((String) vValues.get(i), ASelectProcessor.CHARSET)); } } else { if (_sbResponse.indexOf(sName + "=") > -1) { _logger.error("The response already contains a parameter with name: " + sName); throw new BindingException(SystemErrors.ERROR_INTERNAL); } _sbResponse.append(sName); _sbResponse.append("="); _sbResponse.append(URLEncoder.encode((String) oValue, ASelectProcessor.CHARSET)); } } catch (BindingException e) { throw e; } catch (Exception e) { StringBuffer sbError = new StringBuffer("Internal error while setting parameter '"); sbError.append(sName); sbError.append("' with value:"); sbError.append(oValue); _logger.fatal(sbError.toString(), e); throw new BindingException(SystemErrors.ERROR_INTERNAL); } }
From source file:edu.umn.natsrl.evaluation.ContourPlotter.java
private String[] getTimes() { Vector<EvaluationResult> results = (Vector<EvaluationResult>) this.eval.getResult().clone(); ArrayList<String> times = results.get(0).getColumn(0); // remove not time format (hh:mm:ss) for (int i = 0; i < times.size(); i++) { if (!times.get(i).matches("[0-9]+:[0-9]+:[0-9]+")) { times.remove(i--);/* ww w. java2 s .c o m*/ } } return times.toArray(new String[times.size()]); }
From source file:edu.ku.brc.specify.conversion.TableDataChecker.java
/** * @param tableName/* www . ja v a2 s .c om*/ * @param skipNames * @return */ public List<Pair<String, String>> getColumnNamesWithData(final String tableName, final HashSet<String> skipNames) { List<Pair<String, String>> fieldsWithData = new Vector<Pair<String, String>>(); int numRows = BasicSQLUtils.getNumRecords(connection, tableName); if (numRows > 0) { try { Vector<Object[]> rows = BasicSQLUtils.query(connection, String.format( "SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT FROM INFORMATION_SCHEMA.COLUMNS " + "WHERE table_name = '%s' AND table_schema = '%s'", tableName, connection.getCatalog())); for (Object[] cols : rows) { String fieldName = cols[0].toString(); if ((skipNames == null || !skipNames.contains(fieldName.toLowerCase()))) { if (cols[2].equals("YES")) { String sql = String.format("SELECT COUNT(*) FROM `%s` WHERE `%s` IS NOT NULL", tableName, fieldName); int cnt = BasicSQLUtils.getCountAsInt(connection, sql); if (cnt > 0) { sql = String.format( "SELECT DISTINCT c.caption, fst.TextForValue from usysmetacontrol c INNER JOIN usysmetaobject o on o.objectid = c.objectid " + "INNER JOIN usysmetafieldset fs on fs.fieldsetid = o.fieldsetid LEFT JOIN usysmetafieldsetsubtype fst on fst.fieldsetsubtypeid = c.fieldsetsubtypeid " + "WHERE fs.fieldsetname = '%s' and o.objectname = '%s' and (fst.TextForValue is null or (fst.TextForValue not in('TissueOrExtract', 'KaryoSlide', 'HistoSlideSeries', 'Image', 'Sound', 'SoundRecording', 'ImagePrint', 'Spectrogram', 'Container')))", tableName, fieldName); Pair<String, String> namePair = new Pair<String, String>(); Vector<Object[]> captions = BasicSQLUtils.query(connection, sql); if (captions.size() > 0) { namePair.second = (String) captions.get(0)[0]; } namePair.first = fieldName; fieldsWithData.add(namePair); } } } } } catch (Exception ex) { ex.printStackTrace(); } } return fieldsWithData; }
From source file:chartsPK.LineChart.java
private XYDataset createDataset() { XYSeriesCollection dataset = new XYSeriesCollection(); Vector<XYSeries> series = new Vector<>(); for (LineChartDataSeries dataSerie : dataSeries) { series.add(new XYSeries(dataSerie.getTitle())); }//from w ww . j a va2s .c o m for (int i = 0; i < dataSeries.size(); i++) { for (int j = 0; j < dataSeries.get(i).getXValues().size(); j++) { series.get(i).add(dataSeries.get(i).getXValues().get(j), dataSeries.get(i).getYValues().get(j)); } } for (XYSeries serie : series) { dataset.addSeries(serie); } return dataset; }
From source file:de.escidoc.core.test.om.container.ContainerReferenceIT.java
/** * References that are to skip (or non valid GET refs). * * @param ref The reference (path).//from w w w . j a va 2 s . c om * @return True if the reference is to skip, false otherwise. */ private boolean skipRefCheck(final String ref) { Vector<String> skipList = new Vector<String>(); skipList.add("members/filter"); skipList.add("members/filter/refs"); for (int i = 0; i < skipList.size(); i++) { if (ref.endsWith(skipList.get(i))) { return (true); } } return false; }
From source file:com.autoparts.buyers.activity.SelectModeActivity.java
public void setData(ResponseModel responseModel) { // {//from w w w . j a v a 2 s. co m // "partbandid": 3, // "nam": "", // "pic": "http://123.56.87.239:81/auto/resource/partband/1434756909.png" // } Vector<HashMap<String, Object>> maps = responseModel.getMaps(); if (maps != null && maps.size() > 0) { for (int i = 0; i < maps.size(); i++) { HashMap<String, Object> map = maps.get(i); String bandid = (String) map.get("partbandid"); String nam = (String) map.get("nam"); String pic = (String) map.get("pic"); CommonLetterModel commonLetterModel = new CommonLetterModel(); commonLetterModel.setUser_id(bandid); commonLetterModel.setUser_image(pic); commonLetterModel.setUser_name(nam); String key = "#"; if (!TextUtils.isEmpty(nam)) { key = new ContactUtils().getPinYinHeadChar(nam.substring(0, 1)); key = key.toUpperCase(); if (TextUtils.isEmpty(key)) { key = "#"; } } commonLetterModel.setUser_key(key); mList.add(commonLetterModel); } mList = contactUtils.getListKey(mList); mIndexer = contactUtils.getmIndexer(); actionsAdapter.setData(mList); actionsAdapter.notifyDataSetChanged(); setDataNull(false); } else { setDataNull(true); } }
From source file:eionet.gdem.dcm.business.StylesheetManager.java
/** * Gets conversion types/*from w w w .j a v a 2 s .c o m*/ * @return Conversion types * @throws DCMException If an error occurs. */ public ConvTypeHolder getConvTypes() throws DCMException { ConvTypeHolder ctHolder = new ConvTypeHolder(); ArrayList convs; try { convs = new ArrayList(); Vector convTypes = convTypeDao.getConvTypes(); for (int i = 0; i < convTypes.size(); i++) { Hashtable hash = (Hashtable) convTypes.get(i); String conv_type = (String) hash.get("conv_type"); ConvType conv = new ConvType(); conv.setConvType(conv_type); convs.add(conv); } ctHolder.setConvTypes(convs); } catch (Exception e) { e.printStackTrace(); LOGGER.error("Error getting conv types", e); throw new DCMException(BusinessConstants.EXCEPTION_GENERAL); } return ctHolder; }
From source file:edu.umn.natsrl.evaluation.ContourPlotter.java
private void setData() { // it should be average or a day data // see Evaluation.java Vector<EvaluationResult> results = (Vector<EvaluationResult>) this.eval.getResult().clone(); EvaluationResult result = results.get(0); // x => index of time line // y => index of stations with virtual stations // z => value int colDataStartPoint = result.COL_DATA_START(); int rowDataStartPoint = result.ROW_DATA_START(); int xSize = result.getRowSize(1) - rowDataStartPoint; int ySize = result.getColumnSize() - colDataStartPoint; // for all data according to time series for (int x = 0; x < xSize; x++) { // for all station data for (int y = colDataStartPoint; y < ySize; y++) { //System.out.println("x="+x+", y="+y+", z="+Double.parseDouble(result.get(y+colDataStartPoint, x+rowDataStartPoint).toString())); xIndex.add((double) x); yIndex.add((double) y); zValue.add(Double.parseDouble(result.get(y + colDataStartPoint, x + rowDataStartPoint).toString())); }/* w ww. jav a 2s .com*/ } }