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


Java DelegateTree.setRoot方法代码示例

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


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

示例1: getConstraintSolverHierarchy

import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
/**
 * Get the hierarchy of {@link ConstraintSolver}s rooted in this {@link MultiConstraintSolver}.
 * @return The hierarchy of {@link ConstraintSolver}s rooted in this {@link MultiConstraintSolver}.
 */
public DelegateTree<ConstraintSolver,String> getConstraintSolverHierarchy() {
	DelegateTree<ConstraintSolver,String> ret = new DelegateTree<ConstraintSolver, String>();
	ret.setRoot(this);
	ConstraintSolver[] myConstraintSolvers = this.getConstraintSolvers();
	for (int i = 0; i < myConstraintSolvers.length; i++) {
		String edgeLabel = i + " (" + this.hashCode() + ")";
		if (myConstraintSolvers[i] instanceof MultiConstraintSolver) {
			DelegateTree<ConstraintSolver,String> subtree = ((MultiConstraintSolver)myConstraintSolvers[i]).getConstraintSolverHierarchy();
			TreeUtils.addSubTree(ret, subtree, this, edgeLabel);
		}
		else {
			ret.addChild(edgeLabel, this, myConstraintSolvers[i]);
		}
	}
	return ret;
}
 
开发者ID:FedericoPecora,项目名称:meta-csp-framework,代码行数:21,代码来源:MultiConstraintSolver.java

示例2: getConstraintNetworkHierarchy

import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
/**
 * Get a tree whose nodes are the constraint networks managed by the hierarchy of
 * {@link ConstraintSolver}s underlying this {@link MultiConstraintSolver}.
 * @return A tree whose nodes are the constraint networks managed by the hierarchy of
 * {@link ConstraintSolver}s underlying this {@link MultiConstraintSolver}.
 */
public DelegateTree<ConstraintNetwork,String> getConstraintNetworkHierarchy() {
	DelegateTree<ConstraintNetwork,String> ret = new DelegateTree<ConstraintNetwork, String>();
	ConstraintNetwork myCN = this.getConstraintNetwork();
	ret.setRoot(myCN);
	ConstraintSolver[] myConstraintSolvers = this.getConstraintSolvers();
	for (int i = 0; i < myConstraintSolvers.length; i++) {
		String edgeLabel = i + " (" + this.hashCode() + ")";
		if (myConstraintSolvers[i] instanceof MultiConstraintSolver) {
			DelegateTree<ConstraintNetwork,String> subtree = ((MultiConstraintSolver)myConstraintSolvers[i]).getConstraintNetworkHierarchy();
			TreeUtils.addSubTree(ret, subtree, myCN, edgeLabel);
		}
		else {
			ret.addChild(edgeLabel, myCN, myConstraintSolvers[i].getConstraintNetwork());
		}
	}
	return ret;
}
 
开发者ID:FedericoPecora,项目名称:meta-csp-framework,代码行数:24,代码来源:MultiConstraintSolver.java

示例3: getVariableHierarchy

import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
/**
 * Get the hierarchy of {@link Variable}s underlying this {@link MultiVariable}.
 * @return The hierarchy of {@link Variable}s underlying this {@link MultiVariable}.
 */
public DelegateTree<Variable,String> getVariableHierarchy() {
	DelegateTree<Variable,String> ret = new DelegateTree<Variable, String>();
	ret.setRoot(this);
	Variable[] myVars = this.getInternalVariables();
	for (int i = 0; i < myVars.length; i++) {
		String edgeLabel = i + " (" + this.getConstraintSolver().hashCode() + ")";
		if (myVars[i] instanceof MultiVariable) {
			DelegateTree<Variable,String> subTree = ((MultiVariable)myVars[i]).getVariableHierarchy();
			TreeUtils.addSubTree(ret, subTree, this, edgeLabel);
		}
		else ret.addChild(edgeLabel, this, myVars[i]);
	}
	return ret;
}
 
开发者ID:FedericoPecora,项目名称:meta-csp-framework,代码行数:19,代码来源:MultiVariable.java

示例4: getEnvelopeHierarchy

