scala.util.automata

class WordBerrySethi

[source: scala/util/automata/WordBerrySethi.scala]

abstract class WordBerrySethi
extends BaseBerrySethi
This class turns a regexp into a NondetWordAutom using the celebrated position automata construction (also called Berry-Sethi or Glushkov)
Author
Burak Emir
Version
1.0
Direct Known Subclasses:
ContentModel.Translator

Type Summary
type _labelT
Value Summary
protected var defaultq : Array[List[Int]]
protected var deltaq : Array[HashMap[_labelT, List[Int]]]
protected var initials : Set[Int]
protected var labelAt : TreeMap[Int, _labelT]
protected var labels : HashSet[_labelT]
override abstract val lang : WordExp
Values and Variables inherited from BaseBerrySethi
pos, globalFirst, follow, finalTag, finals, emptySet
Method Summary
def automatonFrom (pat : RegExp, finalTag : Int) : NondetWordAutom[_labelT]
protected def collectTransitions : Unit
protected override def compFirst (r : RegExp) : Set[Int]
Computes first(r) where the word regexp r.
protected override def compFollow1 (fol1 : Set[Int], r : RegExp) : Set[Int]
Returns the first set of an expression, setting the follow set along the way.
protected override def compLast (r : RegExp) : Set[Int]
Computes last(r) where the word regexp r.
protected def initialize (subexpr : Seq[RegExp]) : Unit
protected def initializeAutom : Unit
protected def makeTransition (src : Int, dest : Int, label : _labelT) : Unit
protected def seenLabel (r : RegExp, label : _labelT) : Int
protected def seenLabel (r : RegExp, i : Int, label : _labelT) : Unit
called at the leaves of the regexp
override def traverse (r : RegExp) : Unit
returns "Sethi-length" of a pattern, creating the set of position along the way.
Methods inherited from BaseBerrySethi
compFollow
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Type Details
type _labelT

Value Details
override abstract val lang : WordExp
Overrides
BaseBerrySethi.lang

protected var labels : HashSet[_labelT]

protected var labelAt : TreeMap[Int, _labelT]

protected var deltaq : Array[HashMap[_labelT, List[Int]]]

protected var defaultq : Array[List[Int]]

protected var initials : Set[Int]

Method Details
protected override def compFirst(r : RegExp) : Set[Int]
Computes first(r) where the word regexp r.
Parameters
r - the regular expression
Returns
the computed set first(r)
Overrides
BaseBerrySethi.compFirst

protected override def compLast(r : RegExp) : Set[Int]
Computes last(r) where the word regexp r.
Parameters
r - the regular expression
Returns
the computed set last(r)
Overrides
BaseBerrySethi.compLast

protected override def compFollow1(fol1 : Set[Int], r : RegExp) : Set[Int]
Returns the first set of an expression, setting the follow set along the way.
Parameters
fol1 - ...
r - the regular expression
Returns
the computed set
Overrides
BaseBerrySethi.compFollow1

protected def seenLabel(r : RegExp, i : Int, label : _labelT) : Unit
called at the leaves of the regexp

protected def seenLabel(r : RegExp, label : _labelT) : Int

override def traverse(r : RegExp) : Unit
returns "Sethi-length" of a pattern, creating the set of position along the way.
Parameters
r - ...
Overrides
BaseBerrySethi.traverse

protected def makeTransition(src : Int, dest : Int, label : _labelT) : Unit

protected def initialize(subexpr : Seq[RegExp]) : Unit

protected def initializeAutom : Unit

protected def collectTransitions : Unit

def automatonFrom(pat : RegExp, finalTag : Int) : NondetWordAutom[_labelT]