/** * Finds the string in the <code>group</code> closest to * <code>key</code> and returns it. * * @return null if group.length==0. */ public static String findNearest( String key, String[] group ) { return findNearest(key, Arrays.asList(group)); }
/** * Finds a type name that this context recognizes which is * "closest" to the given type name. * * <p> * This method is used for error recovery. */ public String getNearestTypeName(QName name) { String[] all = new String[typeMap.size()]; int i=0; for (QName qn : typeMap.keySet()) { if(qn.getLocalPart().equals(name.getLocalPart())) return qn.toString(); // probably a match, as people often gets confused about namespace. all[i++] = qn.toString(); } String nearest = EditDistance.findNearest(name.toString(), all); if(EditDistance.editDistance(nearest,name.toString())>10) return null; // too far apart. return nearest; }
/** * Finds the string in the <code>group</code> closest to * <code>key</code> and returns it. * * @return null if group.length==0. */ public static String findNearest( String key, String[] group ) { return findNearest(key, Arrays.asList(group)); }
/** * Finds a type name that this context recognizes which is * "closest" to the given type name. * * <p> * This method is used for error recovery. */ public String getNearestTypeName(QName name) { String[] all = new String[typeMap.size()]; int i=0; for (QName qn : typeMap.keySet()) { if(qn.getLocalPart().equals(name.getLocalPart())) return qn.toString(); // probably a match, as people often gets confused about namespace. all[i++] = qn.toString(); } String nearest = EditDistance.findNearest(name.toString(), all); if(EditDistance.editDistance(nearest,name.toString())>10) return null; // too far apart. return nearest; }
/** * Finds the string in the <code>group</code> closest to * <code>key</code> and returns it. * * @return null if group.length==0. */ public static String findNearest( String key, String[] group ) { return findNearest(key, Arrays.asList(group)); }
/** * Finds the string in the <code>group</code> closest to * <code>key</code> and returns it. * * @return null if group.length==0. */ public static String findNearest( String key, String[] group ) { return findNearest(key, Arrays.asList(group)); }
/** * Finds the string in the <code>group</code> closest to * <code>key</code> and returns it. * * @return null if group.length==0. */ public static String findNearest( String key, String[] group ) { return findNearest(key, Arrays.asList(group)); }
/** * Finds the string in the <code>group</code> closest to * <code>key</code> and returns it. * * @return null if group.length==0. */ public static String findNearest( String key, String[] group ) { return findNearest(key, Arrays.asList(group)); }
/** * Finds a type name that this context recognizes which is * "closest" to the given type name. * * <p> * This method is used for error recovery. */ public String getNearestTypeName(QName name) { String[] all = new String[typeMap.size()]; int i=0; for (QName qn : typeMap.keySet()) { if(qn.getLocalPart().equals(name.getLocalPart())) return qn.toString(); // probably a match, as people often gets confused about namespace. all[i++] = qn.toString(); } String nearest = EditDistance.findNearest(name.toString(), all); if(EditDistance.editDistance(nearest,name.toString())>10) return null; // too far apart. return nearest; }
/** * Finds a type name that this context recognizes which is * "closest" to the given type name. * * <p> * This method is used for error recovery. */ public String getNearestTypeName(QName name) { String[] all = new String[typeMap.size()]; int i=0; for (QName qn : typeMap.keySet()) { if(qn.getLocalPart().equals(name.getLocalPart())) return qn.toString(); // probably a match, as people often gets confused about namespace. all[i++] = qn.toString(); } String nearest = EditDistance.findNearest(name.toString(), all); if(EditDistance.editDistance(nearest,name.toString())>10) return null; // too far apart. return nearest; }
/** * Sets the schema language. */ public void setLanguage(String language) { Language l = Language.valueOf(language.toUpperCase()); if(l==null) { Language[] languages = Language.values(); String[] candidates = new String[languages.length]; for( int i=0; i<candidates.length; i++ ) candidates[i] = languages[i].name(); throw new BuildException("Unrecognized language: "+language+". Did you mean "+ EditDistance.findNearest(language.toUpperCase(),candidates)+" ?"); } options.setSchemaLanguage(l); }
/** * Sets the schema language. */ public void setLanguage(String language) { Language l = Language.valueOf(language.toUpperCase()); if(l==null) { Language[] languages = Language.values(); String[] candidates = new String[languages.length]; for( int i=0; i<candidates.length; i++ ) candidates[i] = languages[i].name(); throw new BuildException("Unrecognized language: "+language+". Did you mean "+ EditDistance.findNearest(language.toUpperCase(),candidates)+" ?"); } options.setSchemaLanguage(l); }
/** * Sets the schema language. */ public void setLanguage(String language) { Language l = Language.valueOf(language.toUpperCase()); if (l == null) { Language[] languages = Language.values(); String[] candidates = new String[languages.length]; for (int i = 0; i < candidates.length; i++) candidates[i] = languages[i].name(); throw new BuildException("Unrecognized language: " + language + ". Did you mean " + EditDistance.findNearest(language.toUpperCase(), candidates) + " ?"); } options.setSchemaLanguage(l); }
/** * Sets the schema language. */ public void setLanguage(String language) { Language l = Language.valueOf(language.toUpperCase()); if (l == null) { Language[] languages = Language.values(); String[] candidates = new String[languages.length]; for (int i = 0; i < candidates.length; i++) candidates[i] = languages[i].name(); throw new BuildException("Unrecognized language: " + language + ". Did you mean " + EditDistance.findNearest(language.toUpperCase(), candidates) + " ?"); } options.setSchemaLanguage(l); }
/** * Sets the schema language. */ public void setLanguage(String language) { Language l = Language.valueOf(language.toUpperCase()); if (l == null) { Language[] languages = Language.values(); String[] candidates = new String[languages.length]; for (int i = 0; i < candidates.length; i++) candidates[i] = languages[i].name(); throw new BuildException("Unrecognized language: " + language + ". Did you mean " + EditDistance.findNearest(language.toUpperCase(), candidates) + " ?"); } options.setSchemaLanguage(l); }
String nearest = EditDistance.findNearest(uri, recognizableExtensions);
String nearest = EditDistance.findNearest(uri, recognizableExtensions);
String nearest = EditDistance.findNearest(uri, recognizableExtensions);
String nearest = EditDistance.findNearest(uri, recognizableExtensions);
String nearest = EditDistance.findNearest(uri, recognizableExtensions);