001    /*
002     * Copyright 2011 Christian Kumpe http://kumpe.de/christian/java
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package de.kumpe.hadooptimizer;
017    
018    import java.io.Serializable;
019    
020    /**
021     * A {@link Mutator} creates a mutant of the given individual. It mutates the
022     * individual e.g. by adding normal distributed random numbers.
023     * <p>
024     * <i>The general contract is to not modify the given individual. See
025     * {@link #mutate(Object)} for additional hints.</i>
026     * 
027     * @param <I>
028     *            the individuals' type
029     * 
030     * @author <a href="http://kumpe.de/christian/java">Christian Kumpe</a>
031     */
032    public interface Mutator<I> extends Serializable {
033            /**
034             * Creates a mutant of the given individual.
035             * <p>
036             * <i>The general contract is to not modify the given individual, but return
037             * a mutated copy.</i>
038             * 
039             * @param individual
040             *            the individual to mutate
041             * 
042             * @return the mutant of the passed individual
043             */
044            I mutate(I individual);
045    }