Subversion Repositories DevTools

Rev

Rev 7079 | Rev 7133 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7079 dpurdie 1
package com.erggroup.buildtool.ripple;
2
 
3
import java.util.Comparator;
4
 
5
 
6
/** Class to contain package build information
7
 *  Information not stored in the package as its dynamic
8
 */
9
class PlannedPackage {
10
    int mBuildLevel = 0;
11
    Package mPkg = null;
12
 
13
    public PlannedPackage (Package pkg, int buildLevel)
14
    {
15
        this.mPkg = pkg;
16
        this.mBuildLevel = buildLevel;
17
    }
18
 
19
    /** Comparator for sorting package collections by mBuildTime and mRippleOrder
20
     *  Preserve rippleOrder
21
     *  
22
     */
23
    static final Comparator<PlannedPackage> BuildOrderComparitor = new Comparator<PlannedPackage>() {
24
 
25
        /**
26
         * Returns -ve: p1 is less than p2
27
         *           0: p1 = p2
28
         *         +ve: p1 > p2
29
         */
30
        public int compare (PlannedPackage p1, PlannedPackage p2) {
31
            if (p1.mBuildLevel == p2.mBuildLevel)
32
            {
33
                return p1.mPkg.mBuildTime - p2.mPkg.mBuildTime;
34
            }
35
 
36
            return p1.mBuildLevel - p2.mBuildLevel;
37
 
38
        }
39
    };
40
 
41
}