RegExp (API documentation of hlt.language packages)
Date: 2013-01-30

hlt.language.util

## Class RegExp

- java.lang.Object
- - hlt.language.util.RegExp

- Direct Known Subclasses:
    RegExpOne, RegExpSymbol, RegExpTwo

      public abstract class RegExp
      extends java.lang.Object

  This abstract class defines a representation for a regular expression (RE) on an alphabet of `Object`'s (as opposed to just `char`'s as done in most RE representation packages meant for character word pattern-matching such as `java.util.regex`).

  The purpose of this class and its subclasses is to allow the symbolic manipulation of RE's on any alphabet, providing methods for reading, writing, equality, and normalization to canonical form. RE matching is not the intended use, although it should be simple to have that as well by encoding each `Object` in the alphabet with a `char` and delegate the work to `java.util.regex`.

  The abstract subclasses of this class are:

  - `RegExpOne`

  - `RegExpTwo`

  The concrete subclasses of this class are:

  - `RegExpSymbol`

  - `RegExpOption`

  - `RegExpPlus`

  - `RegExpPower`

  - `RegExpPowerRange`

  - `RegExpStar`

  - `RegExpConcat`

  - `RegExpChoice`
  Version:
    Last modified on Fri Oct 19 17:39:04 2012 by hak
  Author:
    Hassan Aït-Kaci
  Copyright:
    © Hassan Aït-Kaci

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `BINARY_EXP`
    `static int` | `CHOICE_EXP`
    `static int` | `CONCAT_EXP`
    `static RegExpSymbol` | `EMPTY` A canonical empty symbol.
    `static int` | `EMPTY_EXP` Constants identifying each specific type of `RegExp`.
    `static int` | `OPTION_EXP`
    `static int` | `PLUS_EXP`
    `static int` | `POWER_EXP`
    `static int` | `RANGE_EXP`
    `static int` | `STAR_EXP`
    `static int` | `SYMBOL_EXP`
    `static int` | `UNARY_EXP`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RegExp()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `RegExp` | `cleanup(RegExp e)` This simply returns its argument, unless `null` - in which case it returns `EMPTY`.
    `abstract RegExp` | `deepCopy()` This returns a deep copy of this `RegExp`.
    `boolean` | `isBinary()`
    `boolean` | `isChoice()`
    `boolean` | `isConcat()`
    `boolean` | `isEmpty()` Each of the following methods tests whether thus is a specific `RegExp` type or form (i.e., unary or binary).
    `boolean` | `isLexLess(RegExp other)`
    `boolean` | `isOption()`
    `boolean` | `isPlus()`
    `boolean` | `isPower()`
    `boolean` | `isRange()`
    `boolean` | `isStar()`
    `boolean` | `isSymbol()`
    `boolean` | `isUnary()`
    `abstract RegExp` | `normalize()` This is the method that implements the normalization rule set for each syntactic category forming a `RegExp`; namely,: `RegExpSymbol.normalize()` `RegExpOption.normalize()` `RegExpPlus.normalize()` `RegExpStar.normalize()` `RegExpPower.normalize()` `RegExpPowerRange.normalize()` `RegExpConcat.normalize()` `RegExpChoice.normalize()`
    `boolean` | `normEquals(RegExp other)` Returns `true` iff the specified `RegExp`'s normal form is equal to this `RegExp`'s normal form.
    `static void` | `noTrace()` Disables tracing mode.
    `abstract RegExp` | `shallowCopy()` This returns a shallow copy of this `RegExp`.
    `java.lang.String` | `tag()` This returns a string identifying this `RegExp`'s specific type.
    `static void` | `toggleTrace()` Toggles tracing mode.
    `java.lang.String` | `toNormalString()` Returns the printable form for this `RegExp`'s normal form.
    `static void` | `trace()` Enables tracing mode on.
    `static boolean` | `tracing()` Tests whether tracing is on.
    `abstract int` | `type()` This returns the specific type identifying this `RegExp`.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY

          public static final RegExpSymbol EMPTY

      A canonical empty symbol.

    - #### EMPTY_EXP

          public static final int EMPTY_EXP

      Constants identifying each specific type of `RegExp`.
      See Also:
        Constant Field Values

    - #### SYMBOL_EXP

          public static final int SYMBOL_EXP

      See Also:
        Constant Field Values

    - #### OPTION_EXP

          public static final int OPTION_EXP

      See Also:
        Constant Field Values

    - #### PLUS_EXP

          public static final int PLUS_EXP

      See Also:
        Constant Field Values

    - #### STAR_EXP

          public static final int STAR_EXP

      See Also:
        Constant Field Values

    - #### POWER_EXP

          public static final int POWER_EXP

      See Also:
        Constant Field Values

    - #### RANGE_EXP

          public static final int RANGE_EXP

      See Also:
        Constant Field Values

    - #### CHOICE_EXP

          public static final int CHOICE_EXP

      See Also:
        Constant Field Values

    - #### CONCAT_EXP

          public static final int CONCAT_EXP

      See Also:
        Constant Field Values

    - #### UNARY_EXP

          public static final int UNARY_EXP

      See Also:
        Constant Field Values

    - #### BINARY_EXP

          public static final int BINARY_EXP

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RegExp

          public RegExp()

  - ### Method Detail

    - #### normalize

          public abstract RegExp normalize()

      This is the method that implements the normalization rule set for each syntactic category forming a `RegExp`; namely,:
      - `RegExpSymbol.normalize()`
      - `RegExpOption.normalize()`
      - `RegExpPlus.normalize()`
      - `RegExpStar.normalize()`
      - `RegExpPower.normalize()`
      - `RegExpPowerRange.normalize()`
      - `RegExpConcat.normalize()`
      - `RegExpChoice.normalize()`

    - #### normEquals

          public final boolean normEquals(RegExp other)

      Returns `true` iff the specified `RegExp`'s normal form is equal to this `RegExp`'s normal form.

    - #### shallowCopy

          public abstract RegExp shallowCopy()

      This returns a shallow copy of this `RegExp`.

    - #### deepCopy

          public abstract RegExp deepCopy()

      This returns a deep copy of this `RegExp`.

    - #### cleanup

          public final RegExp cleanup(RegExp e)

      This simply returns its argument, unless `null` - in which case it returns `EMPTY`.

    - #### type

          public abstract int type()

      This returns the specific type identifying this `RegExp`.

    - #### tag

          public final java.lang.String tag()

      This returns a string identifying this `RegExp`'s specific type.

    - #### isEmpty

          public final boolean isEmpty()

      Each of the following methods tests whether thus is a specific `RegExp` type or form (i.e., unary or binary).

    - #### isSymbol

          public final boolean isSymbol()

    - #### isChoice

          public final boolean isChoice()

    - #### isConcat

          public final boolean isConcat()

    - #### isOption

          public final boolean isOption()

    - #### isPlus

          public final boolean isPlus()

    - #### isPower

          public final boolean isPower()

    - #### isRange

          public final boolean isRange()

    - #### isStar

          public final boolean isStar()

    - #### isUnary

          public final boolean isUnary()

    - #### isBinary

          public final boolean isBinary()

    - #### toNormalString

          public final java.lang.String toNormalString()

      Returns the printable form for this `RegExp`'s normal form.

    - #### isLexLess

          public final boolean isLexLess(RegExp other)

    - #### tracing

          public static final boolean tracing()

      Tests whether tracing is on.

    - #### trace

          public static final void trace()

      Enables tracing mode on.

    - #### noTrace

          public static final void noTrace()

      Disables tracing mode.

    - #### toggleTrace

          public static final void toggleTrace()

      Toggles tracing mode.