Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private attributes changed to underscore private #15

Merged
merged 1 commit into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/routing-result.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,62 @@
//export {RoutingResult as default};

export default class RoutingResult{
#foundPath=[];
#traversedCountries=[];
#isClosest=false;
_foundPath=[];
_traversedCountries=[];
_isClosest=false;

#fromCountryCode='';
#toCountryCode='';
_fromCountryCode='';
_toCountryCode='';


get isClosest() {
return this.#isClosest;
return this._isClosest;
}

set isClosest(value) {
this.#isClosest = value;
this._isClosest = value;
}

get traversedCountries() {
return this.#traversedCountries;
return this._traversedCountries;
}

get fromCountryCode() {
return this.#fromCountryCode;
return this._fromCountryCode;
}

get toCountryCode() {
return this.#toCountryCode;
return this._toCountryCode;
}

getFoundPath() {
//TODO: foundPath elements should be a class instance!
return this.#foundPath;
return this._foundPath;
}

prependToFoundPath(foundPathEntry){
//TODO: this is not used sufficiently, use it wherever you can
this.#foundPath=[foundPathEntry,...this.#foundPath];
this._foundPath=[foundPathEntry,...this._foundPath];
}

appendToFoundPath(foundPathEntry){
this.#foundPath.push(foundPathEntry);
this._foundPath.push(foundPathEntry);
}

get pathDistance() {
return this.#foundPath.reduce((n, {distanceBetweenNode}) => n + distanceBetweenNode, 0);
return this._foundPath.reduce((n, {distanceBetweenNode}) => n + distanceBetweenNode, 0);
}

get pathCountryCount() {
return this.#foundPath.length;
return this._foundPath.length;
}


constructor(foundPath, traversedCountries, fromCountryCode, toCountryCode) {
this.#foundPath = foundPath;
this.#traversedCountries = traversedCountries;
this.#fromCountryCode = fromCountryCode;
this.#toCountryCode = toCountryCode;
this._foundPath = foundPath;
this._traversedCountries = traversedCountries;
this._fromCountryCode = fromCountryCode;
this._toCountryCode = toCountryCode;
}


Expand Down
24 changes: 12 additions & 12 deletions src/traverse-country-node/traverse-country-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
import Utils from "../utils.js";

export class CountryNode {
#countryCode;
#attributes;
_countryCode;
_attributes;



constructor(countryCode, attributes) {
this.#countryCode = countryCode;
this.#attributes = attributes;
this._countryCode = countryCode;
this._attributes = attributes;
}

get countryCode() {
return this.#countryCode;
return this._countryCode;
}

get attributes() {
return this.#attributes;
return this._attributes;
}

isSameCountryNode(targetCountryNode){
Expand All @@ -45,23 +45,23 @@ export class CountryNode {

export class TraverseCountryNode extends CountryNode {

#distanceToFinalDestination;//TODO: this can be handled here. Consider.
_distanceToFinalDestination;//TODO: this can be handled here. Consider.

#distanceBetweenNode;
_distanceBetweenNode;

constructor(countryCode, attributes, distanceToFinalDestination, distanceBetweenNode) {
super(countryCode,attributes);
this.#distanceToFinalDestination = distanceToFinalDestination;
this.#distanceBetweenNode = distanceBetweenNode;
this._distanceToFinalDestination = distanceToFinalDestination;
this._distanceBetweenNode = distanceBetweenNode;
}


get distanceToFinalDestination() {
return this.#distanceToFinalDestination;
return this._distanceToFinalDestination;
}

get distanceBetweenNode() {
return this.#distanceBetweenNode;
return this._distanceBetweenNode;
}


Expand Down