Package ca.ucalgary.ispia.rebac.impl

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


 
  @SuppressWarnings({ "rawtypes", "unchecked" })
  public static Set findFreeVars(Policy policy, Set free_vars){
   
    if (policy instanceof VariableImpl) {
      VariableImpl temp = (VariableImpl) policy;
      free_vars.add(temp.getVariable());
    }
    else if (policy == FalseImpl.getInstance()){
      //nothing added
    }
    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


    }

    else if (tPolicy instanceof OwnerImpl){
   
      //Translate the Owner variant to a variable
      translatedPolicy = new VariableImpl(Constants.owner);
     
    }
    else if (tPolicy instanceof RequestorImpl){
   
      //Translate the Requestor variant to a variable
      translatedPolicy = new VariableImpl(Constants.requestor);
    }

    else if (tPolicy == FalseImpl.getInstance()){

      // Already primitive
View Full Code Here

   

    if (policy instanceof VariableImpl) {

      VariableImpl temp = (VariableImpl) policy;

      free_vars.add(temp.getVariable());

    }

    else if (policy == FalseImpl.getInstance()){

      //nothing added

    }

    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

      newPolicy = OwnerImpl.getInstance();
    }
    else if (element.getNodeName().equals("variable")){ 
      Object temp=null;
      temp = new String (element.getFirstChild().getNodeValue());
      newPolicy = new VariableImpl(temp);
    }
    else if (element.getNodeName().equals("at")||element.getNodeName().equals("bind")){
      Policy policyA = null;
      Object variable = null;
     
View Full Code Here

    }

    else if (tPolicy instanceof OwnerImpl){
   
      //Translate the Owner variant to a variable
      translatedPolicy = new VariableImpl(Constants.owner);
     
    }
    else if (tPolicy instanceof RequestorImpl){
   
      //Translate the Requestor variant to a variable
      translatedPolicy = new VariableImpl(Constants.requestor);
    }
    else if (tPolicy instanceof ResourceImpl){
      //Translate the Resource variant to ta variable
      translatedPolicy = new VariableImpl(Constants.resource);
    }

    else if (tPolicy == FalseImpl.getInstance()){

      // Already primitive
View Full Code Here

      newPolicy = FalseImpl.getInstance();
    }
    else if (element.getNodeName().equals("variable")){ 
      Object temp=null;
      temp = new String (element.getFirstChild().getNodeValue());
      newPolicy = new VariableImpl(temp);
    }
    else if (element.getNodeName().equals("at")||element.getNodeName().equals("bind")){
      Policy policyA = null;
      Object variable = null;
     
View Full Code Here

TOP

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

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.