mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 19:00:09 +00:00
some more work on dependency sorting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7883315598
commit
05450f261d
@ -210,7 +210,11 @@ module.FeatureSet = {
|
|||||||
// 2) remove the duplicate features except fot the first
|
// 2) remove the duplicate features except fot the first
|
||||||
// occurance
|
// occurance
|
||||||
//
|
//
|
||||||
// NOTE: we do not do recursice dependency expansion.
|
// NOTE: recursice dependency expansion is not needed here as if
|
||||||
|
// a dependency is not included in the list then it is not
|
||||||
|
// needed...
|
||||||
|
// their dependencies to be sorted, and if that does not work
|
||||||
|
// we can give up...
|
||||||
// NOTE: stage 2 is done later when filtering the list...
|
// NOTE: stage 2 is done later when filtering the list...
|
||||||
// NOTE: if dependency errors/conflicts exist this will break at
|
// NOTE: if dependency errors/conflicts exist this will break at
|
||||||
// the next step.
|
// the next step.
|
||||||
@ -220,10 +224,8 @@ module.FeatureSet = {
|
|||||||
// - dependency / priority conflict
|
// - dependency / priority conflict
|
||||||
// X will have higher priority than one of its
|
// X will have higher priority than one of its
|
||||||
// dependencies...
|
// dependencies...
|
||||||
//
|
var _sortDep = function(lst, missing){
|
||||||
// XXX do we add dependencies that are not included in the list???
|
|
||||||
var res = []
|
var res = []
|
||||||
var missing = {}
|
|
||||||
lst.forEach(function(n){
|
lst.forEach(function(n){
|
||||||
var e = that[n]
|
var e = that[n]
|
||||||
// no dependencies...
|
// no dependencies...
|
||||||
@ -251,7 +253,14 @@ module.FeatureSet = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
lst = res
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
var missing = {}
|
||||||
|
// sort twice to cover the dependencies of dependencies...
|
||||||
|
// ...if this does not work we give up ;)
|
||||||
|
lst = _sortDep(lst, missing)
|
||||||
|
lst = _sortDep(lst, missing)
|
||||||
|
|
||||||
// sort features via priority keeping the order as close to
|
// sort features via priority keeping the order as close to
|
||||||
// manual as possible...
|
// manual as possible...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user