List of usage examples for java.util Vector get
public synchronized E get(int index)
From source file:edu.gatech.ppl.cycleatlanta.TripUploader.java
private String getPostData(long tripId) throws JSONException { JSONObject coords = getCoordsJSON(tripId); JSONObject user = getUserJSON();/*from w w w . ja va 2 s. c om*/ String deviceId = getDeviceId(); Vector<String> tripData = getTripData(tripId); String notes = tripData.get(0); String purpose = tripData.get(1); String startTime = tripData.get(2); // String endTime = tripData.get(3); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new BasicNameValuePair("coords", coords.toString())); nameValuePairs.add(new BasicNameValuePair("user", user.toString())); nameValuePairs.add(new BasicNameValuePair("device", deviceId)); nameValuePairs.add(new BasicNameValuePair("notes", notes)); nameValuePairs.add(new BasicNameValuePair("purpose", purpose)); nameValuePairs.add(new BasicNameValuePair("start", startTime)); // nameValuePairs.add(new BasicNameValuePair("end", endTime)); nameValuePairs.add(new BasicNameValuePair("version", "" + kSaveProtocolVersion)); String codedPostData = "purpose=" + purpose + "&user=" + user.toString() + "¬es=" + notes + "&coords=" + coords.toString() + "&version=" + String.valueOf(kSaveProtocolVersion) + "&start=" + startTime + "&device=" + deviceId; return codedPostData; }
From source file:export.notes.view.to.excel.ExcelWriter.java
@SuppressWarnings("unchecked") public void createTableHeader(View view) throws NotesException { Vector<ViewColumn> columns = view.getColumns(); // offset column int offset = 0; for (int x = 0; x < columns.size(); x++) { ViewColumn column = columns.get(x); if (column.isConstant()) { offset++;/*from w w w . java 2s .c o m*/ } else if (column.isFormula()) { // A column value (ViewEntry.getColumnValues()) is not // returned if it is determined by a constant. Check it. String formula = column.getFormula(); if (formula == null) { offset++; } else { // empty string formula = formula.replaceAll("\"", "").trim(); // some whitespaces if (StringUtils.isBlank(formula)) { offset++; } } } // hidden and icons columns not will be use if (!column.isHidden() && !column.isIcon() && !column.isConstant()) { String s = columns.get(x).getTitle(); if (s == null || "".equals(s)) { //$NON-NLS-1$ s = " "; //$NON-NLS-1$ } int position = x - offset; headers.put(position, column); ViewNavigator nav = view.createViewNav(); ViewEntry entry = nav.getFirst(); while (!entry.isDocument()) { entry = nav.getNext(); } createCellStyle(position, column, entry); } } // column indexes int idy = 0; // Generate column headings Cell c = null; if (sheet == null) { SimpleDateFormat sf = new SimpleDateFormat("dd.MM.yyyy HH:mm"); //$NON-NLS-1$ sheet = createSheet(Messages.ExportAction_10 + " " + sf.format(new Date())); } Row row = sheet.createRow(0); Font fontBold = workbook.createFont(); fontBold.setBoldweight(Font.BOLDWEIGHT_BOLD); CellStyle cellStyle = workbook.createCellStyle(); cellStyle.setFont(fontBold); for (Entry<Integer, ViewColumn> entry : headers.entrySet()) { ViewColumn column = entry.getValue(); c = row.createCell(idy++); c.setCellValue(column.getTitle()); c.setCellStyle(cellStyle); } sheet.createFreezePane(0, 1, 0, 1); }
From source file:it.classhidra.core.controller.wsController.java
public boolean performStream_Enter(Vector _streams, String id_action, i_action action_instance, HashMap wsParameters) throws bsControllerException, Exception, Throwable { for (int i = 0; i < _streams.size(); i++) { info_stream iStream = (info_stream) _streams.get(i); i_stream currentStream = bsController.getAction_config().streamFactory(iStream.getName()); if (currentStream != null) { currentStream.onPreEnter(wsParameters); redirects currentStreamRedirect = currentStream.streamservice_enter(wsParameters); currentStream.onPostEnter(currentStreamRedirect, wsParameters); if (currentStreamRedirect != null) { throw new bsControllerException( "BLOCKED from ENTER stream:" + currentStream.get_infostream().getName(), iStub.log_ERROR); }//from w w w. j av a2s . com } } return true; }
From source file:com.clustercontrol.poller.impl.MultipleOidsUtils.java
public Collection<VariableBinding> query(Target target, OID[] rootOids) throws IOException { HashMap<OID, VariableBinding> result = new HashMap<OID, VariableBinding>(); if ((rootOids == null) || (rootOids.length == 0)) { throw new IllegalArgumentException("No OIDs specified"); }//from w w w . java 2s . c om PDU request = pduFactory.createPDU(target); // Bulk????MaxRepetitions if (request.getType() == PDU.GETBULK) { // DefaultPDUFactory?????????????PDU?? request.setMaxRepetitions(this.factory.getMaxRepetitions()); } RootOidAndOidMapping mapping = new RootOidAndOidMapping(rootOids); int requestCounter = 0; int responseCounter = 0; while (!mapping.isEmpty()) { ArrayList<OID> oidList = mapping.getOidList(); log.debug(target.getAddress() + " oidList.size=" + oidList.size()); RootOidAndOidMapping oldMapping = new RootOidAndOidMapping(mapping); PDU response = sendRequest(request, target, oidList); requestCounter++; if (response == null) { log.info(target.getAddress() + " response is null : result.size=" + result.values().size()); throw new IOException(MessageConstant.MESSAGE_TIME_OUT.getMessage()); } Vector<? extends VariableBinding> vbs = response.getVariableBindings(); int requestOidSize = request.getVariableBindings().size();//requestOidSize <= oidList.size() for (int i = 0; i < vbs.size(); i++) { responseCounter++; VariableBinding vb = vbs.get(i); log.trace("oid=" + vb.getOid() + ", " + vb.toString()); int colIndex = i % requestOidSize; OID oldOid = oidList.get(colIndex); OID rootOid = oldMapping.getRootOidByOid(oldOid); if (rootOid == null) { continue; } mapping.removeByRootOid(rootOid); if (vb.isException()) { log.debug("exception " + target.getAddress() + ", " + vb.toString()); // endOfMibView continue; } OID oid = vb.getOid(); if (!oid.startsWith(rootOid)) { continue; } if (result.containsKey(oid)) { continue; } result.put(oid, vb); mapping.put(rootOid, oid); } } // SNMP??????? String message = target.getAddress() + ", requestCounter=" + requestCounter + ", responseCounter=" + responseCounter; if (requestCounter > 200 || responseCounter > 10000) { log.warn(message); } else if (requestCounter > 100 || responseCounter > 5000) { log.info(message); } else { log.debug(message); } return result.values(); }
From source file:it.classhidra.core.controller.wsController.java
public boolean performStream_Exit(Vector _streams, String id_action, i_action action_instance, HashMap wsParameters) throws bsControllerException, Exception, Throwable { for (int i = _streams.size() - 1; i > -1; i--) { info_stream iStream = (info_stream) _streams.get(i); i_stream currentStream = bsController.getAction_config().streamFactory(iStream.getName()); if (currentStream != null) { currentStream.onPreExit(wsParameters); redirects currentStreamRedirect = currentStream.streamservice_exit(wsParameters); currentStream.onPostExit(currentStreamRedirect, wsParameters); if (currentStreamRedirect != null) { throw new bsControllerException( "BLOCKED from EXIT stream:" + currentStream.get_infostream().getName(), iStub.log_ERROR); }// w w w . j ava2 s . c o m } } return true; }
From source file:eu.europa.ec.markt.dss.validation102853.report.SimpleReportBuilder.java
private void addSignedBy(final XmlNode signatureNode, final XmlDom signCert) { String signedBy = "?"; if (signCert != null) { final String dn = signCert.getValue("./SubjectDistinguishedName[@Format='RFC2253']/text()"); final X509Principal principal = new X509Principal(dn); final Vector<?> values = principal.getValues(new ASN1ObjectIdentifier("2.5.4.3")); if (values != null && values.size() > 0) { final String string = (String) values.get(0); if (DSSUtils.isNotBlank(string)) { signedBy = DSSUtils.replaceStrStr(string, "&", "&"); }/*from w w w . j a va2 s.com*/ if (DSSUtils.isEmpty(signedBy)) { signedBy = DSSUtils.replaceStrStr(dn, "&", "&"); } } } signatureNode.addChild(NodeName.SIGNED_BY, signedBy); }
From source file:rb.app.RBnSCMCSystem.java
private List<Integer> getSorted_CJ_Indices(Vector<Parameter> C_J) { int J = C_J.size(); LinkedHashMap<Double, Integer> dist_from_mu = new LinkedHashMap<Double, Integer>(J); for (int j = 0; j < J; j++) { double dist = param_dist(get_current_parameters(), C_J.get(j)); dist_from_mu.put(dist, j);//from w ww . j a v a 2 s.co m } List<Map.Entry<Double, Integer>> list = new LinkedList<Map.Entry<Double, Integer>>(dist_from_mu.entrySet()); Collections.sort(list, new Comparator() { public int compare(Object o1, Object o2) { return ((Comparable) ((Map.Entry) (o1)).getKey()).compareTo(((Map.Entry) (o2)).getKey()); } }); // Create a sorted list of values to return List<Integer> result = new LinkedList<Integer>(); for (Iterator it = list.iterator(); it.hasNext();) { Map.Entry<Double, Integer> entry = (Map.Entry<Double, Integer>) it.next(); result.add(entry.getValue()); } return result; }
From source file:eu.europa.esig.dss.validation.report.SimpleReportBuilder.java
private void addSignedBy(final XmlNode signatureNode, final XmlDom signCert) { String signedBy = "?"; if (signCert != null) { final String dn = signCert.getValue("./SubjectDistinguishedName[@Format='RFC2253']/text()"); final X509Principal principal = new X509Principal(dn); final Vector<?> values = principal.getValues(new ASN1ObjectIdentifier("2.5.4.3")); if ((values != null) && (values.size() > 0)) { final String string = (String) values.get(0); if (StringUtils.isNotBlank(string)) { signedBy = DSSUtils.replaceStrStr(string, "&", "&"); }/*from w w w .j a v a 2s . co m*/ if (StringUtils.isEmpty(signedBy)) { signedBy = DSSUtils.replaceStrStr(dn, "&", "&"); } } } signatureNode.addChild(NodeName.SIGNED_BY, signedBy); }
From source file:com.iver.cit.gvsig.fmap.drivers.wms.FMapWMSDriver.java
private GetMapRequest createMapRequest(WMSStatus status) { GetMapRequest mapRequest = wms.createGetMapRequest(); mapRequest.setSRS(status.getSrs());/*from www. j a va2s . c om*/ String bbox = status.getExtent().getMinX() + "," + status.getExtent().getMinY() + "," + status.getExtent().getMaxX() + "," + status.getExtent().getMaxY(); mapRequest.setBBox(bbox); mapRequest.setDimensions(status.getWidth(), status.getHeight()); mapRequest.setFormat(status.getFormat()); mapRequest.setTransparent(status.getTransparency()); Vector<String> stylesVector = status.getStyles(); if (stylesVector != null && stylesVector.size() > 0) { Vector<String> layerNamesVector = status.getLayerNames(); for (int i = 0; i < stylesVector.size(); i++) { mapRequest.addLayer(layerNamesVector.get(i), stylesVector.get(i)); } } else { for (Layer layer : WMSUtils.getNamedLayers(wms.getCapabilities())) { mapRequest.addLayer(layer); } } return mapRequest; }
From source file:at.lame.hellonzb.parser.NzbParser.java
/** * Check all download files within this parser for consecutive * index numbers without any gaps. Throw exception if a gap was * found./*from www. j a v a 2 s. c o m*/ */ private void checkFileSegments() { for (DownloadFile df : this.downloadFiles) { Vector<DownloadFileSegment> segs = df.getAllOriginalSegments(); for (int currIdx = 0; currIdx < segs.size(); currIdx++) { if ((segs.get(currIdx) == null) || (segs.get(currIdx).getIndex() != (currIdx + 1))) { // create new dummy segment DownloadFileSegment dummySeg = new DownloadFileSegment(df, 1, currIdx + 1, df.getGroups()); dummySeg.setArticleId("dummy"); df.addSegment(dummySeg); } } } }