本文整理汇总了Java中java.util.Vector.size方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.size方法的具体用法?Java Vector.size怎么用?Java Vector.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Vector
的用法示例。
在下文中一共展示了Vector.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMarkedNotes
import java.util.Vector; //导入方法依赖的package包/类
/**
* @see net.sf.memoranda.NoteList#getMarkedNotes()
*/
public Collection getMarkedNotes() {
Vector v = new Vector();
Elements yrs = _root.getChildElements("year");
for (int yi = 0; yi < yrs.size(); yi++) {
Year y = new Year(yrs.get(yi));
Vector ms = y.getMonths();
for (int mi = 0; mi < ms.size(); mi++) {
Month m = (Month) ms.get(mi);
Vector ds = m.getDays();
for (int di = 0; di < ds.size(); di++) {
Day d = (Day) ds.get(di);
Vector ns = d.getNotes();
for(int ni = 0; ni < ns.size(); ni++) {
NoteElement ne = (NoteElement) ns.get(ni);
Note n = new NoteImpl(ne.getElement(), _project);
if (n.isMarked()) v.add(n);
}
}
}
}
return v;
}
示例2: bookmark
import java.util.Vector; //导入方法依赖的package包/类
public void bookmark(){
if (desc.type >-1){
Vector<DBDescription> bookmarks=new Vector<DBDescription>();
File rt = GMARoot.getRoot();
if (rt==null) return;
String fs = System.getProperty("file.separator");
File bm = new File(rt.getPath()+fs+"history"+fs+"db.bm");
if (bm!=null) bookmarks = readVectors(bm);
for (int i = Math.max(bookmarks.size()-10,0); i < bookmarks.size(); i++)
if (desc.equals((bookmarks.get(i)))){
// GMA 1.5.2: Corrected misspelling of "already"
// JOptionPane.showMessageDialog(null, "Bookmark allready exists", "Bookmark exists", JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(null, "Bookmark already exists", "Bookmark exists", JOptionPane.INFORMATION_MESSAGE);
return;
}
bookmarks.add(desc);
File hstD = new File(rt.getPath()+fs+"history");
hstD.mkdir();
try {
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(bm));
for (int i = 0; i < bookmarks.size(); i++)
out.writeObject(bookmarks.get(i));
out.close();
JOptionPane.showMessageDialog(null, "Bookmark created.", "Succesful", JOptionPane.INFORMATION_MESSAGE);
} catch (IOException e) {JOptionPane.showMessageDialog(null, "Error Writing Bookmark:\n"+e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);}
}
}
示例3: LPC
import java.util.Vector; //导入方法依赖的package包/类
/**
* LPC Constructor.
*
* @param poPreprocessing Preprocessing module reference
*/
public LPC(IPreprocessing poPreprocessing) {
super(poPreprocessing);
setDefaults();
// LPC-specific parameters, if any
ModuleParams oModuleParams = MARF.getModuleParams();
if (oModuleParams != null) {
Vector oParams = oModuleParams.getFeatureExtractionParams();
if (oParams.size() > 0) {
this.iPoles = ((Integer) oParams.elementAt(0)).intValue();
this.iWindowLen = ((Integer) oParams.elementAt(1)).intValue();
}
}
}
示例4: getStationKey
import java.util.Vector; //导入方法依赖的package包/类
public Object getStationKey(String name) {
Object key = null;
Vector<Object> stations = sd.getStationKeys();
for (int i = 0; i < stations.size(); i++) {
if (sd.getStationName(stations.get(i)).equals(name)) {
key = stations.get(i);
}
}
return key;
}
示例5: permuteList
import java.util.Vector; //导入方法依赖的package包/类
/**
* Generates a permuted ArrayList from the original one. The original List
* is not modified
*
* @param arr
* the ArrayList to be permuted
* @param rand
* the source of Randomness for permutation
* @return a new ArrayList with the permuted elements.
*/
private static Vector permuteList(
Vector arr,
SecureRandom rand)
{
Vector retval = new Vector();
Vector tmp = new Vector();
for (int i = 0; i < arr.size(); i++)
{
tmp.addElement(arr.elementAt(i));
}
retval.addElement(tmp.elementAt(0));
tmp.removeElementAt(0);
while (tmp.size() != 0)
{
retval.insertElementAt(tmp.elementAt(0), getInt(rand, retval.size() + 1));
tmp.removeElementAt(0);
}
return retval;
}
示例6: checkForNoSinkWithOpenClassError
import java.util.Vector; //导入方法依赖的package包/类
/**
* Check if there is at least one open class but there are no sinks. If a problem is found it raises
* to "true" the corresponding position inside the problems array.
*/
private void checkForNoSinkWithOpenClassError() {
//vector used to contain the set of open class keys
Vector<Object> openClasses = new Vector<Object>(0, 1);
//vector used to contain the complete set class keys
Vector<Object> classes = class_def.getClassKeys();
//for cicle used to collect the open class keys from the classes vector
for (int i = 0; i < classes.size(); i++) {
Object thisClassKey = classes.get(i);
if (class_def.getClassType(thisClassKey) == CLASS_TYPE_OPEN) {
openClasses.add(thisClassKey);
}
}
//if there is at least one open class
if (openClasses.size() > 0) {
//variable counting the number of sink
int nSink = 0;
//vector containing the complete set of class keys
Vector<Object> stations = station_def.getStationKeys();
//for each station ...
for (int i = 0; i < stations.size(); i++) {
Object thisStationKey = stations.get(i);
// ... check if it is a sink, in that case increase the nSink variable
if (station_def.getStationType(thisStationKey).equals(STATION_TYPE_SINK)) {
nSink++;
}
}
//if no sink was found there is an error
errors[NO_SINK_WITH_OPEN_CLASSES_ERROR] = nSink == 0;
} else {
errors[NO_SINK_WITH_OPEN_CLASSES_ERROR] = false;
}
}
示例7: main
import java.util.Vector; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
String[][] addrs =
{{"9.255.255.255", "false"}, {"10.0.0.0", "true"},
{"10.255.255.255", "true"}, {"11.0.0.0", "false"},
{"172.15.255.255", "false"}, {"172.16.0.0", "true"},
{"172.30.1.2", "true"}, {"172.31.255.255", "true"},
{"172.32.0.0", "false"}, {"192.167.255.255", "false"},
{"192.168.0.0", "true"}, {"192.168.255.255", "true"},
{"192.169.0.0", "false"}};
Vector v = new Vector();
for (int i = 0; i < addrs.length; i++) {
InetAddress addr = InetAddress.getByName(addrs[i][0]);
boolean result = new Boolean(addrs[i][1]).booleanValue();
if (addr.isSiteLocalAddress() != result) {
v.add(addrs[i]);
}
}
Iterator itr = v.iterator();
while (itr.hasNext()) {
String[] entry = (String[]) itr.next();
System.out.println(entry[0] +" should return "+entry[1]
+ " when calling isSiteLocalAddress()");
}
if (v.size() > 0) {
throw new RuntimeException("InetAddress.isSiteLocalAddress() test failed");
}
}
示例8: findNative
import java.util.Vector; //导入方法依赖的package包/类
static long findNative(ClassLoader loader, String name) {
Vector<NativeLibrary> libs =
loader != null ? loader.nativeLibraries : systemNativeLibraries;
synchronized (libs) {
int size = libs.size();
for (int i = 0; i < size; i++) {
NativeLibrary lib = libs.elementAt(i);
long entry = lib.find(name);
if (entry != 0)
return entry;
}
}
return 0;
}
示例9: checkForNoBacwardLinkWarning
import java.util.Vector; //导入方法依赖的package包/类
/**
* Checks if there are stations mot backward linked
*/
private void checkForNoBacwardLinkWarning() {
Vector<Object> stations = station_def.getStationKeys();
for (int i = 0; i < stations.size(); i++) {
Object thisStationKey = stations.get(i);
if ((!station_def.getStationType(thisStationKey).equals(STATION_TYPE_SOURCE))
&& (!station_def.getStationType(thisStationKey).equals(STATION_TYPE_SINK))) {
Vector<Object> backwardConnections = station_def.getBackwardConnections(thisStationKey);
if (backwardConnections.size() == 0) {
warnings[NO_BACKWARD_LINK_WARNING] = true;
stationWithoutBackwardLinks.add(thisStationKey);
}
}
}
}
示例10: manageProbabilities
import java.util.Vector; //导入方法依赖的package包/类
/**
* Francesco D'Aquino
* Normalizes the routing probabilities for each station
*/
public void manageProbabilities() {
//get the vector of the stations
Vector<Object> stations = getStationKeys();
//get the vector of the classes
Vector<Object> classes = getClassKeys();
//for each station ...
for (int i = 0; i < stations.size(); i++) {
//get the station at i from the station vector
Object thisStation = stations.get(i);
//if it isn't a sink...
if (!getStationType(thisStation).equals(CommonConstants.STATION_TYPE_SINK)) {
//Aboce :-^All stations have router except Sink
//for each class...
for (int j = 0; j < classes.size(); j++) {
Object thisClass = classes.get(j);
//check if the routing strategy in thisStation is ProbabilityRouting
if (getRoutingStrategy(thisStation, thisClass) instanceof ProbabilityRouting) {
//if it is so, normalize routing probabilities
Vector<Object> outputKeys = getForwardConnections(thisStation);
ProbabilityRouting pr = (ProbabilityRouting) getRoutingStrategy(thisStation, thisClass);
Map<Object, Double> values = pr.getValues();
// normalizeProbabilities(values, outputKeys, thisClass, thisStation); //QN-Java
}
}
}
}
}
示例11: TableDB
import java.util.Vector; //导入方法依赖的package包/类
public TableDB( Vector headings, Vector rows, StringBuffer comments) {
this.comments = comments;
this.headings = headings;
this.rows = rows;
resolveLonLat();
resolveClasses();
columnOrder = new Vector();
for( int k=0 ; k<headings.size() ; k++) columnOrder.add(new Integer(k));
}
示例12: parseStrings
import java.util.Vector; //导入方法依赖的package包/类
/**
* @return an array of all the strings in <code>value</code>
* that are separated by whitespace.
*/
static String[] parseStrings(String value) {
int current, last;
int length = (value == null) ? 0 : value.length();
Vector<String> temp = new Vector<String>(4);
current = 0;
while (current < length) {
// Skip ws
while (current < length && Character.isWhitespace
(value.charAt(current))) {
current++;
}
last = current;
while (current < length && !Character.isWhitespace
(value.charAt(current))) {
current++;
}
if (last != current) {
temp.addElement(value.substring(last, current));
}
current++;
}
String[] retValue = new String[temp.size()];
temp.copyInto(retValue);
return retValue;
}
示例13: getSubmitButtons
import java.util.Vector; //导入方法依赖的package包/类
/**
* Returns an array containing the submit buttons defined for this form.
**/
public SubmitButton[] getSubmitButtons() {
if (_submitButtons == null) {
Vector buttons = getSubmitButtonVector();
_submitButtons = new SubmitButton[ buttons.size() ];
buttons.copyInto( _submitButtons );
}
return _submitButtons;
}
示例14: suppressChildren
import java.util.Vector; //导入方法依赖的package包/类
/**
* Walk recursively through a hierarchy of sub-features and accumulate a list of suppress operations
* @param features The list of feature objects to check
* @param featOps The output list of accumulated suppress operations
* @param clip Whether to clip-suppress suppressed features to the end of the structure
* @throws JLIException
* @throws jxthrowable
*/
private void suppressChildren(Vector<CallFeature> features, CallFeatureOperations featOps, boolean clip) throws JLIException,jxthrowable {
if (features!=null) {
int len = features.size();
CallFeature feat;
SuppressLooper2 subLooper;
// loop through each input feature
for (int i=0; i<len; i++) {
feat = (CallFeature)features.elementAt(i);
// use a looper to resume sub-features
subLooper = new SuppressLooper2();
subLooper.featOps = featOps;
subLooper.clip = clip;
subLooper.loop(feat);
// restore this code if going with separate featOps
// if (subLooper.featOps!=null && subLooper.featOps.getarraysize()>0) {
// parentSolid.ExecuteFeatureOps(subLooper.featOps, null);
// }
// if any new suppress operations were added in the looper, walk the children of this feature
if (subLooper.featuresSuppressed!=null) {
suppressChildren(subLooper.featuresSuppressed, subLooper.featOps, clip);
}
}
}
}
示例15: writeSourceSection
import java.util.Vector; //导入方法依赖的package包/类
static protected void writeSourceSection(Document doc, Node node,
CommonModel model, Object stationKey) {
Element elem = doc.createElement(XML_E_STATION_SECTION);
elem.setAttribute(XML_A_STATION_SECTION_CLASSNAME, CLASSNAME_SOURCE);
node.appendChild(elem);
Vector<Object> classes = model.getClassKeys();
// obtain classes that must be generated by this source
Vector<Object> refClasses = getClassesForSource(model, stationKey);
XMLParameter[] distrParams = new XMLParameter[classes.size()];
for (int i = 0; i < distrParams.length; i++) {
// if current class must be generated by this source
Object currentClass = classes.get(i);
if (refClasses.contains(currentClass)) {
distrParams[i] = DistributionWriter
.getDistributionParameter((Distribution) model
.getClassDistribution(currentClass), model,
currentClass);
} else {
// otherwise write a null parameter
String name = "ServiceTimeStrategy";
distrParams[i] = new XMLParameter(name, strategiesClasspathBase
+ serviceStrategiesSuffix + name,
model.getClassName(currentClass), "null", true);
}
}
// creating global service strategy parameter
String gspName = "ServiceStrategy";
XMLParameter globalStrategyParameter = new XMLParameter(gspName,
strategiesClasspathBase + gspName, null, distrParams, false);
// finally, create node from parameters and append it to the section
// element
globalStrategyParameter.appendParameterElement(doc, elem);
}