00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 package org.osgi.service.condpermadmin;
00020
00021 import java.util.Dictionary;
00022
00030 public interface Condition {
00035 public final static Condition TRUE = new BooleanCondition(true);
00036
00041 public final static Condition FALSE = new BooleanCondition(false);
00042
00056 boolean isPostponed();
00057
00064 boolean isSatisfied();
00065
00073 boolean isMutable();
00074
00092 boolean isSatisfied(Condition conditions[], Dictionary context);
00093
00094 }
00095
00100 final class BooleanCondition implements Condition {
00101 final boolean satisfied;
00102
00103 BooleanCondition(boolean satisfied) {
00104 this.satisfied = satisfied;
00105 }
00106
00107 public boolean isPostponed() {
00108 return false;
00109 }
00110
00111 public boolean isSatisfied() {
00112 return satisfied;
00113 }
00114
00115 public boolean isMutable() {
00116 return false;
00117 }
00118
00119 public boolean isSatisfied(Condition[] conds, Dictionary context) {
00120 for (int i = 0; i < conds.length; i++) {
00121 if (!conds[i].isSatisfied())
00122 return false;
00123 }
00124 return true;
00125 }
00126
00127 }