Skip to content

Commit 9184f79

Browse files
committed
rename ambiguous start/end with extremity
Signed-off-by: Louis Greiner <[email protected]>
1 parent 8e1d49b commit 9184f79

File tree

7 files changed

+21
-18
lines changed

7 files changed

+21
-18
lines changed

src/app/models/node.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export class Node {
423423
);
424424
}
425425

426-
getStartTrainrunSection(trainrunId: number, returnForwardStartNode = true): TrainrunSection {
426+
getExtremityTrainrunSection(trainrunId: number, returnForwardStartNode = true): TrainrunSection {
427427
const portsForTrainrun = this.ports.filter(
428428
(port) => port.getTrainrunSection().getTrainrunId() === trainrunId,
429429
);

src/app/models/trainrunsection.model.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,9 @@ describe("TrainrunSection Model Test", () => {
582582
const port2 = node2.addPort(PortAlignment.Right, ts2);
583583
node2.addTransitionAndComputeRouting(node2.getPort(port1), node2.getPort(port2), tr, true);
584584

585-
const ts001 = node1.getStartTrainrunSection(tr.getId());
586-
const ts002 = node2.getStartTrainrunSection(tr.getId());
587-
const ts003 = node3.getStartTrainrunSection(tr.getId());
585+
const ts001 = node1.getExtremityTrainrunSection(tr.getId());
586+
const ts002 = node2.getExtremityTrainrunSection(tr.getId());
587+
const ts003 = node3.getExtremityTrainrunSection(tr.getId());
588588

589589
expect(ts001).toBe(undefined);
590590
expect(ts002).toBe(undefined);

src/app/perlenkette/service/load-perlenkette.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class LoadPerlenketteService implements OnDestroy {
127127
);
128128

129129
if (startForwardNode) {
130-
const startTrainrunSection = startForwardNode.getStartTrainrunSection(trainrun.getId());
130+
const startTrainrunSection = startForwardNode.getExtremityTrainrunSection(trainrun.getId());
131131
if (startTrainrunSection === undefined) {
132132
return perlenketteItem;
133133
}

src/app/services/data/trainrun.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ export class TrainrunService {
564564
}
565565

566566
propagateTrainrunInitialConsecutiveTimes(trainrun: Trainrun) {
567-
const startNode = this.getStartNodeWithTrainrunId(trainrun.getId());
567+
const startNode = this.getLeftOrTopNodeWithTrainrunId(trainrun.getId());
568568
const ts = startNode.getTrainrunSection(trainrun);
569569
this.propagateConsecutiveTimesForTrainrun(ts.getId());
570570
}
@@ -603,7 +603,7 @@ export class TrainrunService {
603603

604604
const propDataForward = this.propagateConsecutiveTimes(
605605
startForwardBackwardNode.startForwardNode,
606-
startForwardBackwardNode.startForwardNode.getStartTrainrunSection(
606+
startForwardBackwardNode.startForwardNode.getExtremityTrainrunSection(
607607
trainrunSection.getTrainrunId(),
608608
true,
609609
),
@@ -621,7 +621,7 @@ export class TrainrunService {
621621

622622
const propDataBackward = this.propagateConsecutiveTimes(
623623
startForwardBackwardNode.startBackwardNode,
624-
startForwardBackwardNode.startBackwardNode.getStartTrainrunSection(
624+
startForwardBackwardNode.startBackwardNode.getExtremityTrainrunSection(
625625
trainrunSection.getTrainrunId(),
626626
false,
627627
),
@@ -637,12 +637,12 @@ export class TrainrunService {
637637
}
638638
}
639639

640-
getStartNodeWithTrainrunId(trainrunId: number): Node {
640+
getLeftOrTopNodeWithTrainrunId(trainrunId: number): Node {
641641
const bothEndNodes = this.getBothEndNodesWithTrainrunId(trainrunId);
642642
return GeneralViewFunctions.getLeftOrTopNode(bothEndNodes.endNode1, bothEndNodes.endNode2);
643643
}
644644

645-
getEndNodeWithTrainrunId(trainrunId: number): Node {
645+
getRightOrBottomNodeWithTrainrunId(trainrunId: number): Node {
646646
const bothEndNodes = this.getBothEndNodesWithTrainrunId(trainrunId);
647647
return GeneralViewFunctions.getRightOrBottomNode(bothEndNodes.endNode1, bothEndNodes.endNode2);
648648
}

src/app/streckengrafik/services/sg-1-load-trainrun-item.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,10 @@ export class Sg1LoadTrainrunItemService implements OnDestroy {
11191119
let trainrunSectionGroup: TrainrunSectionGroup = undefined;
11201120
let fromNode = node;
11211121
let toNode = undefined;
1122-
const startTrainrunSection = node.getStartTrainrunSection(trainrunId, returnForwardStartNode);
1122+
const startTrainrunSection = node.getExtremityTrainrunSection(
1123+
trainrunId,
1124+
returnForwardStartNode,
1125+
);
11231126
if (startTrainrunSection === undefined) {
11241127
return {
11251128
trainrunSectionGroups: trainrunSectionGroups,

src/app/view/editor-tools-view-component/editor-tools-view.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,8 @@ export class EditorToolsViewComponent {
590590
// Retrieve start -> end with:
591591
// start {startNode, startTrainrunSection}
592592
// end {iterator.current.node, iterator.current.trainrunSection}
593-
const startNode = this.trainrunService.getStartNodeWithTrainrunId(trainrun.getId());
594-
const startTrainrunSection = startNode.getStartTrainrunSection(trainrun.getId());
593+
const startNode = this.trainrunService.getLeftOrTopNodeWithTrainrunId(trainrun.getId());
594+
const startTrainrunSection = startNode.getExtremityTrainrunSection(trainrun.getId());
595595
const iterator = this.trainrunService.getIterator(startNode, startTrainrunSection);
596596
while (iterator.hasNext()) {
597597
iterator.next();

src/integration-testing/trainrunsection.service.test.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ describe("TrainrunSection Service Test", () => {
281281
trs.setTargetArrivalConsecutiveTime(undefined);
282282
});
283283
trainrunService.propagateInitialConsecutiveTimes();
284-
const startNode = trainrunService.getStartNodeWithTrainrunId(2);
285-
const startTrainrunSection = startNode.getStartTrainrunSection(2);
284+
const startNode = trainrunService.getLeftOrTopNodeWithTrainrunId(2);
285+
const startTrainrunSection = startNode.getExtremityTrainrunSection(2);
286286

287287
expect(startTrainrunSection.getSourceDepartureConsecutiveTime()).toBe(0);
288288
expect(startTrainrunSection.getSourceArrivalConsecutiveTime()).toBe(180);
@@ -309,11 +309,11 @@ describe("TrainrunSection Service Test", () => {
309309
trs.setTargetDepartureConsecutiveTime(undefined);
310310
trs.setTargetArrivalConsecutiveTime(undefined);
311311
});
312-
const startNode = trainrunService.getStartNodeWithTrainrunId(2);
313-
const trainrunSection = startNode.getStartTrainrunSection(2);
312+
const startNode = trainrunService.getLeftOrTopNodeWithTrainrunId(2);
313+
const trainrunSection = startNode.getExtremityTrainrunSection(2);
314314
trainrunSection.setTravelTime(123);
315315
trainrunService.propagateInitialConsecutiveTimes();
316-
const startTrainrunSection = startNode.getStartTrainrunSection(2);
316+
const startTrainrunSection = startNode.getExtremityTrainrunSection(2);
317317

318318
expect(startTrainrunSection.getSourceDepartureConsecutiveTime()).toBe(0);
319319
expect(startTrainrunSection.getSourceArrivalConsecutiveTime()).toBe(420);

0 commit comments

Comments
 (0)