com.github.mkroli.lpm

LongestPrefixMatch

Related Doc: package lpm

class LongestPrefixMatch[T] extends LongestPrefixMatchSugar[T]

This class stores data belonging to decimal number ranges. This can be used inside dial plans. Ranges with more than 2 permutations are compressed automatically. When querying this the value of the longest matching path will be returned. So if there are the ranges 1 and 11-13 when querying with 12, the later's value will be returned. This is as it holds the longer prefix (2 digits instead of 1).

Example usage:

val lpm = new LongestPrefixMatch[String].
  addValueForRange("123", "456", "V1").
  addValueForRange("12345", "12349", "V2")
lpm.getValueFromPrefix("1234")  // will return Some("V1")
lpm.getValueFromPrefix("12347") // will return Some("V2")
Linear Supertypes
LongestPrefixMatchSugar[T], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. LongestPrefixMatch
  2. LongestPrefixMatchSugar
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LongestPrefixMatch()

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. def +(rangeStart: String, rangeEnd: String, value: T): LongestPrefixMatch[T]

    Definition Classes
    LongestPrefixMatchSugar
  4. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  5. def addValueForRange(rangeStart: String, rangeEnd: String, value: T): LongestPrefixMatch[T]

    Adds a range-specific value.

    Adds a range-specific value. The rangeStart and rangeEnd parameters must be of the same length.

    rangeStart

    the inclusive start of the range

    rangeEnd

    the inclusive end of the range

    value

    the data to be stored for this range

    returns

    an updated instance of [this]

    Annotations
    @throws( classOf[IllegalArgumentException] )
  6. def apply(prefix: String): Option[T]

    Definition Classes
    LongestPrefixMatchSugar
  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def compact(): LongestPrefixMatch[T]

  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  14. def getValueFromPrefix(prefix: String): Option[T]

    Retrieves the value stored under the longest range matching.

    Retrieves the value stored under the longest range matching.

    prefix

    the number to match prefixes against

  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  21. def toString(): String

    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from LongestPrefixMatchSugar[T]

Inherited from AnyRef

Inherited from Any

Ungrouped