本文整理汇总了Java中com.touchgraph.graphlayout.Edge.getFrom方法的典型用法代码示例。如果您正苦于以下问题:Java Edge.getFrom方法的具体用法?Java Edge.getFrom怎么用?Java Edge.getFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.touchgraph.graphlayout.Edge
的用法示例。
在下文中一共展示了Edge.getFrom方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addEdge
import com.touchgraph.graphlayout.Edge; //导入方法依赖的package包/类
/** Add the Edge <tt>edge</tt> to the graph. */
public void addEdge(Edge edge)
{
if (edge == null)
{
return;
}
if (!contains(edge))
{
edges.addElement(edge);
Node from = edge.getFrom();
from.addEdge(edge);
edge.setFrom(from);
Node to = edge.getTo();
to.addEdge(edge);
edge.setTo(to);
}
}
示例2: deleteEdge
import com.touchgraph.graphlayout.Edge; //导入方法依赖的package包/类
/** Delete the Edge <tt>edge</tt>. */
public boolean deleteEdge(Edge edge)
{
synchronized (edges)
{
if (edge == null)
{
return false;
}
if (!edges.removeElement(edge))
{
return false;
}
Node from = edge.getFrom();
from.removeEdge(edge);
edge.setFrom(from);
Node to = edge.getTo();
to.removeEdge(edge);
edge.setTo(to);
return true;
}
}
示例3: deleteStatement
import com.touchgraph.graphlayout.Edge; //导入方法依赖的package包/类
/**
* Delete statement.
*/
public void deleteStatement() {
StatusBar.show("Deleting statement...");
Node predicate = getSelectedNode();
if (predicate.edgeCount() < 2) {
StatusBar.show("Error: Uncomplete statement (missing either subject or object)!");
return;
}
if (predicate.getType() != render.getPredicateNodeType()) {
JOptionPane.showMessageDialog(MindRaider.mainJFrame, "To delete statement, predicate must be selected!",
"Triplet Delete Error", JOptionPane.ERROR_MESSAGE);
return;
}
Node subject, object;
Edge e = predicate.edgeAt(0);
if (predicate == e.getTo()) {
subject = e.getFrom();
object = predicate.edgeAt(1).getTo();
} else {
subject = e.getTo();
object = predicate.edgeAt(1).getFrom();
}
rdfModel.deleteStatement(subject.rdfNode, (Property) predicate.rdfNode, object.rdfNode);
save();
renderModel();
}
示例4: addEdge
import com.touchgraph.graphlayout.Edge; //导入方法依赖的package包/类
/**
* @see com.touchgraph.graphlayout.graphelements.GraphEltSet#addEdge(com.touchgraph.graphlayout.Edge)
*/
public void addEdge(Edge edge) {
if (!contains(edge)) {
super.addEdge(edge);
Node from = edge.getFrom();
edge.setFrom(from);
from.visibleEdgeCnt++;
Node to = edge.getTo();
to.visibleEdgeCnt++;
edge.setTo(to);
}
}
示例5: removeEdge
import com.touchgraph.graphlayout.Edge; //导入方法依赖的package包/类
/**
* @see com.touchgraph.graphlayout.graphelements.Locality#removeEdge(com.touchgraph.graphlayout.Edge)
*/
public boolean removeEdge(Edge edge) {
boolean removed = super.removeEdge(edge);
if (removed) {
edge.setVisible(false);
Node from = edge.getFrom();
from.visibleEdgeCnt--;
edge.setFrom(from);
Node to = edge.getTo();
to.visibleEdgeCnt--;
edge.setTo(to);
}
return removed;
}
示例6: deleteNode
import com.touchgraph.graphlayout.Edge; //导入方法依赖的package包/类
/** Delete the Node <tt>node</tt>, returning true if successful. */
public boolean deleteNode(Node node)
{
synchronized (nodes)
{
if (node == null)
{
return false;
}
if (!nodes.removeElement(node))
{
return false;
}
String id = node.getID();
if (id != null)
{
nodeIDRegistry.remove(id); // remove from registry
}
for (int i = 0; i < node.edgeCount(); i++)
{
Edge e = node.edgeAt(i);
Node to = e.getTo();
Node from = e.getFrom();
if (from == node)
{
edges.removeElement(e); // Delete edge not used, because it would change the node's edges
to.removeEdge(e);
e.setTo(to);
// vector which is being iterated on.
}
else if (to == node)
{
edges.removeElement(e);
from.removeEdge(e);
e.setFrom(from);
}
// No edges are deleted from node. Hopefully garbage collection will pick them up.
}
}
return true;
}