Package no.priv.garshol.duke

Examples of no.priv.garshol.duke.ConfigurationImpl$HighComparator


    csv.setInputFile(outfile.getAbsolutePath());
    csv.addColumn(new Column("id", null, null, null));
    csv.addColumn(new Column("name", null, null, null));
    csv.addColumn(new Column("age", null, null, null));

    ConfigurationImpl cfg = new ConfigurationImpl();
    cfg.addDatabase(new InMemoryDatabase());
    cfg.addDataSource(0, csv);

    Comparator cmp = new ExactComparator();

    List<Property> props = new ArrayList();
    props.add(new PropertyImpl("id"));
    props.add(new PropertyImpl("name", cmp, 0.0, 1.0));
    props.add(new PropertyImpl("age", cmp, 0.0, 1.0));

    cfg.setProperties(props);

    GeneticAlgorithm gen = new GeneticAlgorithm(cfg, tstfile.getAbsolutePath(),
                                                true);
    gen.setQuiet(true);
    gen.run(); // should not crash!
View Full Code Here


  private String propName = "NAME";
 
  @Before
  public void setup() {
   
    config1 = new ConfigurationImpl()
   
    List<Property> props = new ArrayList<Property>();
    props.add(new PropertyImpl("ID"));
    props.add(new PropertyImpl(propName, null, 0.3, 0.8));   
   
View Full Code Here

    Property name = new PropertyImpl("NAME", comp, 0.3, 0.8);
    props.add(name);
    Property email = new PropertyImpl("EMAIL", comp, 0.3, 0.8);
    props.add(email);

    ConfigurationImpl config = new ConfigurationImpl();
    config.setThreshold(0.85);
    config.setProperties(props);

    Collection<Property> lookups = config.getLookupProperties();
    assertEquals(2, lookups.size());
    assertTrue(lookups.contains(name));
    assertTrue(lookups.contains(email));

    config.validate();
  }
View Full Code Here

    props.add(name);
    Property email = new PropertyImpl("EMAIL", comp, 0.3, 0.8);
    props.add(email);
    props.add(new PropertyImpl("IGNORE", comp, 0.0, 0.0));

    ConfigurationImpl config = new ConfigurationImpl();
    config.setThreshold(0.85);
    config.setProperties(props);

    Collection<Property> lookups = config.getLookupProperties();
    assertEquals(2, lookups.size());
    assertTrue(lookups.contains(name));
    assertTrue(lookups.contains(email));

    config.validate();
  }
View Full Code Here

    props.add(name);
    props.add(new PropertyImpl("EMAIL", comp, 0.0, 0.0));
    props.add(new PropertyImpl("IGNORE", comp, 0.0, 0.0));
    props.add(new PropertyImpl("IGNORE2", comp, 0.0, 0.0));

    ConfigurationImpl config = new ConfigurationImpl();
    config.setThreshold(0.85);
    config.setProperties(props);

    Collection<Property> lookups = config.getLookupProperties();
    assertEquals(lookups.size(), 1);
    assertTrue(lookups.contains(name));

    config.validate();
  }
View Full Code Here

    config.validate();
  }

  @Test
  public void testNoProperties() throws IOException {
    ConfigurationImpl config = new ConfigurationImpl();

    try {
      config.validate();
      fail("Configuration with no properties accepted");
    } catch (DukeConfigException e) {
      // yep, should fail, because it doesn't have *any* properties
    }
  }
View Full Code Here

    Property name = new PropertyImpl("NAME", comp, 0.3, 0.8);
    props.add(name);
    Property email = new PropertyImpl("EMAIL", comp, 0.3, 0.8);
    props.add(email);

    ConfigurationImpl config = new ConfigurationImpl();
    config.setThreshold(0.85);
    config.setProperties(props);

    try {
      config.validate();
      fail("Configuration with no ID properties accepted");
    } catch (DukeConfigException e) {
      // yep, should fail, due to lack of ID property
    }
  }
View Full Code Here

    Property name = new PropertyImpl("NAME", comp, 0.3, 0.8);
    props.add(name);
    Property email = new PropertyImpl("EMAIL", comp, 0.3, 0.8);
    props.add(email);

    ConfigurationImpl config = new ConfigurationImpl();
    config.setThreshold(1.0);
    config.setProperties(props);

    try {
      config.validate();
      fail("Configuration which will never match anything accepted");
    } catch (DukeConfigException e) {
      // should fail, because cannot match any records, even if all
      // properties match 100%
    }
View Full Code Here

    Property name = new PropertyImpl("NAME", comp, 0.3, 0.8);
    props.add(name);
    Property email = new PropertyImpl("EMAIL", comp, 0.3, 0.8);
    props.add(email);

    ConfigurationImpl config = new ConfigurationImpl();
    config.setThreshold(0.85);
    config.setProperties(props);
    config.validate();

    Collection<Property> lookups = config.getLookupProperties();
    assertEquals(2, lookups.size());
    assertTrue(lookups.contains(name));
    assertTrue(lookups.contains(email));
  }
View Full Code Here

    props.add(name);
    Property email = new PropertyImpl("EMAIL", comp, 0.3, 0.8);
    email.setLookupBehaviour(Property.Lookup.DEFAULT);
    props.add(email);

    ConfigurationImpl config = new ConfigurationImpl();
    config.setThreshold(0.85);
    config.setProperties(props);
    config.validate();

    Collection<Property> lookups = config.getLookupProperties();
    assertEquals(2, lookups.size());
    assertTrue(lookups.contains(name));
    assertTrue(lookups.contains(email));
  }
View Full Code Here

TOP

Related Classes of no.priv.garshol.duke.ConfigurationImpl$HighComparator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.