private boolean xcheck() { Object[] lists = allSynonyms.getCollections().toArray(); for(int i=0; i < lists.length; i++) { List<String> li = (List<String>) lists[i]; for(int j=i+1; j < lists.length; j++) { if(!Collections.disjoint(li, (Collection<?>) lists[j])) { log.error("different synonyms groups intercection found: " + li.toString() + " has names in common with " + lists[j].toString()); return false; } } } return true; // now intersection found :) }
private List<String> getSynonymsForName(String name, CompositeCollection<String> groups) { String dbName = dbName(name); for(Collection<String> group : groups.getCollections()) { if (group.contains(dbName)) { return (List<String>) group; } } return Collections.emptyList(); }
private boolean xcheck() { Object[] lists = allSynonyms.getCollections().toArray(); for(int i=0; i < lists.length; i++) { List<String> li = (List<String>) lists[i]; for(int j=i+1; j < lists.length; j++) { if(!Collections.disjoint(li, (Collection<?>) lists[j])) { log.error("different synonyms groups intercection found: " + li.toString() + " has names in common with " + lists[j].toString()); return false; } } } return true; // now intersection found :) }
private List<String> getSynonymsForName(String name, CompositeCollection<String> groups) { String dbName = dbName(name); for(Collection<String> group : groups.getCollections()) { if (group.contains(dbName)) { return (List<String>) group; //copy to protect } } return Collections.emptyList(); }
/** * Gets the primary name for the DB. * It returns NULL for "unknown" database name. * * @param name case insensitive * @return */ public String getPrimaryDbName(String name) { String dbName = dbName(name); for(Collection<String> group : allSynonyms.getCollections()) { if (group.contains(dbName)) { return group.iterator().next(); //get the first } } return null; }
allSynonyms.addComposited((Collection<? extends String>[]) extraGroups.getCollections().toArray()); Set<Set<Collection<String>>> groupsOfGroups = clus.cluster(allSynonyms.getCollections(), Integer.MAX_VALUE);
allSynonyms.addComposited((Collection<? extends String>[]) extraGroups.getCollections().toArray()); Set<Set<Collection<String>>> groupsOfGroups = clus.cluster(allSynonyms.getCollections(), Integer.MAX_VALUE);