/** * The properties which are used to identify records, rather than * compare them. */ public Collection<Property> getIdentityProperties() { Collection<Property> ids = new ArrayList(); for (Property p : getProperties()) if (p.isIdProperty()) ids.add(p); return ids; }
/** * Creates a new processor, bound to the given database. */ public Processor(Configuration config, Database database) { this.config = config; this.database1 = database; // using this List implementation so that listeners can be removed // while Duke is running (see issue 117) this.listeners = new CopyOnWriteArrayList<MatchListener>(); this.logger = new DummyLogger(); this.threads = 1; // precomputing for later optimizations this.proporder = new ArrayList(); for (Property p : config.getProperties()) if (!p.isIdProperty()) proporder.add(p); Collections.sort(proporder, new PropertyComparator()); // still precomputing double prob = 0.5; accprob = new double[proporder.size()]; for (int ix = proporder.size() - 1; ix >= 0; ix--) { prob = Utils.computeBayes(prob, proporder.get(ix).getHighProbability()); accprob[ix] = prob; } }
private String getid(Record r) { for (String propname : r.getProperties()) if (config.getPropertyByName(propname).isIdProperty()) return r.getValue(propname); return null; } }
if (!prop.isIdProperty() && !prop.isIgnoreProperty() && prop.getLookupBehaviour() != Property.Lookup.FALSE &&
private String getid(Record r) { for (String propname : r.getProperties()) { Property prop = config.getPropertyByName(propname); if (prop == null) throw new DukeConfigException("Record has property " + propname + " which is not in configuration"); if (prop.isIdProperty()) return r.getValue(propname); } return null; }
aspects.add(new ThresholdAspect()); for (Property prop : config.getProperties()) { if (!prop.isIdProperty()) { if (evolve_comparators) aspects.add(new ComparatorAspect(prop, comparators));
/** * Returns the brief summary used in the command-line output. */ public String toString() { StringBuilder buf = new StringBuilder(); buf.append("[GeneticConfiguration " + shortnum(config.getThreshold())); for (Property p : config.getProperties()) if (p.isIdProperty()) buf.append(" [" + p.getName() + "]"); else buf.append(" [" + p.getName() + " " + shortname(p.getComparator()) + " " + shortnum(p.getHighProbability()) + " " + shortnum(p.getLowProbability()) + "]"); buf.append(" mr=" + mutation_rate + " rr=" + shortnum(recombination_rate)); buf.append("]"); return buf.toString(); }
if (prop.isIdProperty()) { id = record.getValue(propname); } else {
if (prop.isIdProperty()) continue;
if (prop == null) continue; // means the property is unknown if (prop.isIdProperty() || prop.isIgnoreProperty()) continue;
} else { Field.Index ix; if (prop.isIdProperty())
private void writeProperty(Property prop) { AttributeListImpl atts = new AttributeListImpl(); if (prop.isIdProperty()) atts.addAttribute("type", "CDATA", "id"); else if (prop.isIgnoreProperty()) atts.addAttribute("type", "CDATA", "ignore"); if (!prop.isIdProperty() && prop.getLookupBehaviour() != Property.Lookup.DEFAULT) { String value = prop.getLookupBehaviour().toString().toLowerCase(); atts.addAttribute("lookup", "CDATA", value); } pp.startElement("property", atts); writeElement("name", prop.getName()); if (prop.getComparator() != null) writeElement("comparator", prop.getComparator().getClass().getName()); if (prop.getLowProbability() != 0.0) writeElement("low", "" + prop.getLowProbability()); if (prop.getHighProbability() != 0.0) writeElement("high", "" + prop.getHighProbability()); pp.endElement("property"); }
assertTrue("ID property lost", prop.isIdProperty());
private int countDifferences(Configuration config, Configuration rand) { int differences = 0; if (rand.getThreshold() != config.getThreshold()) differences += 1; Property prop = rand.getPropertyByName("ID"); assertTrue("ID property lost", prop.isIdProperty()); differences += checkProperty("NAME", config, rand); differences += checkProperty("EMAIL", config, rand); return differences; }
assertTrue("ID property lost", prop.isIdProperty());
assertTrue("ID property lost", prop.isIdProperty());
assertTrue("ID property lost", prop.isIdProperty());
/** * The properties which are used to identify records, rather than * compare them. */ public Collection<Property> getIdentityProperties() { Collection<Property> ids = new ArrayList(); for (Property p : getProperties()) if (p.isIdProperty()) ids.add(p); return ids; }
private String getid(Record r) { for (String propname : r.getProperties()) if (config.getPropertyByName(propname).isIdProperty()) return r.getValue(propname); return null; }
private String getid(Record r) { for (String propname : r.getProperties()) if (config.getPropertyByName(propname).isIdProperty()) return r.getValue(propname); return null; } }