Codota Logo
ProfileTargetingExpression
Code IndexAdd Codota to your IDE (free)

How to use
ProfileTargetingExpression
in
org.milyn.cdr

Best Java code snippets using org.milyn.cdr.ProfileTargetingExpression (Showing top 16 results out of 315)

  • Common ways to obtain ProfileTargetingExpression
private void myMethod () {
ProfileTargetingExpression p =
  • Codota IconString expression;new ProfileTargetingExpression(expression)
  • Smart code suggestions by Codota
}
origin: smooks/smooks

/**
 * 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);
    }
  }
}
origin: smooks/smooks

/**
 * 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;
}
origin: smooks/smooks

specificity += profileTargetingExpressions[i].getSpecificity(profileSet);
origin: org.milyn/milyn-smooks-core

specificity += profileTargetingExpressions[i].getSpecificity(profileSet);
origin: smooks/smooks

/**
 * 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;
}
origin: org.milyn/milyn-smooks-core

/**
 * 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);
    }
  }
}
origin: org.milyn/milyn-smooks-all

specificity += profileTargetingExpressions[i].getSpecificity(profileSet);
origin: org.milyn/milyn-smooks-all

/**
 * 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;
}
origin: org.milyn/milyn-smooks-all

/**
 * 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);
    }
  }
}
origin: org.virtuslab/milyn-smooks-core

specificity += profileTargetingExpressions[i].getSpecificity(profileSet);
origin: org.milyn/milyn-smooks-core

/**
 * 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;
}
origin: org.virtuslab/milyn-smooks-core

/**
 * 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);
    }
  }
}
origin: org.milyn/milyn-smooks-all

/**
 * 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;
}
origin: org.virtuslab/milyn-smooks-core

/**
 * 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;
}
origin: org.milyn/milyn-smooks-core

/**
 * 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;
}
origin: org.virtuslab/milyn-smooks-core

/**
 * 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;
}
org.milyn.cdrProfileTargetingExpression

Javadoc

Represents a single parsed profile targeting expression.

The target-profile attribute can contain multiple comma seperated "profile targeting expressions" i.e. a list of them. See org.milyn.cdr.SmooksResourceConfiguration docs. This class represents a single expression within a list of expressions.

So, a single expression is composed of 1 or more "expression tokens" seperated by "AND". The expression arg to the constructor will be in one of the following forms:

  1. "profileX" i.e. a single entity.
  2. "profileX AND profileY" i.e. a compound entity.
  3. "profileX AND not:profileY" i.e. a compound entity.
Note, we only supports "AND" operations between the tokens, but a token can be negated by prefixing it with "not:".

See ProfileTargetingExpression.ExpressionToken.

Most used methods

  • <init>
  • getSpecificity
    Get the specificity of this expression with respect to the supplied profile set. Iterates over this
  • isMatch
    Does this expression match one of the profiles in the supplied profile set.

Popular in Java

  • Making http post requests using okhttp
  • findViewById (Activity)
  • getSharedPreferences (Context)
  • setContentView (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now