Class Regex.Rank

java.lang.Object
edu.isi.pegasus.planner.selector.replica.Regex.Rank
All Implemented Interfaces:
Comparable
Enclosing class:
Regex

private static class Regex.Rank extends Object implements Comparable
A Data class that allows us to compile a regex expression and associate a rank value with it.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Pattern
    The compiled regex expression
    private int
    The inverse of rank.
    private int
    The rank value.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Rank(int rank, String regex)
    The default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares the Rank object with another rank object.
    void
    computePriority(int maxRank)
    Computes priority based on the max rank passed
    int
    Returns the priority
    int
    Returns the rank associated with it.
    Returns the underlying regex pattern associated with the Rank object.
    boolean
    matches(String input)
    Matches a string against the compiled regex expression
    private void
    setPriority(int priority)
     
    Returns the textual representation of this

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • mRank

      private int mRank
      The rank value.
    • mPriority

      private int mPriority
      The inverse of rank. Higher priority value means lower rank value
    • mPattern

      private Pattern mPattern
      The compiled regex expression
  • Constructor Details

    • Rank

      public Rank(int rank, String regex)
      The default constructor.
      Parameters:
      rank - The rank value.
      regex - The regex expression.
  • Method Details

    • matches

      public boolean matches(String input)
      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

      public Pattern 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

      public int compareTo(Object o)
      Compares the Rank object with another rank object.
      Specified by:
      compareTo in interface Comparable
      Parameters:
      o - the object to be compared.
      Returns:
      int
    • toString

      public String toString()
      Returns the textual representation of this
      Overrides:
      toString in class Object
    • 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)