资源预览内容
第1页 / 共51页
第2页 / 共51页
第3页 / 共51页
第4页 / 共51页
第5页 / 共51页
第6页 / 共51页
第7页 / 共51页
第8页 / 共51页
第9页 / 共51页
第10页 / 共51页
亲,该文档总共51页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
.社会网络分析系统的设计和实现.目录目录一、设计题目 1二、需求分析 11运行环境软、硬件环境12输入的形式和输入值的 X 围 23输出的形式描述 24功能描述 25测试数据 3三、概要设计 31抽象数据类型定义描述 32功能模块设计如主程序模块设计33模块层次调用关系图 4四、详细设计 4五、调试分析 141问题和改进 142时间&空间复杂度 15六、测试结果 16七、结论 16.八、附录:程序设计源代码 17III / 51.一一、 设计题目设计题目 实验题目实验题目 社会网络分析系统的设计和实现 问题描述问题描述 实现一个社会网络分析系统。 基本要求基本要求 系统功能主要包括:1) 对 email 数据进行预处理,利用数据结构课程中图中的理论,建立社会网络的邻接矩阵。2) 利用度的概念,找出社会网络中核心人物、活跃人物和边缘人物。3) 利用子图概念分析社会网络的结构 ,找出小团体和联系小团体的桥接人物。4) 能查找任何人的交往圈子。二二、 需求分析需求分析1 1 运行环境运行环境 软软、硬件环境硬件环境 软件:MyEclipse Professional 2014硬件:能运行 MyEclipse Professional 2014 的硬件平台如 CPU:Intel 酷睿 i5;内存 4G;操作系统 Windows8.2 2 输入的形式和输入值的输入的形式和输入值的 X X 围围数据类型:文本txtX 围:在 txt 文本的最大存储 X 围内3 3 输出的形式描述输出的形式描述采用界面形式输出1 该社会网络中个人的收发数量2 该社会网络中的核心人物、活跃人物、边缘人物3 该社会网络中的小团体、桥接人物4 该社会网络中单个人的交往圈子4 4 功能描述功能描述1. 对 email 数据进行预处理,利用数据结构课程中图中的理论,建立社会网络的邻接矩阵2. 利用度的概念,找出社会网络中核心人物、活跃人物和边缘人物3. 利用子图概念分析社会网络的结构 ,找出小团体和联系小团体的桥接人物4. 能查找任何人的交往圈子2 / 51.5 5 测试数据测试数据三三、 概要设计概要设计1 1 抽象数据类型定义描述抽象数据类型定义描述publicpublic SeqList/数组构造函数publicpublic Edge/边构造函数publicpublic AdjMatrixGraph/建立邻接矩阵publicpublic AdjMatrixGraph/建立邻接矩阵publicintpublicint vertexCount/邻接矩阵中顶点的个数publicpublic T get/取出第i个顶点的内容publicpublic String toString/输出邻接矩阵publicintpublicint insertVertex/插入邻接矩阵的顶点publicvoidpublicvoid insertEdge/插入邻接矩阵的度publicvoidpublicvoid insertEdge/插入邻接矩阵的度publicintpublicint outdegres/邻接矩阵中每个对象的出度总和publicintpublicint indegres/邻接矩阵中每个对象的入度总和2 2 功能模块设计功能模块设计 如主程序模块设计如主程序模块设计 publicpublic String activeperson/活跃人物publicpublic String mainperson/核心人物publicpublic String marginalperson/边缘人物3 / 51.publicbooleanpublicboolean isExist/是否存在该人publicpublic String group_one/个人的圈子publicpublic String Connecter/桥接人publicpublic String group/圈子publicpublic String teamgroup/小团体publicintpublicint team/团体publicbooleanpublicboolean isConnection/是否与其他人有联系3 3 模块层次调用关系图模块层次调用关系图四四、 详细设计详细设计在程序内定义一个AdjMatrixGraph 的类来实现程序的基本操作。定义import_email 这个类来实现文本的读取。定义 MainFrm 来实现数据的输出。AdjMatrixGraphAdjMatrixGraph 类类: :protectedprotected SeqList vertexlist;protectedintprotectedint adjmatrix;protectedintprotectedint visit;privatefinalintprivatefinalintMAX_WEIGHT=99999;*publicpublic String activeperson/活跃人物intint max=-1;4 / 51.intint line=-1;forforintint i=0;ithisthis.outdegres.length;i+if ifthisthis.outdegresimaxmax=thisthis.outdegresi;line=i;returnreturn thisthis.get;利用AdjMatrixGraph中的某个人的出度总和函数,来计算每个人的出度总和也就是某个人发出的数量,找出其中发送数量最大的人作为活跃人物。*publicpublic String mainperson/核心人物intint temp = newintnewint thisthis.outdegres.length;intint max=-1;intint line=-1;forforintint i=0;ithisthis.outdegres.length;i+tempi=thisthis.outdegresi+thisthis.indegresi;forforintint i=0;iif ifmaxmax=thisthis.outdegresi;5 / 51.line=i;returnreturn thisthis.get;利用AdjMatrixGraph中的某个人的出度和入度总和函数,来计算每个人的出度和入度总和也就是某个人发出和接收的数量,找出其中发送和接收数量最大的人作为活跃人物。*publicpublic String marginalperson/边缘人物intint temp = newintnewint thisthis.outdegres.length;intint min=99999;intint line=-1;forforintint i=0;ithisthis.outdegres.length;i+tempi=thisthis.outdegresi+thisthis.indegresi;forforintint i=0;iif iftempimin=tempi;line=i;6 / 51.returnreturn thisthis.get;利用AdjMatrixGraph中的某个人的出度和入度总和函数,来计算每个人的出度和入度总和也就是某个人发出和接收的数量,找出其中发送和接收数量最小的人作为活跃人物。*publicbooleanpublicboolean isExist/是否存在该人forforintint i=0;iif iftempi.equalsreturntruereturntrue;returnfalsereturnfalse;在查找某人的圈子时候,判断此人是否已经有过此人。*publicpublic String group_one/个人的圈子String init=thisthis.group;intint count=0;whilewhilecount+;String temp=newnew Stringcount;7 / 51.forforintint i=0;itempi=initi;returnreturn temp;调用group函数利用返回值的String类进行整理,截取前面的内容丢弃null。*publicpublic String Connecter/桥接人intint count=0;forforintint i=0;iif if=2count+;String connector = newnew Stringcount;count=0;forforintint i=0;iif if=2connectorcount=thisthis.get;count+;8 / 51.returnreturn connector;在访问小团体teamgroup的时候,声明的visit数组来计算每个人访问的次数,在visit中的值大于等于2的时候此人就处于两个团体之中,也就是作为桥接人。*publicpublic String group/圈子String temp = newnew Stringvertices.length;intint location=-1;intint count=0;forforintint i=0;iif ifverticesi.equalslocation=i;breakbreak;forforintint i=0;iif iftempcount=thisthis.get;count+;9 / 51.forforintint i=0;iif ifif if!thisthis.isExisttemp, thisthis.get,counttempcount=thisthis.get;count+;returnreturn temp;查找制定人在邻接矩阵中的i行j列的位置,记录位置。执行循环,第一次查找制定人所在行和列数值不为0和99999的数,记录个数,建立特定的数组。第二次,再次循环把行和列数值不为0和99999的数的特定人赋值到数组中,返回数组。*publicpublic String teamgroup/小团体intint temp = thisthis.team;intint count=0;forforintint i=0;iif if!count+;10 / 51.String group=newnew String counttemp.length/2;intint t=count;count=0;forforintint i=0;itemp.length & countif if!forforgroupcountj=thisthis.get;count+;returnreturn group;接收team传回来的数组,进行处理,截断输出。*publicintpublicint team/团体visit = newintnewintthisthis.vertexCount;intint temp = newintnewintthisthis.vertexCountthisthis.vertexCount;forforintint i=0;ithisthis.vertexCount;i+if iftempi0=i+1;visiti+;11 / 51.intint t=1;forforintint j=0;jthisthis.vertexCount;j+if ifthisthis.isConnectiontempit=j+1;visitj+;t+;returnreturn temp;先指定一个对象,从这个对象开始,先从此对象发送过的人中查找,当某一个对象拜访过后,其对应visit中的值加1,查找与这一个对象有联系的人,有联系的人为有过上的往来的人,利用isConnection的方法进行,如果此人定义为有联系的人,把这个人的坐标存入temp的数组中,再进行下一步的查找,查找到另一个时,要确定这个人是否与temp数组中的人都有过上的往来,如果都有就存入temp数组,没有就丢弃。这一对象查找完毕后,查找下一对象,在查找下一对象之前,先访问这一对象的visit数组中的值是否为0,只有当他没有访问过时,才能从这一对象开始查找。最后访问所有的对象,并返回数组。*12 / 51.publicbooleanpublicboolean isConnection/是否与其他人有联系intint flag=0;forforintint m=0;mif ifflag+;if ifreturntruereturntrue;elsereturnfalseelsereturnfalse;利用传回来的 temp数组判断联系人与数组中的所有人是否两两存在上的往来,返回 boolean 值。import_emailimport_email 类类:*publicpublic Edge import_email_edges/从文件中读取出信息存入边的数组publicpublic String import_email_vertices/从文件中读取出信息存入顶点13 / 51.的数组publicbooleanpublicboolean isExists/判断这个顶点是否存在publicintpublicint vertices_where/查找这个值的顶点值在哪JFrameJFrame:*publicpublic MainFrm/主界面publicpublic GroupFrm /查找小团体界面publicpublic SpecialPersonFrm /查找特殊人界面publicpublic TeamGroupFrm/查找桥接人界面五五、 调试分析调试分析1 1 问题和改进问题和改进 问题问题&改进改进 11小团体与桥接人的定义小团体与桥接人的定义小团体:在小团体中,每个人都要与剩余的其他人进行两两的收发。桥接:在两个或者多个小团体中都出现的人物。 问题问题&改进改进 22桥接人的寻找桥接人的寻找如果是在查找完小团体之后 ,在从小团体之间找出共用的桥接人 ,就会对所有的小团体进行排序查找算法 ,这样会影响算法的效率 。所以我运用了 visit数组,如果此对象经过了拜访,其对应的值就加 1。最后,在查找桥14 / 51.接人的时候只要查找 visit数组中拜访次数大于等于 2 的情况就可以了,大大节省时间。 问题问题&改进改进 3Boolean3Boolean 值函数的使用值函数的使用在使用 Boolean 值函数进行判断该成员是否在数组内的时候一直出现空指针的问题,最后发现是数组中的值还没有填满的情况下使用数组.length 方法会发生空指针的问题,所以我在接下来的使用中,使用count 数值来统计已经存放了多少数据,并在函数调用的时候传入 count值作为循环结束条件。2 2 时间时间&空间复杂度空间复杂度1.1.时间复杂度时间复杂度publicintpublicint outdegres-OOpublicintpublicint indegres-OOpublicpublic String activeperson-OOpublicpublic String mainperson-OOpublicpublic String marginalperson-OOpublicbooleanpublicboolean isExist-OOpublicpublic String group_one-OOpublicpublic String Connecter-OOpublicpublic String group-OOpublicpublic String teamgroup-OO15 / 51.publicintpublicint team-OOpublicbooleanpublicboolean isConnection-OO2.2.空间复杂度空间复杂度publicintpublicint outdegres-OOpublicintpublicint indegres-OOpublicpublic String activeperson-OOpublicpublic String mainperson-OOpublicpublic String marginalperson-OOpublicbooleanpublicboolean isExist-OOpublicpublic String group_one-OOpublicpublic String Connecter-OOpublicpublic String group-OOpublicpublic String teamgroup-OOpublicintpublicint team-OOpublicbooleanpublicboolean isConnection-OO六六、 测试结果测试结果七七、 结论结论在本次程序的编写过程中 ,我先对题目进行分析 ,也对程序的要求进行分析,确定小团体、桥接人、活跃人物、核心人物、边缘人物的定义。接着开16 / 51.始程序大体框架的搭建和所要运用的类进行定义。我编写程序中,有不清楚的地方就询问老师来帮助我完成要求 ,对 E-mail的处理操作和文件读取操作是以前没有学过的 ,所以我就上网找资料自主学习这个操作,并在程序中使用。在程序编写的时候我要先处理实验测试数据 ,在实验测速数据的处理方面先画出图 ,然后再进行测试数据的编写 。我要接近真实的电子环境,所以对测试数据的要求就大大增加了。在以后的编写中多多使用 断点进行编译和执行 ,可以大大提高编写效率。这一次的课程设计中,我收获了很多,希望在今后的编程中有所使用。八八、 附录附录:程序设计源代码程序设计源代码packagepackage project;publicclasspublicclass AdjMatrixGraph protectedprotected SeqList vertexlist;protectedintprotectedint adjmatrix;protectedintprotectedint visit;privatefinalintprivatefinalintMAX_WEIGHT=99999;publicpublic AdjMatrixGraphsize=size10?10:size;thisthis.vertexlist=newnew SeqList;thisthis.adjmatrix=newintnewintsizesize;forforintint i=0;i17 / 51.forforintint j=0;jthisthis.adjmatrixij=?0:MAX_WEIGHT;publicpublic AdjMatrixGraphthisthis;if ifreturnreturn;forforintint i=0;iinsertVertex;if ifforforintint j=0;jinsertEdge;publicintpublicint vertexCountreturnthisreturnthis.vertexlist.length;publicintpublicint getWeightreturnthisreturnthis.adjmatrixij;publicpublic T getreturnthisreturnthis.vertexlist.get;/ 5118.publicpublic String toStringString str=顶点集合:+thisthis.vertexlist.toString+n 邻接矩阵 n;intint n=thisthis.vertexCount;forforintint i=0;iforforintint j=0;jstr+=thisthis.adjmatrixij=MAX_WEIGHT? : +thisthis.adjmatrixij;str+=n;returnreturn str;publicintpublicint insertVertexthisthis.vertexlist.append;if ifthisthis.vertexCountthisthis.adjmatrix.lengthintint temp=adjmatrix,i,j;thisthis.adjmatrix=newintnewinttemp.length*2temp.length2;forfori=0;iforforj=0;jthisthis.adjmatrixij=tempij;forforj=temp.length;jthisthis.adjmatrixij=MAX_WEIGHT;19 / 51.forfori=temp.length;iforforj=0;jthisthis.adjmatrixij=?0:MAX_WEIGHT;returnthisreturnthis.vertexlist.length-1;publicvoidpublicvoid insertEdgethisthis.insertEdge;publicvoidpublicvoid insertEdgeintint n=thisthis.vertexCount;if if=0&i=0&i!=jif ifthisthis.adjmatrixij=0;thisthis.adjmatrixij+=weight;publicintpublicint outdegresintint temp = newintnewintthisthis.adjmatrix.length;forforintint i=0;i20 / 51.forforintint j=0;jif iftempi=tempi+thisthis.adjmatrixij;returnreturn temp;publicintpublicint indegresintint temp = newintnewintthisthis.adjmatrix.length;forforintint i=0;iforforintint j=0;jif iftempi=tempi+thisthis.adjmatrixji;returnreturn temp;publicpublic String activepersonintint max=-1;intint line=-1;forforintint i=0;ithisthis.outdegres.length;i+21 / 51.if ifthisthis.outdegresimaxmax=thisthis.outdegresi;line=i;returnreturn thisthis.get;publicpublic String mainpersonintint temp = newintnewint thisthis.outdegres.length;intint max=-1;intint line=-1;forforintint i=0;ithisthis.outdegres.length;i+tempi=thisthis.outdegresi+thisthis.indegresi;forforintint i=0;iif ifmaxmax=thisthis.outdegresi;line=i;returnreturn thisthis.get;22 / 51.publicpublic String marginalpersonintint temp = newintnewint thisthis.outdegres.length;intint min=99999;intint line=-1;forforintint i=0;ithisthis.outdegres.length;i+tempi=thisthis.outdegresi+thisthis.indegresi;forforintint i=0;iif iftempimin=tempi;line=i;returnreturn thisthis.get;publicbooleanpublicboolean isExistforforintint i=0;iif iftempi.equalsreturntruereturntrue;returnfalsereturnfalse;23 / 51.publicpublic String group_oneString init=thisthis.group;intint count=0;whilewhilecount+;String temp=newnew Stringcount;forforintint i=0;itempi=initi;returnreturn temp;publicpublic String Connecterintint count=0;forforintint i=0;iif if=2count+;String connector = newnew Stringcount;count=0;forforintint i=0;iif if=224 / 51.connectorcount=thisthis.get;count+;returnreturn connector;publicpublic String groupString temp = newnew Stringvertices.length;intint location=-1;intint count=0;forforintint i=0;iif ifverticesi.equalslocation=i;breakbreak;forforintint i=0;iif iftempcount=thisthis.get;count+;forforintint i=0;i25 / 51.if ifif if!thisthis.isExisttemp, thisthis.get,counttempcount=thisthis.get;count+;returnreturn temp;publicpublic String teamgroupintint temp = thisthis.team;intint count=0;forforintint i=0;iif if!count+;String group=newnew String counttemp.length/2;intint t=count;count=0;forforintint i=0;itemp.length & countif if!forforgroupcountj=thisthis.get;26 / 51.count+;returnreturn group;publicintpublicint teamvisit = newintnewintthisthis.vertexCount;intint temp = newintnewintthisthis.vertexCountthisthis.vertexCount;forforintint i=0;ithisthis.vertexCount;i+if iftempi0=i+1;visiti+;intint t=1;forforintint j=0;jthisthis.vertexCount;j+if ifthisthis.isConnectiontempit=j+1;visitj+;t+;27 / 51.returnreturn temp;publicbooleanpublicboolean isConnectionintint flag=0;forforintint m=0;mif ifflag+;if ifreturntruereturntrue;elsereturnfalseelsereturnfalse;packagepackage project;publicclasspublicclass Edge implementsimplements Comparablepublicintpublicintstart,dest,weight;publicpublic Edge28 / 51.thisthis.start=start;thisthis.dest=dest;thisthis.weight=weight;publicpublic String toStringreturnreturn;publicintpublicint compareTo if ifreturnthisreturnthis.start-e.start;returnthisreturnthis.dest-e.dest;packagepackage project;publicclasspublicclass SeqListprivateprivate Object element;privateintprivateintlen;publicpublic SeqListthisthis.element=newnew Objectsize;thisthis.len = 0;29 / 51publicpublic SeqListSeqList listthisthis;thisthis.len=list.len;publicpublic SeqListthisthis;publicbooleanpublicboolean isEmptyreturnthisreturnthis.len=0;publicintpublicint lengthreturnthisreturnthis.len;publicpublic T getif if=0&ireturnreturnthisthis.elementi;returnnullreturnnull;publicvoidpublicvoid setif ifreturnreturn;.30 / 51.if if=0&ithisthis.elementi = x;elseelsethrownewthrownew IndexOutOfBoundsException;publicpublic String toStringString str = ;if if0str += thisthis.element0.toString;forforintint i=1;istr +=,+thisthis.elementi.toString;returnreturn str+;publicvoidpublicvoid insertif ifreturnreturn;if ifObject temp = thisthis.element;thisthis.element=newnew Objecttemp.length*2;forforintint j=0;j thisthis.elementj=tempj;31 / 51if ifii=0;if ifthisthis.leni=thisthis.len;forfor=i;j-thisthis.elementj+1 = thisthis.elementj;thisthis.elementi=x;thisthis.len+;publicvoidpublicvoid appendinsert;publicpublic T removeif ifthisthis.len=0|i=lenreturnnullreturnnull;T old = thisthis.elementi;forforintint j=0;jthisthis.elementj = thisthis.elementj+1;thisthis.elementthisthis.len-1=nullnull;thisthis.len-;.32 / 51.returnreturn old;publicvoidpublicvoid removeAllthisthis.len=0;packagepackage project;importimport java.io.*;importimport java.util.*;publicclasspublicclass import_email publicpublic Edge import_email_edgesString vertices = thisthis.import_email_vertices;String temp =newnew String9992;Edge edges = nullnull;intint count=0;trytryScanner scanner = newnew Scannernewnew FileInputStream;whilewhilescanner.hasNexttempcount0 = scanner.next;tempcount1 = scanner.next;count+;33 / 51.edges=newnew Edgecount;forforintint i=0;iedgesi =newnewEdgevertices_where,vertices_where,1;catchcatche.printStackTrace;returnreturn edges;publicpublic String import_email_verticesString temp =newnew String999;String vertices=nullnull;intint count=0;trytryScanner scanner = newnew Scannernewnew FileInputStream;whilewhilescanner.hasNextString word = scanner.next;if if!thisthis.isExiststempcount=word;34 / 51.count+;vertices=newnew Stringcount;forforintint i=0;iverticesi=tempi;catchcatche.printStackTrace;returnreturn vertices;publicbooleanpublicboolean isExistsforforintint i=0;iif ifstri.equalsreturntruereturntrue;returnfalsereturnfalse;publicintpublicint vertices_where35 / 51.forforintint i=0;iif ifstri.equalsreturnreturn i;returnreturn -1;publicstaticvoidpublicstaticvoid mainimport_email email = newnew import_email;String vertices=email.import_email_vertices;forforintint i=0;iSystem.out.println;Edge edges=email.import_email_edges;forforintint i=0;ipackagepackage project;importimport javax.swing.*;importimport;System.out.println;36 / 51.importimport java.awt.*;importimport java.awt.event.*;publicclasspublicclassMainFrmextendsextends JFrame implementsimplements ActionListener privateprivate JTable table = nullnull;privateprivate String cols = 编号,发件人,发件数量,收件数量;privateprivate utton Btn1 = newnew utton;privateprivate utton Btn2 = newnew utton;privateprivate utton Btn3 = newnew utton;privateprivate utton Btn4 = newnew utton;import_email email = newnew import_email;String vertices = email.import_email_vertices;Edge edges=email.import_email_edges;AdjMatrixGraph adjMatrixGraph = newnewAdjMatrixGraph;privatevoidprivatevoid initTable String rows = newnew StringadjMatrixGraph.vertexCount4;forforintint i=0;iadjMatrixGraph.vertexCount;i+rowsi0=String.valueOf;rowsi1=verticesi;rowsi2=String.valueOfadjMatrixGraph.outdegresi;rowsi3=String.valueOfadjMatrixGraph.indegresi;37 / 51.table = newnew JTable;publicpublic MainFrmJPanel jp = thisthis.getContentPane;initTable;JScrollPane jsp_table = newnew JScrollPane;table.getColumnModel.getColumn.setPreferredWidth;jp.add;JPanel jp_top = newnew JPanel;jp_top.add;jp_top.add;jp_top.add;jp_top.add;jp.add;Btn1.addActionListener;Btn2.addActionListener;Btn3.addActionListener;Btn4.addActionListener;thisthis.setTitle;thisthis.setSize;38 / 51.thisthis.setVisible;thisthis.setDefaultCloseOperation;publicvoidpublicvoid actionPerformed if ife.getSource=Btn1newnew SpecialPersonFrm;if ife.getSource=Btn2intint row=table.getSelectedRow;if if-1String str = String.valueOftable.getValueAt;newnew GroupFrm;elseelse JOptionPane.showMessageDialog;if ife.getSource=Btn3newnew TeamGroupFrm;if ife.getSource=Btn4newnew ConnectorFrm;39 / 51.publicstaticvoidpublicstaticvoid mainnewnew MainFrm;packagepackage project;importimport javax.swing.*;importimport;importimport java.awt.*;importimport java.awt.event.*;publicclasspublicclassConnectorFrmextendsextends JFrame implementsimplements ActionListenerimport_email email = newnew import_email;String vertices = email.import_email_vertices;Edge edges=email.import_email_edges;AdjMatrixGraph adjMatrixGraph = newnewAdjMatrixGraph;utton btn = newnew utton;JTextArea txt= newnew JTextArea;publicpublic ConnectorFrm String temp=nullnull;adjMatrixGraph.teamgroup;forforintint i=0;iadjMatrixGraph.Connecter.length;i+40 / 51.if iftemp= adjMatrixGraph.Connecteri;elseelse temp=temp+n+adjMatrixGraph.Connecteri;txt.setText;JPanel jp = thisthis.getContentPane;JPanel jp1 = newnew JPanel;JPanel jp2 = newnew JPanel;jp1.add;jp2.add;jp.add;jp.add;btn.addActionListener;thisthis.setSize;thisthis.setVisible;thisthis.setTitle;publicvoidpublicvoid actionPerformed if if e.getSource = btn dispose;41 / 51.publicstaticvoidpublicstaticvoid mainnewnew ConnectorFrm;packagepackage project;importimport javax.swing.*;importimport java.awt.*;importimport java.awt.event.*;publicclasspublicclassGroupFrmextendsextends JFrame implementsimplements ActionListenerimport_email email = newnew import_email;String vertices = email.import_email_vertices;Edge edges=email.import_email_edges;AdjMatrixGraph adjMatrixGraph = newnewAdjMatrixGraph;utton btn_add = newnew utton;JTextArea txt= newnew JTextArea;publicpublic GroupFrm String temp=nullnull;forforintint i=0;iadjMatrixGraph.group_one.length;i+if if42 / 51.temp= adjMatrixGraph.group_onei;elseelse temp=temp+n+adjMatrixGraph.group_onei;txt.setText;JPanel jp = thisthis.getContentPane;JPanel jp1 = newnew JPanel;JPanel jp2 = newnew JPanel;jp1.add;jp2.add;jp.add;jp.add;btn_add.addActionListener;thisthis.setSize;thisthis.setVisible;thisthis.setTitle;publicvoidpublicvoid actionPerformed if if e.getSource = btn_add dispose;43 / 51.packagepackage project;importimport javax.swing.*;importimport java.awt.*;importimport java.awt.event.*;publicclasspublicclassSpecialPersonFrmextendsextends JFrame implementsimplements ActionListenerimport_email email = newnew import_email;String vertices = email.import_email_vertices;Edge edges=email.import_email_edges;AdjMatrixGraph adjMatrixGraph = newnewAdjMatrixGraph;utton btn_add = newnew utton;JLabel lb_mainperson = newnew JLabel;JLabel lb_activeperson = newnew JLabel;JLabel lb_marginalperson = newnew JLabel;JTextField txt_mainperson = newnew JTextField;JTextField txt_activeperson = newnew JTextField;JTextField txt_marginalperson = newnew JTextField;publicpublic SpecialPersonFrm txt_mainperson.setTextadjMatrixGraph.mainperson;txt_activeperson.setTextadjMatrixGraph.activeperson;44 / 51.txt_marginalperson.setTextadjMatrixGraph.marginalperson;JPanel jp = thisthis.getContentPane;JPanel jp1 = newnew JPanel;JPanel jp2 = newnew JPanel;jp1.setLayoutnewnew GridLayout;jp1.add;jp1.add;jp1.add;jp1.add;jp1.add;jp1.add;jp2.add;jp.add;jp.add;btn_add.addActionListener;thisthis.setSize;thisthis.setVisible;thisthis.setTitle;publicvoidpublicvoid actionPerformed if if e.getSource = btn_add 45 / 51.dispose;packagepackage project;importimport javax.swing.*;importimport;importimport java.awt.*;importimport java.awt.event.*;publicclasspublicclassTeamGroupFrmextendsextends JFrame implementsimplements ActionListener privateprivate JTable table = nullnull;privateprivate String cols = , , , , , ;privateprivate utton Btn = newnew utton;import_email email = newnew import_email;String vertices = email.import_email_vertices;Edge edges=email.import_email_edges;AdjMatrixGraph adjMatrixGraph = newnewAdjMatrixGraph;privatevoidprivatevoid initTable String rows = newnew StringadjMatrixGraph.teamgroup.length6;forforintint i=0;iadjMatrixGraph.teamgroup.length;i+46 / 51.forforintint j=0;adjMatrixGraph.teamgroupij!=nullnull;j+rowsij=adjMatrixGraph.teamgroupij;table = newnew JTable;publicpublic TeamGroupFrmJPanel jp = thisthis.getContentPane;initTable;JScrollPane jsp_table = newnew JScrollPane;table.setAutoResizeMode;jp.add;JPanel jp_top = newnew JPanel;jp_top.add;jp.add;Btn.addActionListener;thisthis.setTitle;thisthis.setSize;thisthis.setVisible;publicvoidpublicvoid actionPerformed 47 / 51if e.getSource=Btndispose;.48 / 51
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号