public ProfileTargetingExpression(String expression) { if(expression == null || expression.trim().equals("")) { throw new IllegalArgumentException("null or empty 'expression' arg."); } this.expression = expression; String[] tokens = expression.split(" AND "); expressionTokens = new ExpressionToken[tokens.length]; for(int i = 0; i < tokens.length; i++) { String token = tokens[i].trim(); expressionTokens[i] = new ExpressionToken(token); } }
if(isNegated()) { if(profileSet.getBaseProfile().equals(expressionToken)) { return 0; } else if(profileSet.isMember(expressionToken)) { return 0; } else if(isWildcard()) { return 0; return 10; } else if(isWildcard()) { return 5;
if(isNegated()) { if(profileSet.getBaseProfile().equals(expressionToken)) { return 0; } else if(profileSet.isMember(expressionToken)) { return 0; } else if(isWildcard()) { return 0; return 10; } else if(isWildcard()) { return 5;
if(isNegated()) { if(profileSet.getBaseProfile().equals(expressionToken)) { return 0; } else if(profileSet.isMember(expressionToken)) { return 0; } else if(isWildcard()) { return 0; return 10; } else if(isWildcard()) { return 5;
if(isNegated()) { if(profileSet.getBaseProfile().equals(expressionToken)) { return 0; } else if(profileSet.isMember(expressionToken)) { return 0; } else if(isWildcard()) { return 0; return 10; } else if(isWildcard()) { return 5;
/** * Get the specificity of this expression with respect to the supplied profile set. * * Iterates over this expressions list of {@link ExpressionToken}s calling * {@link ExpressionToken#getSpecificity(org.milyn.profile.ProfileSet)} and adds up their specificities. * @param profileSet Evaluation Profile Set. * @return Specificity value of the expression for the supplied profile set. */ public double getSpecificity(ProfileSet profileSet) { double specificity = 0; // Only if the expression matches the device. if(isMatch(profileSet)) { for (int i = 0; i < expressionTokens.length; i++) { if(expressionTokens[i].isMatch(profileSet)) { specificity += expressionTokens[i].getSpecificity(profileSet); } } } return specificity; }
/** * Get the specificity of this expression with respect to the supplied profile set. * <p/> * Iterates over this expressions list of {@link ExpressionToken}s calling * {@link ExpressionToken#getSpecificity(org.milyn.profile.ProfileSet)} and adds up their specificities. * @param profileSet Evaluation Profile Set. * @return Specificity value of the expression for the supplied profile set. */ public double getSpecificity(ProfileSet profileSet) { double specificity = 0; // Only if the expression matches the device. if(isMatch(profileSet)) { for (int i = 0; i < expressionTokens.length; i++) { if(expressionTokens[i].isMatch(profileSet)) { specificity += expressionTokens[i].getSpecificity(profileSet); } } } return specificity; }
/** * Get the specificity of this expression with respect to the supplied profile set. * <p/> * Iterates over this expressions list of {@link ExpressionToken}s calling * {@link ExpressionToken#getSpecificity(org.milyn.profile.ProfileSet)} and adds up their specificities. * @param profileSet Evaluation Profile Set. * @return Specificity value of the expression for the supplied profile set. */ public double getSpecificity(ProfileSet profileSet) { double specificity = 0; // Only if the expression matches the device. if(isMatch(profileSet)) { for (int i = 0; i < expressionTokens.length; i++) { if(expressionTokens[i].isMatch(profileSet)) { specificity += expressionTokens[i].getSpecificity(profileSet); } } } return specificity; }
/** * Get the specificity of this expression with respect to the supplied profile set. * <p/> * Iterates over this expressions list of {@link ExpressionToken}s calling * {@link ExpressionToken#getSpecificity(org.milyn.profile.ProfileSet)} and adds up their specificities. * @param profileSet Evaluation Profile Set. * @return Specificity value of the expression for the supplied profile set. */ public double getSpecificity(ProfileSet profileSet) { double specificity = 0; // Only if the expression matches the device. if(isMatch(profileSet)) { for (int i = 0; i < expressionTokens.length; i++) { if(expressionTokens[i].isMatch(profileSet)) { specificity += expressionTokens[i].getSpecificity(profileSet); } } } return specificity; }
/** * Is the profile specified in this token is a member of the supplied profile set. * @param profileSet Profile set. * @return True if the profile specified in this token is a member of the supplied * profile set, otherwise false. */ public boolean isMatch(ProfileSet profileSet) { if(isWildcard()) { return true; } else if(negated) { return !profileSet.isMember(expressionToken); } else { return profileSet.isMember(expressionToken); } }
/** * Is the profile specified in this token is a member of the supplied profile set. * @param profileSet Profile set. * @return True if the profile specified in this token is a member of the supplied * profile set, otherwise false. */ public boolean isMatch(ProfileSet profileSet) { if(isWildcard()) { return true; } else if(negated) { return !profileSet.isMember(expressionToken); } else { return profileSet.isMember(expressionToken); } }
/** * Does this expression match one of the profiles in the supplied profile set. * @param profileSet Profile set. * @return True if this expression matches one of the profiles in the supplied * profile set, otherwise false. */ public boolean isMatch(ProfileSet profileSet) { for (int i = 0; i < expressionTokens.length; i++) { if(!expressionTokens[i].isMatch(profileSet)) { return false; } } return true; }
/** * Does this expression match one of the profiles in the supplied profile set. * @param profileSet Profile set. * @return True if this expression matches one of the profiles in the supplied * profile set, otherwise false. */ public boolean isMatch(ProfileSet profileSet) { for (int i = 0; i < expressionTokens.length; i++) { if(!expressionTokens[i].isMatch(profileSet)) { return false; } } return true; }
/** * Does this expression match one of the profiles in the supplied profile set. * @param profileSet Profile set. * @return True if this expression matches one of the profiles in the supplied * profile set, otherwise false. */ public boolean isMatch(ProfileSet profileSet) { for (int i = 0; i < expressionTokens.length; i++) { if(!expressionTokens[i].isMatch(profileSet)) { return false; } } return true; }
/** * Does this expression match one of the profiles in the supplied profile set. * @param profileSet Profile set. * @return True if this expression matches one of the profiles in the supplied * profile set, otherwise false. */ public boolean isMatch(ProfileSet profileSet) { for (int i = 0; i < expressionTokens.length; i++) { if(!expressionTokens[i].isMatch(profileSet)) { return false; } } return true; }
/** * Is the profile specified in this token is a member of the supplied profile set. * @param profileSet Profile set. * @return True if the profile specified in this token is a member of the supplied * profile set, otherwise false. */ public boolean isMatch(ProfileSet profileSet) { if(isWildcard()) { return true; } else if(negated) { return !profileSet.isMember(expressionToken); } else { return profileSet.isMember(expressionToken); } }
/** * Is the profile specified in this token is a member of the supplied profile set. * @param profileSet Profile set. * @return True if the profile specified in this token is a member of the supplied * profile set, otherwise false. */ public boolean isMatch(ProfileSet profileSet) { if(isWildcard()) { return true; } else if(negated) { return !profileSet.isMember(expressionToken); } else { return profileSet.isMember(expressionToken); } }
public ProfileTargetingExpression(String expression) { if(expression == null || expression.trim().equals("")) { throw new IllegalArgumentException("null or empty 'expression' arg."); } this.expression = expression; String[] tokens = expression.split(" AND "); expressionTokens = new ExpressionToken[tokens.length]; for(int i = 0; i < tokens.length; i++) { String token = tokens[i].trim(); expressionTokens[i] = new ExpressionToken(token); } }
public ProfileTargetingExpression(String expression) { if(expression == null || expression.trim().equals("")) { throw new IllegalArgumentException("null or empty 'expression' arg."); } this.expression = expression; String[] tokens = expression.split(" AND "); expressionTokens = new ExpressionToken[tokens.length]; for(int i = 0; i < tokens.length; i++) { String token = tokens[i].trim(); expressionTokens[i] = new ExpressionToken(token); } }
public ProfileTargetingExpression(String expression) { if(expression == null || expression.trim().equals("")) { throw new IllegalArgumentException("null or empty 'expression' arg."); } this.expression = expression; String[] tokens = expression.split(" AND "); expressionTokens = new ExpressionToken[tokens.length]; for(int i = 0; i < tokens.length; i++) { String token = tokens[i].trim(); expressionTokens[i] = new ExpressionToken(token); } }