Package no.priv.garshol.duke

Examples of no.priv.garshol.duke.Property


  }

  @Test
  public void canAddCustomComparator() {
    GeneticConfiguration conf = new GeneticConfiguration(config1);     
  Property aspectProp = new PropertyImpl(propName, null, 0.5, 0.5);
  List<Comparator> compList = new ArrayList<Comparator>();
  compList.add(comparator);
  ComparatorAspect aspect = new ComparatorAspect(aspectProp, compList);
 
  aspect.setRandomly(conf);
 
  Property updatedProp = config1.getPropertyByName(propName);
  Comparator randomComparator = updatedProp.getComparator();
    assertTrue("should have custom comparator set, but has : " + randomComparator.getClass(), randomComparator.equals(comparator));
  }
View Full Code Here


  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;
  }
View Full Code Here

    return differences;
  }
 
  private int checkProperty(String name, Configuration config,
                            Configuration rand) {
    Property prop = rand.getPropertyByName(name);
    Property orig = config.getPropertyByName(name);

    int differences = 0;
    if (!prop.getComparator().equals(orig.getComparator()))
      differences++;
    if (prop.getHighProbability() != orig.getHighProbability())
      differences++;
    if (prop.getLowProbability() != orig.getLowProbability())
      differences++;
    return differences;
  }
View Full Code Here

  @Test
  public void testTrivial() throws IOException {
    ExactComparator comp = new ExactComparator();
    List<Property> props = new ArrayList();
    props.add(new PropertyImpl("ID"));
    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);
View Full Code Here

  @Test
  public void testWithZeroes() throws IOException {
    ExactComparator comp = new ExactComparator();
    List<Property> props = new ArrayList();
    props.add(new PropertyImpl("ID"));
    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);
    props.add(new PropertyImpl("IGNORE", comp, 0.0, 0.0));

    ConfigurationImpl config = new ConfigurationImpl();
    config.setThreshold(0.85);
View Full Code Here

  @Test
  public void testJustOne() throws IOException {
    ExactComparator comp = new ExactComparator();
    List<Property> props = new ArrayList();
    props.add(new PropertyImpl("ID"));
    Property name = new PropertyImpl("NAME", comp, 0.0, 1.0);
    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));
View Full Code Here

 
  @Test
  public void testNoIdProperties() throws IOException {
    ExactComparator comp = new ExactComparator();
    List<Property> props = new ArrayList();
    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);
View Full Code Here

  @Test
  public void testThresholdTooHigh() throws IOException {
    ExactComparator comp = new ExactComparator();
    List<Property> props = new ArrayList();
    props.add(new PropertyImpl("ID"));
    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);
View Full Code Here

  @Test
  public void testLookupProperties() throws IOException {
    ExactComparator comp = new ExactComparator();
    List<Property> props = new ArrayList();
    props.add(new PropertyImpl("ID"));
    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);
View Full Code Here

  @Test
  public void testLookupPropertiesDefault() throws IOException {
    ExactComparator comp = new ExactComparator();
    List<Property> props = new ArrayList();
    props.add(new PropertyImpl("ID"));
    Property name = new PropertyImpl("NAME", comp, 0.3, 0.8);
    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);
View Full Code Here

TOP

Related Classes of no.priv.garshol.duke.Property

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.