@syntest/search
Version:
The common core of the SynTest Framework
75 lines • 2.21 kB
JavaScript
;
/*
* Copyright 2020-2021 Delft University of Technology and SynTest contributors
*
* This file is part of SynTest Framework - SynTest Core.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectiveFunction = void 0;
/**
* Function that models the objective.
*
* @author Mitchell Olsthoorn
*/
class ObjectiveFunction {
constructor(id, subject) {
this._id = id;
this._subject = subject;
this.shallowDistance = false;
this._lowestDistance = Number.MAX_VALUE;
}
/**
* Return if the objective function is shallow (True) or deep (False).
*/
get shallow() {
return this.shallowDistance;
}
/**
* Set the depth of the objective function.
*
* @param shallow True if the objective function is shallow, False otherwise.
*/
set shallow(shallow) {
this.shallowDistance = shallow;
}
/**
* Return the identifier of the objective.
*/
getIdentifier() {
return this._id;
}
/**
* Return the subject of the objective.
*/
getSubject() {
return this._subject;
}
/**
* Update the lowest distance with a new distance
* @param distance
*/
updateDistance(distance) {
this._lowestDistance = Math.min(distance, this._lowestDistance);
}
/**
* Gets the lowest distance to this objective function
* @returns the lowest distance encountered so far
*/
getLowestDistance() {
return this._lowestDistance;
}
}
exports.ObjectiveFunction = ObjectiveFunction;
//# sourceMappingURL=ObjectiveFunction.js.map