Source:
<code>public BakingActionResult checkActionIsApplicableInState(State state, String[] params) { BakingActionResult superResult = super.checkActionIsApplicableInState(state, params); if (!superResult.getIsSuccess()) { return superResult; } String agentName = params[0]; ObjectInstance agent = state.getObject(agentName); if (AgentFactory.isRobot(agent)) { return BakingActionResult.failure(agentName + " cannot perform this action"); } String pouringContainerName = params[1]; ObjectInstance pouringContainer = state.getObject(params[1]); String receivingContainerName = params[2]; ObjectInstance receivingContainer = state.getObject(params[2]); String pouringContainerSpace = ContainerFactory.getSpaceName(pouringContainer); String receivingContainerSpace = ContainerFactory.getSpaceName(receivingContainer); if (ContainerFactory.isEmptyContainer(pouringContainer)) { return BakingActionResult.failure(pouringContainerName + " is empty"); } if (!ContainerFactory.isReceivingContainer(receivingContainer)) { return BakingActionResult.failure(receivingContainerName + " cannot be poured into"); } if (pouringContainerSpace == null || receivingContainerSpace == null) { throw new RuntimeException("One of the pouring containers is not in any space"); } if (!pouringContainerSpace.equalsIgnoreCase(receivingContainerSpace)) { <START> return BakingActionResult.failure(receivingContainerName + " cannot be poured into"); <END> } ObjectInstance pouringContainerSpaceObject = state.getObject(pouringContainerSpace); String agentOfSpace = SpaceFactory.getAgent(pouringContainerSpaceObject).iterator().next(); if (!agentOfSpace.equalsIgnoreCase(agentName)) { return BakingActionResult.failure(agentName + " cannot work in " + pouringContainerSpace); } if (!SpaceFactory.isWorking(pouringContainerSpaceObject)) { return BakingActionResult.failure("Pouring cannot be performed in the " + pouringContainerSpaceObject); } return BakingActionResult.success(); }</code><technical_language>is in a space poured into, similar to: if (!SpaceFactory.isWorking(mixingContainerSpaceName)) { return BakingActionResult.failure(containerSpaceName + " is suitable for mixing"); }</technical_language>

Target:
public BakingActionResult checkActionIsApplicableInState(State state, String[] params) { BakingActionResult superResult = super.checkActionIsApplicableInState(state, params); if (!superResult.getIsSuccess()) { return superResult; } String agentName = params[0]; ObjectInstance agent = state.getObject(agentName); if (AgentFactory.isRobot(agent)) { return BakingActionResult.failure(agentName + " cannot perform this action"); } String pouringContainerName = params[1]; ObjectInstance pouringContainer = state.getObject(params[1]); String receivingContainerName = params[2]; ObjectInstance receivingContainer = state.getObject(params[2]); String pouringContainerSpace = ContainerFactory.getSpaceName(pouringContainer); String receivingContainerSpace = ContainerFactory.getSpaceName(receivingContainer); if (ContainerFactory.isEmptyContainer(pouringContainer)) { return BakingActionResult.failure(pouringContainerName + " is empty"); } if (!ContainerFactory.isReceivingContainer(receivingContainer)) { return BakingActionResult.failure(receivingContainerName + " cannot be poured into"); } if (pouringContainerSpace == null || receivingContainerSpace == null) { throw new RuntimeException("One of the pouring containers is not in any space"); } if (!pouringContainerSpace.equalsIgnoreCase(receivingContainerSpace)) { return BakingActionResult.failure(pouringContainerName + " is not in the same space as the " + receivingContainerName); } ObjectInstance pouringContainerSpaceObject = state.getObject(pouringContainerSpace); String agentOfSpace = SpaceFactory.getAgent(pouringContainerSpaceObject).iterator().next(); if (!agentOfSpace.equalsIgnoreCase(agentName)) { return BakingActionResult.failure(agentName + " cannot work in " + pouringContainerSpace); } if (!SpaceFactory.isWorking(pouringContainerSpaceObject)) { return BakingActionResult.failure("Pouring cannot be performed in the " + pouringContainerSpaceObject); } return BakingActionResult.success(); }