|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.util.AbbreviationsGenerator
public class AbbreviationsGenerator
Creates and stores abbreviations for any String based keys.
This is useful for storing only necessary character sequences instead of full names, which saves some memory.
Copyright Enough Software 2004 - 2011
history
23-Jul-2004 - rob creation
| Field Summary | |
|---|---|
static char[] |
ABBREVIATIONS_ALPHABET_LOWERCASE
A character array consisting of a-z. |
static char[] |
ABBREVIATIONS_ALPHABET_UPPERCASE
A character array consisting of A-Z |
static char[] |
ABBREVIATIONS_ALPHANUMERICAL
A character array consisting of numbers and A-Z and a-z. |
| Constructor Summary | |
|---|---|
AbbreviationsGenerator()
Creates a new empty generator. |
|
AbbreviationsGenerator(Map abbreviations)
Creates a new generator. |
|
AbbreviationsGenerator(Map abbreviations,
char[] abbreviationCharacters)
Creates a new generator. |
|
| Method Summary | |
|---|---|
String |
getAbbreviation(String name,
boolean create)
Retrieves an abbreviation for the given key. |
Map |
getAbbreviationsMap()
Retrieves the map containing all abbreviations. |
protected int |
getCharIndex(char c,
String abbreviation)
Retrieves the index of the given character in the ABBREVIATION array. |
static String |
getLastAbbreviation(String[] abbreviationsArr)
Finds the last abbreviation within the given String array, e.g. |
String |
getNextPropertyAbbreviation()
Creates the next property abbreviation |
static void |
main(String[] args)
|
void |
setAbbreviationsMap(Map map)
Sets the abbreviations for this generator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final char[] ABBREVIATIONS_ALPHANUMERICAL
public static final char[] ABBREVIATIONS_ALPHABET_LOWERCASE
public static final char[] ABBREVIATIONS_ALPHABET_UPPERCASE
| Constructor Detail |
|---|
public AbbreviationsGenerator()
public AbbreviationsGenerator(Map abbreviations)
abbreviations - the known abbreviations
public AbbreviationsGenerator(Map abbreviations,
char[] abbreviationCharacters)
abbreviations - the known abbreviationsabbreviationCharacters - characters used for creating the abbreviations| Method Detail |
|---|
public Map getAbbreviationsMap()
public void setAbbreviationsMap(Map map)
map - a HashMap containing all abbreviations for full keywordspublic static String getLastAbbreviation(String[] abbreviationsArr)
abbreviationsArr - an array of already used abbreviations
protected final int getCharIndex(char c,
String abbreviation)
c - the characterabbreviation - the abbreviation of the style
public String getAbbreviation(String name,
boolean create)
name - the full name of the keycreate - true when a new abbreviation should be created when
none is found.
public String getNextPropertyAbbreviation()
public static void main(String[] args)
throws FileNotFoundException,
IOException
FileNotFoundException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||