From: Erlend Kristiansen Date: Tue, 26 Nov 2013 15:37:18 +0000 (+0100) Subject: Adding to the thesis about property collectors. X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=72b643286622cb4c547254452b92d13cbe4ed9df;p=ifi-stolz-refaktor.git Adding to the thesis about property collectors. --- diff --git a/thesis/master-thesis-erlenkr.aux b/thesis/master-thesis-erlenkr.aux index 6a8a6320..0794af44 100644 --- a/thesis/master-thesis-erlenkr.aux +++ b/thesis/master-thesis-erlenkr.aux @@ -121,24 +121,38 @@ \pp@pagectr{footnote}{25}{26}{14} \pp@pagectr{footnote}{26}{26}{14} \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {3.2.3}The ExtractAndMoveMethodPrefixesExtractor Class}{14}} -\pp@pagectr{footnote}{27}{26}{14} \citation{dp} +\citation{dp} +\pp@pagectr{footnote}{27}{27}{15} \pp@pagectr{footnote}{28}{27}{15} -\@writefile{tdo}{\defcounter {refsection}{0}\relax }\@writefile{tdo}{\contentsline {todo}{Write about how prefixes and unfixes are chosen. And how the safe ones are computed}{15}} -\pgfsyspdfmark {pgfid41}{10269865}{47463037} -\pgfsyspdfmark {pgfid44}{33785118}{47429500} -\pgfsyspdfmark {pgfid45}{37143838}{47181923} -\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {3.2.4}The Prefix Class}{15}} -\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {3.2.5}The PrefixSet Class}{15}} -\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {3.2.6}Hacking the Refactoring Undo History}{15}} -\newlabel{hacking_undo_history}{{3.2.6}{15}} -\@writefile{tdo}{\defcounter {refsection}{0}\relax }\@writefile{tdo}{\contentsline {todo}{Where to put this section?}{15}} -\pgfsyspdfmark {pgfid46}{6178078}{41011416} -\pgfsyspdfmark {pgfid49}{33785118}{41006574} -\pgfsyspdfmark {pgfid50}{37143838}{40758997} \pp@pagectr{footnote}{29}{27}{15} \pp@pagectr{footnote}{30}{27}{15} \pp@pagectr{footnote}{31}{27}{15} +\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsubsection}{The PrefixesCollector}{15}} \pp@pagectr{footnote}{32}{27}{15} \pp@pagectr{footnote}{33}{27}{15} +\@writefile{tdo}{\defcounter {refsection}{0}\relax }\@writefile{tdo}{\contentsline {todo}{Rewrite in the case of changes to the way prefixes are found}{15}} +\pgfsyspdfmark {pgfid41}{12333008}{36934521} +\pgfsyspdfmark {pgfid44}{33785118}{36929679} +\pgfsyspdfmark {pgfid45}{37143838}{36682102} +\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsubsection}{The UnfixesCollector}{15}} \pp@pagectr{footnote}{34}{27}{15} +\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsubsection}{Computing Safe Prefixes}{15}} +\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {3.2.4}The Prefix Class}{15}} +\@writefile{tdo}{\defcounter {refsection}{0}\relax }\@writefile{tdo}{\contentsline {todo}{?}{15}} +\pgfsyspdfmark {pgfid46}{6178078}{20480241} +\pgfsyspdfmark {pgfid49}{33785118}{20475399} +\pgfsyspdfmark {pgfid50}{37143838}{20227822} +\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {3.2.5}The PrefixSet Class}{15}} +\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {3.2.6}Hacking the Refactoring Undo History}{15}} +\newlabel{hacking_undo_history}{{3.2.6}{15}} +\@writefile{tdo}{\defcounter {refsection}{0}\relax }\@writefile{tdo}{\contentsline {todo}{Where to put this section?}{15}} +\pgfsyspdfmark {pgfid51}{6178078}{15631587} +\pgfsyspdfmark {pgfid54}{33785118}{15626745} +\pgfsyspdfmark {pgfid55}{37143838}{15379168} +\pp@pagectr{footnote}{35}{27}{15} +\pp@pagectr{footnote}{36}{28}{16} +\pp@pagectr{footnote}{37}{28}{16} +\pp@pagectr{footnote}{38}{28}{16} +\pp@pagectr{footnote}{39}{28}{16} +\pp@pagectr{footnote}{40}{28}{16} diff --git a/thesis/master-thesis-erlenkr.pdf b/thesis/master-thesis-erlenkr.pdf index 9871c9eb..8ee6d5d2 100644 Binary files a/thesis/master-thesis-erlenkr.pdf and b/thesis/master-thesis-erlenkr.pdf differ diff --git a/thesis/master-thesis-erlenkr.tdo b/thesis/master-thesis-erlenkr.tdo index 59bd7278..753204f8 100644 --- a/thesis/master-thesis-erlenkr.tdo +++ b/thesis/master-thesis-erlenkr.tdo @@ -15,6 +15,8 @@ \defcounter {refsection}{0}\relax \contentsline {todo}{refine}{10} \defcounter {refsection}{0}\relax -\contentsline {todo}{Write about how prefixes and unfixes are chosen. And how the safe ones are computed}{15} +\contentsline {todo}{Rewrite in the case of changes to the way prefixes are found}{15} +\defcounter {refsection}{0}\relax +\contentsline {todo}{?}{15} \defcounter {refsection}{0}\relax \contentsline {todo}{Where to put this section?}{15} diff --git a/thesis/master-thesis-erlenkr.tex b/thesis/master-thesis-erlenkr.tex index e7d19b55..b498398e 100644 --- a/thesis/master-thesis-erlenkr.tex +++ b/thesis/master-thesis-erlenkr.tex @@ -622,10 +622,12 @@ will never return \type{null}. Before extracting the new method, the possible targets for the move operation is found with the help of an \typewithref{no.uio.ifi.refaktor.extractors}{ExtractAndMoveMethodPrefixesExtractor}. -The possible targets is those that the extractor returns from its +The possible targets is computed from the prefixes that the extractor returns +from its \methodwithref{no.uio.ifi.refaktor.extractors.ExtractAndMoveMethodPrefixesExtractor}{getSafePrefixes} method. The changer then choose the most suitable target by finding the most -frequent occurring prefix among the safe ones. +frequent occurring prefix among the safe ones. The target is the type of the +first part of the prefix. After finding a suitable target, the \type{ExtractAndMoveMethodChanger} first creates an \type{ExtractMethodRefactoring} and performs it as explained in @@ -635,15 +637,46 @@ changes done by the Extract Method refactoring. \subsection{The ExtractAndMoveMethodPrefixesExtractor Class} This extractor extracts properties needed for building the Extract and Move -Method refactoring. It searches through the given selection to find safe targets -for the move part of the refactoring. It finds both the candidates, in the form -of prefixes, and the non-candidates, called unfixes. All prefixes (and unfixes) -are represented by a \typewithref{no.uio.ifi.refaktor.extractors}{Prefix}, and -they are collected into prefix -sets.\typeref{no.uio.ifi.refaktor.extractors.PrefixSet}. \todo{Write about how -prefixes and unfixes are chosen. And how the safe ones are computed}. +Method refactoring. It searches through the given selection to find safe +prefixes, and those prefixes form a base that can be used to compute possible +targets for the move part of the refactoring. It finds both the candidates, in +the form of prefixes, and the non-candidates, called unfixes. All prefixes (and +unfixes) are represented by a +\typewithref{no.uio.ifi.refaktor.extractors}{Prefix}, and they are collected +into prefix sets.\typeref{no.uio.ifi.refaktor.extractors.PrefixSet}. + +The prefixes and unfixes are found by property +collectors\typeref{no.uio.ifi.refaktor.extractors.collectors.PropertyCollector}. +A property collector follows the visitor pattern \cite{dp} and is of the +\typewithref{org.eclipse.jdt.core.dom}{ASTVisitor} type. An \type{ASTVisitor} +visits nodes in an abstract syntax tree that forms the Java document object +model. The tree consists of nodes of type +\typewithref{org.eclipse.jdt.core.do}{ASTNode}. + +\subsubsection{The PrefixesCollector} +The \typewithref{no.uio.ifi.refaktor.extractors.collectors}{PrefixesCollector} +is of type \type{PropertyCollector}. It visits expression +statements\typeref{org.eclipse.jdt.core.dom.ExpressionStatement} and creates +prefixes from its expressions in the case of method invocations. The prefixes +found is registered with a prefix set, together with all its sub-prefixes. +\todo{Rewrite in the case of changes to the way prefixes are found} + +\subsubsection{The UnfixesCollector} +The \typewithref{no.uio.ifi.refaktor.extractors.collectors}{UnfixesCollector} +finds unfixes within the selection. An unfix is a name that is assigned to +within the selection. The reason that this cannot be allowed, is that the result +would be an assignment to the \type{this} keyword, which is not valid in Java. + +\subsubsection{Computing Safe Prefixes} +A safe prefix is a prefix that does not enclose an unfix. A prefix is enclosing +an unfix if the unfix is in the set of its sub-prefixes. As an example, +\texttt{``a.b''} is enclosing \texttt{``a''}, as is \texttt{``a''}. The safe +prefixes is unified in a \type{PrefixSet} and can be fetched calling the +\method{getSafePrefixes} method of the +\type{ExtractAndMoveMethodPrefixesExtractor}. \subsection{The Prefix Class} +\todo{?} \subsection{The PrefixSet Class} \subsection{Hacking the Refactoring Undo diff --git a/thesis/master-thesis-erlenkr.toc b/thesis/master-thesis-erlenkr.toc index c97fae6b..1fc427d0 100644 --- a/thesis/master-thesis-erlenkr.toc +++ b/thesis/master-thesis-erlenkr.toc @@ -72,6 +72,12 @@ \defcounter {refsection}{0}\relax \contentsline {subsection}{\numberline {3.2.3}The ExtractAndMoveMethodPrefixesExtractor Class}{14} \defcounter {refsection}{0}\relax +\contentsline {subsubsection}{The PrefixesCollector}{15} +\defcounter {refsection}{0}\relax +\contentsline {subsubsection}{The UnfixesCollector}{15} +\defcounter {refsection}{0}\relax +\contentsline {subsubsection}{Computing Safe Prefixes}{15} +\defcounter {refsection}{0}\relax \contentsline {subsection}{\numberline {3.2.4}The Prefix Class}{15} \defcounter {refsection}{0}\relax \contentsline {subsection}{\numberline {3.2.5}The PrefixSet Class}{15}