Skip to content

Add Genotype::slice method #862

Closed
Closed
@jenetics

Description

Add a method, which allows to create a sliced (chromosome) view onto a given Genotype.

Genotype<G> slice(int fromIndex, int toIndex)

Usage:

final Genotype<DoubleGene> genotype = Genotype.of(
    DoubleChromosome.of(0, 10, 100),
    DoubleChromosome.of(0, 10, 50),
    DoubleChromosome.of(0, 10, 40),
    DoubleChromosome.of(0, 10, 10),
    DoubleChromosome.of(0, 10, 30)
);
assert genotype.length() == 5;

final Genotype<DoubleGene> slice = genotype.slice(1, 3);
assert slice.length() == 2;

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions