本文整理汇总了Java中java.util.Vector.containsAll方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.containsAll方法的具体用法?Java Vector.containsAll怎么用?Java Vector.containsAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Vector
的用法示例。
在下文中一共展示了Vector.containsAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateTaskGraph
import java.util.Vector; //导入方法依赖的package包/类
public static Vector<String> validateTaskGraph(Vector<TaskGraph> task_graphs) {
// TODO validate multi source, multi sink task graphs
// Make sure that inputs of the task match incoming edges data
// This takes care of outputs as well
// Check counts, types, NOT order, of input and output through graph
Vector<String> errors = new Vector<String>();
for( TaskGraph tg: task_graphs) {
for(TaskDefinition td: tg.getSorted()) {
Set<Edge> incoming_edges = tg.getGraph().incomingEdgesOf(td);
Set<Edge> outgoing_edges = tg.getGraph().outgoingEdgesOf(td);
// Cannot have more than 8 outgoing edges
if(outgoing_edges.size() > 8) {
errors.add("Line "+(td.getLine()+1)+": Task \""+td.getName()+"\" cannot have more than eight (8) outgoing edges, remove links.");
}
Iterator<Edge> itr = incoming_edges.iterator();
Vector<Argument> task_inputs = td.getInput();
while(itr.hasNext()) {
TaskDefinition source_task = tg.getGraph().getEdgeSource(itr.next());
Vector<Argument> incoming_data = source_task.getOutput();
if(task_inputs.containsAll(incoming_data) == false) {
errors.add("Line "+(td.getLine()+1)+": Input signature of \""+td.getName()+"\" does not match name, type, or count, of incoming edges, missing " + incoming_data);
}
}
// Special case: if an incomming edge is a predicate, then this does not
// satisfy input match to output, as predicate is not guaranteed to always be originator / source
}
}
return errors;
}
示例2: resolveDependencies
import java.util.Vector; //导入方法依赖的package包/类
/**
* This method returns a vector with variables/params and keys in the
* order in which they are to be compiled for initialization. The order
* is determined by analyzing the dependencies between them. The XSLT 1.0
* spec does not allow a key to depend on a variable. However, for
* compatibility with Xalan interpretive, that type of dependency is
* allowed and, therefore, consider to determine the partial order.
*/
private Vector resolveDependencies(Vector input) {
/* DEBUG CODE - INGORE
for (int i = 0; i < input.size(); i++) {
final TopLevelElement e = (TopLevelElement) input.elementAt(i);
System.out.println("e = " + e + " depends on:");
Vector dep = e.getDependencies();
for (int j = 0; j < (dep != null ? dep.size() : 0); j++) {
System.out.println("\t" + dep.elementAt(j));
}
}
System.out.println("=================================");
*/
Vector result = new Vector();
while (input.size() > 0) {
boolean changed = false;
for (int i = 0; i < input.size(); ) {
final TopLevelElement vde = (TopLevelElement) input.elementAt(i);
final Vector dep = vde.getDependencies();
if (dep == null || result.containsAll(dep)) {
result.addElement(vde);
input.remove(i);
changed = true;
}
else {
i++;
}
}
// If nothing was changed in this pass then we have a circular ref
if (!changed) {
ErrorMsg err = new ErrorMsg(ErrorMsg.CIRCULAR_VARIABLE_ERR,
input.toString(), this);
getParser().reportError(Constants.ERROR, err);
return(result);
}
}
/* DEBUG CODE - INGORE
System.out.println("=================================");
for (int i = 0; i < result.size(); i++) {
final TopLevelElement e = (TopLevelElement) result.elementAt(i);
System.out.println("e = " + e);
}
*/
return result;
}