From 6e95ad2b84af762895d07f9224c0b283780f8fea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <peckato1@fit.cvut.cz>
Date: Tue, 25 Mar 2014 13:46:34 +0100
Subject: [PATCH] Comments for libaregexptree

---
 aintegral/.cproject                     |  4 ++--
 libaregexptree/src/RegExpAlphabet.h     | 18 ++++++++++++++++++
 libaregexptree/src/RegExpDerivation.cpp |  2 ++
 libaregexptree/src/RegExpDerivation.h   | 15 ++++++++++++++-
 libaregexptree/src/RegExpIntegral.cpp   |  2 ++
 libaregexptree/src/RegExpIntegral.h     | 18 +++++++++++++++++-
 6 files changed, 55 insertions(+), 4 deletions(-)

diff --git a/aintegral/.cproject b/aintegral/.cproject
index 2096eb1c21..07e97ef0d5 100644
--- a/aintegral/.cproject
+++ b/aintegral/.cproject
@@ -23,9 +23,9 @@
 							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1369390546" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
 								<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.993968371" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
 								<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.1537920879" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
-								<option id="gnu.cpp.compiler.option.include.paths.2114166236" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+								<option id="gnu.cpp.compiler.option.include.paths.2114166236" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/alib/src}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/libaderivation/src}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/libaregexptree/src}&quot;"/>
 									<listOptionValue builtIn="false" value="/usr/include/libxml2"/>
 								</option>
 								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1939414215" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
diff --git a/libaregexptree/src/RegExpAlphabet.h b/libaregexptree/src/RegExpAlphabet.h
index a584656cf4..dcbd0e032c 100644
--- a/libaregexptree/src/RegExpAlphabet.h
+++ b/libaregexptree/src/RegExpAlphabet.h
@@ -9,13 +9,31 @@
 #include <list>
 #include <set>
 
+/**
+ * "Getters" for regular expression alphabet.
+ */
 class RegExpAlphabet
 {
 public:
+    /**
+     * Returns pointers to RegExpSymbols in order as they occur in regexp tree. Used in Glushkov algorithm.
+     * @param re RegExp
+     * @return symbols of regexp tree in order of they occurence in regexp.
+     */
     static std::list<const regexp::RegExpSymbol*> getSymbolsListInOrder( const regexp::RegExp & re );
+
+    /**
+     * @param re RegExp
+     * @return set of symbols appearing in regexp
+     */
     static std::set<regexp::RegExpSymbol> getSymbols( const regexp::RegExp & re );
 
 private:
+    /**
+     * Traverse through regexp tree and store all encountered RegExpSymbols.
+     *
+     * @param alphabet list to insert symbols
+     */
     static void searchSymbols( const regexp::RegExpElement * element, std::list<const regexp::RegExpSymbol*> & alphabet );
 };
 
diff --git a/libaregexptree/src/RegExpDerivation.cpp b/libaregexptree/src/RegExpDerivation.cpp
index 54d5b04c60..f52f5cb62c 100644
--- a/libaregexptree/src/RegExpDerivation.cpp
+++ b/libaregexptree/src/RegExpDerivation.cpp
@@ -18,6 +18,8 @@ RegExpDerivation::RegExpDerivation( const RegExp & re ) : m_re( re )
 
 RegExp RegExpDerivation::derivation ( const list<RegExpElement*> & dString ) const
 {
+    // TODO: change dString to WORD object when implemented.
+
     const RegExpElement * oldRegExp = m_re.getRegExp( )->clone( ), * derivedRegExp;
 
     for( const auto & dSymbol : dString )
diff --git a/libaregexptree/src/RegExpDerivation.h b/libaregexptree/src/RegExpDerivation.h
index b61df11dba..c9e0cf9504 100644
--- a/libaregexptree/src/RegExpDerivation.h
+++ b/libaregexptree/src/RegExpDerivation.h
@@ -26,7 +26,17 @@
 class RegExpDerivation
 {
 public:
+    /**
+     * @param re RegExp to derivate
+     */
     RegExpDerivation( const regexp::RegExp & re );
+
+    /**
+     * returns derivation of regexp over word dString
+     * @param dString list of RegExpElements representing word. Derivation will be over this word.
+     * @see RegExpElement
+     * @return Derivation of regexp over dString
+     */
     regexp::RegExp derivation( const std::list<regexp::RegExpElement*> & dString ) const;
 
 private:
@@ -38,7 +48,10 @@ private:
     regexp::RegExpElement * derivation( const regexp::RegExpEpsilon * element, const regexp::RegExpSymbol & dSymbol ) const;
     regexp::RegExpElement * derivation( const regexp::RegExpEmpty * element, const regexp::RegExpSymbol & dSymbol ) const;
 
-    const regexp::RegExp & m_re;
+    /**
+     * stores original regexp
+     */
+    const regexp::RegExp m_re;
 };
 
 #endif /* REGEXPDERIVATION_H_ */
diff --git a/libaregexptree/src/RegExpIntegral.cpp b/libaregexptree/src/RegExpIntegral.cpp
index edbd68cfbf..ee5a569682 100644
--- a/libaregexptree/src/RegExpIntegral.cpp
+++ b/libaregexptree/src/RegExpIntegral.cpp
@@ -17,6 +17,8 @@ RegExpIntegral::RegExpIntegral( const RegExp & re ) : m_re( re )
 
 RegExp RegExpIntegral::integral( const list<RegExpElement*> & dString ) const
 {
+    // TODO: change dString to WORD object when implemented.
+
     const RegExpElement * oldRegExp = m_re.getRegExp( )->clone( ), * integralRegExp;
 
     for( auto it = dString.rbegin( ); it != dString.rend( ); it ++ )
diff --git a/libaregexptree/src/RegExpIntegral.h b/libaregexptree/src/RegExpIntegral.h
index 4acc909880..15b27a4c80 100644
--- a/libaregexptree/src/RegExpIntegral.h
+++ b/libaregexptree/src/RegExpIntegral.h
@@ -13,10 +13,23 @@
 #include <regexp/RegExp.h>
 #include <regexp/RegExpElements.h>
 
+/**
+ * Computes integral of regular expression as defined in Melichar, 2.93 (chapter 2.4.4)
+ */
 class RegExpIntegral
 {
 public:
+    /**
+     * @param re RegExp to integrate
+     */
     RegExpIntegral( const regexp::RegExp & re );
+
+    /**
+     * returns integral of regexp over word dString
+     * @param dString list of RegExpElements representing word. Integral will be over this word.
+     * @see RegExpElement
+     * @return Integral of regexp over dString
+     */
     regexp::RegExp integral( const std::list<regexp::RegExpElement*> & dString ) const;
 
 private:
@@ -28,7 +41,10 @@ private:
     regexp::RegExpElement * integral( const regexp::RegExpEpsilon * node, const regexp::RegExpSymbol & dSymbol ) const;
     regexp::RegExpElement * integral( const regexp::RegExpEmpty * node, const regexp::RegExpSymbol & dSymbol ) const;
 
-    const regexp::RegExp & m_re;
+    /**
+     * stores original regular expression
+     */
+    const regexp::RegExp m_re;
 };
 
 #endif /* REGEXPINTEGRAL_H_ */
-- 
GitLab