source: java/ecj/cecj/archive/ArchivingSubpopulation.java @ 193

Last change on this file since 193 was 193, checked in by Maciej Komosinski, 11 years ago

Set svn:eol-style native for all textual files

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1/*
2  Copyright 2009 by Marcin Szubert
3  Licensed under the Academic Free License version 3.0
4 */
5
6package cecj.archive;
7
8import java.util.ArrayList;
9import java.util.Arrays;
10import java.util.List;
11
12import ec.EvolutionState;
13import ec.Group;
14import ec.Individual;
15import ec.Subpopulation;
16import ec.util.Parameter;
17
18/**
19 *
20 * @author Marcin Szubert
21 *
22 */
23public class ArchivingSubpopulation extends Subpopulation {
24
25        private List<Individual> archiveIndividuals;
26
27        @Override
28        public void setup(EvolutionState state, Parameter base) {
29                super.setup(state, base);
30                archiveIndividuals = new ArrayList<Individual>();
31        }
32
33        @Override
34        public Group emptyClone() {
35                ArchivingSubpopulation subpopulation = (ArchivingSubpopulation) super.emptyClone();
36                subpopulation.archiveIndividuals = archiveIndividuals;
37                return subpopulation;
38        }
39
40        /**
41         * Returns the list of archival individuals.
42         *
43         * @return the list of archival individuals
44         */
45        public List<Individual> getArchivalIndividuals() {
46                return archiveIndividuals;
47        }
48
49        /**
50         * Returns the list of population individuals.
51         *
52         * @return the list of population individuals
53         */
54        public List<Individual> getIndividuals() {
55                return Arrays.asList(individuals);
56        }
57}
Note: See TracBrowser for help on using the repository browser.