本文整理汇总了Java中java.util.Vector.contains方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.contains方法的具体用法?Java Vector.contains怎么用?Java Vector.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Vector
的用法示例。
在下文中一共展示了Vector.contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertMatchingSet
import java.util.Vector; //导入方法依赖的package包/类
protected void assertMatchingSet( String comment, Object[] expected, Object[] found ) {
Vector expectedItems = new Vector();
Vector foundItems = new Vector();
for (int i = 0; i < expected.length; i++) expectedItems.addElement( expected[i] );
for (int i = 0; i < found.length; i++) foundItems.addElement( found[i] );
for (int i = 0; i < expected.length; i++) {
if (!foundItems.contains( expected[i] )) {
fail( comment + ": expected " + asText( expected ) + " but found " + asText( found ) );
} else {
foundItems.removeElement( expected[i] );
}
}
for (int i = 0; i < found.length; i++) {
if (!expectedItems.contains( found[i] )) {
fail( comment + ": expected " + asText( expected ) + " but found " + asText( found ) );
} else {
expectedItems.removeElement( found[i] );
}
}
if (!foundItems.isEmpty()) fail( comment + ": expected " + asText( expected ) + " but found " + asText( found ) );
}
示例2: findResources
import java.util.Vector; //导入方法依赖的package包/类
@Override
protected Enumeration<URL> findResources(String name) throws IOException {
Vector<URL> vector = new Vector<URL>();
for (ClassLoader loader : loaders) {
Enumeration<URL> enumeration = loader.getResources(name);
while (enumeration.hasMoreElements()) {
URL url = enumeration.nextElement();
if (!vector.contains(url)) {
vector.add(url);
}
}
}
return vector.elements();
}
示例3: addProgressListener
import java.util.Vector; //导入方法依赖的package包/类
public synchronized void addProgressListener(ProgressListener l) {
@SuppressWarnings("unchecked")
Vector<ProgressListener> v = progressListeners == null ?
new Vector<ProgressListener>(2) : (Vector<ProgressListener>) progressListeners.clone();
if (!v.contains(l)) {
v.addElement(l);
progressListeners = v;
}
}
示例4: getClassesAux
import java.util.Vector; //导入方法依赖的package包/类
private static void getClassesAux(Class<?> currentClass, Vector<String> v) {
if (!v.contains(currentClass.getName())) {
v.addElement(currentClass.getName());
}
currentClass = currentClass.getSuperclass();
while (currentClass != null) {
getTypeNames(currentClass, v);
currentClass = currentClass.getSuperclass();
}
}
示例5: getNeighbourNetworkComponents
import java.util.Vector; //导入方法依赖的package包/类
/**
* Returns the neighbour NetworkComponent's based on a Vector of NetworkComponent's.
*
* @param networkComponents the network components
* @return the neighbour network components
*/
public Vector<NetworkComponent> getNeighbourNetworkComponents(Vector<NetworkComponent> networkComponents) {
Vector<NetworkComponent> neighbourNetworkComponents = new Vector<NetworkComponent>();
for (NetworkComponent networkComponent : networkComponents) {
Vector<NetworkComponent> neighboursFound = getNeighbourNetworkComponents(networkComponent);
for (NetworkComponent neighbour : neighboursFound) {
if (neighbourNetworkComponents.contains(neighbour)==false) {
neighbourNetworkComponents.add(neighbour);
}
}
}
return neighbourNetworkComponents;
}
示例6: prefixes
import java.util.Vector; //导入方法依赖的package包/类
public Enumeration prefixes() {
Vector v = new Vector();
for (PrefixMapping p = prefixMapping; p != null; p = p.next) {
if (!v.contains(p.prefix)) {
v.addElement(p.prefix);
}
}
return v.elements();
}
示例7: addRelatedElement
import java.util.Vector; //导入方法依赖的package包/类
private void addRelatedElement(XSElementDeclaration decl, Vector componentList, String namespace, Map<String, Vector> dependencies) {
if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
if (!componentList.contains(decl)) {
Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
componentList.add(decl);
}
}
else {
expandRelatedElementComponents(decl, componentList, namespace, dependencies);
}
}
示例8: checkForGlobalConstants
import java.util.Vector; //导入方法依赖的package包/类
/**
* Extract the global constants from the supplied integer expression
* representation (string) and add them to the supplied import list.
**/
static private void checkForGlobalConstants (String exprRep, Vector importTypes, Vector importList)
{
// NOTE: Do not use '/' as a delimiter. Symbol table names use '/' as a
// delimiter and would not be otherwise properly collected. Blanks and
// arithmetic symbols do not appear in tokens, except for '/'.
java.util.StringTokenizer st = new java.util.StringTokenizer (exprRep, " +-*()~&|^%<>");
while (st.hasMoreTokens ())
{
String token = st.nextToken ();
// When token contains '/', it represents the division symbol or
// a nested type (e.g., I/x). Ignore the division symbol, and don't
// forget constants declared within global interfaces!
if (!token.equals ("/"))
{
SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (token);
if (typeEntry instanceof ConstEntry)
{
int slashIdx = token.indexOf ('/');
if (slashIdx < 0) // Possible global constant
{
if (importTypes.contains (typeEntry))
addTo (importList, typeEntry.name ());
}
else // Possible constant in global interface
{
SymtabEntry constContainer = (SymtabEntry)symbolTable.get (token.substring (0, slashIdx));
if (constContainer instanceof InterfaceEntry && importTypes.contains (constContainer))
addTo (importList, constContainer.name ());
}
}
}
}
}
示例9: gotFocus
import java.util.Vector; //导入方法依赖的package包/类
/**
* Updates list of stations and selects last selected station
*/
@Override
public void gotFocus() {
if (stationsList != null) {
Vector stations = stationData.getStationKeys();
stationsList.setListData(stations);
// If old selected key exists selects it, otherwise select first station
if (stations.contains(selectedKey)) {
stationsList.setSelectedValue(selectedKey, true);
} else if (stations.size() > 0) {
stationsList.setSelectedIndex(0);
selectedKey = stationsList.getSelectedValue();
}
}
}
示例10: addStatusListener
import java.util.Vector; //导入方法依赖的package包/类
/**
* Adds a {@link gate.event.StatusListener} to the list of listeners for this
* processing resource
*/
public synchronized void addStatusListener(StatusListener l) {
@SuppressWarnings("unchecked")
Vector<StatusListener> v =
statusListeners == null ? new Vector<StatusListener>(2) : (Vector<StatusListener>)statusListeners.clone();
if(!v.contains(l)) {
v.addElement(l);
statusListeners = v;
}
}
示例11: allTriangles
import java.util.Vector; //导入方法依赖的package包/类
private void allTriangles(Triangle curr, Vector<Triangle> front, int mc) {
if (curr != null && curr.getMc() == mc && !front.contains(curr)) {
front.add(curr);
allTriangles(curr.getAbTriangle(), front, mc);
allTriangles(curr.getBcTriangle(), front, mc);
allTriangles(curr.getCaTriangle(), front, mc);
}
}
示例12: addDocumentListener
import java.util.Vector; //导入方法依赖的package包/类
@Override
public synchronized void addDocumentListener(DocumentListener l) {
@SuppressWarnings("unchecked")
Vector<DocumentListener> v = documentListeners == null
? new Vector<DocumentListener>(2)
: (Vector<DocumentListener>)documentListeners.clone();
if(!v.contains(l)) {
v.addElement(l);
documentListeners = v;
}
}
示例13: addTo
import java.util.Vector; //导入方法依赖的package包/类
/**
*
**/
static private void addTo (Vector importList, String name)
{
// REVISIT - <d62023-klr> was also importing ValueBaseHolder and Helper
if (name.startsWith ("ValueBase")) // don't import ValueBase*
if ((name.compareTo ("ValueBase") == 0) ||
(name.compareTo ("ValueBaseHolder") == 0) ||
(name.compareTo ("ValueBaseHelper") == 0))
return;
if (!importList.contains (name))
importList.addElement (name);
}
示例14: buildIDList
import java.util.Vector; //导入方法依赖的package包/类
/**
*
**/
private void buildIDList (InterfaceEntry entry, Vector list)
{
if (!entry.fullName ().equals ("org/omg/CORBA/Object"))
{
String id = Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ());
if (!list.contains (id))
list.addElement (id);
Enumeration e = entry.derivedFrom ().elements ();
while (e.hasMoreElements ())
buildIDList ((InterfaceEntry)e.nextElement (), list);
}
}
示例15: addNamespaceDependency
import java.util.Vector; //导入方法依赖的package包/类
private void addNamespaceDependency(String namespace1, String namespace2, Vector list) {
final String ns1 = null2EmptyString(namespace1);
final String ns2 = null2EmptyString(namespace2);
if (!ns1.equals(ns2)) {
if (!list.contains(ns2)) {
list.add(ns2);
}
}
}