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


Java Edge.setTo方法代码示例

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


在下文中一共展示了Edge.setTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:21,代码来源:GraphEltSet.java

示例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;
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:25,代码来源:GraphEltSet.java

示例3: 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);
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:16,代码来源:VisibleLocality.java

示例4: 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;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:18,代码来源:VisibleLocality.java

示例5: 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;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:44,代码来源:GraphEltSet.java


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