else if (tPolicy instanceof DisjunctionImpl){
// Disjunction(policyA, policyB) =
// Negation(Conjunction((Negation(policyA)), (Negation(policyB))))
DisjunctionImpl temp = (DisjunctionImpl) tPolicy;
// Get contained fields
Policy tempA = temp.getPolicyA();
Policy tempB = temp.getPolicyB();
// Translate contained policies
tempA = new NegationImpl (translate(tempA));
tempB = new NegationImpl (translate(tempB));
// Create translated policy
Policy tempC = new ConjunctionImpl(tempA, tempB);
translatedPolicy = new NegationImpl (tempC);
}
else if (tPolicy instanceof BoxImpl){
// Box(policy) = Negation(Diamond(Negation(policy)))
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);
}
else if (tPolicy instanceof BindImpl){
//Already primitive. Recurse on contained policy
BindImpl temp= (BindImpl) tPolicy;
Policy tempA = temp.getPolicy();
Object var = temp.getVariable();
//translate contained policy
tempA=translate(tempA);
// Create translated policy
translatedPolicy = new BindImpl(var, tempA);
}
else if (tPolicy instanceof AtImpl){
//Already primitive. Recurse on contained policy
AtImpl temp = (AtImpl) tPolicy;
Policy tempA = temp.getPolicy();
Object var = temp.getVariable();
//translate contained policy
tempA=translate(tempA);
// Create translated policy
translatedPolicy = new AtImpl(var, tempA);