本文整理汇总了Java中org.javarosa.core.util.DAG.getSinks方法的典型用法代码示例。如果您正苦于以下问题:Java DAG.getSinks方法的具体用法?Java DAG.getSinks怎么用?Java DAG.getSinks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.javarosa.core.util.DAG
的用法示例。
在下文中一共展示了DAG.getSinks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propagateMarkToDAG
import org.javarosa.core.util.DAG; //导入方法依赖的package包/类
/**
* Propogates the provided mark in a chain from all nodes which meet the mask to all of their
* neighboring nodes, as long as those nodes meet the relationship provided. If the relationship
* is null, only the mask is checked.
*
* @param dag
* @param walkFromSourceToSink If true, start at sources (nodes with only outgoing edges), and walk edges
* from parent to child. If false, start at sinks (nodes with only incoming edges)
* and walk from child to parent
* @param maskCondition A mask for what nodes meet the criteria of being marked in the walk.
* @param markToApply A new binary flag (or set of flags) to apply to all nodes meeting the criteria
* @param relationship If non-null, an additional criteria for whether a node should be marked.
* A node will only be marked if the edge walked to put it on the stack
* meets this criteria.
*/
private static void propagateMarkToDAG(DAG<String, int[], String> dag, boolean walkFromSourceToSink,
int maskCondition, int markToApply, String relationship,
boolean requireOpenDestination) {
Stack<String> toProcess = walkFromSourceToSink ? dag.getSources() : dag.getSinks();
while (!toProcess.isEmpty()) {
// current node
String index = toProcess.pop();
int[] node = dag.getNode(index);
Vector<Edge<String, String>> edgeSet = walkFromSourceToSink ? dag.getChildren(index) :
dag.getParents(index);
for (Edge<String, String> edge : edgeSet) {
if (caseStatusIs(node[0], maskCondition) && (relationship == null || edge.e.equals(relationship))) {
if(!requireOpenDestination || caseStatusIs(dag.getNode(edge.i)[0], STATUS_OPEN)) {
dag.getNode(edge.i)[0] |= markToApply;
}
}
toProcess.addElement(edge.i);
}
}
}
示例2: propagateMarkToDAG
import org.javarosa.core.util.DAG; //导入方法依赖的package包/类
/**
* Propogates the provided mark in a chain from all nodes which meet the mask to all of their
* neighboring nodes, as long as those nodes meet the relationship provided. If the relationship
* is null, only the mask is checked.
*
* @param walkFromSourceToSink If true, start at sources (nodes with only outgoing edges), and walk edges
* from parent to child. If false, start at sinks (nodes with only incoming edges)
* and walk from child to parent
* @param maskCondition A mask for what nodes meet the criteria of being marked in the walk.
* @param markToApply A new binary flag (or set of flags) to apply to all nodes meeting the criteria
* @param relationship If non-null, an additional criteria for whether a node should be marked.
* A node will only be marked if the edge walked to put it on the stack
* meets this criteria.
*/
private static void propagateMarkToDAG(DAG<String, int[], String> dag, boolean walkFromSourceToSink,
int maskCondition, int markToApply, String relationship,
boolean requireOpenDestination) {
Stack<String> toProcess = walkFromSourceToSink ? dag.getSources() : dag.getSinks();
while (!toProcess.isEmpty()) {
// current node
String index = toProcess.pop();
int[] node = dag.getNode(index);
Vector<Edge<String, String>> edgeSet = walkFromSourceToSink ? dag.getChildren(index) :
dag.getParents(index);
for (Edge<String, String> edge : edgeSet) {
if (caseStatusIs(node[0], maskCondition) && (relationship == null || edge.e.equals(relationship))) {
if(!requireOpenDestination || caseStatusIs(dag.getNode(edge.i)[0], STATUS_OPEN)) {
dag.getNode(edge.i)[0] |= markToApply;
}
}
toProcess.addElement(edge.i);
}
}
}