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