agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/ResourceRequest.java
/**
     * Comparison method so we can compare a resource request with a {@link BatchQueue} as a simple validation
     * mechanism. If this {@link #compareTo(BatchQueue)} evaluates to 1, the request cannot be satisfied by the
     * queue. If it evaluates to anything else, the {@link BatchQueue} will satisfy the request.
     * @param batchQueue the queue to compare against the {@link ResourceRequest}
     * @return 1 if the queue can satisfy the resource request, 0 if it exactly fits, -1 if it easily fits.
     */
Comparison method so we can compare a resource request with a  BatchQueue as a simple validation
mechanism. If this  #compareTo(BatchQueue) evaluates to 1, the request cannot be satisfied by the
queue. If it evaluates to anything else, the  BatchQueue will satisfy the request.
@param batchQueue the queue to compare against the  ResourceRequest
@return 1 if the queue can satisfy the resource request, 0 if it exactly fits, -1 if it easily fits.
Comparison method so we can compare a resource request with a BatchQueue as a simple validation mechanism . If this #compareTo ( BatchQueue ) evaluates to 1 the request cannot be satisfied by the queue . If it evaluates to anything else the BatchQueue will satisfy the request . @param batchQueue the queue to compare against the ResourceRequest @return 1 if the queue can satisfy the resource request 0 if it exactly fits - 1 if it easily fits .
public int compareTo(BatchQueue batchQueue) {
        if (batchQueue == null) return 1;
        int nodeComp = NumberUtils.compare((maxNodes == null ? 0 : maxNodes), (batchQueue.getMaxNodes() == -1 ? Long.MAX_VALUE : batchQueue.getMaxNodes()));
        int memComp = NumberUtils.compare((maxMemoryPerNode == null ? 0 : maxMemoryPerNode), (batchQueue.getMaxMemoryPerNode() == -1 ? Double.MAX_VALUE : batchQueue.getMaxMemoryPerNode()));
        int procComp = NumberUtils.compare((maxProcessorsPerNode == null ? 0 : maxProcessorsPerNode), (batchQueue.getMaxProcessorsPerNode() == -1 ? Long.MAX_VALUE : batchQueue.getMaxProcessorsPerNode()));
        int timeComp = TimeUtils.compareRequestedJobTimes(maxRequestedTime == null ? BatchQueue.DEFAULT_MIN_RUN_TIME : maxRequestedTime, batchQueue.getMaxRequestedTime());
        if (nodeComp == 0 && memComp == 0 && procComp == 0 && timeComp == 0) {
            return 0;
        } else if (nodeComp > 0 || memComp > 0 || procComp > 0 || timeComp > 0) {
            return 1;
        } else {
            return -1;
        }
 else {
    }
public int compareTo ( BatchQueue batchQueue ) { if ( batchQueue == null ) return 1 ; int nodeComp = NumberUtils . compare ( ( maxNodes == null ? 0 : maxNodes ) , ( batchQueue . getMaxNodes ( ) == - 1 ? Long . MAX_VALUE : batchQueue . getMaxNodes ( ) ) ) ; int memComp = NumberUtils . compare ( ( maxMemoryPerNode == null ? 0 : maxMemoryPerNode ) , ( batchQueue . getMaxMemoryPerNode ( ) == - 1 ? Double . MAX_VALUE : batchQueue . getMaxMemoryPerNode ( ) ) ) ; int procComp = NumberUtils . compare ( ( maxProcessorsPerNode == null ? 0 : maxProcessorsPerNode ) , ( batchQueue . getMaxProcessorsPerNode ( ) == - 1 ? Long . MAX_VALUE : batchQueue . getMaxProcessorsPerNode ( ) ) ) ; int timeComp = TimeUtils . compareRequestedJobTimes ( maxRequestedTime == null ? BatchQueue . DEFAULT_MIN_RUN_TIME : maxRequestedTime , batchQueue . getMaxRequestedTime ( ) ) ; if ( nodeComp == 0 && memComp == 0 && procComp == 0 && timeComp == 0 ) { return 0 ; } else if ( nodeComp > 0 || memComp > 0 || procComp > 0 || timeComp > 0 ) { return 1 ; } else { return - 1 ; } }
Comparison method so we can compare a resource request with a {@link BatchQueue} as a simple validation
 mechanism.
Comparison method so we can compare a resource request with a { @link BatchQueue } as a simple validation mechanism .
// if either is null, or the queue supports max nodes, then it passes // if the request and queue match on all values, then return a match // if any request value exceeded the corresponding queue value, then no match, the request is larger // if the queue equals or exceeds the request on every corresponding value, then return a match //        } //        if (maxNodes == null || batchQueue.getMaxNodes() == -1) { //            if (maxMemoryPerNode == null || batchQueue.getMaxMemoryPerNode() == -1) { //                if (maxProcessorsPerNode == null || batchQueue.getMaxProcessorsPerNode() == -1) { //                    return TimeUtils.compareRequestedJobTimes(maxRequestedTime == null ? BatchQueue.DEFAULT_MIN_RUN_TIME : maxRequestedTime, batchQueue.getMaxRequestedTime()); //                } else { //                    return NumberUtils.compare((maxProcessorsPerNode == null ? 0 : maxProcessorsPerNode), (batchQueue.getMaxProcessorsPerNode() == -1 ? Long.MAX_VALUE : batchQueue.getMaxProcessorsPerNode())); //                } //            } else { //                return NumberUtils.compare((maxMemoryPerNode == null ? 0 : maxMemoryPerNode), (batchQueue.getMaxMemoryPerNode() == -1 ? Double.MAX_VALUE : batchQueue.getMaxMemoryPerNode())); //            } //        } else { //            return NumberUtils.compare((maxNodes == null ? 0 : maxNodes), (batchQueue.getMaxNodes() == -1 ? Long.MAX_VALUE : batchQueue.getMaxNodes())); //        }