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

org.opentripplanner.analyst.batch.Population Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
/* This program is free software: you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public License
 as published by the Free Software Foundation, either version 3 of
 the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see . */

package org.opentripplanner.analyst.batch;

import java.util.List;

/**
 * A collection of individual locations that will be used as either the origin set or the 
 * destination set in a many-to-many (batch Analyst) search.
 * 
 * An iterator over a population will skip those individuals that have been marked as rejected by
 * its filter chain, and is not the same as an iterator over a population's list of individuals. 
 * 
 * @author andrewbyrd
 */
public interface Population extends Iterable {

    public void addIndividual(Individual individual);

    public void clearIndividuals(List individuals);

    /** @return the number of individuals in this population. */
    public int size();

    /**
     * Prepare the population for use. This includes loading or generating the individuals, 
     * filtering them, but not sampling (linking them into the graph) because origin populations
     * do not need to be permanently linked.
     */
    public void setup();

    /**
     * Subclass-specific method to load the individuals from a file or create them based on other 
     * properties. This method should fill in all fields of each individual except the sample, 
     * since sampling will be carried out after the filter chain is applied.
     */
    public void createIndividuals();

    /**
     * Save the output data in this population to a file, using a format that is appropriate for the 
     * specific class of population. For example, a population loaded from an image file or 
     * generated on a regular grid will be saved as a Geotiff raster. A population of points that 
     * are not known to be aligned on a regular grid in some CRS will be saved as a CSV file.
     */
    public void writeAppropriateFormat(String fileName, ResultSet results);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy