DGtal  1.5.beta
OrderedAlphabet.h
1 
17 #pragma once
18 
35 #if defined(OrderedAlphabet_RECURSES)
36 #error Recursive header files inclusion detected in OrderedAlphabet.h
37 #else // defined(OrderedAlphabet_RECURSES)
39 #define OrderedAlphabet_RECURSES
40 
41 #if !defined OrderedAlphabet_h
43 #define OrderedAlphabet_h
44 
46 // Inclusions
47 #include <iostream>
48 #include <string>
49 #include "DGtal/base/Common.h"
50 #include "DGtal/kernel/NumberTraits.h"
51 #include "DGtal/arithmetic/ModuloComputer.h"
53 
54 namespace DGtal
55 {
56 
58  // class OrderedAlphabet
70  {
71  // ----------------------- Standard types ------------------------------
72  public:
73 
77  typedef int Integer;
78 
82  typedef unsigned int index_t;
83 
87  typedef unsigned int size_t;
88 
89  // ----------------------- Standard services ------------------------------
90  public:
91 
96 
106  OrderedAlphabet( char first, unsigned int nb );
107 
111  std::string orderedAlphabet() const;
112 
116  void shiftLeft();
117 
121  void shiftRight();
122 
126  void reverse();
127 
132 
139  unsigned int order( char c ) const;
140 
149  char letter( unsigned int i ) const;
150 
156  bool less( char c1, char c2 ) const;
157 
163  bool lessOrEqual( char c1, char c2 ) const;
164 
170  bool equal( char c1, char c2 ) const;
171 
172  // ----------------------- word services ------------------------------
173  public:
174 
188  void firstLyndonFactor( size_t & len, size_t & nb,
189  const std::string & w,
190  index_t s, index_t e ) const;
191 
192 
206  void firstLyndonFactorMod( size_t & len, size_t & nb,
207  const std::string & w,
208  index_t s, index_t e ) const;
209 
210 
232  bool duvalPP( size_t & len, size_t & nb,
233  const std::string & w,
234  index_t s, index_t e
235  ) const;
236 
258  bool duvalPPMod( size_t & len, size_t & nb,
259  const std::string & w,
260  index_t s, index_t e ) const;
287  bool duvalPPtoDSS( size_t & len, size_t & nb,
288  unsigned int & n1, unsigned int & n2,
289  unsigned int & Lf1, unsigned int & Lf2,
290  const std::string & w,
291  index_t s, index_t e
292  ) const;
293 
294 
295 
296  // ----------------------- MLP services -----------------------------------
297  public:
298 
319  size_t nextEdge( size_t & nb_a1, size_t & nb_a2,
320  std::string & w, index_t & s, bool & cvx );
321 
322 
323  // ----------------------- Interface --------------------------------------
324  public:
325 
330  void selfDisplay ( std::ostream & out ) const;
331 
336  bool isValid() const;
337 
338  // ------------------------- Protected Datas ------------------------------
339  private:
340  // ------------------------- Private Datas --------------------------------
341  private:
345  char myFirst;
346 
350  unsigned int myNb;
351 
355  unsigned int* myOrder;
356 
357  // ------------------------- Hidden services ------------------------------
358  protected:
359 
365 
366  private:
367 
373  OrderedAlphabet ( const OrderedAlphabet & other );
374 
382 
383  // ------------------------- Internals ------------------------------------
384  private:
385 
386  }; // end of class OrderedAlphabet
387 
388 
395  std::ostream&
396  operator<< ( std::ostream & out, const OrderedAlphabet & object );
397 
398 
399 } // namespace DGtal
400 
401 
403 // Includes inline functions/methods if necessary.
404 #include "DGtal/base/OrderedAlphabet.ih"
405 
406 // //
408 
409 #endif // !defined OrderedAlphabet_h
410 
411 #undef OrderedAlphabet_RECURSES
412 #endif // else defined(OrderedAlphabet_RECURSES)
Aim: Describes an alphabet over an interval of (ascii) letters, where the lexicographic order can be ...
char letter(unsigned int i) const
bool less(char c1, char c2) const
OrderedAlphabet(char first, unsigned int nb)
bool duvalPP(size_t &len, size_t &nb, const std::string &w, index_t s, index_t e) const
unsigned int order(char c) const
void firstLyndonFactorMod(size_t &len, size_t &nb, const std::string &w, index_t s, index_t e) const
void firstLyndonFactor(size_t &len, size_t &nb, const std::string &w, index_t s, index_t e) const
std::string orderedAlphabet() const
void selfDisplay(std::ostream &out) const
bool lessOrEqual(char c1, char c2) const
bool equal(char c1, char c2) const
bool duvalPPMod(size_t &len, size_t &nb, const std::string &w, index_t s, index_t e) const
bool duvalPPtoDSS(size_t &len, size_t &nb, unsigned int &n1, unsigned int &n2, unsigned int &Lf1, unsigned int &Lf2, const std::string &w, index_t s, index_t e) const
OrderedAlphabet(const OrderedAlphabet &other)
OrderedAlphabet & operator=(const OrderedAlphabet &other)
size_t nextEdge(size_t &nb_a1, size_t &nb_a2, std::string &w, index_t &s, bool &cvx)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)