All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aksw.commons.accessors.CollectionAccessor Maven / Gradle / Ivy

package org.aksw.commons.accessors;

import java.util.Collection;

import com.google.common.base.Converter;
import com.google.common.collect.Range;

/**
 * Not sure if this this should really inherit from single valued accessor
 * -> Maybe rename to BasicAccessor or SimpleAccessor
 * 
 * 
 * @author raven May 2, 2018
 *
 * @param 
 */
public interface CollectionAccessor
//	extends SingleValuedAccessor>
{
	/**
	 * Returns the multiplicity of the underlying collection
	 * This is the minimum and maximum number of items this collection may hold.
	 * If a minimum exists, it is assumed that the collection's iterator yields those immutable entries first.
	 * 
	 * @return
	 */
	Range getMultiplicity();
	Collection get();
	
	default  CollectionAccessor convert(Converter converter) {
		return new CollectionAccessorFromConverter<>(this, converter);
	}

}