本文整理汇总了Java中java.util.Vector类的典型用法代码示例。如果您正苦于以下问题:Java Vector类的具体用法?Java Vector怎么用?Java Vector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector类属于java.util包,在下文中一共展示了Vector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unit
import java.util.Vector; //导入依赖的package包/类
/**
* add all the sameScanWifi that in tempSameScanWifiVector into wifis
* if their was an ellement from the same scan it units them,
* else it add it to the end of the vector
* @param dataBase
* @param tempDataBase
*/
public static void unit(Vector<sameScanWifi> dataBase, Vector<sameScanWifi> tempDataBase) {
// TODO Auto-generated method stub
for(int i=0;i<tempDataBase.size();i++){
boolean add=false;
for(int j=0;j<dataBase.size();j++){
if(tempDataBase.elementAt(i).compare(dataBase.elementAt(j))){
dataBase.elementAt(j).insert(tempDataBase.elementAt(i));
add=true;
break;
}
}
if(!add){
dataBase.add(tempDataBase.elementAt(i));
}
}
}
示例2: refreshList
import java.util.Vector; //导入依赖的package包/类
public void refreshList() {
clearTable();
Vector services = null ;
try {
services = vv.lookupAsString(regServerURL);
}
catch( Exception e ) {
System.err.println("---------------------------------------------");
e.printStackTrace();
JOptionPane.showMessageDialog(this, e.toString(), "Error",
JOptionPane.INFORMATION_MESSAGE );
}
for ( int i = 0 ; services != null && i < services.size() ; i++ ) {
Service s = (Service) services.elementAt(i);
addServer( s );
}
buyList.removeAllItems();
purchasePanel.setEnabled( false );
refreshButton.setEnabled( true );
registerButton.setEnabled( true );
enableButtons();
}
示例3: writeDeleteableFiles
import java.util.Vector; //导入依赖的package包/类
private final void writeDeleteableFiles(Vector files) throws IOException {
OutputStream output = directory.createFile("deleteable.new");
try {
output.writeInt(files.size());
for (int i = 0; i < files.size(); i++)
output.writeString((String)files.elementAt(i));
} finally {
output.close();
}
directory.renameFile("deleteable.new", "deletable");
}
示例4: toMessageString
import java.util.Vector; //导入依赖的package包/类
public Vector toMessageString() throws ProtocolException {
if (userId == null || userId.equals("") || password == null || password.equals("")) {
throw new ProtocolException("UserId or password not specified");
}
String
msg =
version + " " + RestConstantsZ.ACTION_UPDATEORDERSTATUS + " " + userId + " " + password +
" " + orderId + " " + status;
if (hasResponseMessageNumbers()) {
msg += " " + getResponseMessageNumbers();
} else {
msg += " " + MessageUtil.DUMMY;
}
if (isDev) {
msg += " d";
}
return MessageUtil.split(msg, msgId);
}
示例5: addDatastoreListener
import java.util.Vector; //导入依赖的package包/类
@Override
public synchronized void addDatastoreListener(DatastoreListener l) {
@SuppressWarnings("unchecked")
Vector<DatastoreListener> v = datastoreListeners == null ? new Vector<DatastoreListener>(2) : (Vector<DatastoreListener>) datastoreListeners.clone();
if (!v.contains(l)) {
v.addElement(l);
datastoreListeners = v;
}
}
示例6: getFileTypeListing
import java.util.Vector; //导入依赖的package包/类
/**
* Gets a listing of known, shared file types. Types returned here are not
* gurenteed to contain any files, only that the type is known and has a
* "shared" of true. (Myster allows the users the option of not sharing a
* type. Types that aren't shared are still known by the FileManager but are
* not shared and so don't appear here.)
*
* @return a String[] of shared Myster file types.
*/
public MysterType[] getFileTypeListing() {
//This routine uses the old vector copied to an array trick, since the
// number of shared Items is not known until later
//so the list is put into a vector intialy then copied to an array.
Vector workinglist = new Vector(filelist.length); //since the size of
// the final vector
// will always be <=
// filelist.length.
for (int i = 0; i < filelist.length; i++) {
if (filelist[i].isShared())
workinglist.addElement(filelist[i].getType());
}
MysterType[] array = new MysterType[workinglist.size()];
for (int i = 0; i < array.length; i++) {
array[i] = ((MysterType) (workinglist.elementAt(i)));
}
return array;
}
示例7: createSnmpRequestHandler
import java.util.Vector; //导入依赖的package包/类
private void createSnmpRequestHandler(SnmpAdaptorServer server,
int id,
DatagramSocket s,
DatagramPacket p,
SnmpMibTree tree,
Vector<SnmpMibAgent> m,
InetAddressAcl a,
SnmpPduFactory factory,
SnmpUserDataFactory dataFactory,
MBeanServer f,
ObjectName n) {
final SnmpRequestHandler handler =
new SnmpRequestHandler(this, id, s, p, tree, m, a, factory,
dataFactory, f, n);
threadService.submitTask(handler);
}
示例8: getSeriesDataForAllGroupCells
import java.util.Vector; //导入依赖的package包/类
/**
* Returns a list of GroupCellKeyAndData which contains contains data for each group cell. The
* data in this list represents data series ready to be plotted, i.e. aggregated etc. It does
* not contain data tables, but double[] arrays for each SeriesUsageType and each Dimension.
*
* Since the generation of this list is usually quite expensive, implementations are strongly
* encouraged to provide a caching mechanism.
*/
public GroupCellSeriesData getSeriesDataForAllGroupCells() {
synchronized (this) {
if (cachedSeriesDataForAllGroupCells == null) {
Vector<PlotDimension> dimensions = new Vector<PlotDimension>();
for (Entry<PlotDimension, DefaultDimensionConfig> dimensionEntry : plotInstance
.getCurrentPlotConfigurationClone().getDefaultDimensionConfigs().entrySet()) {
PlotDimension d = dimensionEntry.getKey();
if (d == PlotDimension.DOMAIN || d == PlotDimension.VALUE) {
throw new RuntimeException("This should not happen!");
}
dimensions.add(d);
}
cachedSeriesDataForAllGroupCells = recursivelyGetSeriesDataForAllGroupCells(dimensions, 0, null, null);
}
}
return cachedSeriesDataForAllGroupCells;
}
示例9: setClassType
import java.util.Vector; //导入依赖的package包/类
/**
* Sets type of the class linked to the specific key. Type of class is represented by
* an int number whose value is contained in <code>JMODELConstants</code>.
* */
@Override
public synchronized void setClassType(int type, Object key) {
// If a class type changes, resets its reference station
int old = getClassType(key);
super.setClassType(type, key);
// If type has changed sets ref station to first found source if class is open
if (old != type) {
setClassRefStation(key, null);
if (type == CLASS_TYPE_OPEN) {
Vector stations = this.getStationKeys();
for (int i = 0; i < stations.size(); i++) {
if (this.getStationType(stations.get(i)).equals(STATION_TYPE_SOURCE)) {
setClassRefStation(key, stations.get(i));
break;
}
}
}
}
}
示例10: main
import java.util.Vector; //导入依赖的package包/类
/**
* Classifies an input file, given a model
* @param args optional: input file, model file and the output file
*/
public static void main(String[] args) {
loadLabelMappings("data/models/sentiment_label_mappings.tsv");
modelFile = "data/models/sentiment_model.svm";
testFile = "dev.tsv";
predictionFile = "sentiment_test_predictions.tsv";
positiveGazeteerFile = "data/dictionaries/positive";
negativeGazeteerFile = "data/dictionaries/negative";
if (args.length == 3) {
testFile = args[0];
modelFile = args[1];
predictionFile = args[2];
}
Vector<FeatureExtractor> features = loadFeatureExtractors();
Model model = loadModel(modelFile);
classifyTestSet(testFile, model, features, predictionFile, "sentiment");
}
示例11: setupManagerDepartments
import java.util.Vector; //导入依赖的package包/类
/**
* @return
*/
private void setupManagerDepartments(HttpServletRequest request) throws Exception{
Vector<LabelValueBean> labelValueDepts = new Vector<LabelValueBean>();
for (Department d: Department.getUserDepartments(sessionContext.getUser())) {
labelValueDepts.add(
new LabelValueBean(
d.getDeptCode() + "-" + d.getName(),
d.getUniqueId().toString() ) );
}
if (labelValueDepts.size() == 1)
request.setAttribute("deptId", labelValueDepts.get(0).getValue());
request.setAttribute(Department.DEPT_ATTR_NAME,labelValueDepts);
}
示例12: ListPane
import java.util.Vector; //导入依赖的package包/类
/**
* Construct a JList that displays the elements in the specified
* Vector. This constructor just delegates to the ListModel
* constructor.
*/
public ListPane(final Vector listData) {
this(
new AbstractListModel() {
public int getSize() {
return listData.size();
}
public Object getElementAt(int i) {
return listData.elementAt(i);
}
}
);
}
示例13: removeProjectHistory
import java.util.Vector; //导入依赖的package包/类
public static void removeProjectHistory(Project prj) {
Vector list = new Vector();
String id;
for (int i = 0; i < _list.size(); i++) {
id = (((HistoryItem) _list.elementAt(i)).getProject()).getID();
if (id.equals(prj.getID())) {
list.add(_list.elementAt(i));
p--;
if (_list.elementAt(i).equals(prev)) {
if (p > 0) prev = _list.get(p - 1);
else prev = null;
}
}
}
if (!list.isEmpty()) {
_list.removeAll(list);
if (p < 0) {
p = 0;
}
_list.setSize(p);
next = null;
historyBackAction.update();
historyForwardAction.update();
}
}
示例14: getPrefixes
import java.util.Vector; //导入依赖的package包/类
/**
* TODO: Namespace doesn't give information giving multiple prefixes for
* the same namespaceURI.
*/
public java.util.Iterator getPrefixes(String namespaceURI) {
if (namespaceURI == null) {
throw new IllegalArgumentException("URI can't be null.");
}
else {
Vector vector =
((NamespaceSupport) fNamespaceContext).getPrefixes(namespaceURI.intern());
return vector.iterator();
}
}
示例15: FormatFileWriter
import java.util.Vector; //导入依赖的package包/类
public FormatFileWriter(Vector<Object> names, Vector comments, Vector delimiters, Vector regExprs, int[] types, String name, Vector defualts,
Vector replaces) {
File fileN = new File(name);
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(fileN));
writer.write(new String(names.size() + "\n"));
for (int i = 0; i < names.size(); i++) {
writer.write((String) names.get(i) + "\n");
writer.write(Integer.toString(types[i]) + "\n");
writer.write("1\n");
writer.write((String) comments.get(i) + "\n");
writer.write((String) delimiters.get(i) + "\n");
writer.write((String) regExprs.get(i) + "\n");
writer.write((String) defualts.get(i) + "\n");
writer.write((String) replaces.get(i) + "\n");
}
writer.close();
} catch (IOException e) {
System.err.println("Errore nella creazione del file di salvataggio del formato");
e.printStackTrace();
}
}