Java Code Examples for java.util.Vector.addAll()

The following are Jave code examples for showing how to use addAll() of the java.util.Vector class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ZXingDemo   File: DecodeThread.java   View Source Code Vote up 8 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 2
Project: smaph   File: GreedyFeaturePack.java   View Source Code Vote up 7 votes
public static String[] getFeatureNamesStatic() {
	if (ftrNames == null) {
		Vector<String> v = new Vector<String>();
		v.addAll(Arrays.asList(AnnotationFeaturePack.getFeatureNamesStatic()));
		v.add("covered_tokens_incr");
		v.add("covered_tokens_incr_ratio");
		v.add("covered_tokens_after");
		v.add("segments_lp_sum");
		v.add("segments_lp_avg");
		v.add("segments_lp_ratio");
		v.add("max_relatedness_before");
		v.add("avg_relatedness_before");
		v.add("max_relatedness_mw_before");
		v.add("min_relatedness_mw");
		v.add("max_relatedness_mw");
		v.add("min_relatedness_diff");
		v.add("avg_relatedness_diff");
		v.add("min_relatedness_mw_diff");
		v.add("max_relatedness_mw_diff");
		ftrNames = v.toArray(new String[] {});
	}
	return ftrNames;
}
 
Example 3
Project: GitHub   File: DecodeThread.java   View Source Code Vote up 7 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 4
Project: QN-ACTR-Release   File: DistributionsEditor.java   View Source Code Vote up 7 votes
/**
 * Helper method to extract the probability components the dialog's components.
 * These components are the probability labels and the probability TextFields.
 * @return a Vector of probability related components
 * @author Federico Dal Castello
 */
private Vector<Component> getProbabilityComponents() {
	Vector<Component> probabilityComponents = new Vector<Component>();

	Vector<Component> components = new Vector<Component>();
	components.addAll(Arrays.asList(intervalPanels[1].getComponents()));
	components.addAll(Arrays.asList(intervalPanels[2].getComponents()));

	Iterator<Component> it = components.iterator();

	while (it.hasNext()) {
		Component comp = it.next();

		if (comp instanceof JTextField) {
			if (comp.getName().equals(PROBABILITY_INTERVAL_A) || comp.getName().equals(PROBABILITY_INTERVAL_B)) {
				probabilityComponents.add(comp);
			}
		}

		if (comp instanceof JLabel && ((JLabel) comp).getText().equals(PROBABILITY)) {
			probabilityComponents.add(comp);
		}
	}

	return probabilityComponents;
}
 
Example 5
Project: SuperMarketManageSystem   File: XiaoShouPaiHang.java   View Source Code Vote up 7 votes
private void updateTable(Iterator iterator) {
	int rowCount = dftm.getRowCount();
	for (int i = 0; i < rowCount; i++) {
		dftm.removeRow(0);
	}
	while (iterator.hasNext()) {
		Vector vector = new Vector();
		List view = (List) iterator.next();
		Vector row=new Vector(view);
		int rowSize = row.size();
		for(int i=rowSize-2;i<rowSize;i++){
			Object colValue = row.get(i);
			row.remove(i);
			row.insertElementAt(colValue, 2);
		}
		vector.addAll(row);
		dftm.addRow(vector);
	}
}
 
