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

org.evosuite.testcase.ExecutableChromosome Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (C) 2010-2018 Gordon Fraser, Andrea Arcuri and EvoSuite
 * contributors
 *
 * This file is part of EvoSuite.
 *
 * EvoSuite 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.0 of the License, or
 * (at your option) any later version.
 *
 * EvoSuite 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
 * Lesser Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with EvoSuite. If not, see .
 */
package org.evosuite.testcase;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.HashMap;
import java.util.Map;

import org.evosuite.coverage.mutation.Mutation;
import org.evosuite.coverage.mutation.MutationExecutionResult;
import org.evosuite.ga.Chromosome;
import org.evosuite.testcase.execution.ExecutionResult;
import org.evosuite.testsuite.TestSuiteFitnessFunction;
public abstract class ExecutableChromosome extends Chromosome {
	private static final long serialVersionUID = 1L;

	protected transient ExecutionResult lastExecutionResult = null;

	protected transient Map lastMutationResult = new HashMap();

	/**
	 * 

Constructor for ExecutableChromosome.

*/ public ExecutableChromosome() { super(); } /** *

Setter for the field lastExecutionResult.

* * @param lastExecutionResult a {@link org.evosuite.testcase.execution.ExecutionResult} object. */ public void setLastExecutionResult(ExecutionResult lastExecutionResult) { this.lastExecutionResult = lastExecutionResult; } /** *

Getter for the field lastExecutionResult.

* * @return a {@link org.evosuite.testcase.execution.ExecutionResult} object. */ public ExecutionResult getLastExecutionResult() { return lastExecutionResult; } /** *

Setter for the field lastExecutionResult.

* * @param lastExecutionResult a {@link org.evosuite.coverage.mutation.MutationExecutionResult} object. * @param mutation a {@link org.evosuite.coverage.mutation.Mutation} object. */ public void setLastExecutionResult(MutationExecutionResult lastExecutionResult, Mutation mutation) { this.lastMutationResult.put(mutation, lastExecutionResult); } /** *

Getter for the field lastExecutionResult.

* * @param mutation a {@link org.evosuite.coverage.mutation.Mutation} object. * @return a {@link org.evosuite.coverage.mutation.MutationExecutionResult} object. */ public MutationExecutionResult getLastExecutionResult(Mutation mutation) { return lastMutationResult.get(mutation); } /** *

clearCachedResults

*/ public void clearCachedResults() { this.lastExecutionResult = null; lastMutationResult.clear(); } /** *

clearCachedMutationResults

*/ public void clearCachedMutationResults() { lastMutationResult.clear(); } /** *

copyCachedResults

* * @param other a {@link org.evosuite.testcase.ExecutableChromosome} object. */ protected abstract void copyCachedResults(ExecutableChromosome other); /** *

executeForFitnessFunction

* * @param testSuiteFitnessFunction a {@link org.evosuite.testsuite.TestSuiteFitnessFunction} object. * @return a {@link org.evosuite.testcase.execution.ExecutionResult} object. */ abstract public ExecutionResult executeForFitnessFunction( TestSuiteFitnessFunction testSuiteFitnessFunction); private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); lastExecutionResult = null; lastMutationResult = new HashMap(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy