Class PlotCommitList<L extends PlotLane>

Type Parameters:
L - type of lane used by the application.
All Implemented Interfaces:
Iterable<PlotCommit<L>>, Collection<PlotCommit<L>>, List<PlotCommit<L>>
Direct Known Subclasses:
SwingCommitList

public class PlotCommitList<L extends PlotLane> extends RevCommitList<PlotCommit<L>>
An ordered list of PlotCommit subclasses.

Commits are allocated into lanes as they enter the list, based upon their connections between descendant (child) commits and ancestor (parent) commits.

The source of the list must be a PlotWalk and RevCommitList.fillTo(int) must be used to populate the list.

  • Field Details

  • Constructor Details

    • PlotCommitList

      public PlotCommitList()
  • Method Details

    • clear

      public void clear()
      Specified by:
      clear in interface Collection<L extends PlotLane>
      Specified by:
      clear in interface List<L extends PlotLane>
      Overrides:
      clear in class RevCommitList<PlotCommit<L extends PlotLane>>
    • source

      public void source(RevWalk w)
      Set the revision walker this list populates itself from.
      Overrides:
      source in class RevCommitList<PlotCommit<L extends PlotLane>>
      Parameters:
      w - the walker to populate from.
      See Also:
    • findPassingThrough

      public void findPassingThrough(PlotCommit<L> currCommit, Collection<L> result)
      Find the set of lanes passing through a commit's row.

      Lanes passing through a commit are lanes that the commit is not directly on, but that need to travel through this commit to connect a descendant (child) commit to an ancestor (parent) commit. Typically these lanes will be drawn as lines in the passed commit's box, and the passed commit won't appear to be connected to those lines.

      This method modifies the passed collection by adding the lanes in any order.

      Parameters:
      currCommit - the commit the caller needs to get the lanes from.
      result - collection to add the passing lanes into.
    • enter

      protected void enter(int index, PlotCommit<L> currCommit)
      Optional callback invoked when commits enter the list by fillTo.

      This method is only called during RevCommitList.fillTo(int).

      Overrides:
      enter in class RevCommitList<PlotCommit<L extends PlotLane>>
      Parameters:
      index - the list position this object will appear at.
      currCommit - the object being added (or set) into the list.
    • continueActiveLanes

      private void continueActiveLanes(PlotCommit currCommit)
    • handleBlockedLanes

      private void handleBlockedLanes(int index, PlotCommit currCommit, PlotCommit childOnLane)
      Sets up fork and merge information in the involved PlotCommits. Recognizes and handles blockades that involve forking or merging arcs.
      Parameters:
      index - the index of currCommit in the list
      currCommit -
      childOnLane - the direct child on the same lane as currCommit, may be null if currCommit is the first commit on the lane
    • handleMerge

      private PlotLane handleMerge(int index, PlotCommit currCommit, PlotCommit childOnLane, PlotCommit child, PlotLane laneToUse)
    • drawLaneToChild

      private void drawLaneToChild(int commitIndex, PlotCommit child, PlotLane laneToContinue)
      Connects the commit at commitIndex to the child, using the given lane. All blockades on the lane must be resolved before calling this method.
      Parameters:
      commitIndex -
      child -
      laneToContinue -
    • addBlockedPosition

      private static void addBlockedPosition(BitSet blockedPositions, PlotCommit rObj)
    • closeLane

      private void closeLane(PlotLane lane)
    • setupChildren

      private void setupChildren(PlotCommit<L> currCommit)
    • nextFreeLane

      private PlotLane nextFreeLane()
    • nextFreeLane

      private PlotLane nextFreeLane(BitSet blockedPositions)
    • getFreePosition

      private int getFreePosition(BitSet blockedPositions)
      Parameters:
      blockedPositions - may be null
      Returns:
      a free lane position
    • createLane

      protected L createLane()
      Create a new PlotLane appropriate for this particular PlotCommitList.
      Returns:
      a new PlotLane appropriate for this particular PlotCommitList.
    • recycleLane

      protected void recycleLane(L lane)
      Return colors and other reusable information to the plotter when a lane is no longer needed.
      Parameters:
      lane - a lane