private void nameLengthStatistics() { Iterator i = Person.iterator(); Person p; int l = Person.getMaxNameLength(); int lengthTable[] = new int[l + 1]; int j; System.out.println(); // System.out.println("Name length: Number of persons"); while (i.hasNext()) { p = (Person) i.next(); lengthTable[p.getName().length()]++; } for (j = 1; j <= l; j++) { System.out.print(j + ": " + lengthTable[j] + " "); if (j % 5 == 0) System.out.println(); } System.out.println(); }
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException { if (rawName.equals("author") || rawName.equals("editor")) { // System.out.println("End of author"); Person p; if ((p = Person.searchPerson(Value)) == null) { p = new Person(Value); } p.increment(); if (numberOfPersons < maxAuthorsPerPaper) persons[numberOfPersons++] = p; return; } if (rawName.equals("booktitle") || rawName.equals("journal")) { conference c; if ((c = conference.searchConference(Value)) == null) { c = new conference(Value.replaceAll("[0-9]*", "")); } c.increment(); System.out.println("conference"); System.out.println(c.getNumberId()); // conference[numberOfConferences++] = c; } if (rawName.equals(recordTag)) { // System.out.println("End of paper"); if (numberOfPersons == 0) return; Person pa[] = new Person[numberOfPersons]; // System.out.println(); System.out.println("author"); for (int i = 0; i < numberOfPersons; i++) { pa[i] = persons[i]; System.out.print(persons[i].getNumberId() + " "); persons[i] = null; } System.out.println(); System.out.println("cutting line"); Publication p = new Publication(key, pa, s_conference); numberOfPersons = 0; } }
private void publicationCountStatistics() { Iterator i = Person.iterator(); Person p; int l = Person.getMaxPublCount(); int countTable[] = new int[l + 1]; int j, n; System.out.println(); System.out.println("Number of publications: Number of persons"); while (i.hasNext()) { p = (Person) i.next(); countTable[p.getCount()]++; } n = 0; for (j = 1; j <= l; j++) { if (countTable[j] == 0) continue; n++; System.out.print(j + ": " + countTable[j] + " "); if (n % 5 == 0) System.out.println(); } System.out.println(); }