当前位置: 首页>>代码示例>>Java>>正文


Java Vector.elements方法代码示例

本文整理汇总了Java中java.util.Vector.elements方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.elements方法的具体用法?Java Vector.elements怎么用?Java Vector.elements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Vector的用法示例。


在下文中一共展示了Vector.elements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: splitFrom

import java.util.Vector; //导入方法依赖的package包/类
/**
 * This method creates a new Vector which does not contain the first
 * element up to the specified limit.
 *
 * @param original The original vector.
 * @param limit The limit.
 */
private Vector<SnmpVarBind> splitFrom(Vector<SnmpVarBind> original, int limit) {

    int max= original.size();
    Vector<SnmpVarBind> result= new Vector<>(max - limit);
    int i= limit;

    // Ok the loop looks a bit strange. But in order to improve the
    // perf, we try to avoid reference to the limit variable from
    // within the loop ...
    //
    for(Enumeration<SnmpVarBind> e= original.elements(); e.hasMoreElements(); --i) {
        SnmpVarBind var= e.nextElement();
        if (i >0)
            continue;
        result.addElement(new SnmpVarBind(var.oid, var.value));
    }
    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:SnmpMibAgent.java

示例2: extractLocales

import java.util.Vector; //导入方法依赖的package包/类
private static void extractLocales(Hashtable languages, Vector q,Vector l)
{
    // XXX We will need to order by q value Vector in the Future ?
    Enumeration e = q.elements();
    while (e.hasMoreElements()) {
        Vector v =
            (Vector)languages.get(((Double)e.nextElement()).toString());
        Enumeration le = v.elements();
        while (le.hasMoreElements()) {
	        String language = (String)le.nextElement();
     	String country = "";
    		int countryIndex = language.indexOf("-");
            if (countryIndex > -1) {
                country = language.substring(countryIndex + 1).trim();
                language = language.substring(0, countryIndex).trim();
            }
            l.addElement(new Locale(language, country));
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:AcceptLanguage.java

示例3: findCrossings

import java.util.Vector; //导入方法依赖的package包/类
public static Crossings findCrossings(Vector<? extends Curve> curves,
                                      double xlo, double ylo,
                                      double xhi, double yhi)
{
    Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi);
    Enumeration<? extends Curve> enum_ = curves.elements();
    while (enum_.hasMoreElements()) {
        Curve c = enum_.nextElement();
        if (c.accumulateCrossings(cross)) {
            return null;
        }
    }
    if (debug) {
        cross.print();
    }
    return cross;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Crossings.java

示例4: equalsVector

import java.util.Vector; //导入方法依赖的package包/类
/** Tells whether the given list contains the same data as the vector */
private boolean equalsVector(HsqlList list, Vector vector) {

    if (list.size() != vector.size()) {
        return false;
    }

    Iterator listElements   = list.iterator();
    Enumeration             vectorElements = vector.elements();
    Object                  listObj        = null;
    Object                  vectorObj      = null;

    while (listElements.hasNext()) {
        listObj   = listElements.next();
        vectorObj = vectorElements.nextElement();

        if (!listObj.equals(vectorObj)) {
            return false;
        }
    }

    return true;
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:24,代码来源:TestDataStructures.java

示例5: getGenericRules

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Gets the genericRules attribute of the YassAlbumFilter object
 *
 * @param data Description of the Parameter
 * @return The genericRules value
 */
public String[] getGenericRules(Vector<YassSong> data) {
    Vector<String> albums = new Vector<>();
    for (Enumeration<?> e = data.elements(); e.hasMoreElements(); ) {
        YassSong s = (YassSong) e.nextElement();
        String album = s.getAlbum();
        if (album == null || album.length() < 1) {
            continue;
        }
        if (!albums.contains(album)) {
            albums.addElement(album);

        }
    }
    Collections.sort(albums);

    return albums.toArray(new String[albums.size()]);
}
 
开发者ID:SarutaSan72,项目名称:Yass,代码行数:24,代码来源:YassAlbumFilter.java

示例6: getInformCommunities

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Returns an enumeration of inform communities for a given host.
 *
 * @param i The address of the host.
 *
 * @return An enumeration of inform communities for a given host (enumeration of <CODE>String</CODE>).
 */
public Enumeration<String> getInformCommunities(InetAddress i) {
    Vector<String> list = null;
    if ((list = informDestList.get(i)) != null ) {
        if (SNMP_LOGGER.isLoggable(Level.FINER)) {
            SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
                "getInformCommunities", "["+i.toString()+"] is in list");
        }
        return list.elements();
    } else {
        list = new Vector<>();
        if (SNMP_LOGGER.isLoggable(Level.FINER)) {
            SNMP_LOGGER.logp(Level.FINER, SnmpAcl.class.getName(),
                "getInformCommunities", "["+i.toString()+"] is not in list");
        }
        return list.elements();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:SnmpAcl.java

示例7: replaceIdsWithShortcodes

import java.util.Vector; //导入方法依赖的package包/类
private void replaceIdsWithShortcodes(Vector<Hashtable<String, String>> materials) {
  xLogger.fine("Entered replaceIdsWithShortcodes");
  if (materials == null || materials.isEmpty()) {
    return;
  }
  Enumeration<Hashtable<String, String>> en = materials.elements();
  while (en.hasMoreElements()) {
    Hashtable<String, String> ht = en.nextElement();
    Long materialId = Long.valueOf(ht.get(JsonTagsZ.MATERIAL_ID));
    try {
      IMaterial m = mcs.getMaterial(materialId);
      String shortCode = m.getShortCode();
      String shortName = m.getShortName();
      if (shortCode != null) {
        ht.put(JsonTagsZ.MATERIAL_ID, shortCode);
        xLogger.fine("replaceIdsWithShortcodes: replaced {0} with {1}", materialId, shortCode);
      }
      if (shortName != null && !shortName.isEmpty()) {
        ht.put(JsonTagsZ.NAME, shortName);
      }
    } catch (ServiceException e) {
      xLogger.warn("Unable to get material with ID: {0}", materialId);
    }
  }
  xLogger.fine("Exiting replaceIdsWithShortcodes");
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:27,代码来源:MachineProtocolMessageHandler.java

示例8: filter

import java.util.Vector; //导入方法依赖的package包/类
private Vector filter(Collection counters, double limit) {
	Vector cnt = new Vector(counters);
	Collections.sort(cnt);
	int total = 0;
	for (Enumeration e=cnt.elements();e.hasMoreElements();)
		total += ((Counter)e.nextElement()).getCounter();
	
	int totalLimit = (int)Math.ceil(limit*total);
	int current = 0;
	
	Vector ret = new Vector();
	for (Enumeration e=cnt.elements();e.hasMoreElements();) {
		Counter c = (Counter)e.nextElement();
		ret.addElement(c);
		current += c.getCounter();
		if (current>=totalLimit) break;
	}
	
	return ret;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:21,代码来源:ExamConflictStatisticsInfo.java

示例9: getFolders

import java.util.Vector; //导入方法依赖的package包/类
@Override
public Enumeration<? extends FileObject> getFolders(boolean rec) {
    Enumeration<? extends FileObject> datas = original.getFolders(rec);
    Vector<FileObject> tmp = new Vector<>();
    while (datas.hasMoreElements()) {
        FileObject nextElement = datas.nextElement();
        tmp.add(findOrCreate(nextElement));
    }
    return tmp.elements();
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:11,代码来源:ReadOnlyFileObject.java

示例10: createArgumentFields

import java.util.Vector; //导入方法依赖的package包/类
void createArgumentFields(Vector argNames) {
    // Create a list of arguments
    if (isMethod()) {
        args = new Vector();

        if (isConstructor() || !(isStatic() || isInitializer())) {
            args.addElement(((SourceClass)clazz).getThisArgument());
        }

        if (argNames != null) {
            Enumeration e = argNames.elements();
            Type argTypes[] = getType().getArgumentTypes();
            for (int i = 0 ; i < argTypes.length ; i++) {
                Object x = e.nextElement();
                if (x instanceof LocalMember) {
                    // This should not happen, but it does
                    // in cases of vicious cyclic inheritance.
                    args = argNames;
                    return;
                }
                Identifier id;
                int mod;
                long where;
                if (x instanceof Identifier) {
                    // allow argNames to be simple Identifiers (deprecated!)
                    id = (Identifier)x;
                    mod = 0;
                    where = getWhere();
                } else {
                    IdentifierToken token = (IdentifierToken)x;
                    id = token.getName();
                    mod = token.getModifiers();
                    where = token.getWhere();
                }
                args.addElement(new LocalMember(where, clazz, mod,
                                               argTypes[i], id));
            }
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:41,代码来源:SourceMember.java

示例11: findResources

import java.util.Vector; //导入方法依赖的package包/类
@Override
protected Enumeration<URL> findResources(String name) throws IOException {
  URL url = null;
  try {
    url = getTempFile().getAbsoluteFile().toURI().toURL();
    System.out.println("GeneratingClassLoader#findResources returning " + url);
  } catch (IOException e) {
  }
  Vector<URL> urls = new Vector<URL>();
  urls.add(url);
  return urls.elements();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:13,代码来源:ClassPathLoaderTest.java

示例12: compareArgTypes

import java.util.Vector; //导入方法依赖的package包/类
private boolean compareArgTypes(RemoteField method, Vector nameVector) {
  String nameString = method.getTypedName();

  // Skip to the argument types and tokenize them
  int index = nameString.indexOf("(");
  if (index == -1) {
    throw new IllegalArgumentException("Method expected");
  }
  StringTokenizer tokens = new StringTokenizer(nameString.substring(index),
                                               "(,) \t\n\r");

  // If argument counts differ, we can stop here
  if (tokens.countTokens() != nameVector.size()) {
    return false;
  }

  // Compare each argument type's name
  Enumeration enum = nameVector.elements();
  while (tokens.hasMoreTokens()) {
    String comp1 = (String)enum.nextElement();
    String comp2 = tokens.nextToken();
    if (! comp1.equals(comp2)) {
      return false;
    }
  }

  return true;
}
 
开发者ID:FJplant,项目名称:AntIDE,代码行数:29,代码来源:BreakpointManager.java

示例13: oneRound

import java.util.Vector; //导入方法依赖的package包/类
void oneRound(String url, String user,
              String password) throws InterruptedException, SQLException {

    Vector      vClient  = new Vector();
    Thread      Client   = null;
    Enumeration e        = null;
    Connection  guardian = null;

    //
    start_time = System.currentTimeMillis();

    for (int i = 0; i < n_clients; i++) {
        if (useStoredProcedure) {
            Client = new ClientThreadProcedure(
                n_txn_per_client, url, user, password,
                Connection.TRANSACTION_READ_COMMITTED);
        } else {
            Client =
                new ClientThread(n_txn_per_client, url, user, password,
                                 Connection.TRANSACTION_READ_COMMITTED);
        }

        Client.start();
        vClient.addElement(Client);
    }

    /*
     ** Barrier to complete this test session
     */
    e = vClient.elements();

    while (e.hasMoreElements()) {
        Client = (Thread) e.nextElement();

        Client.join();
    }

    vClient.removeAllElements();
    reportDone();

    guardian = connect(url, user, password);

    if (count_results) {
        checkSums(guardian);
    }

    connectClose(guardian);
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:49,代码来源:TestBench.java

示例14: SchemaToSelect

import java.util.Vector; //导入方法依赖的package包/类
private boolean SchemaToSelect() {

        Vector result = null;

        try {
            lTable.removeAll();

            if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                result = sourceDb.getSchemas();
            } else if (iSelectionStep == Transfer.SELECT_DEST_SCHEMA) {
                result = targetDb.getSchemas();
            } else {
                exit();
            }

            if (result.size() > 1) {
                lTable.setMultipleMode(true);

                if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                    bStart.setLabel("Select Schema: Source");
                } else {
                    bStart.setLabel("Select Schema: Destination");
                }

                bStart.invalidate();
                bStart.setEnabled(true);

                for (Enumeration e =
                        result.elements(); e.hasMoreElements(); ) {
                    lTable.add(e.nextElement().toString());
                }

                lTable.repaint();
                trace("Select correct Schema or load Settings file");
            } else {
                if (result.size() == 1) {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                        sSourceSchemas    = new String[1];
                        sSourceSchemas[0] = (String) result.firstElement();
                    } else {
                        sDestSchema = (String) result.firstElement();
                    }
                } else {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                        sSourceSchemas = null;
                    } else {
                        sDestSchema = null;
                    }
                }

                if (iTransferMode == TRFM_DUMP) {
                    iSelectionStep = Transfer.SELECT_SOURCE_TABLES;
                } else {
                    iSelectionStep++;
                }

                ProcessNextStep();

                return false;
            }
        } catch (Exception exp) {
            lTable.removeAll();
            trace("Exception reading schemas: " + exp);
            exp.printStackTrace();
        }

        return (lTable.getItemCount() > 0);
    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:69,代码来源:Transfer.java

示例15: getHeaders

import java.util.Vector; //导入方法依赖的package包/类
public Enumeration<String> getHeaders(String name) { 
    Vector<String> v = new Vector<String>();
    v.add(getHeader(name));
    return v.elements();
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:6,代码来源:HttpServletRequestFactory.java


注:本文中的java.util.Vector.elements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。