1 18 19 package org.objectweb.jac.ide; 20 21 import org.objectweb.jac.core.rtti.NamingConventions; 22 import org.objectweb.jac.util.Strings; 23 import java.util.Hashtable ; 24 import java.util.Map ; 25 26 public class Plurals { 27 Map plurals = new Hashtable (); 29 Map singulars = new Hashtable (); 31 32 public void addPlural(String singular, String plural) { 33 plurals.put(singular,plural); 34 singulars.put(plural,singular); 35 } 36 public void removePlural(String singular) { 37 singulars.remove(plurals.get(singular)); 38 plurals.remove(singular); 39 } 40 public Map getPlurals() { 41 return plurals; 42 } 43 public String getPlural(String singular) { 44 String plural = (String )plurals.get(singular); 45 if (plural==null) { 46 plural = NamingConventions.getPlural(singular); 47 } 48 return plural; 49 } 50 public String getSingular(String plural) { 51 String singular = (String )singulars.get(plural); 52 if (singular==null) { 53 singular = NamingConventions.getSingular(plural); 54 } 55 return singular; 56 } 57 } 58 59 | Popular Tags |