本文整理匯總了Java中org.javarosa.core.util.DAG.getNode方法的典型用法代碼示例。如果您正苦於以下問題:Java DAG.getNode方法的具體用法?Java DAG.getNode怎麽用?Java DAG.getNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.javarosa.core.util.DAG
的用法示例。
在下文中一共展示了DAG.getNode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
}
}
示例3: propagateAvailabile
import org.javarosa.core.util.DAG; //導入方法依賴的package包/類
private static void propagateAvailabile(DAG<String, int[], String> g) {
for (Enumeration e = g.getIndices(); e.hasMoreElements(); ) {
String index = (String)e.nextElement();
int[] node = g.getNode(index);
if (caseStatusIs(node[0], STATUS_OPEN | STATUS_RELEVANT) &&
!hasOutgoingExtension(g, index)) {
node[0] |= STATUS_AVAILABLE;
}
}
propagateMarkToDAG(g, false, STATUS_AVAILABLE, STATUS_AVAILABLE, CaseIndex.RELATIONSHIP_EXTENSION, true);
}
示例4: propagateLive
import org.javarosa.core.util.DAG; //導入方法依賴的package包/類
private static void propagateLive(DAG<String, int[], String> g) {
for (Enumeration e = g.getIndices(); e.hasMoreElements(); ) {
String index = (String)e.nextElement();
int[] node = g.getNode(index);
if (caseStatusIs(node[0], STATUS_OWNED | STATUS_RELEVANT | STATUS_AVAILABLE)) {
node[0] |= STATUS_ALIVE;
}
}
propagateMarkToDAG(g, true, STATUS_ALIVE, STATUS_ALIVE);
propagateMarkToDAG(g, false, STATUS_ALIVE, STATUS_ALIVE, CaseIndex.RELATIONSHIP_EXTENSION, true);
}