예제 #1
0
 /**
  * Produce values for a list of scales that can be used in a pulldown menu
  *
  * @param scales a list of {@link EvalScale}
  * @return an array of values for the passed in scales
  */
 public static String[] getScaleValues(List<EvalScale> scales) {
   List<String> scaleValues = new ArrayList<>();
   for (EvalScale scale : scales) {
     // ensure only real scales are included
     if (scale.getId() != null) {
       scaleValues.add(scale.getId().toString());
     }
   }
   return (String[]) scaleValues.toArray(new String[] {});
 }
예제 #2
0
 /**
  * Produce scale labels for a list of scales that can be used in a pulldown menu
  *
  * @param scales a list of {@link EvalScale}
  * @return an array of labels for the passed in scales
  */
 public static String[] getScaleLabels(List<EvalScale> scales) {
   List<String> scaleLabels = new ArrayList<>();
   for (EvalScale scale : scales) {
     // ensure only real scales are included
     if (scale.getId() != null) {
       scaleLabels.add(makeScaleText(scale, 90));
     }
   }
   return (String[]) scaleLabels.toArray(new String[scaleLabels.size()]);
 }
예제 #3
0
 public static int idealIndex(EvalScale scale) {
   int index = -1;
   for (int i = 0; i < idealKeys.length; ++i) {
     if (StringUtil.equals(scale.getIdeal(), idealKeys[i])) {
       index = i;
       break;
     }
   }
   if (index == -1) {
     // Fix for http://www.caret.cam.ac.uk/jira/browse/CTL-562 - added to ensure this will not
     // cause a failure
     LOG.info(
         "Could not find index for scale ("
             + scale.getId()
             + ") for ideal setting: "
             + scale.getIdeal()
             + ", setting to default of 0 (no ideal)");
     index = 0;
   }
   return index;
 }