public ProfileEntry checkPartAvailability(int partId,  
			double startTime, long duration) {
		
		if(partId >= partitions.length || partId < 0) {
			throw new IndexOutOfBoundsException("Partition " + partId + 
					" does not exist.");
		}
		
		Iterator<ProfileEntry> it = avail.itValuesFromPrec(startTime);
		if (!it.hasNext()) {
			return new Profile.Entry(startTime);
		}
		
		PartProfileEntry entry = (PartProfileEntry)it.next();
		PERangeList intersec = entry.getAvailRanges(partId).clone(); 
		double finishTime = startTime + duration;
            
        // Scans the availability profile until the expected termination
        // of the job to check whether enough PEs will be available for it. 
        while(it.hasNext()) {
        	entry = (PartProfileEntry)it.next();
        	if(entry.getTime() >= finishTime || intersec.getNumPE() == 0) {
        		break;
        	}
        	intersec = intersec.intersection(entry.getAvailRanges(partId));
        }
        
        return new Profile.Entry(startTime, intersec);
	}