/** * Parse the targeting expressions for this configuration. * * @param targetProfiles The <b>target-profile</b> expression from the resource configuration. */ private void parseTargetingExpressions(String targetProfiles) { // Parse the profiles. Seperation tokens: ',' '|' and ';' StringTokenizer tokenizer = new StringTokenizer(targetProfiles, ",|;"); if (tokenizer.countTokens() == 0) { throw new IllegalArgumentException("Empty 'target-profile'. [" + selector + "][" + resource + "]"); } else { this.profileTargetingExpressionStrings = new String[tokenizer.countTokens()]; profileTargetingExpressions = new ProfileTargetingExpression[tokenizer.countTokens()]; for (int i = 0; tokenizer.hasMoreTokens(); i++) { String expression = tokenizer.nextToken(); this.profileTargetingExpressionStrings[i] = expression; profileTargetingExpressions[i] = new ProfileTargetingExpression(expression); } } }
/** * 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; }
specificity += profileTargetingExpressions[i].getSpecificity(profileSet);
specificity += profileTargetingExpressions[i].getSpecificity(profileSet);
/** * Get all SmooksResourceConfiguration entries targeted at the specified profile set. * @param profileSet The profile set to searh against. * @return All SmooksResourceConfiguration entries targeted at the specified profile set. */ public SmooksResourceConfiguration[] getTargetConfigurations(ProfileSet profileSet) { Vector<SmooksResourceConfiguration> matchingSmooksResourceConfigurationsColl = new Vector<SmooksResourceConfiguration>(); SmooksResourceConfiguration[] matchingSmooksResourceConfigurations; // Iterate over the SmooksResourceConfigurations defined on this list. for(int i = 0; i < size(); i++) { SmooksResourceConfiguration resourceConfig = get(i); ProfileTargetingExpression[] profileTargetingExpressions = resourceConfig.getProfileTargetingExpressions(); for(int expIndex = 0; expIndex < profileTargetingExpressions.length; expIndex++) { ProfileTargetingExpression expression = profileTargetingExpressions[expIndex]; if(expression.isMatch(profileSet)) { matchingSmooksResourceConfigurationsColl.addElement(resourceConfig); break; } else { logger.debug("Resource [" + resourceConfig + "] not targeted at profile [" + profileSet.getBaseProfile() + "]. Sub Profiles: [" + profileSet + "]"); } } } matchingSmooksResourceConfigurations = new SmooksResourceConfiguration[matchingSmooksResourceConfigurationsColl.size()]; matchingSmooksResourceConfigurationsColl.toArray(matchingSmooksResourceConfigurations); return matchingSmooksResourceConfigurations; }
/** * Parse the targeting expressions for this configuration. * * @param targetProfiles The <b>target-profile</b> expression from the resource configuration. */ private void parseTargetingExpressions(String targetProfiles) { // Parse the profiles. Seperation tokens: ',' '|' and ';' StringTokenizer tokenizer = new StringTokenizer(targetProfiles, ",|;"); if (tokenizer.countTokens() == 0) { throw new IllegalArgumentException("Empty 'target-profile'. [" + selector + "][" + resource + "]"); } else { this.profileTargetingExpressionStrings = new String[tokenizer.countTokens()]; profileTargetingExpressions = new ProfileTargetingExpression[tokenizer.countTokens()]; for (int i = 0; tokenizer.hasMoreTokens(); i++) { String expression = tokenizer.nextToken(); this.profileTargetingExpressionStrings[i] = expression; profileTargetingExpressions[i] = new ProfileTargetingExpression(expression); } } }
specificity += profileTargetingExpressions[i].getSpecificity(profileSet);
/** * Get all SmooksResourceConfiguration entries targeted at the specified profile set. * @param profileSet The profile set to searh against. * @return All SmooksResourceConfiguration entries targeted at the specified profile set. */ public SmooksResourceConfiguration[] getTargetConfigurations(ProfileSet profileSet) { Vector<SmooksResourceConfiguration> matchingSmooksResourceConfigurationsColl = new Vector<SmooksResourceConfiguration>(); SmooksResourceConfiguration[] matchingSmooksResourceConfigurations; // Iterate over the SmooksResourceConfigurations defined on this list. for(int i = 0; i < size(); i++) { SmooksResourceConfiguration resourceConfig = get(i); ProfileTargetingExpression[] profileTargetingExpressions = resourceConfig.getProfileTargetingExpressions(); for(int expIndex = 0; expIndex < profileTargetingExpressions.length; expIndex++) { ProfileTargetingExpression expression = profileTargetingExpressions[expIndex]; if(expression.isMatch(profileSet)) { matchingSmooksResourceConfigurationsColl.addElement(resourceConfig); break; } else { logger.debug("Resource [" + resourceConfig + "] not targeted at profile [" + profileSet.getBaseProfile() + "]. Sub Profiles: [" + profileSet + "]"); } } } matchingSmooksResourceConfigurations = new SmooksResourceConfiguration[matchingSmooksResourceConfigurationsColl.size()]; matchingSmooksResourceConfigurationsColl.toArray(matchingSmooksResourceConfigurations); return matchingSmooksResourceConfigurations; }
/** * Parse the targeting expressions for this configuration. * * @param targetProfiles The <b>target-profile</b> expression from the resource configuration. */ private void parseTargetingExpressions(String targetProfiles) { // Parse the profiles. Seperation tokens: ',' '|' and ';' StringTokenizer tokenizer = new StringTokenizer(targetProfiles, ",|;"); if (tokenizer.countTokens() == 0) { throw new IllegalArgumentException("Empty 'target-profile'. [" + selector + "][" + resource + "]"); } else { this.profileTargetingExpressionStrings = new String[tokenizer.countTokens()]; profileTargetingExpressions = new ProfileTargetingExpression[tokenizer.countTokens()]; for (int i = 0; tokenizer.hasMoreTokens(); i++) { String expression = tokenizer.nextToken(); this.profileTargetingExpressionStrings[i] = expression; profileTargetingExpressions[i] = new ProfileTargetingExpression(expression); } } }
specificity += profileTargetingExpressions[i].getSpecificity(profileSet);
/** * 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; }
/** * Parse the targeting expressions for this configuration. * * @param targetProfiles The <b>target-profile</b> expression from the resource configuration. */ private void parseTargetingExpressions(String targetProfiles) { // Parse the profiles. Seperation tokens: ',' '|' and ';' StringTokenizer tokenizer = new StringTokenizer(targetProfiles, ",|;"); if (tokenizer.countTokens() == 0) { throw new IllegalArgumentException("Empty 'target-profile'. [" + selector + "][" + resource + "]"); } else { this.profileTargetingExpressionStrings = new String[tokenizer.countTokens()]; profileTargetingExpressions = new ProfileTargetingExpression[tokenizer.countTokens()]; for (int i = 0; tokenizer.hasMoreTokens(); i++) { String expression = tokenizer.nextToken(); this.profileTargetingExpressionStrings[i] = expression; profileTargetingExpressions[i] = new ProfileTargetingExpression(expression); } } }
/** * 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. * * 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 all SmooksResourceConfiguration entries targeted at the specified profile set. * @param profileSet The profile set to searh against. * @return All SmooksResourceConfiguration entries targeted at the specified profile set. */ public SmooksResourceConfiguration[] getTargetConfigurations(ProfileSet profileSet) { Vector<SmooksResourceConfiguration> matchingSmooksResourceConfigurationsColl = new Vector<SmooksResourceConfiguration>(); SmooksResourceConfiguration[] matchingSmooksResourceConfigurations; // Iterate over the SmooksResourceConfigurations defined on this list. for(int i = 0; i < size(); i++) { SmooksResourceConfiguration resourceConfig = get(i); ProfileTargetingExpression[] profileTargetingExpressions = resourceConfig.getProfileTargetingExpressions(); for(int expIndex = 0; expIndex < profileTargetingExpressions.length; expIndex++) { ProfileTargetingExpression expression = profileTargetingExpressions[expIndex]; if(expression.isMatch(profileSet)) { matchingSmooksResourceConfigurationsColl.addElement(resourceConfig); break; } else { logger.debug("Resource [" + resourceConfig + "] not targeted at profile [" + profileSet.getBaseProfile() + "]. Sub Profiles: [" + profileSet + "]"); } } } matchingSmooksResourceConfigurations = new SmooksResourceConfiguration[matchingSmooksResourceConfigurationsColl.size()]; matchingSmooksResourceConfigurationsColl.toArray(matchingSmooksResourceConfigurations); return matchingSmooksResourceConfigurations; }
/** * Get all SmooksResourceConfiguration entries targeted at the specified profile set. * @param profileSet The profile set to searh against. * @return All SmooksResourceConfiguration entries targeted at the specified profile set. */ public SmooksResourceConfiguration[] getTargetConfigurations(ProfileSet profileSet) { Vector<SmooksResourceConfiguration> matchingSmooksResourceConfigurationsColl = new Vector<SmooksResourceConfiguration>(); SmooksResourceConfiguration[] matchingSmooksResourceConfigurations; // Iterate over the SmooksResourceConfigurations defined on this list. for(int i = 0; i < size(); i++) { SmooksResourceConfiguration resourceConfig = get(i); ProfileTargetingExpression[] profileTargetingExpressions = resourceConfig.getProfileTargetingExpressions(); for(int expIndex = 0; expIndex < profileTargetingExpressions.length; expIndex++) { ProfileTargetingExpression expression = profileTargetingExpressions[expIndex]; if(expression.isMatch(profileSet)) { matchingSmooksResourceConfigurationsColl.addElement(resourceConfig); break; } else { logger.debug("Resource [" + resourceConfig + "] not targeted at profile [" + profileSet.getBaseProfile() + "]. Sub Profiles: [" + profileSet + "]"); } } } matchingSmooksResourceConfigurations = new SmooksResourceConfiguration[matchingSmooksResourceConfigurationsColl.size()]; matchingSmooksResourceConfigurationsColl.toArray(matchingSmooksResourceConfigurations); return matchingSmooksResourceConfigurations; }