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

es.uam.eps.ir.relison.diffusion.metrics.distributions.AbstractDistribution Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2020 Information Retrieval Group at Universidad Autónoma
 * de Madrid, http://ir.ii.uam.es
 *
 *  This Source Code Form is subject to the terms of the Mozilla Public
 *  License, v. 2.0. If a copy of the MPL was not distributed with this
 *  file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package es.uam.eps.ir.relison.diffusion.metrics.distributions;

import es.uam.eps.ir.relison.diffusion.data.Data;

import java.io.Serializable;

/**
 * Abstract class for defining a distribution of elements.
 *
 * @author Javier Sanz-Cruzado ([email protected])
 * @author Pablo Castells ([email protected])
 *
 * @param  Type of the users.
 * @param  Type of the information pieces.
 * @param  Type of the features.
 */
public abstract class AbstractDistribution implements Distribution
{
    /**
     * The complete data.
     */
    protected Data data;
    /**
     * Indicates if it has been initialized.
     */
    protected boolean initialized;
    
    /**
     * The distribution name
     */
    private final String name;
    
    /**
     * Constructor
     * @param name the distribution name. 
     */
    public AbstractDistribution(String name)
    {
        this.name = name;
    }
    
    @Override
    public void initialize(Data data)
    {
        this.data = data;
        this.initialize();
    }
    
    /**
     * Initializes the necessary variables.
     */
    protected abstract void initialize();
    
    @Override
    public String getName()
    {
        return this.name;
    }
    
    @Override
    public boolean isInitialized()
    {
        return this.initialized;
    }
}