public boolean apply(IScheduledTask input) {
Optional<IJobUpdate> update = Optional.fromNullable(
roleJobUpdates.get(input.getAssignedTask().getTask().getJob()));
if (update.isPresent()) {
IJobUpdateInstructions instructions = update.get().getInstructions();
RangeSet<Integer> initialInstances = instanceRangeSet(instructions.getInitialState());
RangeSet<Integer> desiredInstances = instanceRangeSet(instructions.isSetDesiredState()
? ImmutableSet.of(instructions.getDesiredState())
: ImmutableSet.<IInstanceTaskConfig>of());
int instanceId = input.getAssignedTask().getInstanceId();
return !initialInstances.contains(instanceId) && !desiredInstances.contains(instanceId);
}