当前位置: 首页>>代码示例>>Java>>正文


Java Node.getChildren方法代码示例

本文整理汇总了Java中org.prop4j.Node.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getChildren方法的具体用法?Java Node.getChildren怎么用?Java Node.getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.prop4j.Node的用法示例。


在下文中一共展示了Node.getChildren方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: replaceAbstractVariables

import org.prop4j.Node; //导入方法依赖的package包/类
public static Node replaceAbstractVariables(Node node,
		HashMap<Object, Node> map, boolean replaceNull) {
	if (node == null)
		return null;
	if (node instanceof Literal) {
		Literal literal = (Literal) node;
		if (map.containsKey(literal.var)) {
			Node replacing = map.get(literal.var);
			if (replacing == null)
				return replaceNull ? null : node;
			replacing = replacing.clone();
			node = literal.positive ? replacing : new Not(replacing);
		}
	} else {
		Node[] children = node.getChildren();
		for (int i = 0; i < children.length; i++) {
			children[i] = replaceAbstractVariables(children[i], map,
					replaceNull);
			if (replaceNull && children[i] == null)
				return null;
		}
	}
	return node;
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:25,代码来源:NodeCreator.java

示例2: setRight

import org.prop4j.Node; //导入方法依赖的package包/类
public void setRight(Node b) {
	b = b.clone().toCNF();
	if (b instanceof Or)
		b = new And(b);
	bChildren = b.getChildren();
	bSatisfiable = new LinkedList<Integer>();
	bIndex = -1;
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:9,代码来源:ExampleCalculator.java

示例3: nodeContains

import org.prop4j.Node; //导入方法依赖的package包/类
private static boolean nodeContains(Node node, String abstractFeature) {
	if (node instanceof Literal) {
		Literal lit = (Literal) node;
		return lit.var.equals(abstractFeature);
	}
	for (Node child : node.getChildren())
		if (nodeContains(child, abstractFeature))
			return true;
	return false;
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:11,代码来源:NodeCreator.java

示例4: replaceFeature

import org.prop4j.Node; //导入方法依赖的package包/类
private static Node replaceFeature(Node node, Object abstractFeature,
		Object replacement) {
	if (node instanceof Literal) {
		Literal lit = (Literal) node;
		if (lit.var.equals(abstractFeature))
			return new Literal(replacement, lit.positive);
		else
			return node;
	}
	Node[] children = node.getChildren();
	for (int i = 0; i < children.length; i++)
		children[i] = replaceFeature(children[i], abstractFeature,
				replacement);
	return node;
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:16,代码来源:NodeCreator.java

示例5: removeIdenticalNodes

import org.prop4j.Node; //导入方法依赖的package包/类
/**
 * Removes all child nodes that are contained in the reference node.
 * 
 * @param node
 *            the node to copy and remove from
 * @param referenceNode
 *            node that specifies what do remove
 * @return a copy of the node where some child nodes are not existent
 */
private Node removeIdenticalNodes(Node node, Node referenceNode) {
	if (!strategy.contains(Strategy.WithoutIdenticalRules))
		return node;
	LinkedList<Node> updatedNodes = new LinkedList<Node>();
	for (Node child : node.getChildren())
		if (!containedIn(child, referenceNode.getChildren()))
			updatedNodes.add(child);
	return updatedNodes.isEmpty() ? null : new And(updatedNodes);
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:19,代码来源:ModelComparator.java

示例6: renameVariables

import org.prop4j.Node; //导入方法依赖的package包/类
private void renameVariables(Node node, String oldName, String newName) {
	if (node instanceof Literal) {
		if (oldName.equals(((Literal) node).var))
			((Literal) node).var = newName;
		return;
	}

	for (Node child : node.getChildren())
		renameVariables(child, oldName, newName);
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:11,代码来源:FeatureModel.java


注:本文中的org.prop4j.Node.getChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。