org.apache.ivy.core.sort

Class ModuleInSort

class ModuleInSort extends Object

Decorates a ModuleDescriptor with some attributes used during the sort. Thus every instance of a ModuleInSort can be used in only one ModuleDescriptorSorter at a time.
The added fields are :
Constructor Summary
ModuleInSort(ModuleDescriptor moduleToSort)
Method Summary
voidaddToSortedListIfRequired(List sorted)
Add this module to the sorted list except if this module is an intermediary element of a loop.
booleancheckLoop(ModuleInSort futurCaller, CircularDependencyStrategy depStrategy)
Check if a adding this element as a dependency of caller will introduce a circular dependency.
voidendOfCall()
DependencyDescriptor[]getDependencies()
ModuleDescriptorgetSortedModuleDescriptor()
booleanisInLoop()
booleanisProcessed()
This ModuleInSort has already been analyzed.
booleanisSorted()
This ModuleInSort has been placed on the sorted list
static voidlogLoopWarning(List loopElement)
Log a warning saying that a loop is detected
booleanmatch(DependencyDescriptor descriptor, VersionMatcher versionMatcher)
Return true if this module match the DependencyDescriptor with the given versionMatcher.
voidsetCaller(ModuleInSort caller)
StringtoString()

Constructor Detail

ModuleInSort

public ModuleInSort(ModuleDescriptor moduleToSort)

Method Detail

addToSortedListIfRequired

public void addToSortedListIfRequired(List sorted)
Add this module to the sorted list except if this module is an intermediary element of a loop. If this module is the 'root' of a loop, then all elements of that loops are added before.

Parameters: sorted The list of sorted elements on which this module will be added

checkLoop

public boolean checkLoop(ModuleInSort futurCaller, CircularDependencyStrategy depStrategy)
Check if a adding this element as a dependency of caller will introduce a circular dependency. If it is, all the elements of the loop are flaged as 'loopIntermediateElement', and the loopElements of this module (which is the root of the loop) is updated. The depStrategy is invoked on order to report a correct circular loop message.

Parameters: futurCaller depStrategy

Returns: true if a loop is detected.

endOfCall

public void endOfCall()

getDependencies

public DependencyDescriptor[] getDependencies()

getSortedModuleDescriptor

public ModuleDescriptor getSortedModuleDescriptor()

isInLoop

public boolean isInLoop()

isProcessed

public boolean isProcessed()
This ModuleInSort has already been analyzed. It is either already added to the sorted list, either it is included in a loop and will be added when the root of the loop will be added to the list.

isSorted

public boolean isSorted()
This ModuleInSort has been placed on the sorted list

logLoopWarning

public static void logLoopWarning(List loopElement)
Log a warning saying that a loop is detected

match

public boolean match(DependencyDescriptor descriptor, VersionMatcher versionMatcher)
Return true if this module match the DependencyDescriptor with the given versionMatcher. If this module has no version defined, then true is always returned.

setCaller

public void setCaller(ModuleInSort caller)

toString

public String toString()