Class Regex.Rank
java.lang.Object
edu.isi.pegasus.planner.selector.replica.Regex.Rank
- All Implemented Interfaces:
Comparable
- Enclosing class:
- Regex
A Data class that allows us to compile a regex expression and associate a rank value with it.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compares the Rank object with another rank object.void
computePriority
(int maxRank) Computes priority based on the max rank passedint
Returns the priorityint
getRank()
Returns the rank associated with it.getRegex()
Returns the underlying regex pattern associated with the Rank object.boolean
Matches a string against the compiled regex expressionprivate void
setPriority
(int priority) toString()
Returns the textual representation of this
-
Field Details
-
mRank
private int mRankThe rank value. -
mPriority
private int mPriorityThe inverse of rank. Higher priority value means lower rank value -
mPattern
The compiled regex expression
-
-
Constructor Details
-
Rank
The default constructor.- Parameters:
rank
- The rank value.regex
- The regex expression.
-
-
Method Details
-
matches
Matches a string against the compiled regex expression- Parameters:
input
- the input string to be matched- Returns:
- boolean indicating whether input matches or not.
-
getRegex
Returns the underlying regex pattern associated with the Rank object.- Returns:
- the regex pattern
-
getRank
public int getRank()Returns the rank associated with it.- Returns:
- the int value of the rank
-
compareTo
Compares the Rank object with another rank object.- Specified by:
compareTo
in interfaceComparable
- Parameters:
o
- the object to be compared.- Returns:
- int
-
toString
Returns the textual representation of this -
computePriority
public void computePriority(int maxRank) Computes priority based on the max rank passed- Parameters:
maxRank
- the maximum rank
-
getPriority
public int getPriority()Returns the priority- Returns:
- priority
-
setPriority
private void setPriority(int priority)
-