/** * Determines if the specified permission is implied by this permission. * <p> * This method returns {@code false} if and only if at least one of the * following conditions are fulfilled for the specified permission: * <ul> * <li>it is not a {@code MonitorPermission}</li> * <li>it has a broader set of actions allowed than this one</li> * <li>it allows initiating time based monitoring jobs with a lower minimal * sampling interval</li> * <li>the target set of {@code Monitorable}s is not the same nor a subset * of the target set of {@code Monitorable}s of this permission</li> * <li>the target set of {@code StatusVariable}s is not the same nor a * subset of the target set of {@code StatusVariable}s of this permission</li> * </ul> * * @param p the permission to be checked * @return {@code true} if the given permission is implied by this * permission */ public boolean implies(Permission p) { if (!(p instanceof MonitorPermission)) return false; MonitorPermission other = (MonitorPermission) p; if ((mask & other.mask) != other.mask) return false; if ((other.mask & STARTJOB_FLAG) != 0 && minJobInterval > other.minJobInterval) return false; return implies(monId, prefixMonId, other.monId, other.prefixMonId) && implies(varId, prefixVarId, other.varId, other.prefixVarId); }
/** * Determines if the specified permission is implied by this permission. * <p> * This method returns {@code false} if and only if at least one of the * following conditions are fulfilled for the specified permission: * <ul> * <li>it is not a {@code MonitorPermission}</li> * <li>it has a broader set of actions allowed than this one</li> * <li>it allows initiating time based monitoring jobs with a lower minimal * sampling interval</li> * <li>the target set of {@code Monitorable}s is not the same nor a subset * of the target set of {@code Monitorable}s of this permission</li> * <li>the target set of {@code StatusVariable}s is not the same nor a * subset of the target set of {@code StatusVariable}s of this permission</li> * </ul> * * @param p the permission to be checked * @return {@code true} if the given permission is implied by this * permission */ public boolean implies(Permission p) { if (!(p instanceof MonitorPermission)) return false; MonitorPermission other = (MonitorPermission) p; if ((mask & other.mask) != other.mask) return false; if ((other.mask & STARTJOB_FLAG) != 0 && minJobInterval > other.minJobInterval) return false; return implies(monId, prefixMonId, other.monId, other.prefixMonId) && implies(varId, prefixVarId, other.varId, other.prefixVarId); }
/** * Determines if the specified permission is implied by this permission. * <p> * This method returns {@code false} if and only if at least one of the * following conditions are fulfilled for the specified permission: * <ul> * <li>it is not a {@code MonitorPermission}</li> * <li>it has a broader set of actions allowed than this one</li> * <li>it allows initiating time based monitoring jobs with a lower minimal * sampling interval</li> * <li>the target set of {@code Monitorable}s is not the same nor a subset * of the target set of {@code Monitorable}s of this permission</li> * <li>the target set of {@code StatusVariable}s is not the same nor a * subset of the target set of {@code StatusVariable}s of this permission</li> * </ul> * * @param p the permission to be checked * @return {@code true} if the given permission is implied by this * permission */ public boolean implies(Permission p) { if (!(p instanceof MonitorPermission)) return false; MonitorPermission other = (MonitorPermission) p; if ((mask & other.mask) != other.mask) return false; if ((other.mask & STARTJOB_FLAG) != 0 && minJobInterval > other.minJobInterval) return false; return implies(monId, prefixMonId, other.monId, other.prefixMonId) && implies(varId, prefixVarId, other.varId, other.prefixVarId); }