Subversion Repositories DevTools

Rev

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

package com.erggroup.buildtool.ripple;

import java.util.Comparator;


/** Class to contain package build information
 *  Information not stored in the package as its dynamic
 */
class PlannedPackage {
    int mBuildLevel = 0;
    Package mPkg = null;
    
    public PlannedPackage (Package pkg, int buildLevel)
    {
        this.mPkg = pkg;
        this.mBuildLevel = buildLevel;
    }
    
    /** Comparator for sorting package collections by mBuildTime and mRippleOrder
     *  Preserve rippleOrder
     *  
     */
    static final Comparator<PlannedPackage> BuildOrderComparitor = new Comparator<PlannedPackage>() {
        
        /**
         * Returns -ve: p1 is less than p2
         *           0: p1 = p2
         *         +ve: p1 > p2
         */
        public int compare (PlannedPackage p1, PlannedPackage p2) {
            if (p1.mBuildLevel == p2.mBuildLevel)
            {
                return p1.mPkg.mBuildTime - p2.mPkg.mBuildTime;
            }
            
            return p1.mBuildLevel - p2.mBuildLevel;
            
        }
    };
    
}