Module hw06

Package provided.listFW.visitors


package provided.listFW.visitors
A package of provided visitors (algorithms) for use with the listFW visitor system and accumulators for use with the FoldLAlgo and FoldRAlgo visitors.
  • Interface Summary
    Interface
    Description
    An accumulator for use in FoldR and FoldL.
  • Class Summary
    Class
    Description
    An IAccumulator that holds an Object as its internal value and who's string representation is the string representation of that value.
    Returns a copy of the list where the single integer parameter is added to all elements
    Accumulates the values into a list, starting with an empty list.
    Returns a copy of the list
    Returns the count of the number of elements in the list
    Performs the fold-left (forward accumulation) algorithm using the given IAccumulator The general forward accumulation algorithm would not take an accumulator as a top-level input parameter, instead the accumulator would be hidden inside the algorithm.
    Performs the fold-right (reverse accumulation) algorithm using the given IAccumulator.
    Accumulates (saves) the last negative number given to it.
    Accumulates the product of the values, starting with a total of 1.
    Algo to calculate the product of all the elements in a list of integers.
    Accumulates the sum of the values, starting with a total of 1.
    Returns the sum of a list of integers using forward accumulation.
    Returns the sum of a list of integers using reverse accumulation.
    Computes a String representation of IList showing a left parenthesis followed by elements of the IList separated by commas, ending with with a right parenthesis.
    Helps ToStringAlgo compute the String representation of the rest of the list.