Class
Lexical
Comparator for lexical comparison.
Lexical<TSpec>
Include Headers
seqan/sequence.h
Parameters

TSpec | The specializing type. This type can be used for specializations of Lexical. Metafunctions: Spec Default: size_t Remarks: TSpec is by default interpreted as size-type.

Remarks
This class implement comparator objects that perform (lexical) comparisons between two sequences. The result of the comparison is stored in the data members of the instance an can be accessed by some functions, for example isLess or isEqual.
In most cases, there is no need for an explicite use of comparators, but sometimes this concept provide the opportunity to speed up the code.
Functions

compare | Compares two objects.
hasPrefix | Test whether a sequence is prefix of another sequence.
isEqual | Operator "==".
isGreater | Operator ">".
isGreaterOrEqual | Operator ">=".
isLess | Operator "<".
isLessOrEqual | Operator "<=".
isNotEqual | Operator "!=".
isPrefix | Test whether a sequence is prefix of another sequence.
lcpLength | Length of longest common prefix.

Examples
This program compares the strings str1 and str2:
if (isLess(str1, str2)) //first comparison
{
//str1 < str2
}
else if (isGreater(str1, str2)) //second comparison
{
//str1 > str2
}
else
{
//str == str2
}
Using a comparator, the same program only needs one comparison instead of two:
Lexical <> comparator(str1, str2); //comparison is executed here
if (isLess(comparator))
{
//str1 < str2
}
else if (lexGreater(comparator))
{
//str1 > str2
}
else
{
//str == str2
}
The state of a default constructed Lexical instance is undefined until it is set by a call of compare.
See Also
Comparator
SeqAn - Sequence Analysis Library - www.seqan.de

Page built @2012/03/14 16:34:45