1 18 19 package org.osgi.service.condpermadmin; 20 21 import java.util.Dictionary ; 22 23 30 public interface Condition { 31 35 public final static Condition TRUE = new BooleanCondition(true); 36 37 41 public final static Condition FALSE = new BooleanCondition(false); 42 43 56 boolean isPostponed(); 57 58 64 boolean isSatisfied(); 65 66 73 boolean isMutable(); 74 75 92 boolean isSatisfied(Condition conditions[], Dictionary context); 93 94 } 95 96 100 final class BooleanCondition implements Condition { 101 final boolean satisfied; 102 103 BooleanCondition(boolean satisfied) { 104 this.satisfied = satisfied; 105 } 106 107 public boolean isPostponed() { 108 return false; 109 } 110 111 public boolean isSatisfied() { 112 return satisfied; 113 } 114 115 public boolean isMutable() { 116 return false; 117 } 118 119 public boolean isSatisfied(Condition[] conds, Dictionary context) { 120 for (int i = 0; i < conds.length; i++) { 121 if (!conds[i].isSatisfied()) 122 return false; 123 } 124 return true; 125 } 126 127 } 128 | Popular Tags |