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

org.qsardb.model.PredictionRegistry Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2009 University of Tartu
 */
package org.qsardb.model;

import java.util.*;

import javax.xml.bind.annotation.*;

@XmlRootElement (
	name = "PredictionRegistry"
)
@XmlType (
	name = "PredictionRegistry"
)
public class PredictionRegistry extends ParameterRegistry {

	@XmlElementRef (
		type = Prediction.class
	)
	private List predictions = new ArrayList();


	PredictionRegistry(){
	}

	PredictionRegistry(Qdb qdb){
		super(qdb);
	}

	@Override
	List getList(){
		return this.predictions;
	}

	@Override
	String type(){
		return "predictions";
	}

	/**
	 * @see Prediction#getModel()
	 */
	public Collection getByModel(final Model model){
		ContainerFilter filter = new ContainerFilter(){

			public boolean accept(Prediction prediction){
				return ObjectUtil.equals(prediction.getModel(), model);
			}
		};

		return getAll(filter);
	}

	/**
	 * @see Prediction#getModel()
	 * @see Prediction#getType()
	 */
	public Collection getByModelAndType(final Model model, final Prediction.Type type){
		return getByModelAndType(model, EnumSet.of(type));
	}

	public Collection getByModelAndType(final Model model, final EnumSet types){
		ContainerFilter filter = new ContainerFilter(){

			public boolean accept(Prediction prediction){
				return ObjectUtil.equals(prediction.getModel(), model) && types.contains(prediction.getType());
			}
		};

		return getAll(filter);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy