📄 testpeoplegraph.java
字号:
/* Copyright (C) 2002 Univ. of Massachusetts Amherst, Computer Science Dept. This file is part of "MALLET" (MAchine Learning for LanguagE Toolkit). http://www.cs.umass.edu/~mccallum/mallet This software is provided under the terms of the Common Public License, version 1.0, as published by http://www.opensource.org. For further information, see the file `LICENSE' included with this distribution. *//** @author Aron Culotta <a href="mailto:culotta@cs.umass.edu">culotta@cs.umass.edu</a> */package edu.umass.cs.mallet.projects.dex.graph;import edu.umass.cs.mallet.projects.dex.types.*;import salvo.jesus.graph.*;import java.io.*;public class TestPeopleGraph { /** Test graph look like 4-0-1-3-6 * | | * 2 5-7 * * Can also pass serialized graph as first arg */ public static void main (String[] args) throws Exception { PeopleGraph pg = null; if (args.length == 0) pg = createPeopleGraph(); else { try { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File (args[0]))); pg = (PeopleGraph) ois.readObject(); ois.close(); System.err.println ("Read PeopleGraph successfully!"); } catch (IOException e) { System.err.println("Exception reading file: " + e); } catch (ClassNotFoundException cnfe) { System.err.println("Cound not find class reading in object: " + cnfe); } } System.out.println ("Testing on graph " + pg); pg.printAllStatistics (); } public static PeopleGraph createPeopleGraph () throws Exception { People people = new People (); int npeople = 5; Person p0 = new Person ("0", "0", ""); Person p1 = new Person ("1", "1", ""); Person p2 = new Person ("2", "2", ""); Person p3 = new Person ("3", "3", ""); Person p4 = new Person ("4", "4", ""); Person p5 = new Person ("5", "5", ""); Person p6 = new Person ("6", "6", ""); Person p7 = new Person ("7", "7", ""); people.addPerson (p0); people.addPerson (p1); people.addPerson (p2); people.addPerson (p3); people.addPerson (p4); people.addPerson (p5); people.addPerson (p6); people.addPerson (p7); p0.addOutLink (2); p0.addOutLink (1); p4.addOutLink (0); p1.addOutLink (3); p3.addOutLink (5); p3.addOutLink (6); p5.addOutLink (7); p0.addKeyWord ("word0"); p1.addKeyWord ("word0"); p2.addKeyWord ("word2"); p3.addKeyWord ("word3"); p4.addKeyWord ("word4"); p5.addKeyWord ("word5"); p6.addKeyWord ("word6"); p7.addKeyWord ("word7"); return new PeopleGraph (people); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -