TelloViz / Card-Collection

Project for CPSC 362 Software Engineering
0 stars 3 forks source link

Design handle_sets_retrieve Function #98

Closed TelloViz closed 1 month ago

TelloViz commented 1 month ago

handle_sets_retrieve Design Document

Description

A "public" function in the InitHandler class. This function is called by the BackendController class. handle_sets_retrieve essentially calls Backend.all_sets() and returns the result to whoever called handle_sets_retrieve.


See the following diagram:

Image


Parameters

None


Return Type

List[Set] (Set is an object defined by the Pokémon TCG API)


Example Pseudo-Code use of Function:


// Initialize an instance of InitHandler  
INITIALIZE handler AS InitHandler

// Call the handle_sets_retrieve function
SET sets TO handler.handle_sets_retrieve()

// Check if sets is not empty
IF sets IS NOT EMPTY THEN
    // Process the sets
    FOR EACH set IN sets DO
        // Perform actions with each set
        DISPLAY set.name  // For example, print or show the set name
    END FOR
ELSE
    // Handle the case where no sets were found
    DISPLAY "No sets found."
END IF

Pseudo-Code Definition


FUNCTION handle_sets_retrieve()
    // Call the Backend to retrieve all sets
    SET sets TO Backend.all_sets()

    // Return the list of sets
    RETURN sets
END FUNCTION