CombinedRecordMatcher extends AbstractRecordMatcher { public boolean add(IRecordMatcher matcher) { int matchKeySize = matcher.getRecordSize(); if (this.recordSize == 0) { this.recordSize = matchKeySize; } else { if (matchKeySize != this.recordSize) { return false; } } return this.matchers.add(matcher); }  @Override double getMatchingWeight(String[] record1, String[] record2); boolean add(IRecordMatcher matcher); @Override String getLabeledAttributeMatchWeights(); @Override boolean setAttributeMatchers(IAttributeMatcher[] attrMatchers); @Override boolean setAttributeWeights(double[] weights); @Override double getRecordMatchThreshold(); @Override String toString(); @Override MatchResult getMatchingWeight(Record record1, Record record2); IRecordMatcher getLastPositiveMatcher(); List<IRecordMatcher> getMatchers();  }
@Test public void testMatchThreshold() { IRecordMatcher recMatcher1 = RecordMatcherFactory.createMatcher(RecordMatcherType.simpleVSRMatcher, ATTRIBUTEMATCHERALGORITHMS, ATTRIBUTEWEIGHTS_1); IRecordMatcher recMatcher2 = RecordMatcherFactory.createMatcher(RecordMatcherType.simpleVSRMatcher, ATTRIBUTEMATCHERALGORITHMS, ATTRIBUTEWEIGHTS_2); CombinedRecordMatcher combMatcher = RecordMatcherFactory.createCombinedRecordMatcher(); assertTrue(combMatcher.add(recMatcher1)); assertTrue(combMatcher.add(recMatcher2)); int countMatches = countMatches(combMatcher); assertEquals(0, countMatches); recMatcher1.setRecordMatchThreshold(0.7); recMatcher2.setRecordMatchThreshold(0.9); countMatches = countMatches(combMatcher); assertNotSame(0, countMatches); }
@Test public void testAdd() { IRecordMatcher recMatcher1 = RecordMatcherFactory.createMatcher(RecordMatcherType.simpleVSRMatcher, ATTRIBUTEMATCHERALGORITHMS, ATTRIBUTEWEIGHTS_1); CombinedRecordMatcher combMatcher1 = RecordMatcherFactory.createCombinedRecordMatcher(); assertTrue(combMatcher1.add(recMatcher1)); IRecordMatcher recMatcher2 = RecordMatcherFactory.createMatcher(RecordMatcherType.simpleVSRMatcher, ATTRIBUTEMATCHERALGORITHMS, new double[] { 1.0, 3.0 }); assertNull("cannot create a matcher like this", recMatcher2); recMatcher2 = RecordMatcherFactory.createMatcher(RecordMatcherType.simpleVSRMatcher, new String[] { "EXACT", "EXACT" }, new double[] { 1.0, 3.0 }); assertFalse("cannot add a matcher with a different size", combMatcher1.add(recMatcher2)); recMatcher2 = RecordMatcherFactory.createMatcher(RecordMatcherType.simpleVSRMatcher, new String[] { "EXACT", "EXACT", "EXACT", "EXACT" }, ATTRIBUTEWEIGHTS_1); assertTrue(combMatcher1.add(recMatcher2)); }