* Get script specific syllabizer class.
* @return a syllabizer class object or null
*/
- protected Class getSyllabizerClass() {
+ protected Class<? extends Syllabizer> getSyllabizerClass() {
return null;
}
if ( o instanceof Syllabizer ) {
Syllabizer s = (Syllabizer) o;
if ( ( d = script.compareTo ( s.script ) ) == 0 ) {
- if ( ( d = language.compareTo ( s.language ) ) == 0 ) {
- d = 0;
- }
+ d = language.compareTo ( s.language );
}
} else {
d = -1;
return d;
}
private static Map<String,Syllabizer> syllabizers = new HashMap<String,Syllabizer>();
- static Syllabizer getSyllabizer ( String script, String language, Class syllabizerClass ) {
+ static Syllabizer getSyllabizer ( String script, String language, Class<? extends Syllabizer> syllabizerClass ) {
String sid = makeSyllabizerId ( script, language );
Syllabizer s = syllabizers.get ( sid );
if ( s == null ) {
static String makeSyllabizerId ( String script, String language ) {
return script + ":" + language;
}
- static Syllabizer makeSyllabizer ( String script, String language, Class syllabizerClass ) {
+ static Syllabizer makeSyllabizer ( String script, String language, Class<? extends Syllabizer> syllabizerClass ) {
Syllabizer s;
try {
- Constructor cf = syllabizerClass.getDeclaredConstructor ( new Class[] { String.class, String.class } );
+ Constructor<? extends Syllabizer> cf = syllabizerClass.getDeclaredConstructor ( new Class[] { String.class, String.class } );
s = (Syllabizer) cf.newInstance ( script, language );
} catch ( NoSuchMethodException e ) {
s = null;
package org.apache.fop.fonts;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.apache.fop.util.CharUtilities;
private final String script;
- private static Map processors = new HashMap();
+ private static Map<String, ScriptProcessor> processors = new HashMap<String, ScriptProcessor>();
/**
* Instantiate a script processor.
public static synchronized ScriptProcessor getInstance ( String script ) {
ScriptProcessor sp = null;
assert processors != null;
- if ( ( sp = (ScriptProcessor) processors.get ( script ) ) == null ) {
+ if ( ( sp = processors.get ( script ) ) == null ) {
processors.put ( script, sp = createProcessor ( script ) );
}
return sp;