Examples of EdgeDraft


Examples of org.gephi.io.importer.api.EdgeDraft

            for (int i = 0; i < numberOfNodes - 1 && !cancel; i++) {
                NodeDraft node1 = nodeArray[i];
                for (int j = i + 1; j < numberOfNodes && !cancel; j++) {
                    NodeDraft node2 = nodeArray[j];
                    if (random.nextDouble() < wiringProbability) {
                        EdgeDraft edgeDraft = container.factory().newEdgeDraft();
                        edgeDraft.setSource(node1);
                        edgeDraft.setTarget(node2);
                        container.addEdge(edgeDraft);
                    }
                }
                Progress.progress(progress, ++progressUnit);
            }
View Full Code Here

Examples of org.gephi.io.importer.api.EdgeDraft

                    }
                } else {
                    targetNode = container.getNode(addrTo.getAddress());
                }
                //add an edge
                EdgeDraft edge = container.getEdge(sourceNode, targetNode);
                if (edge == null) {
                    edge = container.factory().newEdgeDraft();
                    edge.setSource(sourceNode);
                    edge.setTarget(targetNode);
                    edge.setWeight(1f);
                    container.addEdge(edge);
                } else {
                    edge.setWeight(edge.getWeight() + 1f);
                }
            }
        }
        // cc or bcc as weight
        if (hasCcAsWeight()) {
            //construct the target node of cc
            Address[] recipietsCc = null;
            try {
                recipietsCc = msg.getRecipients(RecipientType.CC);
            } catch (MessagingException ex) {
                report.log("message:" + msg + ",can't get the Cc of the email");
                return;
                //log
            }
            if (recipietsCc != null) {
                for (Address addr : recipietsCc) {
                    InternetAddress addrCc = (InternetAddress) addr;
                    if (!container.nodeExists(addrCc.getAddress())) {
                        //whether use one node to display the same display name
                        boolean exist = false;
                        if (isUseOneNodeIfSameDisplayName()) {
                            if (container instanceof ContainerUnloader) {
                                ContainerUnloader con = (ContainerUnloader) container;
                                Collection<? extends NodeDraftGetter> allNodes = con.getNodes();
                                for (NodeDraftGetter node : allNodes) {
                                    if (node.getLabel() == null || node.getLabel().isEmpty()) {
                                        continue;
                                    }
                                    if (node.getLabel().equalsIgnoreCase(fromAddress.getPersonal())) {
                                        targetNode = container.getNode(node.getId());
                                        exist = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (!exist || !isUseOneNodeIfSameDisplayName()) {
                            targetNode = container.factory().newNodeDraft();
                            targetNode.setId(Utilities.codecTranslate(codecType, addrCc.getAddress()));
                            targetNode.setLabel(Utilities.codecTranslate(codecType, addrCc.getPersonal()));
                            container.addNode(targetNode);
                        }

                    } else {
                        targetNode = container.getNode(addr.toString());
                    }
                    //if use cc as weight, add an edge between cc
                    EdgeDraft edge = container.getEdge(sourceNode, targetNode);
                    if (edge == null) {
                        edge = container.factory().newEdgeDraft();
                        edge.setSource(sourceNode);
                        edge.setTarget(targetNode);
                        container.addEdge(edge);
                        edge.setWeight(1f);
                    } else {
                        edge.setWeight(edge.getWeight() + 1f);
                    }
                }
            }
        }
        if (hasBccAsWeight()) {
            //construct the target node of bcc
            Address[] recipietsBcc = null;
            try {
                recipietsBcc = msg.getRecipients(RecipientType.BCC);
            } catch (MessagingException ex) {
                report.log("message:" + msg + ",can't get the Bcc of the email");
                return;
                //TODO log
            }
            if (recipietsBcc != null) {
                for (Address addr : recipietsBcc) {
                    InternetAddress addrBcc = (InternetAddress) addr;
                    if (!container.nodeExists(addrBcc.getAddress())) {
                        //whether use one node to display the same display name
                        boolean exist = false;
                        if (isUseOneNodeIfSameDisplayName()) {
                            if (container instanceof ContainerUnloader) {
                                ContainerUnloader con = (ContainerUnloader) container;
                                Collection<? extends NodeDraftGetter> allNodes = con.getNodes();
                                for (NodeDraftGetter node : allNodes) {
                                    if (node.getLabel() == null || node.getLabel().isEmpty()) {
                                        continue;
                                    }
                                    if (node.getLabel().equals(fromAddress.getPersonal())) {
                                        targetNode = container.getNode(node.getId());
                                        exist = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (!exist || !isUseOneNodeIfSameDisplayName()) {
                            targetNode = container.factory().newNodeDraft();
                            targetNode.setId(Utilities.codecTranslate(codecType, addrBcc.getAddress()));
                            targetNode.setLabel(Utilities.codecTranslate(codecType, addrBcc.getPersonal()));
                            container.addNode(targetNode);
                        }
                    } else {
                        targetNode = container.getNode(addr.toString());
                    }
                    //if use cc as weight, add an edge between cc
                    EdgeDraft edge = container.getEdge(sourceNode, targetNode);
                    if (edge == null) {
                        edge = container.factory().newEdgeDraft();
                        edge.setSource(sourceNode);
                        edge.setTarget(targetNode);
                        container.addEdge(edge);
                        edge.setWeight(1f);
                    } else {
                        edge.setWeight(edge.getWeight() + 1f);
                    }
                }
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.