Java Code Examples for java.util.Vector#addAll()
The following examples show how to use
java.util.Vector#addAll() .
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: SocketPermission.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * @serialData "permissions" field (a Vector containing the SocketPermissions). */ /* * Writes the contents of the perms field out as a Vector for * serialization compatibility with earlier releases. */ private void writeObject(ObjectOutputStream out) throws IOException { // Don't call out.defaultWriteObject() // Write out Vector Vector<SocketPermission> permissions = new Vector<>(perms.size()); synchronized (this) { permissions.addAll(perms); } ObjectOutputStream.PutField pfields = out.putFields(); pfields.put("permissions", permissions); out.writeFields(); }
Example 2
Source File: SocketPermission.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * @serialData "permissions" field (a Vector containing the SocketPermissions). */ /* * Writes the contents of the perms field out as a Vector for * serialization compatibility with earlier releases. */ private void writeObject(ObjectOutputStream out) throws IOException { // Don't call out.defaultWriteObject() // Write out Vector Vector<SocketPermission> permissions = new Vector<>(perms.size()); synchronized (this) { permissions.addAll(perms); } ObjectOutputStream.PutField pfields = out.putFields(); pfields.put("permissions", permissions); out.writeFields(); }
Example 3
Source File: CPCore.java From olat with Apache License 2.0 | 6 votes |
/** * Checks how many item-elements link to the given resource element. * * @param resource * @return */ protected int referencesCount(final CPResource resource) { int linkCount = 0; final Vector<CPItem> items = new Vector<CPItem>(); for (final Iterator<CPOrganization> it = rootNode.getOrganizations().getOrganizationIterator(); it.hasNext();) { final CPOrganization org = it.next(); items.addAll(org.getAllItems()); } for (final CPItem item : items) { if (item.getIdentifierRef().equals(resource.getIdentifier())) { linkCount++; } } final Vector<CPDependency> dependencies = rootNode.getResources().getAllDependencies(); for (final CPDependency dependency : dependencies) { if (dependency.getIdentifierRef().equals(resource.getIdentifier())) { linkCount++; } } return linkCount; }
Example 4
Source File: FireProcessor.java From megamek with GNU General Public License v2.0 | 6 votes |
public Vector<Report> burnDownWoods(Coords coords) { Vector<Report> burnReports = new Vector<>(); int burnDamage = 5; try { burnDamage = game.getOptions().intOption(OptionsConstants.ADVANCED_WOODS_BURN_DOWN_AMOUNT); } catch (Exception ex) { ex.printStackTrace(); } // Report that damage applied to terrain Report r = new Report(3383, Report.PUBLIC); r.indent(1); r.add(burnDamage); burnReports.addElement(r); Vector<Report> newReports = server.tryClearHex(coords, burnDamage, Entity.NONE); for (Report nr : newReports) { nr.indent(2); } burnReports.addAll(newReports); return burnReports; }
Example 5
Source File: FileUtil.java From qaf with MIT License | 6 votes |
public static Collection<File> getFiles(File directory, String name, StringComparator c, boolean recurse) { // List of files / directories Vector<File> files = new Vector<File>(); // Get files / directories in the directory File[] entries = directory.listFiles(); FilenameFilter filter = getFileFilterFor(name, c); // Go over entries for (File entry : entries) { if ((filter == null) || filter.accept(directory, entry.getName())) { files.add(entry); } // If the file is a directory and the recurse flag // is set, recurse into the directory if (recurse && entry.isDirectory()) { files.addAll(listFiles(entry, filter, recurse)); } } // Return collection of files return files; }
Example 6
Source File: PcalTranslate.java From tlaplus with MIT License | 6 votes |
private static Vector ExplodeLabeledStmtSeq (Vector seq, String next) throws PcalTranslateException { /********************************************************************** * seq is a sequence of LabeledStmts, and `next' is the label that * * follows them. Returns the sequence of LabeledStmts obtained by * * iteratively calling ExplodeLabeledStmt to explode the statements * * in seq. * * * * Added by LL on 30 Jan 2006. I don't know why this method did not * * already exist, since it must have been written in-line about 5 * * times in various other methods. * **********************************************************************/ Vector result = new Vector() ; for (int i = 0; i < seq.size(); i++) { AST.LabeledStmt stmt = (AST.LabeledStmt) seq.elementAt(i) ; String nxt = (i < seq.size() - 1) ? ((AST.LabeledStmt) seq.elementAt(i+1)).label : next ; result.addAll(ExplodeLabeledStmt(stmt, nxt)) ; }; return result ; }
Example 7
Source File: StorageUtils.java From commcare-android with Apache License 2.0 | 6 votes |
@NonNull public static Vector<Integer> getUnsentOrUnprocessedFormIdsForCurrentApp( SqlStorage<FormRecord> storage) { String currentAppId = CommCareApplication.instance().getCurrentApp().getAppRecord().getApplicationId(); Vector<Integer> ids = storage.getIDsForValues( new String[]{FormRecord.META_STATUS, FormRecord.META_APP_ID}, new Object[]{FormRecord.STATUS_UNSENT, currentAppId}); ids.addAll(storage.getIDsForValues( new String[]{FormRecord.META_STATUS, FormRecord.META_APP_ID}, new Object[]{FormRecord.STATUS_COMPLETE, currentAppId})); return ids; }
Example 8
Source File: AmidstClassifier.java From toolbox with Apache License 2.0 | 6 votes |
/** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration<Option> listOptions() { Vector<Option> newVector = new Vector<Option>(2); newVector.addElement(new Option( "\tNumber of Gaussian hidden variables.\n"+ "\t(Default = 0)", "G", 1,"-G <number of Gaussian hidden>")); newVector.addElement(new Option( "\tNumber of states of the discrete hidden variable.\n"+ "\t(Default = 0)", "S", 1,"-S <number of states>")); newVector.addAll(Collections.list(super.listOptions())); return newVector.elements(); }
Example 9
Source File: DecodeThread.java From lunzi with Apache License 2.0 | 6 votes |
DecodeThread(CaptureActivity activity, Vector<BarcodeFormat> decodeFormats, String characterSet, ResultPointCallback resultPointCallback) { this.activity = activity; handlerInitLatch = new CountDownLatch(1); hints = new Hashtable<DecodeHintType, Object>(3); if (decodeFormats == null || decodeFormats.isEmpty()) { decodeFormats = new Vector<BarcodeFormat>(); decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS); decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS); decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS); } hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats); if (characterSet != null) { hints.put(DecodeHintType.CHARACTER_SET, characterSet); } hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback); }
Example 10
Source File: SwingClientApplication.java From chipster with MIT License | 5 votes |
public void updateFocusTraversal() { Vector<Component> order = new Vector<Component>(); order.addAll(visualisationFrameManager.getFocusComponents()); order.addAll(tree.getFocusComponents()); order.addAll(toolPanel.getFocusComponents()); getMainFrame().setFocusTraversalPolicy(new ClientFocusTraversalPolicy(order)); }
Example 11
Source File: Database.java From PlotMe-Core with GNU General Public License v3.0 | 5 votes |
/** * Very demanding task depending on how many plots in each world. * * @return all plots */ public List<Plot> getPlots() { Vector<Plot> allPlots = new Vector<>(); for (HashMap<PlotId, Plot> plotIdPlotHashMap : plots.values()) { allPlots.addAll(plotIdPlotHashMap.values()); } return allPlots; }
Example 12
Source File: AmidstRegressor.java From toolbox with Apache License 2.0 | 5 votes |
/** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration<Option> listOptions() { Vector<Option> newVector = new Vector<Option>(1); newVector.addElement(new Option( "\tNumber of Gaussian hidden variables.\n"+ "\t(Default = 0)", "G", 1,"-G <number of Gaussian hidden>")); newVector.addAll(Collections.list(super.listOptions())); return newVector.elements(); }
Example 13
Source File: PcalTranslate.java From tlaplus with MIT License | 5 votes |
private static Vector ExplodeLabeledStmt (AST.LabeledStmt ast, String next) throws PcalTranslateException { /****************************************************************** * label SL --> * * label when pc = "label" ; * * SL * * pc := next; * * * * Comment added by LL on 30 Jan 2006. * * I have no idea what the comment above is supposed to mean, but * * this seems to return a sequence of labeled statements, * * consisting of the exploded version of the labeled stmt ast * * followed by the exploded labeled statements contained within * * it. * ******************************************************************/ /* Handle case of initial while separately */ if (ast.stmts.size() > 0 && ast.stmts.elementAt(0).getClass().equals(AST.WhileObj.getClass())) { return ExplodeWhile(ast, next); } AST.LabeledStmt newast = new AST.LabeledStmt(); Vector pair = CopyAndExplodeLastStmtWithGoto((Vector) ast.stmts.clone(), next); Vector result = new Vector(); newast.setOrigin(ast.getOrigin()) ; newast.col = ast.col; newast.line = ast.line; newast.label = ast.label; /* add the statements with last exploded */ newast.stmts = (Vector) pair.elementAt(0); if (! ParseAlgorithm.omitPC) { /* prepend pc check */ newast.stmts.insertElementAt(CheckPC(newast.label), 0); result.addElement(newast); } /* add recursively generated labeled statements */ result.addAll((Vector) pair.elementAt(1)); return result; }
Example 14
Source File: Tank.java From megamek with GNU General Public License v2.0 | 5 votes |
@Override public Vector<Report> victoryReport() { Vector<Report> vDesc = new Vector<Report>(); Report r = new Report(7025); r.type = Report.PUBLIC; r.addDesc(this); vDesc.addElement(r); r = new Report(7035); r.type = Report.PUBLIC; r.newlines = 0; vDesc.addElement(r); vDesc.addAll(getCrew().getDescVector(false)); r = new Report(7070, Report.PUBLIC); r.add(getKillNumber()); vDesc.addElement(r); if (isDestroyed()) { Entity killer = game.getEntity(killerId); if (killer == null) { killer = game.getOutOfGameEntity(killerId); } if (killer != null) { r = new Report(7072, Report.PUBLIC); r.addDesc(killer); } else { r = new Report(7073, Report.PUBLIC); } vDesc.addElement(r); } else if (getCrew().isEjected()) { r = new Report(7071, Report.PUBLIC); vDesc.addElement(r); } r.newlines = 2; return vDesc; }
Example 15
Source File: Scope.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
protected Enumeration getDefinitions() { Vector allElements = new Vector(); allElements.addAll(elements.values()); allElements.addAll(labels.values()); allElements.addAll(classes.values()); return allElements.elements(); }
Example 16
Source File: DecodeImgThread.java From zxing with MIT License | 4 votes |
@Override public void run() { super.run(); if (TextUtils.isEmpty(imgPath) || callback == null) { return; } Bitmap scanBitmap = getBitmap(imgPath, 400, 400); MultiFormatReader multiFormatReader = new MultiFormatReader(); // 解码的参数 Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(2); // 可以解析的编码类型 Vector<BarcodeFormat> decodeFormats = new Vector<BarcodeFormat>(); // 扫描的类型 一维码和二维码 decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS); decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS); decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS); hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats); // 设置解析的字符编码格式为UTF8 // hints.put(DecodeHintType.CHARACTER_SET, "UTF8"); // 设置解析配置参数 multiFormatReader.setHints(hints); // 开始对图像资源解码 Result rawResult = null; try { rawResult = multiFormatReader.decodeWithState(new BinaryBitmap(new HybridBinarizer(new BitmapLuminanceSource(scanBitmap)))); Log.i("解析结果", rawResult.getText()); } catch (Exception e) { e.printStackTrace(); // Log.i("解析的图片结果","失败"); } if (rawResult != null) { callback.onImageDecodeSuccess(rawResult); } else { callback.onImageDecodeFailed(); } }
Example 17
Source File: Document.java From org.openntf.domino with Apache License 2.0 | 4 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Item appendItemValue(final String name, final Object value, final boolean unique) { checkMimeOpen(name); Item result = null; if (unique && hasItem(name)) { // TODO RPr This function is not yet 100% mime compatible // Once mime compatible, remove the reference in org.openntf.domino.ext.Document Javadoc result = getFirstItem(name); if (result.containsValue(value)) {// this does not work when it is not dominoFriendly return result; } } try { if (!hasItem(name)) { result = replaceItemValue(name, value); } else if (value != null) { List recycleThis = new ArrayList(); try { Object domNode = toDominoFriendly(value, getAncestorSession(), recycleThis); if (getAncestorSession().isFixEnabled(Fixes.APPEND_ITEM_VALUE)) { Vector current = getItemValue(name); if (current == null) { result = replaceItemValue(name, value); } else if (domNode instanceof Collection) { current.addAll((Collection) domNode); result = replaceItemValue(name, current); } else { current.add(domNode); result = replaceItemValue(name, current); } } else { beginEdit(); result = fromLotus(getDelegate().appendItemValue(name, domNode), Item.SCHEMA, this); markDirty(name, true); } } finally { s_recycle(recycleThis); } } else { result = appendItemValue(name); } } catch (NotesException e) { DominoUtils.handleException(e, this, "Item=" + name); } return result; }
Example 18
Source File: BuildConfig.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
Vector getIncludes() { Vector rv = new Vector(); collectRelevantVectors(rv, "AbsoluteInclude"); rv.addAll(getSourceIncludes()); return rv; }
Example 19
Source File: UpdateTransactionCache_taddr.java From guarda-android-wallets with GNU General Public License v3.0 | 4 votes |
@Override public void run() { synchronized (requestExistsMutex) { if (requestExist) { callback.onResponse("Another UpdateTransacionCache_taddr request exists.", null); return; } else { requestExist = true; } } Vector<ZCashTransactionDetails_taddr> transactions = cache; if (transactions == null) { synchronized (requestExistsMutex) { requestExist = false; } callback.onResponse("Wallet is not imported.", null); return; } SortedSet<ZCashTransactionDetails_taddr> uniqueTransactions = new TreeSet<>(); long lastBlock = 0; if (transactions.isEmpty()) { rescan = true; } else { lastBlock = transactions.lastElement().blockHeight; } if (rescan) { synchronized (transactions) { transactions.clear(); } } try { getAllRecv(20, 0, rescan, lastBlock, uniqueTransactions); getAllSent(20, 0, rescan, lastBlock, uniqueTransactions); } catch (ZCashException e) { synchronized (requestExistsMutex) { requestExist = false; } callback.onResponse(e.getMessage(), null); return; } boolean initialized = ZCashTransactionDetails_taddr.prepareAfterParsing(uniqueTransactions); if (initialized) { transactions.addAll(uniqueTransactions); } else { synchronized (requestExistsMutex) { requestExist = false; } return; } synchronized (requestExistsMutex) { requestExist = false; } callback.onResponse("ok", null); }
Example 20
Source File: LegAttackHandler.java From megamek with GNU General Public License v2.0 | 4 votes |
@Override protected void handleEntityDamage(Entity entityTarget, Vector<Report> vPhaseReport, Building bldg, int hits, int nCluster, int bldgAbsorbs) { HitData hit = entityTarget.rollHitLocation(toHit.getHitTable(), toHit.getSideTable(), waa.getAimedLocation(), waa.getAimingMode(), toHit.getCover()); hit.setAttackerId(getAttackerId()); // If a leg attacks hit a leg that isn't // there, then hit the other leg. if (entityTarget.getInternal(hit) <= 0) { if (hit.getLocation() == Mech.LOC_RLEG) { hit = new HitData(Mech.LOC_LLEG); } else { hit = new HitData(Mech.LOC_RLEG); } } hit.setGeneralDamageType(generalDamageType); Report r = new Report(3405); r.subject = subjectId; r.add(toHit.getTableDesc()); r.add(entityTarget.getLocationAbbr(hit)); vPhaseReport.addElement(r); int damage = 4; if (ae instanceof BattleArmor) { damage += ((BattleArmor) ae).getVibroClaws(); if (((BattleArmor) ae).hasMyomerBooster()) { damage += ((BattleArmor) ae).getTroopers() * 2; } } // ASSUMPTION: buildings CAN'T absorb *this* damage. vPhaseReport.addAll(server.damageEntity(entityTarget, hit, damage, false, damageType, false, false, throughFront, underWater)); Report.addNewline(vPhaseReport); // Do criticals. int critMod = 0; if (entityTarget.getArmorType(hit.getLocation()) == EquipmentType.T_ARMOR_HARDENED) { critMod -= 2; } if (ae.hasAbility(OptionsConstants.MISC_HUMAN_TRO,Crew.HUMANTRO_MECH)) { critMod += 1; } vPhaseReport.addAll(server.criticalEntity(entityTarget, hit.getLocation(), hit.isRear(), critMod, damage)); }