Example 6
Project: zxing_qrcode_demo   File: DecodeThread.java   View Source Code Vote up 7 votes
DecodeThread(CaptureFragment fragment,
             Vector<BarcodeFormat> decodeFormats,
             String characterSet,
             ResultPointCallback resultPointCallback) {

    this.fragment = fragment;
    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 7
Project: OpenJSharp   File: Stylesheet.java   View Source Code Vote up 7 votes
public Vector getAllValidTemplates() {
    // Return templates if no imported/included stylesheets
    if (_includedStylesheets == null) {
        return _templates;
    }

    // Is returned value cached?
    if (_allValidTemplates == null) {
       Vector templates = new Vector();
       templates.addAll(_templates);
        int size = _includedStylesheets.size();
        for (int i = 0; i < size; i++) {
            Stylesheet included =(Stylesheet)_includedStylesheets.elementAt(i);
            templates.addAll(included.getAllValidTemplates());
        }
        //templates.addAll(_templates);

        // Cache results in top-level stylesheet only
        if (_parentStylesheet != null) {
            return templates;
        }
        _allValidTemplates = templates;
     }

    return _allValidTemplates;
}
 
Example 8
Project: thornsec-core   File: ACompoundProfile.java   View Source Code Vote up 6 votes
public Vector<IUnit> getUnits(String server, NetworkModel model) {
	Vector<IUnit> rules = new Vector<IUnit>();
	rules.add(new ComplexUnit(getLabel() + "_compound", precondition, "",
			getLabel() + "_unchanged=1;\n" + getLabel() + "_compound=1;\n"));
	rules.addAll(this.getChildren(server, model));
	rules.add(new ComplexUnit(getLabel(), precondition, config + "\n" + getLabel() + "_unchanged=1;\n",
			getLabel() + "=$" + getLabel() + "_unchanged;\n"));
	return rules;
}
 
Example 9
Project: SuperMarketManageSystem   File: RuKuTuiHuoChaXun.java   View Source Code Vote up 6 votes
private void updateTable(Iterator iterator) {
	int rowCount = dftm.getRowCount();
	for (int i = 0; i < rowCount; i++) {
		dftm.removeRow(0);
	}
	while (iterator.hasNext()) {
		Vector vector = new Vector();
		List view = (List) iterator.next();
		vector.addAll(view);
		dftm.addRow(vector);
	}
}
 
Example 10
Project: SER316-Munich   File: EventsManager.java   View Source Code Vote up 6 votes
public static Collection getEventsForDate(CalendarDate date) {
	Vector v = new Vector();
	Day d = getDay(date);
	if (d != null) {
		Elements els = d.getElement().getChildElements("event");
		for (int i = 0; i < els.size(); i++)
			v.add(new EventImpl(els.get(i)));
	}
	Collection r = getRepeatableEventsForDate(date);
	if (r.size() > 0)
		v.addAll(r);
	//EventsVectorSorter.sort(v);
	Collections.sort(v);
	return v;
}
 
Example 11
Project: Moenagade   File: ConfigureParameters.java   View Source Code Vote up 6 votes
/**
 * Creates new form ConfigureParameters
 */
public ConfigureParameters() {
    initComponents();
    setModal(true);
    
    Vector<String> entries = new Vector<>();
    entries.add("int");
    entries.add("double");
    entries.add("boolean");
    entries.add("String");
    entries.add("long");
    entries.add("float");
    entries.addAll(Library.getInstance().getProject().getEntityNames());
    
    cbParamType.setModel(new DefaultComboBoxModel(entries));
}
 
Example 12
Project: AgentWorkbench   File: NetworkModel.java   View Source Code Vote up 6 votes
/**
 * Returns all {@link NetworkComponent}s of the network model sorted by the numeric value of the ID of the component.
 * @param ascending set true to sort ascending, false to sort descending
 * @return a sorted NetworkComponent vector sorted
 */
public Vector<NetworkComponent> getNetworkComponentVectorSorted(boolean ascending) {
	
	Vector<NetworkComponent> netCompVector = new Vector<NetworkComponent>();
	netCompVector.addAll(this.getNetworkComponents().values());
	
	Comparator<NetworkComponent> comp = null;
	if (ascending==true) {
		// --- Ascending sorted ---------------------------------
		comp = new Comparator<NetworkComponent>() {
			@Override
			public int compare(NetworkComponent netComp1, NetworkComponent netComp2) {
				Integer n1 = Integer.parseInt(netComp1.getId().replaceAll("\\D+",""));
				Integer n2 = Integer.parseInt(netComp2.getId().replaceAll("\\D+",""));
				return n1.compareTo(n2);
			}
		};
		
	} else {
		// --- Desscending sorted -------------------------------
		comp = new Comparator<NetworkComponent>() {
			@Override
			public int compare(NetworkComponent netComp1, NetworkComponent netComp2) {
				Integer n1 = Integer.parseInt(netComp1.getId().replaceAll("\\D+",""));
				Integer n2 = Integer.parseInt(netComp2.getId().replaceAll("\\D+",""));
				return n1.compareTo(n2);
			}
		};
		
	}
	Collections.sort(netCompVector, comp);
	return netCompVector;
}
 
Example 13
Project: Dahlem_SER316   File: EventsManager.java   View Source Code Vote up 6 votes
public static Collection getEventsForDate(CalendarDate date) {
	Vector v = new Vector();
	Day d = getDay(date);
	if (d != null) {
		Elements els = d.getElement().getChildElements("event");
		for (int i = 0; i < els.size(); i++)
			v.add(new EventImpl(els.get(i)));
	}
	Collection r = getRepeatableEventsForDate(date);
	if (r.size() > 0)
		v.addAll(r);
	//EventsVectorSorter.sort(v);
	Collections.sort(v);
	return v;
}
 
Example 14
Project: Wilmersdorf_SER316   File: EventsManager.java   View Source Code Vote up 6 votes
public static Collection getEventsForDate(CalendarDate date) {
	Vector v = new Vector();
	Day d = getDay(date);
	if (d != null) {
		Elements els = d.getElement().getChildElements("event");
		for (int i = 0; i < els.size(); i++)
			v.add(new EventImpl(els.get(i)));
	}
	Collection r = getRepeatableEventsForDate(date);
	if (r.size() > 0)
		v.addAll(r);
	//EventsVectorSorter.sort(v);
	Collections.sort(v);
	return v;
}
 
Example 15
Project: thornsec-core   File: AptSourcesModel.java   View Source Code Vote up 6 votes
public Vector<IUnit> getUnits() {
	Vector<IUnit> units = new Vector<IUnit>();

	units.addElement(new FileUnit("sources_list", "proceed", getPersistent(), "/etc/apt/sources.list"));
	units.addElement(new InstalledUnit("dirmngr", "proceed", "dirmngr",
					 "Couldn't install dirmngr.  Anything which requires a GPG key to be downloaded and installed won't work. "
					 + "You can possibly fix this by reconfiguring the service."));
	
	units.addAll(gpg);
	units.addAll(sources);
	
	return units;
}
 
Example 16
Project: CommonFramework   File: ImageUtils.java   View Source Code Vote up 6 votes
/**
 * 解析二维码图片工具类
 *
 * @param bitmap
 */
public static String analyzeBitmap(Bitmap bitmap) {
    MultiFormatReader multiFormatReader = new MultiFormatReader();

    // 解码的参数
    Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(2);
    // 可以解析的编码类型
    Vector<BarcodeFormat> decodeFormats = new Vector<BarcodeFormat>();
    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);
    // 设置继续的字符编码格式为UTF8
    hints.put(DecodeHintType.CHARACTER_SET, "UTF8");
    // 设置解析配置参数
    multiFormatReader.setHints(hints);

    // 开始对图像资源解码
    Result rawResult = null;
    try {
        rawResult = multiFormatReader.decodeWithState(new BinaryBitmap(new HybridBinarizer(new BitmapLuminanceSource(bitmap))));
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (rawResult != null) {
        return rawResult.getText();
    } else {
        return "Failed";
    }
}
 
Example 17
Project: AgentWorkbench   File: DynTableDataVector.java   View Source Code Vote up 5 votes
/**
 * Gets the child node vector.
 * @return the child node vector
 */
private Vector<Object> getChildNodeVector(DefaultMutableTreeNode parentNode, boolean visibleInTableView) {
	
	Vector<Object> childVector = new Vector<Object>();
	boolean childNodesVisible = true;
	for (int i=0; i<parentNode.getChildCount(); i++) {

		// --------------------------------------------
		// --- Create data row for this node ----------
		DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) parentNode.getChildAt(i);
		DynType dynType = (DynType) childNode.getUserObject();
		dynType.setVisibleInTableView(visibleInTableView);
		
		if (visibleInTableView==true) {
			// --- Are child slots visible in the table ---
			if (OntologyVisualisationConfiguration.isRegisteredOntologyClassVisualisation(dynType.getClassName())) {
				childNodesVisible = false;
			} else {
				childNodesVisible = true;
			}
			
		} else {
			// --- nodes and sub node are invisible ---
			childNodesVisible = visibleInTableView;
		}
		
		// --- Create data row ------------------------
		Vector<Object> dataRow = new Vector<Object>();			
		dataRow.add(dynType);
		dataRow.add(dynType);
		// --- Add to mainVector ----------------------
		childVector.add(dataRow);
		
		// --------------------------------------------
		// --- Remind the row number as editable!? ----
		if (dynType.getTypeName().equals(DynType.typeRawType)) {
			this.getEditableRowsVector().add(this.rowCounter);
		}
		this.rowCounter++;
		
		// --------------------------------------------
		// --- Add the Child nodes, if available ------
		if (childNode.getChildCount()!=0) {
			// --- get child nodes first --------------
			childVector.addAll(this.getChildNodeVector(childNode, childNodesVisible));
		}
		
	}
	return childVector;
}
 
