Class Recommender

  • All Implemented Interfaces:
    RecommenderInterface

    public class Recommender
    extends java.lang.Object
    implements RecommenderInterface
    Taking as input a list of tokens which represents a string of tokens taken from all files that the Input processed. It will process these tokens, and produce a list of recommended refactorings, ordered from greatest to least opportunity value. Additionally, after finding a refactoring recommendation, but before adding the recommendation to the list of recommendations, it will compute the opportunity value of that recommendation.
    See Also:
    RecommenderInterface, TestRecomender
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getMaxRefactoringSize()
      Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive.
      int getMinRefactoringSize()
      Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive.
      java.util.List<? extends RefactoringInterface> getRefactorings()
      If no refactorings have been created, create them.
      java.util.List<? extends TokenInterface> getTokens()  
      void setMaxRefactoringSize()
      Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive.
      void setMaxRefactoringSize​(int input)
      Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive.
      void setMinRefactoringSize()
      Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive.
      void setMinRefactoringSize​(int input)
      Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive.
      void setRefactorings​(java.util.List<? extends RefactoringInterface> input)
      Sets recommender's list of refactorings to a pre-existing refactoring list.
      void setTokens​(java.util.List<? extends TokenInterface> input)
      Sets the list of tokens from which recommendations are generated to the input list parameter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setTokens

        public void setTokens​(java.util.List<? extends TokenInterface> input)
        Sets the list of tokens from which recommendations are generated to the input list parameter.
        Specified by:
        setTokens in interface RecommenderInterface
        Parameters:
        input - a list of token objects.
      • setRefactorings

        public void setRefactorings​(java.util.List<? extends RefactoringInterface> input)
        Sets recommender's list of refactorings to a pre-existing refactoring list.
        Specified by:
        setRefactorings in interface RecommenderInterface
        Parameters:
        input - a list of Refactoring recommendations.
      • getMinRefactoringSize

        public int getMinRefactoringSize()
        Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive.
        Specified by:
        getMinRefactoringSize in interface RecommenderInterface
        Returns:
        the minimum number of tokens that can make up a refactoring.
      • setMinRefactoringSize

        public void setMinRefactoringSize​(int input)
        Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive.
        Specified by:
        setMinRefactoringSize in interface RecommenderInterface
        Parameters:
        input - the minimum number of tokens that can make up a refactoring.
      • setMinRefactoringSize

        public void setMinRefactoringSize()
        Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive. If no input was provided, sets the min to 0 if Recommender's list of tokens is empty, or to 3% of the size of the token list.
        Specified by:
        setMinRefactoringSize in interface RecommenderInterface
      • getMaxRefactoringSize

        public int getMaxRefactoringSize()
        Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive.
        Specified by:
        getMaxRefactoringSize in interface RecommenderInterface
        Returns:
        the maximum number of tokens that can make up a refactoring.
      • setMaxRefactoringSize

        public void setMaxRefactoringSize​(int input)
        Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive.
        Specified by:
        setMaxRefactoringSize in interface RecommenderInterface
        Parameters:
        input - the maximum number of tokens that can make up a refactoring.
      • setMaxRefactoringSize

        public void setMaxRefactoringSize()
        Recommended refactorings should be greater than minRefactoringSize but less than maxRefactoringSize, inclusive. If no input was provided, sets the max to 0 if Recommender's list of tokens is empty, or to 75% of the size of the token list.
        Specified by:
        setMaxRefactoringSize in interface RecommenderInterface