BoxImpl temp = (BoxImpl) tPolicy;
// Get contained fields
Policy tempA = temp.getPolicy();
Object relationID = temp.getRelationIdentifier();
Direction direction = temp.getDirection();
// Translate contained policy
tempA = new NegationImpl (translate(tempA));
// Create translated policy
Policy tempB = new DiamondImpl(tempA, relationID, direction);
translatedPolicy = new NegationImpl (tempB);
}
else if (tPolicy instanceof DiamondImpl){
// Already primitive. Recurse on contained policy.
DiamondImpl temp = (DiamondImpl) tPolicy;
// Get contained fields
Policy tempA = temp.getPolicy();
Object relationID = temp.getRelationIdentifier();
Direction direction = temp.getDirection();
// Translate contained policy
tempA = translate(tempA);
// Create translated policy
translatedPolicy = new DiamondImpl(tempA, relationID, direction);
}