Package no.priv.garshol.duke

Examples of no.priv.garshol.duke.Property


  @Test
  public void testLookupPropertiesTurnedOn() 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);
    Property phone = new PropertyImpl("PHONE", comp, 0.4, 0.51);
    props.add(phone);
    phone.setLookupBehaviour(Property.Lookup.TRUE);

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


  @Test
  public void testLookupPropertiesNotByDefault() throws IOException {
    ExactComparator comp = new ExactComparator();
    List<Property> props = new ArrayList();
    props.add(new PropertyImpl("ID"));
    Property name = new PropertyImpl("NAME", comp, 0.48, 0.8);
    props.add(name);
    Property email = new PropertyImpl("EMAIL", comp, 0.48, 0.8);
    props.add(email);
    Property phone = new PropertyImpl("PHONE", comp, 0.48, 0.51);
    props.add(phone);

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

  @Test
  public void testLookupPropertiesRequired() 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);
    Property phone = new PropertyImpl("PHONE", comp, 0.4, 0.51);
    props.add(phone);
    phone.setLookupBehaviour(Property.Lookup.REQUIRED);

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

    this.comparators = comparators;
  }

  public void setRandomly(GeneticConfiguration cfg) {
    Configuration config = cfg.getConfiguration();
    Property p = config.getPropertyByName(prop.getName());
    p.setComparator(comparators.get((int) (comparators.size() * Math.random())));
  }
View Full Code Here

  public void setFromOther(GeneticConfiguration cfg1,
                           GeneticConfiguration cfg2) {
    Configuration config = cfg1.getConfiguration();
    Configuration other = cfg2.getConfiguration();

    Property p1 = config.getPropertyByName(prop.getName());
    Property p2 = other.getPropertyByName(prop.getName());
    p1.setComparator(p2.getComparator());
  }
View Full Code Here

    this.prop = prop;
  }

  public void setRandomly(GeneticConfiguration cfg) {
    Configuration config = cfg.getConfiguration();
    Property p = config.getPropertyByName(prop.getName());
    double new_value = drift(config.getThreshold(), 0.5, 0.0);
    p.setLowProbability(new_value);
  }
View Full Code Here

  public void setFromOther(GeneticConfiguration cfg1,
                           GeneticConfiguration cfg2) {
    Configuration config = cfg1.getConfiguration();
    Configuration other = cfg2.getConfiguration();

    Property p1 = config.getPropertyByName(prop.getName());
    Property p2 = other.getPropertyByName(prop.getName());
    p1.setLowProbability(p2.getLowProbability());
  }
View Full Code Here

    assertTrue(config.getDataSources(2).isEmpty());
    assertEquals(config.getThreshold(), 0.85);
    assertEquals(config.getMaybeThreshold(), 0.7);
    assertEquals(3, config.getProperties().size());

    Property prop = config.getPropertyByName("ID");
    assertTrue("ID property lost", prop.isIdProperty());

    prop = config.getPropertyByName("NAME");
    assertEquals(lev.getClass(), prop.getComparator().getClass());
    assertEquals(0.3, prop.getLowProbability());
    assertEquals(0.8, prop.getHighProbability());

    prop = config.getPropertyByName("EMAIL");
    assertEquals(lev.getClass(), prop.getComparator().getClass());
    assertEquals(0.3, prop.getLowProbability());
    assertEquals(0.8, prop.getHighProbability());
  }
View Full Code Here

    this.prop = prop;
  }

  public void setRandomly(GeneticConfiguration cfg) {
    Configuration config = cfg.getConfiguration();
    Property p = config.getPropertyByName(prop.getName());
    double new_value = drift(config.getThreshold(), 1.0, 0.5);
    p.setHighProbability(new_value);
  }
View Full Code Here

  public void setFromOther(GeneticConfiguration cfg1,
                           GeneticConfiguration cfg2) {
    Configuration config = cfg1.getConfiguration();
    Configuration other = cfg2.getConfiguration();

    Property p1 = config.getPropertyByName(prop.getName());
    Property p2 = other.getPropertyByName(prop.getName());
    p1.setHighProbability(p2.getHighProbability());
  }
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.