Source:
public boolean isTrue(State state, String[] params) { ObjectInstance space = state.getObject(params[1]); if (this.subgoal == null) { return false; } if (this.subgoal.getGoal().getClassName().equals(AffordanceCreator.SPACEON_PF)) { if (!this.subgoal.goalCompleted(state)) { return true; } } if (!SpaceFactory.getOnOff(space)) { if (SpaceFactory.isHeating(space)) { if (this.topLevelIngredient.getMelted()) { ObjectInstance obj = state.getObject(this.topLevelIngredient.getName()); if (obj != null) { if (!IngredientFactory.isMeltedIngredient(obj) && !IngredientFactory.isMeltedAtRoomTemperature(obj)) { return true; } } } for (IngredientRecipe ing : this.topLevelIngredient.getContents()) { if (ing.getMelted()) { ObjectInstance obj = state.getObject(ing.getName()); if (obj != null) { if (!IngredientFactory.isMeltedIngredient(obj) && !IngredientFactory.isMeltedAtRoomTemperature(obj)) { return true; } } } } } else if (SpaceFactory.isBaking(space)) { if (this.topLevelIngredient.getBaked()) { ObjectInstance obj = state.getObject(this.topLevelIngredient.getName()); if (obj != null) { if (!IngredientFactory.isBakedIngredient(obj)) { return true; } } } for (IngredientRecipe ing : this.topLevelIngredient.getContents()) { if (ing.getBaked()) { ObjectInstance obj = state.getObject(ing.getName()); if (obj != null) { if (!IngredientFactory.isBakedIngredient(obj)) { return true; } } } } } } for (BakingSubgoal precondition : this.subgoal.getPreconditions()) { if (precondition.getGoal().getClassName().equals(AffordanceCreator.SPACEON_PF)) { if (!precondition.goalCompleted(state)) { return true; } } } return false; }

Target:
public boolean isTrue(State state, String[] params) { ObjectInstance space = state.getObject(params[1]); if (this.subgoal == null) { return false; } String subgoalClassName = this.subgoal.getGoal().getClassName(); if (subgoalClassName.equals(AffordanceCreator.SPACEON_PF)) { if (!this.subgoal.goalCompleted(state)) { return true; } } if (!SpaceFactory.getOnOff(space)) { if (SpaceFactory.isHeating(space)) { if (this.topLevelIngredient.getMelted()) { ObjectInstance obj = state.getObject(this.topLevelIngredient.getName()); if (obj != null) { if (!IngredientFactory.isMeltedIngredient(obj) && !IngredientFactory.isMeltedAtRoomTemperature(obj)) { return true; } } } for (IngredientRecipe ing : this.topLevelIngredient.getContents()) { if (ing.getMelted()) { ObjectInstance obj = state.getObject(ing.getName()); if (obj != null) { if (!IngredientFactory.isMeltedIngredient(obj) && !IngredientFactory.isMeltedAtRoomTemperature(obj)) { return true; } } } } } else if (SpaceFactory.isBaking(space)) { if (this.topLevelIngredient.getBaked()) { ObjectInstance obj = state.getObject(this.topLevelIngredient.getName()); if (obj != null) { if (!IngredientFactory.isBakedIngredient(obj)) { return true; } } } for (IngredientRecipe ing : this.topLevelIngredient.getContents()) { if (ing.getBaked()) { ObjectInstance obj = state.getObject(ing.getName()); if (obj != null) { if (!IngredientFactory.isBakedIngredient(obj)) { return true; } } } } } } for (BakingSubgoal precondition : this.subgoal.getPreconditions()) { String preconditionClassName = precondition.getGoal().getClassName(); if (preconditionClassName.equals(AffordanceCreator.SPACEON_PF)) { if (!precondition.goalCompleted(state)) { return true; } } } return false; }