Skip to content

Commit

Permalink
Rename indicatorOnBus to AddCellForBusInfo
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
  • Loading branch information
tadam50 committed Mar 3, 2022
1 parent cf9159c commit 6d5c8f8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class BlockOrganizer {

private final boolean exceptionIfPatternNotHandled;

private final boolean indicatorOnBus;
private final boolean addCellForBusInfo;

public BlockOrganizer() {
this(new PositionFromExtension(), true);
Expand All @@ -60,12 +60,12 @@ public BlockOrganizer(PositionFinder positionFinder, boolean stack, boolean exce
this(positionFinder, stack, exceptionIfPatternNotHandled, handleShunt, false);
}

public BlockOrganizer(PositionFinder positionFinder, boolean stack, boolean exceptionIfPatternNotHandled, boolean handleShunt, boolean indicatorOnBus) {
public BlockOrganizer(PositionFinder positionFinder, boolean stack, boolean exceptionIfPatternNotHandled, boolean handleShunt, boolean addCellForBusInfo) {
this.positionFinder = Objects.requireNonNull(positionFinder);
this.stack = stack;
this.exceptionIfPatternNotHandled = exceptionIfPatternNotHandled;
this.handleShunt = handleShunt;
this.indicatorOnBus = indicatorOnBus;
this.addCellForBusInfo = addCellForBusInfo;
}

/**
Expand Down Expand Up @@ -99,7 +99,7 @@ public void organize(VoltageLevelGraph graph) {

graph.getCells().forEach(Cell::blockSizing);

new BlockPositionner().determineBlockPositions(graph, subsections, indicatorOnBus);
new BlockPositionner().determineBlockPositions(graph, subsections, addCellForBusInfo);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
class BlockPositionner {

void determineBlockPositions(VoltageLevelGraph graph, List<Subsection> subsections, boolean indicatorOnBus) {
void determineBlockPositions(VoltageLevelGraph graph, List<Subsection> subsections, boolean addCellForBusInfo) {
int hPos = 0;
int prevHPos = 0;
int hSpace = 0;
Expand All @@ -37,7 +37,7 @@ void determineBlockPositions(VoltageLevelGraph graph, List<Subsection> subsectio
updateNodeBuses(prevSs, ss, hPos, hSpace, Side.RIGHT); // close nodeBuses
updateNodeBuses(prevSs, ss, hPos, hSpace, Side.LEFT); // open nodeBuses

if (indicatorOnBus) {
if (addCellForBusInfo) {
// Adding cell on busbar left side
hPos += 2; // A cell is 2 units wide
}
Expand All @@ -54,7 +54,7 @@ void determineBlockPositions(VoltageLevelGraph graph, List<Subsection> subsectio
}
hSpace = placeFlatInternCells(hPos, ss.getInternCells(InternCell.Shape.FLAT, Side.LEFT)) - hPos;
hPos += hSpace;
if (indicatorOnBus) {
if (addCellForBusInfo) {
// Adding cell on busbar right side
hPos += 2; // A cell is 2 units wide
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class PositionVoltageLevelLayoutFactory implements VoltageLevelLayoutFact

private boolean handleShunts = false;

private boolean indicatorOnBus = false;
private boolean addCellForBusInfo = false;

public PositionVoltageLevelLayoutFactory() {
this(new PositionFromExtension());
Expand Down Expand Up @@ -85,12 +85,12 @@ public PositionVoltageLevelLayoutFactory setHandleShunts(boolean handleShunts) {
return this;
}

public boolean isIndicatorOnBus() {
return indicatorOnBus;
public boolean isAddCellForBusInfo() {
return addCellForBusInfo;
}

public PositionVoltageLevelLayoutFactory setIndicatorOnBus(boolean indicatorOnBus) {
this.indicatorOnBus = indicatorOnBus;
public PositionVoltageLevelLayoutFactory setAddCellForBusInfo(boolean addCellForBusInfo) {
this.addCellForBusInfo = addCellForBusInfo;
return this;
}

Expand All @@ -101,7 +101,7 @@ public Layout create(VoltageLevelGraph graph) {
.detectCells(graph);

// build blocks from cells
new BlockOrganizer(positionFinder, feederStacked, exceptionIfPatternNotHandled, handleShunts, indicatorOnBus).organize(graph);
new BlockOrganizer(positionFinder, feederStacked, exceptionIfPatternNotHandled, handleShunts, addCellForBusInfo).organize(graph);

return new PositionVoltageLevelLayout(graph);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ protected void drawGrid(String prefixId, VoltageLevelGraph graph, Document docum
// FeederSpan
drawGridHorizontalLine(document, graph, maxH, graph.getY() + layoutParameters.getFeederSpan(), gridRoot);
}

// BOTTOM - Horizontal lines
if (graph.getExternCellHeight(BusCell.Direction.BOTTOM) > 0.) {
// StackHeight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public void test() {
factory.setHandleShunts(true);
assertTrue(factory.isHandleShunts());

assertFalse(factory.isIndicatorOnBus());
factory.setIndicatorOnBus(true);
assertTrue(factory.isIndicatorOnBus());
assertFalse(factory.isAddCellForBusInfo());
factory.setAddCellForBusInfo(true);
assertTrue(factory.isAddCellForBusInfo());
}
}

0 comments on commit 6d5c8f8

Please sign in to comment.