Package ca.ucalgary.ispia.rebac.impl

Examples of ca.ucalgary.ispia.rebac.impl.NegationImpl


      translatedPolicy = tPolicy;
    }
   
    else if(tPolicy instanceof NegationImpl){
      // Already primitive. Recurse on contained policy.
      NegationImpl temp = (NegationImpl) tPolicy;
      // Get contained fields
      Policy tempA = temp.getPolicy();
      // Translate contained policy
      tempA = translate(tempA);
      // Create translated policy
      translatedPolicy = new NegationImpl (tempA);
    }
   
    else if (tPolicy instanceof ConjunctionImpl){
      // Already primitive. Recurse on contained policies.
     
      ConjunctionImpl temp = (ConjunctionImpl) tPolicy;
      // Get contained fields
      Policy tempA = temp.getPolicyA();
      Policy tempB = temp.getPolicyB();
      // Translate contained fields
      tempA = translate(tempA);
      tempB = translate(tempB);
      // Create translated policy
      translatedPolicy = new ConjunctionImpl(tempA, tempB);
    }
   
    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);
View Full Code Here


    else if (policy ==TrueImpl.getInstance()){
      //nothing added
    }
   
    else if(policy instanceof NegationImpl){
      NegationImpl temp = (NegationImpl) policy;
      findFreeVars(temp.getPolicy(), free_vars);
    }
   
    else if (policy instanceof ConjunctionImpl){
      ConjunctionImpl temp = (ConjunctionImpl) policy;
     
      Set temp_setA = findFreeVars(temp.getPolicyA(), new HashSet<Object>());
      Set temp_setB = findFreeVars(temp.getPolicyB(), new HashSet<Object>());
      free_vars.addAll(temp_setA);
      free_vars.addAll(temp_setB);
    }
   
    else if (policy instanceof DisjunctionImpl){
      DisjunctionImpl temp = (DisjunctionImpl) policy;
     
      Set temp_setA = findFreeVars(temp.getPolicyA(), new HashSet<Object>());
      Set temp_setB = findFreeVars(temp.getPolicyB(), new HashSet<Object>());
      free_vars.addAll(temp_setA);
      free_vars.addAll(temp_setB);
    }
   
    else if (policy instanceof BoxImpl){
      BoxImpl temp = (BoxImpl) policy;
      findFreeVars(temp.getPolicy(), free_vars);
    }
   
    else if (policy instanceof DiamondImpl){
      DiamondImpl temp = (DiamondImpl) policy;
      free_vars = findFreeVars(temp.getPolicy(), free_vars);
    }
   
    else if (policy instanceof BindImpl){
      BindImpl temp = (BindImpl) policy;
      findFreeVars(temp.getPolicy(), free_vars);
      free_vars.remove(temp.getVariable());
    }
   
    else if (policy instanceof AtImpl){
      AtImpl temp = (AtImpl) policy;
      findFreeVars(temp.getPolicy(), free_vars);
      free_vars.add(temp.getVariable());
    }
    return free_vars;
  }
