Search in sources :

Example 1 with TerminalEdgePrintElement

use of com.intellij.vcs.log.graph.impl.print.elements.TerminalEdgePrintElement in project intellij-community by JetBrains.

the class AbstractPrintElementGenerator method getPrintElements.

@NotNull
public Collection<PrintElementWithGraphElement> getPrintElements(int rowIndex) {
    Collection<PrintElementWithGraphElement> result = new ArrayList<>();
    Collection<SimpleRowElement> simpleRowElements = getSimpleRowElements(rowIndex);
    Map<GraphEdge, SimpleRowElement> arrows = ContainerUtil.newHashMap();
    for (SimpleRowElement rowElement : simpleRowElements) {
        if (!rowElement.myType.equals(RowElementType.NODE)) {
            arrows.put((GraphEdge) rowElement.myElement, rowElement);
        }
    }
    if (rowIndex < myLinearGraph.nodesCount() - 1) {
        for (ShortEdge shortEdge : getDownShortEdges(rowIndex)) {
            RowElementType rowElementType = RowElementType.NODE;
            if ((arrows.get(shortEdge.myEdge) != null) && RowElementType.DOWN_ARROW.equals(arrows.get(shortEdge.myEdge).myType)) {
                rowElementType = RowElementType.DOWN_ARROW;
                arrows.remove(shortEdge.myEdge);
            }
            result.add(createEdgePrintElement(rowIndex, shortEdge, EdgePrintElement.Type.DOWN, !rowElementType.equals(RowElementType.NODE)));
        }
    }
    if (rowIndex > 0) {
        for (ShortEdge shortEdge : getDownShortEdges(rowIndex - 1)) {
            RowElementType rowElementType = RowElementType.NODE;
            if ((arrows.get(shortEdge.myEdge) != null) && RowElementType.UP_ARROW.equals(arrows.get(shortEdge.myEdge).myType)) {
                rowElementType = RowElementType.UP_ARROW;
                arrows.remove(shortEdge.myEdge);
            }
            result.add(createEdgePrintElement(rowIndex, shortEdge, EdgePrintElement.Type.UP, !rowElementType.equals(RowElementType.NODE)));
        }
    }
    for (SimpleRowElement arrow : arrows.values()) {
        result.add(new TerminalEdgePrintElement(rowIndex, arrow.myPosition, arrow.myType == RowElementType.UP_ARROW ? EdgePrintElement.Type.UP : EdgePrintElement.Type.DOWN, (GraphEdge) arrow.myElement, myPrintElementManager));
    }
    for (SimpleRowElement rowElement : simpleRowElements) {
        if (rowElement.myType.equals(RowElementType.NODE)) {
            result.add(createSimplePrintElement(rowIndex, rowElement));
        }
    }
    return result;
}
Also used : PrintElementWithGraphElement(com.intellij.vcs.log.graph.impl.print.elements.PrintElementWithGraphElement) ArrayList(java.util.ArrayList) TerminalEdgePrintElement(com.intellij.vcs.log.graph.impl.print.elements.TerminalEdgePrintElement) GraphEdge(com.intellij.vcs.log.graph.api.elements.GraphEdge) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GraphEdge (com.intellij.vcs.log.graph.api.elements.GraphEdge)1 PrintElementWithGraphElement (com.intellij.vcs.log.graph.impl.print.elements.PrintElementWithGraphElement)1 TerminalEdgePrintElement (com.intellij.vcs.log.graph.impl.print.elements.TerminalEdgePrintElement)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1