/** * Provide a list containing preferred modules for the specified input type * * @param wanted_input_type * the specified input type * @return the list of system wide preferred modules, null if none */ public static synchronized List<MaryModule> getPreferredModulesForInputType(MaryDataType wanted_input_type) { if (preferredModules != null) { List<MaryModule> v = new ArrayList<MaryModule>(); for (Iterator<MaryModule> it = preferredModules.iterator(); it.hasNext();) { MaryModule m = (MaryModule) it.next(); if (m.inputType().equals(wanted_input_type)) { v.add(m); } } if (v.size() > 0) return v; else return null; } return null; }
/** * Provide a list containing preferred modules for the specified input type * * @param wanted_input_type * the specified input type * @return the list of system wide preferred modules, null if none */ public static synchronized List<MaryModule> getPreferredModulesForInputType(MaryDataType wanted_input_type) { if (preferredModules != null) { List<MaryModule> v = new ArrayList<MaryModule>(); for (Iterator<MaryModule> it = preferredModules.iterator(); it.hasNext();) { MaryModule m = (MaryModule) it.next(); if (m.inputType().equals(wanted_input_type)) { v.add(m); } } if (v.size() > 0) return v; else return null; } return null; }
for (Iterator<MaryModule> it = preferredModules.iterator(); it.hasNext();) { MaryModule m = (MaryModule) it.next(); if (m.inputType().equals(type)) { v.add(m);
for (Iterator<MaryModule> it = preferredModules.iterator(); it.hasNext();) { MaryModule m = (MaryModule) it.next(); if (m.inputType().equals(type)) { v.add(m);
if (registrationComplete) throw new IllegalStateException("cannot register modules after registration is complete"); MaryDataType type = module.inputType(); Object o = mkm.get(type, locale, voice); List<MaryModule> l;
if (registrationComplete) throw new IllegalStateException("cannot register modules after registration is complete"); MaryDataType type = module.inputType(); Object o = mkm.get(type, locale, voice); List<MaryModule> l;
protected void processAndCompare(String basename, Locale locale) throws Exception { assert inputEnding() != null; assert outputEnding() != null; MaryData input = null; if (inputEnding().equals("txt")) { String in = loadResourceIntoString(basename + "." + inputEnding()); input = createMaryDataFromText(in, locale); } else { input = new MaryData(module.inputType(), locale); input.readFrom(this.getClass().getResourceAsStream(basename + "." + inputEnding()), null); } MaryData targetOut = new MaryData(module.outputType(), input.getLocale()); targetOut.readFrom(this.getClass().getResourceAsStream(basename + "." + outputEnding()), null); MaryData processedOut = module.process(input); try { DomUtils.compareNodes(targetOut.getDocument(), processedOut.getDocument(), true); } catch (Exception afe) { StringBuilder msg = new StringBuilder(); msg.append("XML documents are not equal\n"); msg.append("==========target:=============\n"); Document target = (Document) targetOut.getDocument().cloneNode(true); DomUtils.trimAllTextNodes(target); msg.append(DomUtils.document2String(target)).append("\n\n"); msg.append("==========processed:============\n"); Document processed = (Document) processedOut.getDocument().cloneNode(true); DomUtils.trimAllTextNodes(processed); msg.append(DomUtils.document2String(processed)).append("\n"); throw new Exception(msg.toString(), afe); } }
protected void processAndCompare(String basename, Locale locale) throws Exception { assert inputEnding() != null; assert outputEnding() != null; MaryData input = null; if (inputEnding().equals("txt")) { String in = loadResourceIntoString(basename + "." + inputEnding()); input = createMaryDataFromText(in, locale); } else { input = new MaryData(module.inputType(), locale); input.readFrom(this.getClass().getResourceAsStream(basename + "." + inputEnding()), null); } MaryData targetOut = new MaryData(module.outputType(), input.getLocale()); targetOut.readFrom(this.getClass().getResourceAsStream(basename + "." + outputEnding()), null); MaryData processedOut = module.process(input); try { DomUtils.compareNodes(targetOut.getDocument(), processedOut.getDocument(), true); } catch (Exception afe) { StringBuilder msg = new StringBuilder(); msg.append("XML documents are not equal\n"); msg.append("==========target:=============\n"); Document target = (Document) targetOut.getDocument().cloneNode(true); DomUtils.trimAllTextNodes(target); msg.append(DomUtils.document2String(target)).append("\n\n"); msg.append("==========processed:============\n"); Document processed = (Document) processedOut.getDocument().cloneNode(true); DomUtils.trimAllTextNodes(processed); msg.append(DomUtils.document2String(processed)).append("\n"); throw new Exception(msg.toString(), afe); } }
/** * Provide a list containing preferred modules for the specified input type * * @param wanted_input_type * the specified input type * @return the list of system wide preferred modules, null if none */ public static synchronized List<MaryModule> getPreferredModulesForInputType(MaryDataType wanted_input_type) { if (preferredModules != null) { List<MaryModule> v = new ArrayList<MaryModule>(); for (Iterator<MaryModule> it = preferredModules.iterator(); it.hasNext();) { MaryModule m = (MaryModule) it.next(); if (m.inputType().equals(wanted_input_type)) { v.add(m); } } if (v.size() > 0) return v; else return null; } return null; }
for (Iterator<MaryModule> it = preferredModules.iterator(); it.hasNext();) { MaryModule m = (MaryModule) it.next(); if (m.inputType().equals(type)) { v.add(m);
if (registrationComplete) throw new IllegalStateException("cannot register modules after registration is complete"); MaryDataType type = module.inputType(); Object o = mkm.get(type, locale, voice); List<MaryModule> l;