public ArrayList getAnswerArray() {
   ArrayList list = new ArrayList();
   Iterator iter = answerSet.iterator();
   while (iter.hasNext()) {
     list.add(iter.next());
   }
   return list;
 }
  /**
   * Builds a SgrScoreCalculator object
   *
   * @param data - name of file containing sgr data
   * @param winSize - size of display window
   * @throws IOException - if the file cannot be accessed
   */
  public SgrScoreCalculator(String data, int winSize, CurationSet curation) throws IOException {
    super(winSize);
    BufferedReader br = new BufferedReader(new FileReader(data));
    String line;
    double minAbsScore = Double.POSITIVE_INFINITY;
    Set<String> unmatchedIds = new HashSet<String>();
    while ((line = br.readLine()) != null) {
      String[] tokens = line.split("\t");
      String refId = curation.getRefSequence().getName();
      if (!tokens[0].equals(refId)) {
        if (!unmatchedIds.contains(tokens[0])) {
          logger.warn(
              "Score id "
                  + tokens[0]
                  + " does not match main sequence id "
                  + refId
                  + ". Skipping score.");
          unmatchedIds.add(tokens[0]);
        }
        continue;
      }
      Double score = new Double(Double.parseDouble(tokens[2]));
      // chuck out scores outside of the given range
      int pos = Integer.parseInt(tokens[1]);
      if (pos >= curation.getLow() && pos <= curation.getHigh()) {
        scoreMap.put(pos, score);
      }

      if (Math.abs(score) < minAbsScore) {
        minAbsScore = Math.abs(score);
      }
      if (score.doubleValue() < minScore) {
        minScore = score;
      }
      if (score.doubleValue() > maxScore) {
        maxScore = score;
      }
    }
    while (minAbsScore * factor < 1) {
      factor *= 10;
    }
  }
 // for EMI - Attachments at Answer Level
 public boolean getHasAttachment() {
   if (itemTextAttachmentSet != null && itemTextAttachmentSet.size() > 0) return true;
   else return false;
 }
Ejemplo n.º 4
0
  /** Sherpa romeo submission support */
  public void make_sherpaRomeo_submission(Item item, Division divIn) throws WingException {

    if (ConfigurationManager.getBooleanProperty(
        "webui.submission.sherparomeo-policy-enabled", true)) {

      SHERPASubmitService sherpaSubmitService =
          new DSpace().getSingletonService(SHERPASubmitService.class);

      if (sherpaSubmitService.hasISSNs(context, item)) {
        List div = divIn.addList("submit-upload-new", List.TYPE_FORM);
        div.setHead(T_sherpa_title);

        // Since sherpa web service doesn't work reliable with more than 1 issn, perform the service
        // for each issn
        Set<String> issns = sherpaSubmitService.getISSNs(context, item);
        Iterator<String> issnsIterator = issns.iterator();

        int i = 0;
        while (issnsIterator.hasNext()) {
          SHERPAResponse shresp =
              sherpaSubmitService.searchRelatedJournalsByISSN(issnsIterator.next());
          java.util.List<SHERPAJournal> journals = shresp.getJournals();
          java.util.List<SHERPAPublisher> publishers = shresp.getPublishers();

          if (CollectionUtils.isNotEmpty(journals)) {
            for (SHERPAJournal journ : journals) {
              SHERPAPublisher pub = publishers.get(0);

              List sherpaList = div.addList("sherpaList" + (i + 1), "simple", "sherpaList");
              sherpaList
                  .addItem()
                  .addFigure(
                      contextPath + "/static/images/" + (i == 0 ? "romeosmall" : "clear") + ".gif",
                      "http://www.sherpa.ac.uk/romeo/",
                      "sherpaLogo");

              sherpaList.addItem().addHighlight("sherpaBold").addContent(T_sherpa_journal);
              sherpaList.addItem(journ.getTitle() + " (" + journ.getIssn() + ")");

              sherpaList.addItem().addHighlight("sherpaBold").addContent(T_sherpa_publisher);
              sherpaList.addItemXref(pub.getHomeurl(), pub.getName());

              sherpaList.addItem().addHighlight("sherpaBold").addContent(T_sherpa_colour);
              sherpaList
                  .addItem()
                  .addHighlight("sherpaStyle " + pub.getRomeocolour())
                  .addContent(message("xmlui.aspect.sherpa.submission." + pub.getRomeocolour()));
              sherpaList
                  .addItem()
                  .addXref(
                      "http://www.sherpa.ac.uk/romeo/search.php?issn=" + journ.getIssn(),
                      T_sherpa_more,
                      "sherpaMoreInfo");

              i = i + 1;
            }
          }
        }

        List sherpaList = div.addList("sherpaListEnd", "simple", "sherpaList");
        sherpaList.addItem(T_sherpa_consult);
      }
    }
  }