Example 18
Project: tap17-muggl-javaee   File: SimpleConstraintSetOptimizer.java   View Source Code Vote up 5 votes
@SuppressWarnings("unused") 
   public SingleConstraintSet transform(SingleConstraintSet constraintSet) {
// check if any Assignments are already contained or if any Assignments
// can be read of trivially and insert the assignments into the
// remaining constraints
Vector<Assignment> assignments = new Vector<Assignment>();
Vector<SingleConstraint> checkedConstraints = new Vector<SingleConstraint>();
Vector<SingleConstraint> uncheckedConstraints = new Vector<SingleConstraint>();
for (int i = 0; i < constraintSet.getConstraintCount(); i++)
    uncheckedConstraints.add(constraintSet.getConstraint(i));
while (!uncheckedConstraints.isEmpty()){
    SingleConstraint constraint = uncheckedConstraints.remove(0);
    if (constraint instanceof Assignment){
	assignments.add((Assignment)constraint);
	uncheckedConstraints.addAll(checkedConstraints);
	checkedConstraints.removeAllElements();
    } else{
	for (int assignmentIdx = 0; assignmentIdx < assignments.size(); assignmentIdx++)
	    constraint = constraint.insert(assignments.get(assignmentIdx));
	Solution solution = null; //constraint.getUniqueSolution();
	if (solution != null){
	    if (solution == Solution.NOSOLUTION)
		return new SingleConstraintSet(BooleanConstant.FALSE);
	    for (Variable variable: solution.variables()){
		Constant value = solution.getValue(variable);
		Assignment assignment = new Assignment(variable, value);
		constraint = constraint.insert(assignment);
		assignments.add(assignment);
	    }
	    uncheckedConstraints.addAll(checkedConstraints);
	    checkedConstraints.removeAllElements();
	}
	combineConditions(checkedConstraints, uncheckedConstraints, assignments, constraint);
    }
}

SingleConstraintSet result = new SingleConstraintSet();
for (int i = 0; i < checkedConstraints.size(); i++)
    result.add(checkedConstraints.get(i));
for (int i = 0; i < assignments.size(); i++)
    result.add(assignments.get(i));
return result;
   }
 
Example 19
Project: googles-monorepo-demo   File: IteratorsTest.java   View Source Code Vote up 5 votes
private static Enumeration<Integer> enumerate(Integer... ints) {
  Vector<Integer> vector = new Vector<Integer>();
  vector.addAll(asList(ints));
  return vector.elements();
}
 
Example 20
Project: openjdk-jdk10   File: BuildConfig.java   View Source Code Vote up 4 votes
protected void initDefaultLinkerFlags() {
    Vector linkerFlags = new Vector();

    linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName")));

    put("LinkerFlags", linkerFlags);
}