View Full Code Here

        // 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);
      }
         
      else if (tPolicy instanceof DisjunctionImpl){
        // Already primitive. Recurse on contained policies.
       
        DisjunctionImpl temp = (DisjunctionImpl) tPolicy;
        // Get contained fields
        Policy tempA = temp.policyA;
        Policy tempB = temp.policyB;
        // Translate contained fields
        tempA = translate(tempA);
        tempB = translate(tempB);
        // Create translated policy
        translatedPolicy = new DisjunctionImpl(tempA, tempB);
      }
     
      else if (tPolicy == FalseImpl.getInstance()){
        // False = Negation(True)
       
        // Create translated policy
        translatedPolicy = new NegationImpl(TrueImpl.getInstance());
      }
     
      else if(tPolicy instanceof NegationImpl){
        // Already primitive. Recurse on contained policy.
        NegationImpl temp = (NegationImpl) tPolicy;
        // Get contained fields
        Policy tempA = temp.policy;
        // Translate contained policy
        tempA = translate(tempA);
        // Create translated policy
        translatedPolicy = new NegationImpl (tempA);
      }
     
      else if (tPolicy == TrueImpl.getInstance()){
        // For true variant
        translatedPolicy = tPolicy;
View Full Code Here

          policyA = parsePolicy(tempElement);
          break;
        }
      }
      // Create new Negation object
      newPolicy = new NegationImpl(policyA);
     
    }
    else if (element.getNodeName().equals("box") || element.getNodeName().equals("diamond")){
      // element represents the "box" or "diamond" variant
      // The case is combined since both behave similarly
View Full Code Here

    else if(tPolicy instanceof NegationImpl){

      // Already primitive. Recurse on contained policy.

      NegationImpl temp = (NegationImpl) tPolicy;

      // Get contained fields

      Policy tempA = temp.getPolicy();

      // Translate contained policy

      tempA = translate(tempA);

      // Create translated policy

      translatedPolicy = new NegationImpl (tempA);

    }

   

    else if (tPolicy instanceof ConjunctionImpl){

      // Already primitive. Recurse on contained policies.

     

      ConjunctionImpl temp = (ConjunctionImpl) tPolicy;

      // Get contained fields

      Policy tempA = temp.getPolicyA();

      Policy tempB = temp.getPolicyB();

      // Translate contained fields

      tempA = translate(tempA);

      tempB = translate(tempB);

      // Create translated policy

      translatedPolicy = new ConjunctionImpl(tempA, tempB);

    }

   

    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
View Full Code Here

   

    else if(policy instanceof NegationImpl){

      NegationImpl temp = (NegationImpl) policy;

      findFreeVars(temp.getPolicy(), free_vars);

    }

   

    else if (policy instanceof ConjunctionImpl){

      ConjunctionImpl temp = (ConjunctionImpl) policy;

     

      Set temp_setA = findFreeVars(temp.getPolicyA(), new HashSet<Object>());

      Set temp_setB = findFreeVars(temp.getPolicyB(), new HashSet<Object>());

      free_vars.addAll(temp_setA);

      free_vars.addAll(temp_setB);

    }

   

    else if (policy instanceof DisjunctionImpl){

      DisjunctionImpl temp = (DisjunctionImpl) policy;

     

      Set temp_setA = findFreeVars(temp.getPolicyA(), new HashSet<Object>());

      Set temp_setB = findFreeVars(temp.getPolicyB(), new HashSet<Object>());

      free_vars.addAll(temp_setA);

      free_vars.addAll(temp_setB);

    }

   

    else if (policy instanceof BoxImpl){

      BoxImpl temp = (BoxImpl) policy;

      findFreeVars(temp.getPolicy(), free_vars);

    }

   

    else if (policy instanceof DiamondImpl){

      DiamondImpl temp = (DiamondImpl) policy;

      free_vars = findFreeVars(temp.getPolicy(), free_vars);

    }

   

    else if (policy instanceof BindImpl){

      BindImpl temp = (BindImpl) policy;

      findFreeVars(temp.getPolicy(), free_vars);

      free_vars.remove(temp.getVariable());

    }

   

    else if (policy instanceof AtImpl){

      AtImpl temp = (AtImpl) policy;

      findFreeVars(temp.getPolicy(), free_vars);

      free_vars.add(temp.getVariable());

    }

    return free_vars;
View Full Code Here

          policyA = parsePolicy(tempElement);
          break;
        }
      }
      // Create new Negation object
      newPolicy = new NegationImpl(policyA);
     
    }
    else if (element.getNodeName().equals("box") || element.getNodeName().equals("diamond")){
      // element represents the "box" or "diamond" variant
      // The case is combined since both behave similarly
View Full Code Here

    else if(tPolicy instanceof NegationImpl){

      // Already primitive. Recurse on contained policy.

      NegationImpl temp = (NegationImpl) tPolicy;

      // Get contained fields

      Policy tempA = temp.getPolicy();

      // Translate contained policy

      tempA = translate(tempA);

      // Create translated policy

      translatedPolicy = new NegationImpl (tempA);

    }

   

    else if (tPolicy instanceof ConjunctionImpl){

      // Already primitive. Recurse on contained policies.

     

      ConjunctionImpl temp = (ConjunctionImpl) tPolicy;

      // Get contained fields

      Policy tempA = temp.getPolicyA();

      Policy tempB = temp.getPolicyB();

      // Translate contained fields

      tempA = translate(tempA);

      tempB = translate(tempB);

      // Create translated policy

      translatedPolicy = new ConjunctionImpl(tempA, tempB);

    }

   

    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
View Full Code Here

          policyA = parsePolicy(tempElement);
          break;
        }
      }
      // Create new Negation object
      newPolicy = new NegationImpl(policyA);
     
    }
    else if (element.getNodeName().equals("box") || element.getNodeName().equals("diamond")){
      // element represents the "box" or "diamond" variant
      // The case is combined since both behave similarly
View Full Code Here

TOP

Related Classes of ca.ucalgary.ispia.rebac.impl.NegationImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.