java.util.Vector Java Examples
The following examples show how to use
java.util.Vector.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PatternScannerTest.java From beepbeep-3 with GNU Lesser General Public License v3.0 | 6 votes |
@Test public void testTokenFeederPull1() { Object o; QueueSource qsource = new QueueSource(1); Vector<Object> events = new Vector<Object>(); events.add("|hello.|hi."); qsource.setEvents(events); FindPattern mf = new FindPattern("\\|.*?\\."); Connector.connect(qsource, mf); Pullable p = mf.getPullableOutput(0); o = p.pullSoft(); assertEquals("|hello.", (String) o); o = p.pullSoft(); assertEquals("|hi.", (String) o); }
Example #2
Source File: DocumentImpl.java From JDKSourceCode1.8 with MIT License | 6 votes |
@SuppressWarnings("unchecked") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { // We have to read serialized fields first. ObjectInputStream.GetField gf = in.readFields(); Vector<NodeIterator> it = (Vector<NodeIterator>)gf.get("iterators", null); Vector<Range> r = (Vector<Range>)gf.get("ranges", null); Hashtable<NodeImpl, Vector<LEntry>> el = (Hashtable<NodeImpl, Vector<LEntry>>)gf.get("eventListeners", null); mutationEvents = gf.get("mutationEvents", false); //convert Hashtables back to HashMaps and Vectors to Lists if (it != null) iterators = new ArrayList<>(it); if (r != null) ranges = new ArrayList<>(r); if (el != null) { eventListeners = new HashMap<>(); for (Map.Entry<NodeImpl, Vector<LEntry>> e : el.entrySet()) { eventListeners.put(e.getKey(), new ArrayList<>(e.getValue())); } } }
Example #3
Source File: BreakIteratorTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void TestBug4217703() { if (Locale.getDefault().getLanguage().equals("th")) { logln("This test is skipped in th locale."); return; } Vector<String> lineSelectionData = new Vector<String>(); // There shouldn't be a line break between sentence-ending punctuation // and a closing quote lineSelectionData.addElement("He "); lineSelectionData.addElement("said "); lineSelectionData.addElement("\"Go!\" "); lineSelectionData.addElement("I "); lineSelectionData.addElement("went. "); lineSelectionData.addElement("Hashtable$Enumeration "); lineSelectionData.addElement("getText()."); lineSelectionData.addElement("getIndex()"); generalIteratorTest(lineBreak, lineSelectionData); }
Example #4
Source File: EventSupport.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Add the event and vector of listeners to the queue to be delivered. * An event dispatcher thread dequeues events from the queue and dispatches * them to the registered listeners. * Package private; used by NamingEventNotifier to fire events */ synchronized void queueEvent(EventObject event, Vector<? extends NamingListener> vector) { if (eventQueue == null) eventQueue = new EventQueue(); /* * Copy the vector in order to freeze the state of the set * of EventListeners the event should be delivered to prior * to delivery. This ensures that any changes made to the * Vector from a target listener's method during the delivery * of this event will not take effect until after the event is * delivered. */ @SuppressWarnings("unchecked") // clone() Vector<NamingListener> v = (Vector<NamingListener>)vector.clone(); eventQueue.enqueue(event, v); }
Example #5
Source File: DPPIsotopeGrouperTask.java From mzmine2 with GNU General Public License v2.0 | 6 votes |
/** * Fits isotope pattern around one peak. * * @param p Pattern is fitted around this peak * @param charge Charge state of the fitted pattern */ private void fitPattern(Vector<DataPoint> fittedPeaks, DataPoint p, int charge, DataPoint[] sortedPeaks, double isotopeDistance) { if (charge == 0) { return; } // Search for peaks before the start peak if (!monotonicShape) { fitHalfPattern(p, charge, -1, fittedPeaks, sortedPeaks, isotopeDistance); } // Search for peaks after the start peak fitHalfPattern(p, charge, 1, fittedPeaks, sortedPeaks, isotopeDistance); }
Example #6
Source File: Catalog.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Copies the reader list from the current Catalog to a new Catalog. * * <p>This method is used internally when constructing a new catalog. * It copies the current reader associations over to the new catalog. * </p> * * @param newCatalog The new Catalog. */ protected void copyReaders(Catalog newCatalog) { // Have to copy the readers in the right order...convert hash to arr Vector mapArr = new Vector(readerMap.size()); // Pad the mapArr out to the right length for (int count = 0; count < readerMap.size(); count++) { mapArr.add(null); } for (Map.Entry<String, Integer> entry : readerMap.entrySet()) { mapArr.set(entry.getValue(), entry.getKey()); } for (int count = 0; count < mapArr.size(); count++) { String mimeType = (String) mapArr.get(count); Integer pos = readerMap.get(mimeType); newCatalog.addReader(mimeType, (CatalogReader) readerArr.get(pos)); } }
Example #7
Source File: MailDialog.java From jplag with GNU General Public License v3.0 | 6 votes |
private void init(int typ, String title, RequestData rd, AdminTool at) { adminTool = at; type = typ; reqData = rd; if(type == MAIL_ALL) { showSendButtons = false; type = MAIL_ACCEPTED; } try { MailTemplate[] temps = at.getJPlagStub().getMailTemplates(type). getItems(); templates = new Vector<MailTemplate>(temps.length,3); for(int i=0;i<temps.length;i++) templates.add(temps[i]); } catch(Exception ex) { at.CheckException(ex,at); } initialize(title); }
Example #8
Source File: SnmpMsg.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * For SNMP Runtime private use only. */ public SnmpVarBind[] decodeVarBindList(BerDecoder bdec) throws BerException { bdec.openSequence() ; Vector<SnmpVarBind> tmp = new Vector<SnmpVarBind>() ; while (bdec.cannotCloseSequence()) { SnmpVarBind bind = new SnmpVarBind() ; bdec.openSequence() ; bind.oid = new SnmpOid(bdec.fetchOid()) ; bind.setSnmpValue(decodeVarBindValue(bdec)) ; bdec.closeSequence() ; tmp.addElement(bind) ; } bdec.closeSequence() ; SnmpVarBind[] varBindList= new SnmpVarBind[tmp.size()] ; tmp.copyInto(varBindList); return varBindList ; }
Example #9
Source File: PodZoneConfig.java From cloudstack with Apache License 2.0 | 6 votes |
@DB public Vector<Long> getAllZoneIDs() { Vector<Long> allZoneIDs = new Vector<Long>(); String selectSql = "SELECT id FROM data_center"; TransactionLegacy txn = TransactionLegacy.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql); ResultSet rs = stmt.executeQuery(); while (rs.next()) { Long dcId = rs.getLong("id"); allZoneIDs.add(dcId); } } catch (SQLException ex) { System.out.println(ex.getMessage()); printError("There was an issue with reading zone IDs. Please contact Cloud Support."); return null; } return allZoneIDs; }
Example #10
Source File: IdUtil.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** Return an IdList with all the duplicate ids removed @param l a list of ids in external form. @exception StandardException Oops. */ public static String pruneDups(String l) throws StandardException { if (l == null) return null; String[] normal_a = parseIdList(l); StringReader r = new StringReader(l); String[] external_a = parseIdList(r,false); HashSet h = new HashSet(); Vector v = new Vector(); for(int ix=0;ix<normal_a.length;ix++) { if (!h.contains(normal_a[ix])) { h.add(normal_a[ix]); v.addElement(external_a[ix]); } } return vectorToIdList(v,false); }
Example #11
Source File: EventSupport.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Add the event and vector of listeners to the queue to be delivered. * An event dispatcher thread dequeues events from the queue and dispatches * them to the registered listeners. * Package private; used by NamingEventNotifier to fire events */ synchronized void queueEvent(EventObject event, Vector<? extends NamingListener> vector) { if (eventQueue == null) eventQueue = new EventQueue(); /* * Copy the vector in order to freeze the state of the set * of EventListeners the event should be delivered to prior * to delivery. This ensures that any changes made to the * Vector from a target listener's method during the delivery * of this event will not take effect until after the event is * delivered. */ @SuppressWarnings("unchecked") // clone() Vector<NamingListener> v = (Vector<NamingListener>)vector.clone(); eventQueue.enqueue(event, v); }
Example #12
Source File: IOUtil.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Attempts to completely read data from the specified Reader, line by line. * The Reader is closed whether or not the read was successful. * * @param filename * the name of the file to be read * * @return a Vector of Strings, one for each line of data * * @throws IOException * if an I/O error occurs */ static Vector<String> readText( Reader r ) throws IOException { BufferedReader br = new BufferedReader( r ); try { Vector<String> ret = new Vector<String>( ); String line; while ( ( line = br.readLine( ) ) != null ) ret.addElement( line.intern( ) ); // Avoid wasting space return ret; } finally { close( br ); } }
Example #13
Source File: Window.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void initDeserializedWindow() { setWarningString(); inputContextLock = new Object(); // Deserialized Windows are not yet visible. visible = false; weakThis = new WeakReference<>(this); anchor = new Object(); disposerRecord = new WindowDisposerRecord(appContext, this); sun.java2d.Disposer.addRecord(anchor, disposerRecord); addToWindowList(); initGC(null); ownedWindowList = new Vector<>(); }
Example #14
Source File: TiffParser.java From scifio with BSD 2-Clause "Simplified" License | 6 votes |
/** Gets the offsets to every IFD in the file. */ public long[] getIFDOffsets() throws IOException { // check TIFF header final int bytesPerEntry = bigTiff ? TiffConstants.BIG_TIFF_BYTES_PER_ENTRY : TiffConstants.BYTES_PER_ENTRY; final Vector<Long> offsets = new Vector<>(); long offset = getFirstOffset(); while (offset > 0 && offset < in.length()) { in.seek(offset); offsets.add(offset); final int nEntries = bigTiff ? (int) in.readLong() : in .readUnsignedShort(); in.skipBytes(nEntries * bytesPerEntry); offset = getNextOffset(offset); } final long[] f = new long[offsets.size()]; for (int i = 0; i < f.length; i++) { f[i] = offsets.get(i).longValue(); } return f; }
Example #15
Source File: CSV.java From tsml with GNU General Public License v3.0 | 6 votes |
/** * Gets the current option settings for the OptionHandler. * * @return the list of current option settings as an array of strings */ public String[] getOptions() { Vector<String> result; String[] options; int i; result = new Vector<String>(); options = super.getOptions(); for (i = 0; i < options.length; i++) result.add(options[i]); if (getUseTab()) result.add("-use-tab"); return result.toArray(new String[result.size()]); }
Example #16
Source File: ThrowableExtension.java From bazel with Apache License 2.0 | 5 votes |
/** * @param throwable, the key to retrieve or create associated list. * @param createOnAbsence {@code true} to create a new list if there is no value for the key. * @return the associated value with the given {@code throwable}. If {@code createOnAbsence} is * {@code true}, the returned value will be non-null. Otherwise, it can be {@code null} */ public List<Throwable> get(Throwable throwable, boolean createOnAbsence) { deleteEmptyKeys(); WeakKey keyForQuery = new WeakKey(throwable, null); List<Throwable> list = map.get(keyForQuery); if (!createOnAbsence) { return list; } if (list != null) { return list; } List<Throwable> newValue = new Vector<>(2); list = map.putIfAbsent(new WeakKey(throwable, referenceQueue), newValue); return list == null ? newValue : list; }
Example #17
Source File: PreTranslation.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
private boolean isDuplicated(Vector<Hashtable<String, String>> vector, Hashtable<String, String> tu) { int size = vector.size(); String src = tu.get("srcText"); //$NON-NLS-1$ String tgt = tu.get("tgtText"); //$NON-NLS-1$ for (int i = 0; i < size; i++) { Hashtable<String, String> table = vector.get(i); if (src.trim().equals(table.get("srcText").trim()) //$NON-NLS-1$ && tgt.trim().equals(table.get("tgtText").trim())) { //$NON-NLS-1$ return true; } } return false; }
Example #18
Source File: DeepNodeListImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** Returns the node at the specified index. */ public Node item(int index) { Node thisNode; // Tree changed. Do it all from scratch! if(rootNode.changes() != changes) { nodes = new Vector(); changes = rootNode.changes(); } // In the cache if (index < nodes.size()) return (Node)nodes.elementAt(index); // Not yet seen else { // Pick up where we left off (Which may be the beginning) if (nodes.size() == 0) thisNode = rootNode; else thisNode=(NodeImpl)(nodes.lastElement()); // Add nodes up to the one we're looking for while(thisNode != null && index >= nodes.size()) { thisNode=nextMatchingElementAfter(thisNode); if (thisNode != null) nodes.addElement(thisNode); } // Either what we want, or null (not avail.) return thisNode; } }
Example #19
Source File: AudioSystem.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Obtains information about all source lines of a particular type that are supported * by the installed mixers. * @param info a <code>Line.Info</code> object that specifies the kind of * lines about which information is requested * @return an array of <code>Line.Info</code> objects describing source lines matching * the type requested. If no matching source lines are supported, an array of length 0 * is returned. * * @see Mixer#getSourceLineInfo(Line.Info) */ public static Line.Info[] getSourceLineInfo(Line.Info info) { Vector vector = new Vector(); Line.Info[] currentInfoArray; Mixer mixer; Line.Info fullInfo = null; Mixer.Info[] infoArray = getMixerInfo(); for (int i = 0; i < infoArray.length; i++) { mixer = getMixer(infoArray[i]); currentInfoArray = mixer.getSourceLineInfo(info); for (int j = 0; j < currentInfoArray.length; j++) { vector.addElement(currentInfoArray[j]); } } Line.Info[] returnedArray = new Line.Info[vector.size()]; for (int i = 0; i < returnedArray.length; i++) { returnedArray[i] = (Line.Info)vector.get(i); } return returnedArray; }
Example #20
Source File: GFELargeObjectQueryFactory.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public void createIndexes() throws RegionNotFoundException, IndexExistsException, IndexNameConflictException { Vector indexTypes = LargeObjectPrms.getIndexTypes(); for (Iterator i = indexTypes.iterator(); i.hasNext();) { String indexTypeString = (String) i.next(); Log.getLogWriter().info( "GFELargeObjectQueryFactory: creating index:" + indexTypeString); int indexType = LargeObjectPrms.getIndexType(indexTypeString); createIndex(indexType); } }
Example #21
Source File: BlackBerryImplementation.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
/** * @inheritDoc */ public String getAPName(String id) { Vector v = getValidSBEntries(); for (int iter = 0; iter < v.size(); iter++) { ServiceRecord r = (ServiceRecord) v.elementAt(iter); if (("" + r.getUid()).equals(id)) { return r.getName(); } } return null; }
Example #22
Source File: JobTracker.java From RDFS with Apache License 2.0 | 5 votes |
public Vector<JobInProgress> completedJobs() { Vector<JobInProgress> v = new Vector<JobInProgress>(); for (Iterator it = jobs.values().iterator(); it.hasNext();) { JobInProgress jip = (JobInProgress) it.next(); JobStatus status = jip.getStatus(); if (status.getRunState() == JobStatus.SUCCEEDED) { v.add(jip); } } return v; }
Example #23
Source File: ModelParaleler.java From ramus with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") private void init() { Vector<Row> v = fromDataPlugin.getRecChilds(null, false); for (Row r : v) { long qualifierId = StandardAttributesPlugin.getQualifierId( fromEngine, r.getElement()); rowForQualifiers.put(qualifierId, r); } Qualifier bs = IDEF0Plugin.getBaseStreamQualifier(fromEngine); rowForQualifiers.put(bs.getId(), fromDataPlugin.getBaseStream()); List<Attribute> attrs = fromEngine.getSystemAttributes(); List<Attribute> dAttrs = toEngine.getSystemAttributes(); Hashtable<String, Attribute> hash = new Hashtable<String, Attribute>(); for (Attribute attribute : dAttrs) hash.put(attribute.getName(), attribute); for (Attribute a : attrs) { Attribute d = hash.get(a.getName()); if (d == null) System.err .println("WARNING: System attribute not found in destination engine: " + a.getName() + " type: " + a.getAttributeType()); else attrHash.put(a.getId(), d); } }
Example #24
Source File: List.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * @deprecated As of JDK version 1.1, * replaced by <code>removeAll()</code>. */ @Deprecated public synchronized void clear() { ListPeer peer = (ListPeer)this.peer; if (peer != null) { peer.removeAll(); } items = new Vector<>(); selected = new int[0]; }
Example #25
Source File: AbstractMatrixProjection.java From ramus with GNU General Public License v3.0 | 5 votes |
/** * Метод повертає вектор з даними в який зберігається інформація про всі * зв’язки батьківських елементів. Медод повертає вектор масивів з двох * елементів. Перший елемент - елемент класифікатора, з яким саме пов’язаний * елемен, другий елемент сам елемент класифікатора. */ public Vector<Row[]> getRightParent(final Row row) { if (row == null) return new Vector<Row[]>(); final Vector<Row[]> res = new Vector<Row[]>(); if (row != null) getRightParent(row.getParentRow(), res); return res; }
Example #26
Source File: SdlProxyALM.java From sdl_java_suite with BSD 3-Clause "New" or "Revised" License | 5 votes |
public SdlProxyALM(Service appService, IProxyListenerALM listener, SdlProxyConfigurationResources sdlProxyConfigurationResources, String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp, SdlMsgVersion sdlMsgVersion, Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID, String autoActivateID, TemplateColorScheme dayColorScheme, TemplateColorScheme nightColorScheme, boolean callbackToUIThread, boolean preRegister, String sHashID, BaseTransportConfig transportConfig) throws SdlException { super( listener, sdlProxyConfigurationResources, /*enable advanced lifecycle management*/true, appName, ttsName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, /*HMI Display Language Desired*/hmiDisplayLanguageDesired, /*App Type*/appType, /*App ID*/appID, autoActivateID, dayColorScheme, nightColorScheme, callbackToUIThread, preRegister, /*sHashID*/sHashID, /*bEnableResume*/true, transportConfig); this.setAppService(appService); this.sendTransportBroadcast(); SdlTrace.logProxyEvent("Application constructed SdlProxyALM (using new constructor with specified transport) instance passing in: IProxyListener, sdlProxyConfigurationResources, " + "appName, ngnMediaScreenAppName, vrSynonyms, isMediaApp, sdlMsgVersion, languageDesired, appType, appID, autoActivateID, dayColorScheme, nightColorScheme" + "callbackToUIThread and version", SDL_LIB_TRACE_KEY); }
Example #27
Source File: ProtocolManager.java From gsn with GNU General Public License v3.0 | 5 votes |
public synchronized byte[] sendQuery(String queryName, Vector<Object> params) { byte[] answer = null; if(currentState == ProtocolStates.READY) { AbstractHCIQuery query = protocol.getQuery( queryName ); if(query != null) { logger.debug( "Retrieved query " + queryName + ", trying to build raw query."); byte[] queryBytes = query.buildRawQuery( params ); if(queryBytes != null) { try { logger.debug("Built query, it looks like: " + new String(queryBytes)); outputWrapper.sendToWrapper(null,null,new Object[] {queryBytes}); lastExecutedQuery = query; lastParams = params; answer = queryBytes; logger.debug("Query succesfully sent!"); if(query.needsAnswer( params )) { logger.debug("Now entering wait mode for answer."); timer = new Timer(); currentState = ProtocolStates.WAITING; timer.schedule( answerTimeout , new Date()); } } catch( OperationNotSupportedException e ) { logger.debug("Query could not be sent ! See error message."); logger.error( e.getMessage( ) , e ); currentState = ProtocolStates.READY; } } } else { logger.warn("Query " + queryName + " found but no bytes produced to send to device. Implementation may be missing."); } } return answer; }
Example #28
Source File: DecodeFormatManager.java From react-native-smart-barcode with MIT License | 5 votes |
private static Vector<BarcodeFormat> parseDecodeFormats(Iterable<String> scanFormats, String decodeMode) { if (scanFormats != null) { Vector<BarcodeFormat> formats = new Vector<BarcodeFormat>(); try { for (String format : scanFormats) { formats.add(BarcodeFormat.valueOf(format)); } return formats; } catch (IllegalArgumentException iae) { // ignore it then } } if (decodeMode != null) { if (Intents.Scan.PRODUCT_MODE.equals(decodeMode)) { return PRODUCT_FORMATS; } if (Intents.Scan.QR_CODE_MODE.equals(decodeMode)) { return QR_CODE_FORMATS; } if (Intents.Scan.DATA_MATRIX_MODE.equals(decodeMode)) { return DATA_MATRIX_FORMATS; } if (Intents.Scan.ONE_D_MODE.equals(decodeMode)) { return ONE_D_FORMATS; } } return null; }
Example #29
Source File: SQLGenericPrms.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public static int[] getDDLs() { Vector ddls = TestConfig.tab().vecAt(SQLGenericPrms.ddlOperations, new HydraVector()); int[] ddlArr = new int[ddls.size()]; String[] strArr = new String[ddls.size()]; for (int i = 0; i < ddls.size(); i++) { strArr[i] = (String) ddls.elementAt(i); // get what ddl ops are in the // tests } for (int i = 0; i < strArr.length; i++) { ddlArr[i] = DDLStmtFactory.getInt(strArr[i]); // convert to int array } return ddlArr; }
Example #30
Source File: XSDHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * getSchemaDocument method uses XMLInputSource to parse a schema document. * @param schemaNamespace * @param schemaSource * @param mustResolve * @param referType * @param referElement * @return A schema Element. */ private Element getSchemaDocument(XSInputSource schemaSource, XSDDescription desc) { SchemaGrammar[] grammars = schemaSource.getGrammars(); short referType = desc.getContextType(); if (grammars != null && grammars.length > 0) { Vector expandedGrammars = expandGrammars(grammars); // check for existing grammars in our bucket // and if there exist any, and namespace growth is // not enabled - we do nothing if (fNamespaceGrowth || !existingGrammars(expandedGrammars)) { addGrammars(expandedGrammars); if (referType == XSDDescription.CONTEXT_PREPARSE) { desc.setTargetNamespace(grammars[0].getTargetNamespace()); } } } else { XSObject[] components = schemaSource.getComponents(); if (components != null && components.length > 0) { Map<String, Vector> importDependencies = new HashMap(); Vector expandedComponents = expandComponents(components, importDependencies); if (fNamespaceGrowth || canAddComponents(expandedComponents)) { addGlobalComponents(expandedComponents, importDependencies); if (referType == XSDDescription.CONTEXT_PREPARSE) { desc.setTargetNamespace(components[0].getNamespace()); } } } } return null; }