@jbrowse/core
Version:
JBrowse 2 core libraries used by plugins
68 lines (67 loc) • 1.65 kB
JavaScript
export default class BaseResult {
label;
renderingComponent;
displayString;
matchedAttribute;
matchedObject;
textSearchAdapter;
relevance;
trackId;
score;
locString;
results;
constructor(args) {
this.label = args.label;
this.locString = args.locString;
this.renderingComponent = args.renderingComponent;
this.displayString = args.displayString;
this.matchedAttribute = args.matchedAttribute;
this.matchedObject = args.matchedObject;
this.textSearchAdapter = args.textSearchAdapter;
this.relevance = args.relevance;
this.trackId = args.trackId;
this.score = args.score || 1;
this.results = args.results || [];
}
getLabel() {
return this.label;
}
getDisplayString() {
return this.displayString || this.label;
}
getRenderingComponent() {
return this.renderingComponent;
}
getTrackId() {
return this.trackId;
}
getScore() {
return this.score;
}
updateScore(newScore) {
this.score = newScore;
return this.score;
}
getId() {
return `${this.getLabel()}-${this.getLocation()}-${this.getTrackId()}`;
}
hasLocation() {
return !!this.locString;
}
getLocation() {
return this.locString;
}
getComboResults() {
return this.results;
}
}
export class RefSequenceResult extends BaseResult {
refName;
constructor(args) {
super(args);
this.refName = args.refName ?? '';
}
getLocation() {
return this.refName;
}
}