|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.milyn.cdr.ProfileTargetingExpression.ExpressionToken
public class ProfileTargetingExpression.ExpressionToken
Profile targeting expression token.
| Method Summary | |
|---|---|
double |
getSpecificity(ProfileSet profileSet)
Get the specificity of this token with respect to the supplied device. |
String |
getToken()
Get the token value (profile). |
boolean |
isMatch(ProfileSet profileSet)
Is the profile specified in this token is a member of the supplied profile set. |
boolean |
isNegated()
Is this token negated. |
boolean |
isWildcard()
Is the token a wildcard token. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public String getToken()
public boolean isNegated()
public boolean isWildcard()
public boolean isMatch(ProfileSet profileSet)
profileSet - Profile set.
public double getSpecificity(ProfileSet profileSet)
if(isNegated()) {
if(profileSet.getBaseProfile().equals(expressionToken)) {
return 0;
} else if(profileSet.isMember(expressionToken)) {
return 0;
} else if(isWildcard()) {
return 0;
}
return 1;
} else {
// Is the "expressionToken" referencing the base profile, a sub-profile,
// or is it a wildcard token.
Profile profile = profileSet.getProfile(expressionToken);
if(profileSet.getBaseProfile().equalsIgnoreCase(expressionToken)) {
return 100;
} else if(profile != null) {
// If it's a HTTP "Accept" header media profile, multiple
// the specificity by the media qvalue. See the
// HttpAcceptHeaderProfile javadocs.
if(profile instanceof HttpAcceptHeaderProfile) {
return (10 * ((HttpAcceptHeaderProfile)profile).getParamNumeric("q", 1));
} else {
return 10;
}
} else if(isWildcard()) {
return 5;
}
return 0;
}
profileSet - Profile set.
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||