BoxImpl temp = (BoxImpl) tPolicy;
// Get contained fields
Policy tempA = temp.policy;
Object relationID = temp.relationIdentifier;
Direction direction = temp.direction;
// 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 ConjunctionImpl){
// Conjunction(policyA, policyB) =
// Negation(Disjunction((Negation(policyA)), (Negation(policyB))))
ConjunctionImpl temp = (ConjunctionImpl) tPolicy;
// Get contained fields
Policy tempA = temp.policyA;
Policy tempB = temp.policyB;
// Translate contained policies
tempA = new NegationImpl (translate(tempA));
tempB = new NegationImpl (translate(tempB));
// Create translated policy
Policy tempC = new DisjunctionImpl(tempA, tempB);
translatedPolicy = new NegationImpl (tempC);
}
else if (tPolicy instanceof DiamondImpl){
// Already primitive. Recurse on contained policy.
DiamondImpl temp = (DiamondImpl) tPolicy;
// Get contained fields
Policy tempA = temp.policy;
Object relationID = temp.relationIdentifier;
Direction direction = temp.direction;
// Translate contained policy
tempA = translate(tempA);
// Create translated policy
translatedPolicy = new DiamondImpl(tempA, relationID, direction);
}