Beispiel #1
0
 public String obtainFullName() {
   return authorClicked.getFullname();
 }
Beispiel #2
0
  public String getMostFrequentCoAuthors() {
    Set<Author> mostFrequentCoAuthors = controllerBean.getSearch().getSetMostFrequentCoAuthors();
    StringBuilder toReturn = new StringBuilder();

    if (mostFrequentCoAuthors == null || mostFrequentCoAuthors.isEmpty()) {
      return toReturn.toString();
    }

    toReturn.append("<div style=\"font-size:120%;\">");
    toReturn.append("<b>Most frequent co-author(s)</b><br>");
    toReturn.append("</div>");

    if (mostFrequentCoAuthors.size() == 1) {
      Author mostFrequentCoAuthor = mostFrequentCoAuthors.iterator().next();
      int nbCollab = mostFrequentCoAuthor.getTimesMentioned();
      toReturn.append("<b>");
      toReturn.append(mostFrequentCoAuthor.getFullname());
      toReturn.append("</b>");
      toReturn.append(".<br>");
      toReturn.append("Together, they have written ");
      toReturn.append(mostFrequentCoAuthor.getTimesMentioned());
      if (nbCollab == 1) {
        toReturn.append(" document");
      } else {
        toReturn.append(" documents");
      }
      if (controllerBean.getSearch().getYearFirstCollab()
          == controllerBean.getSearch().getYearLastCollab()) {
        toReturn.append(" in  ");
        toReturn.append(mostFrequentCoAuthor.getYearFirstCollab());
      } else {
        toReturn.append(" from ");
        toReturn.append(mostFrequentCoAuthor.getYearFirstCollab());
        toReturn.append(" to ");
        toReturn.append(mostFrequentCoAuthor.getYearLastCollab());
        toReturn.append(".");
      }

    } else {
      Iterator<Author> mostFrequentCoAuthorsIterator = mostFrequentCoAuthors.iterator();
      Author currAuthor;
      int maxNbCollab = 0;
      while (mostFrequentCoAuthorsIterator.hasNext()) {
        currAuthor = mostFrequentCoAuthorsIterator.next();
        maxNbCollab = Math.max(currAuthor.getTimesMentioned(), maxNbCollab);
      }
      if (maxNbCollab == 1) {
        toReturn.append(
            "- multiple coauthors, did not write more than one paper with the same coauthor.");

      } else {
        mostFrequentCoAuthorsIterator = mostFrequentCoAuthors.iterator();
        while (mostFrequentCoAuthorsIterator.hasNext()) {
          currAuthor = mostFrequentCoAuthorsIterator.next();
          toReturn.append("- <b>");
          toReturn.append(currAuthor.getFullname());
          toReturn.append("</b>, with ");
          toReturn.append(currAuthor.getTimesMentioned());
          if (currAuthor.getYearFirstCollab() == currAuthor.getYearLastCollab()) {
            toReturn.append(" shared publications in ");
            toReturn.append(currAuthor.getYearFirstCollab());
          } else {
            toReturn.append(" shared publications from ");
            toReturn.append(currAuthor.getYearFirstCollab());
            toReturn.append(" to ");
            toReturn.append(currAuthor.getYearLastCollab());
            toReturn.append(".<br>");
          }
        }
      }
    }
    toReturn.append("<p></p>");
    return toReturn.toString();
  }