本文整理汇总了Java中prefuse.data.Node.setString方法的典型用法代码示例。如果您正苦于以下问题:Java Node.setString方法的具体用法?Java Node.setString怎么用?Java Node.setString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.data.Node
的用法示例。
在下文中一共展示了Node.setString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addItem
import prefuse.data.Node; //导入方法依赖的package包/类
protected ItemSelector addItem(String id, String alias, boolean primary) {
ItemSelector selector = q.findSelector(id);
if (selector == null) {
selector = new ItemOffspringSelector(id, alias);
selector.setPrimary(primary);
((ItemOffspringSelector)selector).setMatchTemplate(Boolean.FALSE);
((ItemOffspringSelector)selector).setLimitToChild(false);
q.addSelector(selector);
// Update query Graph.
CiBean template = OneCMDBConnection.instance().getBeanFromAlias(alias);
Node n = queryGraph.addNode();
n.setString("id",id);
n.setString("name", alias);
n.setString("alias", alias);
queryGraphNodeMap.put(id, n);
}
return(selector);
}
示例2: addItem
import prefuse.data.Node; //导入方法依赖的package包/类
public ItemSelector addItem(String id, String alias, boolean primary) {
ItemSelector selector = q.findSelector(id);
if (selector == null) {
selector = new ItemOffspringSelector(id, alias);
selector.setPrimary(primary);
q.addSelector(selector);
selector.setPageInfo(new PageInfo(0, maxSize ));
// Update query Graph.
CiBean template = OneCMDBConnection.instance().getBeanFromAlias(alias);
Node n = queryGraph.addNode();
n.setString("id",id);
n.setString("name", alias);
n.setString("alias", alias);
if (template != null) {
n.set("image", "http://localhost:8080/icons/generate?iconid=" + getValue(template, "icon"));
}
queryGraphNodeMap.put(id, n);
}
return(selector);
}
示例3: getDiamondTree
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Create a diamond tree, with a given branching factor at
* each level, and depth levels for the two main branches.
* @param b the number of children of each branch node
* @param d1 the length of the first (left) branch
* @param d2 the length of the second (right) branch
* @return the generated Tree
*/
public static Tree getDiamondTree(int b, int d1, int d2) {
Tree t = new Tree();
t.getNodeTable().addColumns(LABEL_SCHEMA);
Node r = t.addRoot();
r.setString(LABEL, "0,0");
Node left = t.addChild(r);
left.setString(LABEL, "1,0");
Node right = t.addChild(r);
right.setString(LABEL, "1,1");
deepHelper(t, left, b, d1-2, true);
deepHelper(t, right, b, d1-2, false);
while ( left.getFirstChild() != null )
left = left.getFirstChild();
while ( right.getLastChild() != null )
right = right.getLastChild();
deepHelper(t, left, b, d2-1, false);
deepHelper(t, right, b, d2-1, true);
return t;
}
示例4: showTable
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Creates visible node for given table.
*
* @param graph the graph
* @param table the table to show
*/
private boolean showTable(Graph graph, Table table) {
if (table != null && !tableNodes.containsKey(table)) {
Node n = graph.addNode();
n.setString("label", table.getName());
String tooltip = tableRenderer.getToolTip(table);
n.setString("tooltip", tooltip);
tableNodes.put(table, n);
return true;
}
return false;
}
示例5: addItem
import prefuse.data.Node; //导入方法依赖的package包/类
protected ItemSelector addItem(String id, String alias, boolean primary, boolean instance) {
ItemSelector selector = q.findSelector(id);
if (selector == null) {
if (instance) {
selector = new ItemAliasSelector(id, "Root");
((ItemAliasSelector)selector).setAlias(alias);
} else {
selector = new ItemOffspringSelector(id, alias);
((ItemOffspringSelector)selector).setMatchTemplate(Boolean.FALSE);
((ItemOffspringSelector)selector).setLimitToChild(false);
}
selector.setPrimary(primary);
q.addSelector(selector);
// Update query Graph.
//CiBean template = OneCMDBConnection.instance().getBeanFromAlias(alias);
Node n = queryGraph.addNode();
n.setString("id",id);
n.setString("name", alias);
n.setString("alias", alias);
queryGraphNodeMap.put(id, n);
}
return(selector);
}
示例6: getNodes
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Builds a completely unconnected (edge-free) graph with the given
* number of nodes
* @param n the number of nodes
* @return a graph with n nodes and no edges
*/
public static Graph getNodes(int n) {
Graph g = new Graph();
g.getNodeTable().addColumns(LABEL_SCHEMA);
for ( int i=0; i < n; i++ ) {
Node node = g.addNode();
node.setString(LABEL, String.valueOf(i));
}
return g;
}
示例7: getStar
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Builds a "star" graph with one central hub connected to the given
* number of satellite nodes.
* @param n the number of points of the star
* @return a "star" graph with n points, for a total of n+1 nodes
*/
public static Graph getStar(int n) {
Graph g = new Graph();
g.getNodeTable().addColumns(LABEL_SCHEMA);
Node r = g.addNode();
r.setString(LABEL, "0");
for ( int i=1; i <= n; ++i ) {
Node nn = g.addNode();
nn.setString(LABEL, String.valueOf(i));
g.addEdge(r, nn);
}
return g;
}
示例8: getBalancedTree
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Returns a balanced tree of the requested breadth and depth.
* @param breadth the breadth of each level of the tree
* @param depth the depth of the tree
* @return a balanced tree
*/
public static Tree getBalancedTree(int breadth, int depth) {
Tree t = new Tree();
t.getNodeTable().addColumns(LABEL_SCHEMA);
Node r = t.addRoot();
r.setString(LABEL, "0,0");
if ( depth > 0 )
balancedHelper(t, r, breadth, depth-1);
return t;
}
示例9: balancedHelper
import prefuse.data.Node; //导入方法依赖的package包/类
private static void balancedHelper(Tree t, Node n,
int breadth, int depth)
{
for ( int i=0; i<breadth; ++i ) {
Node c = t.addChild(n);
c.setString(LABEL, i+","+c.getDepth());
if ( depth > 0 )
balancedHelper(t,c,breadth,depth-1);
}
}
示例10: getLeftDeepTree
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Returns a left deep binary tree
* @param depth the depth of the tree
* @return the generated tree
*/
public static Tree getLeftDeepTree(int depth) {
Tree t = new Tree();
t.getNodeTable().addColumns(LABEL_SCHEMA);
Node r = t.addRoot();
r.setString(LABEL, "0,0");
deepHelper(t, r, 2, depth, true);
return t;
}
示例11: getRightDeepTree
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Returns a right deep binary tree
* @param depth the depth of the tree
* @return the generated Tree
*/
public static Tree getRightDeepTree(int depth) {
Tree t = new Tree();
t.getNodeTable().addColumns(LABEL_SCHEMA);
Node r = t.addRoot();
r.setString(LABEL, "0,0");
deepHelper(t, r, 2, depth, false);
return t;
}
示例12: deepHelper
import prefuse.data.Node; //导入方法依赖的package包/类
private static void deepHelper(Tree t, Node n,
int breadth, int depth, boolean left)
{
Node c = t.addChild(n);
c.setString(LABEL, "0,"+c.getDepth());
if ( left && depth > 0 )
deepHelper(t, c, breadth, depth-1, left);
for ( int i=1; i<breadth; ++i ) {
c = t.addChild(n);
c.setString(LABEL, i+","+c.getDepth());
}
if ( !left && depth > 0 )
deepHelper(t, c, breadth, depth-1, left);
}
示例13: addNode
import prefuse.data.Node; //导入方法依赖的package包/类
public void addNode(SearchNode st) {
String label = Integer.valueOf(st.getID()).toString();
Node n;
if(st.getParent() != null)
n = addNode(st.getID(), st.getParent().getID());
else
n = addNode(st.getID(), -1);
StringBuilder h = new StringBuilder();
h.append("num-actions: "); h.append(st.getState().getNumActions());
h.append(" num-open-goals: "); h.append(st.getState().tdb.getConsumers().size());
h.append(" num-threats: "); h.append(st.getState().getAllThreats().size());
h.append(" num-opentasks: "); h.append(st.getState().getOpenTasks().size());
h.append(" num-unmotivated: "); h.append(st.getState().getUnmotivatedActions().size());
h.append(" num-unbound: "); h.append(st.getState().getUnboundVariables().size());
h.append("\n");
try {
h.append(planner.heuristicComputer().reportOnState(st.getState()));
h.append(String.format(" g: %s, h: %s", planner.heuristicComputer().g(st), planner.heuristicComputer().h(st)));
} catch (Throwable e) {} // just to make sure the planner does not crash because of the view
n.setString(LABEL, label);
n.setString(NODE_STATUS, "inqueue");
n.setString(HEURISTIC_VALUES, h.toString());
n.setString(SELECTED_FLAW, "???");
n.setString(LAST_APPLIED_RESOLVER, "???");
n.setString(COMMENT, "");
n.set(ACTIONS_CANVAS, st.getState().getCanvasOfActions());
}
示例14: addEdges
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Adds edges for all associations of a table.
*
* @param table the table
* @param toRender is not null, the only association to make visible
*
* @return list of newly rendered tables
*/
private List<Table> addEdges(Graph g, Table table, Association toRender, List<Table> toCheck, boolean visibleDestinationRequired) {
List<Table> result = new ArrayList<Table>();
toCheck.add(table);
for (Association a: table.associations) {
if (toRender != null && toRender != a) {
continue;
}
if (!isVisualizable(a) && (toRender == null || a != toRender)) {
continue;
}
if (visibleDestinationRequired && !tableNodes.containsKey(a.destination)) {
continue;
}
if (!renderedAssociations.containsKey(a) && !renderedAssociations.containsKey(a.reversalAssociation)) {
toCheck.add(a.destination);
toCheck.add(a.source);
if (showTable(g, a.source)) {
result.add(a.source);
}
if (showTable(g, a.destination)) {
result.add(a.destination);
}
String tooltip = a.getJoinCondition();
if (!associationIsUnique(a)) {
Node an = g.addNode();
an.set("association", a);
an.setString("label", a.getName() + "#");
an.setString("tooltip", tooltip);
renderedAssociationsAsNode.put(a, an);
Edge ae = g.addEdge(an, tableNodes.get(a.source));
ae.set("association", a.reversalAssociation);
ae.set("full", Boolean.FALSE);
ae.setString("tooltip", tooltip);
renderedAssociations.put(a.reversalAssociation, ae);
Edge be = g.addEdge(an, tableNodes.get(a.destination));
be.set("association", a);
be.set("full", Boolean.FALSE);
be.setString("tooltip", tooltip);
renderedAssociations.put(a, be);
} else {
Edge e = g.addEdge(tableNodes.get(a.source), tableNodes.get(a.destination));
e.set("association", a);
e.set("full", Boolean.TRUE);
e.setString("tooltip", tooltip);
renderedAssociations.put(a, e);
}
}
}
return result;
}
示例15: create
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* adds random data (nodes & connections) to a given GraphDataModifier
*
* @param graph (PrefuseGraph)
* @return GraphDataModifier (PrefuseGraph) with random nodes and connections
*/
public Graph create(Graph graph) {
graph = GraphAddColumnDefinition.addColumnDefinition(graph);
Random rnd = new Random();
// GraphDataModifier random Nodes with random data
for (int i = 0; i <= COUNT_NODES; i++) {
Node n = graph.addNode();
// add random data (later use protege data)
n.set(ColumnNames.ID, rnd.nextInt(25000));
n.set(ColumnNames.NODE_HEIGHT, rnd.nextInt(35));
n.set(ColumnNames.NODE_WIDTH, rnd.nextInt(35));
n.set(ColumnNames.TEXT_SIZE, rnd.nextInt(12));
n.set(ColumnNames.COLOR_RED, rnd.nextInt(250));
n.set(ColumnNames.COLOR_GREEN, rnd.nextInt(250));
n.set(ColumnNames.COLOR_BLUE, rnd.nextInt(250));
n.set(ColumnNames.TEXT_COLOR_RED, rnd.nextInt(250));
n.set(ColumnNames.TEXT_COLOR_GREEN, rnd.nextInt(250));
n.set(ColumnNames.TEXT_COLOR_BLUE, rnd.nextInt(250));
n.set(ColumnNames.TEXT_BACKGROUND_COLOR_RED, rnd.nextInt(250));
n.set(ColumnNames.TEXT_BACKGROUND_COLOR_BLUE, rnd.nextInt(250));
n.set(ColumnNames.TEXT_BACKGROUND_COLOR_GREEN, rnd.nextInt(250));
n.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_RED, rnd.nextInt(250));
n.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_BLUE, rnd.nextInt(250));
n.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_GREEN, rnd.nextInt(250));
n.setString(ColumnNames.NAME, "Node" + rnd.nextInt(100));
n.setString(ColumnNames.FULL_NAME, "Node" + rnd.nextInt(100));
n.set(ColumnNames.NODE_FORM, Nodetype.nodetype[rnd.nextInt(3)]);
n.set(ColumnNames.NODE_VOWL_TYPE, Nodetype.vowltype[rnd.nextInt(3)]);
n.set(ColumnNames.CLASS_INSTANCE_COUNT, rnd.nextInt(20));
}
// GraphDataModifier random connections
for (int i = 0; i <= COUNT_CONNECTIONS; i++) {
int a = rnd.nextInt(COUNT_NODES);
int b = rnd.nextInt(COUNT_NODES);
int edgeID = graph.addEdge(a, b);
Edge edge = graph.getEdge(edgeID);
edge.setString(ColumnNames.NAME, "Edge" + rnd.nextInt(100));
edge.setString(ColumnNames.FULL_NAME, "Edge" + rnd.nextInt(100));
edge.set(ColumnNames.TEXT_SIZE, rnd.nextInt(8));
edge.set(ColumnNames.TEXT_COLOR_RED, rnd.nextInt(250));
edge.set(ColumnNames.TEXT_COLOR_GREEN, rnd.nextInt(250));
edge.set(ColumnNames.TEXT_COLOR_BLUE, rnd.nextInt(250));
edge.set(ColumnNames.TEXT_BACKGROUND_COLOR_RED, rnd.nextInt(250));
edge.set(ColumnNames.TEXT_BACKGROUND_COLOR_BLUE, rnd.nextInt(250));
edge.set(ColumnNames.TEXT_BACKGROUND_COLOR_GREEN, rnd.nextInt(250));
edge.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_RED, rnd.nextInt(250));
edge.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_BLUE, rnd.nextInt(250));
edge.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_GREEN, rnd.nextInt(250));
edge.set(ColumnNames.COLOR_RED, rnd.nextInt(250));
edge.set(ColumnNames.COLOR_GREEN, rnd.nextInt(250));
edge.set(ColumnNames.COLOR_BLUE, rnd.nextInt(250));
edge.set(ColumnNames.EDGE_ARROW_TYPE, EdgesType.arrowtype[rnd.nextInt(3)]);
edge.set(ColumnNames.EDGE_LINE_TYPE, EdgesType.linetype[rnd.nextInt(3)]);
edge.set(ColumnNames.ID, rnd.nextInt(25000));
edge.set(ColumnNames.EDGE_LENGTH, rnd.nextInt(100));
}
return graph;
}