Class CallableSolution

    • Constructor Detail

      • CallableSolution

        protected CallableSolution​(Solution solution,
                                   String description,
                                   String progressMessage)
        Steps is set to -1, i.e. it will be computed from songCount().
        Parameters:
        solution - actual solution this belongs to
        description - static description of the solution
        progressMessage - message that may be shown while the solution is applied.
      • CallableSolution

        protected CallableSolution​(Solution solution,
                                   Collection<AudioSong> songs,
                                   String description,
                                   String progressMessage,
                                   int steps)
        Parameters:
        solution - actual solution this belongs to
        songs - songs, most likely selected by the user, see Solution.createCallable(Collection, boolean)
        description - static description of the solution
        progressMessage - message that may be shown while the solution is applied.
        steps - number of steps it will take in total - this will be available through getSteps(). If set to -1, it will be computed automatically from songCount() .
    • Method Detail

      • getCommitError

        public Throwable getCommitError()
        Non-null, if a commitment attempt was unsuccessful.
        Returns:
        commit error
      • setCommitError

        public void setCommitError​(Throwable commitError)
      • getSolution

        public Solution getSolution()
      • setSolution

        protected void setSolution​(Solution solution)
      • getProgressMessage

        public String getProgressMessage()
        Message that can be shown while the solution is executed.
        Returns:
        progress message
      • setProgressMessage

        protected void setProgressMessage​(String progressMessage)
      • getDescription

        public String getDescription()
        Static description of the solution.
        Returns:
        description
      • setDescription

        protected void setDescription​(String description)
      • getSteps

        public int getSteps()
        Approximate number of distinct steps in this solution.
        Returns:
        steps
      • setSteps

        protected void setSteps​(int steps)
      • getSongIds

        public List<Long> getSongIds()
        Ids of the songs that are going to be modified by this solution.
        Returns:
        list of song ids or empty list
        See Also:
        setSongIds(Collection)
      • songCount

        public int songCount()
        Number of songs affected by this solution.
        Returns:
        song count
      • canAdd

        public boolean canAdd​(CallableSolution otherCallableSolution)
        Offers a way to check whether you can combine two tasks into one (this).
        Parameters:
        otherCallableSolution - another asynchronous solution
        Returns:
        true, if the given task can be added to this task.
      • add

        public void add​(CallableSolution otherCallableSolution)
        Adds another solution to this one, basically combining them.
        Parameters:
        otherCallableSolution - another asynchronous solution
        Throws:
        IllegalArgumentException - if the solution cannot be added.
      • addProgressListener

        public void addProgressListener​(ProgressListener progressListener)
      • fireProgress

        public void fireProgress​(float progress)
        Fires progress for visual indicator.
        Parameters:
        progress - percent done between 0.0f and 1.0f