Package org.eclipse.jgit.revplot
Class PlotCommitList<L extends PlotLane>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- org.eclipse.jgit.revwalk.RevObjectList<E>
-
- org.eclipse.jgit.revwalk.RevCommitList<PlotCommit<L>>
-
- org.eclipse.jgit.revplot.PlotCommitList<L>
-
- Type Parameters:
L
- type of lane used by the application.
- All Implemented Interfaces:
java.lang.Iterable<PlotCommit<L>>
,java.util.Collection<PlotCommit<L>>
,java.util.List<PlotCommit<L>>
- Direct Known Subclasses:
SwingCommitList
public class PlotCommitList<L extends PlotLane> extends RevCommitList<PlotCommit<L>>
An ordered list ofPlotCommit
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
andRevCommitList.fillTo(int)
must be used to populate the list.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jgit.revwalk.RevObjectList
RevObjectList.Block
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashSet<PlotLane>
activeLanes
private java.util.TreeSet<java.lang.Integer>
freePositions
private java.util.HashMap<PlotLane,java.lang.Integer>
laneLength
number of (child) commits on a lane(package private) static int
MAX_LENGTH
private int
positionsAllocated
-
Fields inherited from class org.eclipse.jgit.revwalk.RevObjectList
contents, size
-
-
Constructor Summary
Constructors Constructor Description PlotCommitList()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
addBlockedPosition(java.util.BitSet blockedPositions, PlotCommit rObj)
void
clear()
private void
closeLane(PlotLane lane)
private void
continueActiveLanes(PlotCommit currCommit)
protected L
createLane()
Create a newPlotLane
appropriate for this particularPlotCommitList
.private void
drawLaneToChild(int commitIndex, PlotCommit child, PlotLane laneToContinue)
Connects the commit at commitIndex to the child, using the given lane.protected void
enter(int index, PlotCommit<L> currCommit)
Optional callback invoked when commits enter the list by fillTo.void
findPassingThrough(PlotCommit<L> currCommit, java.util.Collection<L> result)
Find the set of lanes passing through a commit's row.private int
getFreePosition(java.util.BitSet blockedPositions)
private void
handleBlockedLanes(int index, PlotCommit currCommit, PlotCommit childOnLane)
Sets up fork and merge information in the involved PlotCommits.private PlotLane
handleMerge(int index, PlotCommit currCommit, PlotCommit childOnLane, PlotCommit child, PlotLane laneToUse)
private PlotLane
nextFreeLane()
private PlotLane
nextFreeLane(java.util.BitSet blockedPositions)
protected void
recycleLane(L lane)
Return colors and other reusable information to the plotter when a lane is no longer needed.private void
setupChildren(PlotCommit<L> currCommit)
void
source(RevWalk w)
Set the revision walker this list populates itself from.-
Methods inherited from class org.eclipse.jgit.revwalk.RevCommitList
applyFlag, applyFlag, clearFlag, clearFlag, fillTo, fillTo, indexOf, isPending, lastIndexOf
-
Methods inherited from class org.eclipse.jgit.revwalk.RevObjectList
add, get, set, size
-
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
MAX_LENGTH
static final int MAX_LENGTH
- See Also:
- Constant Field Values
-
positionsAllocated
private int positionsAllocated
-
freePositions
private final java.util.TreeSet<java.lang.Integer> freePositions
-
activeLanes
private final java.util.HashSet<PlotLane> activeLanes
-
laneLength
private final java.util.HashMap<PlotLane,java.lang.Integer> laneLength
number of (child) commits on a lane
-
-
Method Detail
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<L extends PlotLane>
- Specified by:
clear
in interfacejava.util.List<L extends PlotLane>
- Overrides:
clear
in classRevCommitList<PlotCommit<L extends PlotLane>>
-
source
public void source(RevWalk w)
Set the revision walker this list populates itself from.- Overrides:
source
in classRevCommitList<PlotCommit<L extends PlotLane>>
- Parameters:
w
- the walker to populate from.- See Also:
RevCommitList.fillTo(int)
-
findPassingThrough
public void findPassingThrough(PlotCommit<L> currCommit, java.util.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 classRevCommitList<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 ofcurrCommit
in the listcurrCommit
-childOnLane
- the direct child on the same lane ascurrCommit
, may be null ifcurrCommit
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(java.util.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(java.util.BitSet blockedPositions)
-
getFreePosition
private int getFreePosition(java.util.BitSet blockedPositions)
- Parameters:
blockedPositions
- may be null- Returns:
- a free lane position
-
createLane
protected L createLane()
Create a newPlotLane
appropriate for this particularPlotCommitList
.- Returns:
- a new
PlotLane
appropriate for this particularPlotCommitList
.
-
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
-
-