1 package org.kuali.student.lum.statement.config.context.util; 2 3 import org.kuali.student.lum.lu.dto.CluInfo; 4 5 public class NLHelper { 6 7 public static String getProperGrammar(Number number, String singularText, String pluralText) { 8 return (number.intValue() == 1 ? singularText : pluralText); 9 } 10 11 public static String getProperGrammar(Number number, String singularText) { 12 return (number.intValue() == 1 ? singularText : singularText + "s"); 13 } 14 15 public static String getProperGrammar(String number, String singularText, String pluralText) { 16 return getProperGrammar(Integer.valueOf(number), singularText, pluralText); 17 } 18 19 public static String getProperGrammar(String number, String singularText) { 20 return getProperGrammar(Integer.valueOf(number), singularText); 21 } 22 23 public static String getCluOrCluSetAsShortNames(CluInfo clu, NLCluSet cluSet) { 24 return getCluOrCluSetAsShortNames(clu, cluSet, ","); 25 } 26 27 public static String getCluOrCluSetAsShortNames(CluInfo clu, NLCluSet cluSet, String separator) { 28 if(clu != null) { 29 return clu.getOfficialIdentifier().getShortName(); 30 } 31 return cluSet.getCluSetAsShortName(separator); 32 } 33 34 public static String getCluOrCluSetAsLongNames(CluInfo clu, NLCluSet cluSet) { 35 return getCluOrCluSetAsLongNames(clu, cluSet, ","); 36 } 37 38 public static String getCluOrCluSetAsLongNames(CluInfo clu, NLCluSet cluSet, String separator) { 39 if(clu != null) { 40 return clu.getOfficialIdentifier().getLongName(); 41 } 42 return cluSet.getCluSetAsLongName(separator); 43 } 44 }