當前位置: 首頁>>代碼示例>>Java>>正文


Java Vector.containsAll方法代碼示例

本文整理匯總了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;
}
 
開發者ID:PERSISTLab,項目名稱:mayfly-lang,代碼行數:32,代碼來源:ProgramValidator.java

示例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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:57,代碼來源:Stylesheet.java


注:本文中的java.util.Vector.containsAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。