Skip to content

Commit

Permalink
Docs cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
taflanidi committed Apr 10, 2023
1 parent 0d34b09 commit 093c991
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ open class NumberInputListener(
val decimalSeparator = "."

/**
* Create a `NumberInputListener` instance and assign it as a field's
* Create a ``NumberInputListener`` instance and assign it as a field's
* `TextWatcher` and `onFocusChangeListener`.
*/
fun installOn(
Expand All @@ -223,7 +223,7 @@ open class NumberInputListener(
)

/**
* Create a `NumberInputListener` instance and assign it as a field's
* Create a ``NumberInputListener`` instance and assign it as a field's
* `TextWatcher` and `onFocusChangeListener`.
*/
fun installOn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.redmadrobot.inputmask.model.Notation
/**
* ### PhoneInputListener
*
* A ```MaskedTextInputListener``` subclass for guessing a country based on the entered digit sequence
* A ``MaskedTextInputListener`` subclass for guessing a country based on the entered digit sequence
*
* Computed country dictates the phone formatting
*/
Expand Down Expand Up @@ -79,17 +79,17 @@ open class PhoneInputListener(
)

/**
* A detected ```Country``` based on the entered digits
* A detected ``Country`` based on the entered digits
*/
var computedCountry: Country? = null

/**
* A list of possible ```Country``` candidates based on the entered digits
* A list of possible ``Country`` candidates based on the entered digits
*/
var computedCountries: List<Country> = listOf()

/**
* Allowed ```Country``` list. Pre-filters the ```Country::all``` dictionary.
* Allowed ``Country`` list. Pre-filters the ``Country::all`` dictionary.
*
* May contain country names, native country names, ISO-3166 codes, country emojis, or their mix.
*
Expand All @@ -105,7 +105,7 @@ open class PhoneInputListener(
var enableCountries: List<String>? = null

/**
* Blocked ```Country``` list. Pre-filters the ```Country::all``` dictionary.
* Blocked ``Country`` list. Pre-filters the ``Country::all`` dictionary.
*
* May contain country names, native country names, ISO-3166 codes, country emojis, or their mix.
*
Expand All @@ -121,7 +121,7 @@ open class PhoneInputListener(
var disableCountries: List<String>? = null

/**
A custom ```Country``` list to be used instead of ```Country::all``` dictionary.
A custom ``Country`` list to be used instead of ``Country::all`` dictionary.
*/
var customCountries: List<Country>? = null

Expand All @@ -142,7 +142,7 @@ open class PhoneInputListener(

companion object {
/**
* Create a `PhoneInputListener` instance and assign it as a field's
* Create a ``PhoneInputListener`` instance and assign it as a field's
* `TextWatcher` and `onFocusChangeListener`.
*/
fun installOn(
Expand All @@ -157,7 +157,7 @@ open class PhoneInputListener(
)

/**
* Create a `PhoneInputListener` instance and assign it as a field's
* Create a ``PhoneInputListener`` instance and assign it as a field's
* `TextWatcher` and `onFocusChangeListener`.
*/
fun installOn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ enum class AffinityCalculationStrategy {
/**
* Default strategy.
*
* Uses ```Mask``` built-in mechanism to calculate total affinity between the text and the mask format.
* Uses ``Mask`` built-in mechanism to calculate total affinity between the text and the mask format.
*
* For example:
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import com.redmadrobot.inputmask.model.CaretString
/**
* ### CaretStringIterator
*
* Iterates over CaretString.string characters. Each ```next()``` call returns current character and
* Iterates over CaretString.string characters. Each `next()` call returns current character and
* adjusts iterator position.
*
* ```CaretStringIterator``` is used by the ```Mask``` instance to iterate over the string that
* ``CaretStringIterator`` is used by the ``Mask`` instance to iterate over the string that
* should be formatted.
*
* @author taflanidi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,48 @@ import com.redmadrobot.inputmask.model.state.*
* ### Compiler
*
* Creates a sequence of states from the mask format string.
* @see ```State``` class.
* @see ``State`` class.
*
* @complexity ```O(formatString.characters.count)``` plus ```FormatSanitizer``` complexity.
* @complexity `O(formatString.characters.count)` plus ``FormatSanitizer`` complexity.
*
* @requires Format string to contain only flat groups of symbols in ```[]``` and ```{}``` brackets
* without nested brackets, like ```[[000]99]```. Also, ```[…]``` groups may contain only the
* specified characters ("0", "9", "A", "a", "…", "_" and "-"). Square bracket ```[]``` groups cannot
* @requires Format string to contain only flat groups of symbols in `[]` and `{}` brackets
* without nested brackets, like `[[000]99]`. Also, `[…]` groups may contain only the
* specified characters ("0", "9", "A", "a", "…", "_" and "-"). Square bracket `[]` groups cannot
* contain mixed types of symbols ("0" and "9" with "A" and "a" or "_" and "-").
*
* ```Compiler``` object is initialized and ```Compiler.compile(formatString:)``` is called during
* the ```Mask``` instance initialization.
* ``Compiler`` object is initialized and ``Compiler.compile(formatString:)`` is called during
* the ``Mask`` instance initialization.
*
* ```Compiler``` uses ```FormatSanitizer``` to prepare ```formatString``` for the compilation.
* ``Compiler`` uses ``FormatSanitizer`` to prepare `formatString` for the compilation.
*
* @author taflanidi
*/
class Compiler(
/**
* A list of custom rules to compile square bracket ```[]``` groups of format symbols.
* A list of custom rules to compile square bracket `[]` groups of format symbols.
*
* @see ```Notation``` class.
* @see ``Notation`` class.
*/
private val customNotations: List<Notation>
) {

/**
* ### FormatError
*
* Compiler error exception type, thrown when ```formatString``` contains inappropriate
* Compiler error exception type, thrown when `formatString` contains inappropriate
* character sequences.
*
* ```FormatError``` is used by the ```Compiler``` and ```FormatSanitizer``` classes.
* ``FormatError`` is used by the ``Compiler`` and ``FormatSanitizer`` classes.
*/
class FormatError : Exception()

/**
* Compile ```formatString``` into the sequence of states.
* Compile `formatString` into the sequence of states.
*
* * "Free" characters from ```formatString``` are converted to ```FreeState```-s.
* * Characters in square brackets are converted to ```ValueState```-s and ```OptionalValueState```-s.
* * Characters in curly brackets are converted to ```FixedState```-s.
* * End of the formatString line makes ```EOLState```.
* * "Free" characters from `formatString` are converted to ``FreeState``-s.
* * Characters in square brackets are converted to ``ValueState``-s and ``OptionalValueState``-s.
* * Characters in curly brackets are converted to ``FixedState``-s.
* * End of the formatString line makes ``EOLState``.
*
* For instance,
*
Expand All @@ -74,17 +74,17 @@ class Compiler(
*
* @param formatString string with a mask format.
*
* @see ```State``` class.
* @see ``State`` class.
*
* @complexity ```O(formatString.characters.count)``` plus ```FormatSanitizer``` complexity.
* @complexity `O(formatString.characters.count)` plus ``FormatSanitizer`` complexity.
*
* @requires: Format string to contain only flat groups of symbols in ```[]``` and ```{}``` brackets
* without nested brackets, like ```[[000]99]```. Also, ```[…]``` groups may contain only the
* @requires: Format string to contain only flat groups of symbols in `[]` and `{}` brackets
* without nested brackets, like `[[000]99]`. Also, `[…]` groups may contain only the
* specified characters ("0", "9", "A", "a", "…", "_" and "-").
*
* @returns Initialized ```State``` object with assigned ```State.child``` chain.
* @returns Initialized ``State`` object with assigned ``State.child`` chain.
*
* @throws ```FormatError``` if ```formatString``` does not conform to the method requirements.
* @throws ``FormatError`` if `formatString` does not conform to the method requirements.
*/
@Throws(FormatError::class)
fun compile(formatString: String): State {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ import java.util.*
/**
* ### FormatSanitizer
*
* Sanitizes given ```formatString``` before it's compilation.
* Sanitizes given `formatString` before it's compilation.
*
* @complexity ```O(2*floor(log(n)))```, and switches to ```O(n^2)``` for ```n < 20``` where
* ```n = formatString.characters.count```
* @complexity `O(2*floor(log(n)))`, and switches to `O(n^2)` for `n < 20` where
* `n = formatString.characters.count`
*
* @requires Format string to contain only flat groups of symbols in ```[]``` and ```{}``` brackets
* without nested brackets, like ```[[000]99]```. Square bracket ```[]``` groups may contain mixed
* @requires Format string to contain only flat groups of symbols in `[]` and `{}` brackets
* without nested brackets, like `[[000]99]`. Square bracket `[]` groups may contain mixed
* types of symbols ("0" and "9" with "A" and "a" or "_" and "-"), which sanitizer will divide into
* separate groups. Such that, ```[0000Aa]``` group will be divided in two groups: ```[0000]```
* and ```[Aa]```.
* separate groups. Such that, `[0000Aa]` group will be divided in two groups: `[0000]`
* and `[Aa]`.
*
* ```FormatSanitizer``` is used by ```Compiler``` before format string compilation.
* ``FormatSanitizer`` is used by ``Compiler`` before format string compilation.
*
* @author taflanidi
*/
class FormatSanitizer {

/**
* Sanitize ```formatString``` before compilation.
* Sanitize `formatString` before compilation.
*
* In order to do so, sanitizer splits the string into groups of regular symbols, symbols in square
* brackets [] and symbols in curly brackets {}. Then, characters in square brackets are sorted in
* brackets `[]` and symbols in curly brackets `{}`. Then, characters in square brackets are sorted in
* a way that mandatory symbols go before optional symbols. For instance,
*
* ```
Expand All @@ -39,22 +39,22 @@ class FormatSanitizer {
* a ([0099]) b
* ```
*
* Also, ellipsis in square brackets [] is always placed at the end.
* Also, ellipsis in square brackets `[]` is always placed at the end.
*
* @complexity ```O(2*floor(log(n)))```, and switches to ```O(n^2)``` for ```n < 20``` where
* ```n = formatString.characters.count```
* @complexity `O(2*floor(log(n)))`, and switches to `O(n^2)` for `n < 20` where
* `n = formatString.characters.count`
*
* @requires Format string to contain only flat groups of symbols in ```[]``` and ```{}``` brackets
* without nested brackets, like ```[[000]99]```. Square bracket ```[]``` groups may contain mixed
* @requires Format string to contain only flat groups of symbols in `[]` and `{}` brackets
* without nested brackets, like `[[000]99]`. Square bracket `[]` groups may contain mixed
* types of symbols ("0" and "9" with "A" and "a" or "_" and "-"), which sanitizer will divide into
* separate groups. Such that, ```[0000Aa]``` group will be divided in two groups: ```[0000]```
* and ```[Aa]```.
* separate groups. Such that, `[0000Aa]` group will be divided in two groups: `[0000]`
* and `[Aa]`.
*
* @param formatString: mask format string.
*
* @returns Sanitized format string.
*
* @throws ```FormatError``` if ```formatString``` does not conform to the method requirements.
* @throws ``FormatError`` if `formatString` does not conform to the method requirements.
*/
@Throws(Compiler.FormatError::class)
fun sanitize(formatString: String): String {
Expand Down
22 changes: 11 additions & 11 deletions inputmask/src/main/kotlin/com/redmadrobot/inputmask/helper/Mask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import java.util.*
* Iterates over user input. Creates formatted strings from it. Extracts value specified by mask
* format.
*
* Provided mask format string is translated by the ```Compiler``` class into a set of states, which
* Provided mask format string is translated by the ``Compiler`` class into a set of states, which
* define the formatting and value extraction.
*
* @see ```Compiler```, ```State``` and ```CaretString``` classes.
* @see ``Compiler``, ``State`` and ``CaretString`` classes.
*
* @author taflanidi
*/
Expand Down Expand Up @@ -70,11 +70,11 @@ open class Mask(format: String, protected val customNotations: List<Notation>) {
/**
* Factory constructor.
*
* Operates over own ```Mask``` cache where initialized ```Mask``` objects are stored under
* Operates over own ``Mask`` cache where initialized ``Mask`` objects are stored under
* corresponding format key:
* ```[format : mask]```
* `[format : mask]`
*
* @returns Previously cached ```Mask``` object for requested format string. If such it
* @returns Previously cached ``Mask`` object for requested format string. If such it
* doesn't exist in cache, the object is constructed, cached and returned.
*/
fun getOrCreate(format: String, customNotations: List<Notation>): Mask {
Expand All @@ -90,10 +90,10 @@ open class Mask(format: String, protected val customNotations: List<Notation>) {
* Check your mask format is valid.
*
* @param format mask format.
* @param customNotations a list of custom rules to compile square bracket ```[]``` groups of format symbols.
* @param customNotations a list of custom rules to compile square bracket `[]` groups of format symbols.
*
* @returns ```true``` if this format coupled with custom notations will compile into a working ```Mask``` object.
* Otherwise ```false```.
* @returns `true` if this format coupled with custom notations will compile into a working ``Mask`` object.
* Otherwise `false`.
*/
fun isValid(format: String, customNotations: List<Notation>): Boolean {
return try {
Expand Down Expand Up @@ -365,10 +365,10 @@ open class Mask(format: String, protected val customNotations: List<Notation>) {
* While scanning through the input string in the `.apply(…)` method, the mask builds a graph of
* autocompletion steps.
*
* This graph accumulates the results of `.autocomplete()` calls for each consecutive `State`,
* acting as a `stack` of `Next` object instances.
* This graph accumulates the results of `.autocomplete()` calls for each consecutive ``State``,
* acting as a `stack` of ``Next`` object instances.
*
* Each time the `State` returns `null` for its `.autocomplete()`, the graph resets empty.
* Each time the ``State`` returns `null` for its `.autocomplete()`, the graph resets empty.
*/
private class AutocompletionStack : Stack<Next>() {
override fun push(item: Next?): Next? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.util.HashMap
/**
* ### RTLMask
*
* A right-to-left ```Mask``` subclass. Applies format from the string end.
* A right-to-left ``Mask`` subclass. Applies format from the string end.
*/
class RTLMask(format: String, customNotations: List<Notation>) : Mask(reversedFormat(format), customNotations) {
companion object Factory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.redmadrobot.inputmask.model
/**
* ### Country
*
* Model object representing a **Country** record operated by the ```PhoneInputListener```.
* Model object representing a **Country** record operated by the ``PhoneInputListener``.
*/
data class Country(
/**
Expand Down Expand Up @@ -37,12 +37,12 @@ data class Country(
val countryCode: String,

/**
* Primary ```Mask``` format for the country phone numbers.
* Primary ``Mask`` format for the country phone numbers.
*/
val primaryFormat: String,

/**
* Affine ```Mask``` formats for the country phone numbers.
* Affine ``Mask`` formats for the country phone numbers.
*/
val affineFormats: List<String>,

Expand Down Expand Up @@ -93,7 +93,7 @@ data class Country(
}

/**
A ```Country``` dictionary.
A ``Country`` dictionary.
Feel free to append/correct & file PRs, see https://countrycode.org
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package com.redmadrobot.inputmask.model
* ### Next
*
* Model object that represents a set of actions that should take place when transition from one
* ```State``` to another occurs.
* ``State`` to another occurs.
*
* @author taflanidi
*/
Expand Down
Loading

0 comments on commit 093c991

Please sign in to comment.