import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
public DelegateTree<TrajectoryEnvelope,String> getEnvelopeHierarchy() {
	DelegateTree<TrajectoryEnvelope,String> ret = new DelegateTree<TrajectoryEnvelope, String>();
	ret.setRoot(this);
	if (this.getSubEnvelopes() != null) {
		for (TrajectoryEnvelope subTE : this.getSubEnvelopes()) {
			TreeUtils.addSubTree(ret, subTE.getEnvelopeHierarchy(), this, ""+subTE.hashCode());
		}
	}
	return ret;
}
 
开发者ID:FedericoPecora,项目名称:meta-csp-framework,代码行数:11,代码来源:TrajectoryEnvelope.java

示例5: convert

import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
/**
 * Creates a tree using random, unique URIs instead of actual vertices and
 * nodes. The lookup maps are populated with the conversions. NOTE: the Tree
 * can contain duplicates in the sense that different URIs might map to the
 * same vertex/edge.
 *
 * @param graph the graph to convert
 * @param root the root of the tree
 * @param vlookup a (usually empty) map that will be populated with the
 * uri-to-vertex lookup
 * @param elookup a (usually empty) map that will be populated with the
 * uri-to-edge lookup
 * @return a valid tree, no matter what
 */
public Tree<URI, URI> convert( DirectedGraph<V, E> graph,
		V root, Map<URI, V> vlookup, Map<URI, E> elookup ) {

	DelegateTree<URI, URI> tree = new DelegateTree<>();
	Map<V, URI> revlkp = new HashMap<>();

	ArrayDeque<V> deque = new ArrayDeque<>();
	Queue<V> todo = ( Search.DFS == method
			? Collections.asLifoQueue( deque )
			: deque );

	URI rootu = Utility.getUniqueUri();
	vlookup.put( rootu, root );
	revlkp.put( root, rootu );
	tree.setRoot( rootu );

	// avoid cycles in the graph
	Set<E> edgesToSkip = new HashSet<>();

	todo.add( root );
	while ( !todo.isEmpty() ) {
		V v = todo.poll();
		URI srcuri = revlkp.get( v );
		// once we visit a node, we can never end
		// up there again, or we're not acyclic
		edgesToSkip.addAll( graph.getInEdges( v ) );

		Set<E> outgoings = new HashSet<>( graph.getOutEdges( v ) );
		outgoings.removeAll( edgesToSkip );

		for ( E e : outgoings ) {
			V child = graph.getOpposite( v, e );

			URI edgeuri = Utility.getUniqueUri();
			URI tgturi = Utility.getUniqueUri();

			elookup.put( edgeuri, e );
			vlookup.put( tgturi, child );
			revlkp.put( child, tgturi );

			tree.addChild( edgeuri, srcuri, tgturi );
			todo.add( child );
		}
	}

	return tree;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:62,代码来源:GraphToTreeConverter.java

示例6: iconvert

import edu.uci.ics.jung.graph.DelegateTree; //导入方法依赖的package包/类
private Tree<V, E> iconvert( DirectedGraph<V, E> graph, V root,
		boolean throwExceptions ) throws TreeConversionException {

	ArrayDeque<V> deque = new ArrayDeque<>();
	Queue<V> todo = ( Search.DFS == method
			? Collections.asLifoQueue( deque )
			: deque );

	DelegateTree<V, E> tree = new DelegateTree<>();
	tree.setRoot( root );
	todo.add( root );

	// avoid cycles in the graph
	Set<E> edgesToSkip = new HashSet<>();

	while ( !todo.isEmpty() ) {
		V v = todo.poll();

		// once we visit a node, we can never end
		// up there again, or we're not acyclic
		edgesToSkip.addAll( graph.getInEdges( v ) );

		Set<E> outgoings = new HashSet<>( graph.getOutEdges( v ) );
		outgoings.removeAll( edgesToSkip );

		for ( E e : outgoings ) {
			V child = graph.getOpposite( v, e );

			if ( tree.containsVertex( child ) ) {
				if ( throwExceptions ) {
					throw new TreeConversionException();
				}
			}
			else {
				tree.addChild( e, v, child );
				todo.add( child );
			}
		}
	}

	return tree;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:43,代码来源:GraphToTreeConverter.java


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