code: public boolean allocate(JobID newJobId, AllocationID newAllocationId) {
  		if (TaskSlotState.FREE == state) {
  			// sanity checks
  			Preconditions.checkState(allocationId == null);
  			Preconditions.checkState(jobId == null);
  
  			this.jobId = Preconditions.checkNotNull(newJobId);
  			this.allocationId = Preconditions.checkNotNull(newAllocationId);
  
  			state = TaskSlotState.ALLOCATED;
  
  			return true;
  		} else if (TaskSlotState.ALLOCATED == state || TaskSlotState.ACTIVE == state) {
  			Preconditions.checkNotNull(newJobId);
  			Preconditions.checkNotNull(newAllocationId);
  
  			return newJobId.equals(jobId) && newAllocationId.equals(allocationId);
  		} else {
  			return false;
  		}
  	}
docs: Allocate the task slot for the given job and allocation id. If the slot could be allocated,
  or is already allocated/active for the given job and allocation id, then the method returns
  true. Otherwise it returns false.
  
  <p>A slot can only be allocated if it's current state is free.
  
  @param newJobId to allocate the slot for
  @param newAllocationId to identify the slot allocation
  @return True if the slot was allocated for the given job and allocation id; otherwise false