Package org.apache.lucene.facet.index.attributes

Examples of org.apache.lucene.facet.index.attributes.CategoryAttribute.addProperty()


     * properties, but it is kept here for two reasons: 1) Using the array
     * version has some performance cost, and 2) it is expected that most
     * calls will be for this version (single property).
     */
    CategoryAttribute ca = mapCategoryAttribute(categoryPath);
    ca.addProperty(property);
    return ca;
  }

  /**
   * Add a category with multiple properties.
View Full Code Here


   */
  public CategoryAttribute addCategory(CategoryPath categoryPath,
      CategoryProperty... properties) throws FacetException {
    CategoryAttribute ca = mapCategoryAttribute(categoryPath);
    for (CategoryProperty attribute : properties) {
      ca.addProperty(attribute);
    }
    return ca;
  }

  /**
 
View Full Code Here

        .getCategoryPath());
    Set<Class<? extends CategoryProperty>> propertyClasses = categoryAttribute
    .getPropertyClasses();
    if (propertyClasses != null) {
      for (Class<? extends CategoryProperty> propertyClass : propertyClasses) {
        ca.addProperty(categoryAttribute.getProperty(propertyClass));
      }
    }
    return ca;
  }
View Full Code Here

   */
  @Test
  public void testAddCategoryAttributeWithProperty() throws FacetException {
    CategoryAttribute newCA = new CategoryAttributeImpl(new CategoryPath(
        "seven", "eight"));
    newCA.addProperty(new DummyProperty());
    categoryContainer.addCategory(newCA);
    Iterator<CategoryAttribute> iterator = categoryContainer.iterator();

    // count the number of tokens, and check there is one DummyAttribute
    int nCategories;
View Full Code Here

    assertNull("Attribute should be null", ca
        .getProperty(DummyProperty.class));
    assertNull("Attribute classes should be null", ca.getPropertyClasses());

    ca.addProperty(new DummyProperty());
    assertEquals("DummyProperty should be in properties",
        new DummyProperty(), ca.getProperty(DummyProperty.class));
    assertEquals("Attribute classes should contain 1 element", 1, ca
        .getPropertyClasses().size());
View Full Code Here

    assertEquals("Attribute classes should contain 1 element", 1, ca
        .getPropertyClasses().size());

    boolean failed = false;
    try {
      ca.addProperty(new DummyProperty());
    } catch (UnsupportedOperationException e) {
      failed = true;
    }

    if (!failed) {
View Full Code Here

    }

    ca.clearProperties();
    assertNull("Attribute classes should be null", ca.getPropertyClasses());

    ca.addProperty(new DummyProperty());
    assertEquals("DummyProperty should be in properties",
        new DummyProperty(), ca.getProperty(DummyProperty.class));
    ca.remove(DummyProperty.class);
    assertEquals("DummyProperty should not be in properties", null, ca
        .getProperty(DummyProperty.class));
View Full Code Here

    ca.remove(DummyProperty.class);
    assertEquals("DummyProperty should not be in properties", null, ca
        .getProperty(DummyProperty.class));
    assertNull("Attribute classes should be null", ca.getPropertyClasses());

    ca.addProperty(new DummyProperty());
    List<Class<? extends CategoryProperty>> propertyClasses = new ArrayList<Class<? extends CategoryProperty>>();
    assertEquals("No property expected when no classes given", null, ca
        .getProperty(propertyClasses));
    propertyClasses.add(DummyProperty.class);
    assertEquals("DummyProperty should be in properties",
View Full Code Here

     * properties, but it is kept here for two reasons: 1) Using the array
     * version has some performance cost, and 2) it is expected that most
     * calls will be for this version (single property).
     */
    CategoryAttribute ca = mapCategoryAttribute(categoryPath);
    ca.addProperty(property);
    return ca;
  }

  /**
   * Add a category with multiple properties.
View Full Code Here

   */
  public CategoryAttribute addCategory(CategoryPath categoryPath,
      CategoryProperty... properties) {
    CategoryAttribute ca = mapCategoryAttribute(categoryPath);
    for (CategoryProperty attribute : properties) {
      ca.addProperty(attribute);
    }
    return ca;
  }

  /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.