<commit_before>package com.twu.biblioteca.model;

import java.util.ArrayList;

public class Library {
    private ArrayList<Book> books;
    private ArrayList<Movie> movies;

    public Library(ArrayList<Book> books, ArrayList<Movie> movies) {
        this.books = books;
        this.movies = movies;
    }

    public String list() {
        String bookDetails = "";
        for (Book book : books) {
            if (book.getStatus()) {
                String bookName = book.getName();
                String author = book.getAuthor();
                Integer yearPublished = book.getYearPublished();
                bookDetails += String.format("%-32s %-32s %-16s\n", bookName, author, yearPublished);
            }
        }
        return bookDetails;
    }

    public boolean checkout(String bookName) {
        for (Book book : books) {
            if (bookName.equals(book.getName()) && (book.getStatus())) {
                book.setStatus(false);
                return true;
            }
        }
        return false;
    }

    public boolean returnBook(String bookName) {
        for (Book book : books) {
            if (bookName.equals(book.getName()) && !(book.getStatus())) {
                book.setStatus(true);
                return true;
            }
        }
        return false;
    }

    public String checkedOutList() {
        String bookDetails = "";
        for (Book book : books) {
            if (!book.getStatus()) {
                String bookName = book.getName();
                String author = book.getAuthor();
                Integer yearPublished = book.getYearPublished();
                bookDetails += String.format("%-32s %-32s %-16s\n", bookName, author, yearPublished);
            }
        }
        return bookDetails;
    }

    public String listMovies() {
        String movieDetails = "";
        for (Movie movie : movies) {
            if (movie.getStatus()) {
                String movieName = movie.getName();
                String director = movie.getDirector();
                Integer releasedYear = movie.getReleaseYear();
                Integer rating = movie.getRating();
                movieDetails += String.format("%-32s %-32s %-16s %-16s\n", movieName, director, releasedYear, rating);
            }
        }
        return movieDetails;
    }

    public boolean checkoutMovie(String movieName) {
        for (Movie movie : movies) {
            if (movieName.equals(movie.getName()) && (movie.getStatus())) {
                movie.setStatus(false);
                return true;
            }
        }
        return false;
    }

    public String checkedOutMovieList() {
        String movieDetails = "";
        for (Movie movie : movies) {
            if (!movie.getStatus()) {
                String movieName = movie.getName();
                String director = movie.getDirector();
                Integer releasedYear = movie.getReleaseYear();
                Integer rating = movie.getRating();
                movieDetails += String.format("%-32s %-32s %-16s %-16s\n", movieName, director, releasedYear, rating);
            }
        }
        return movieDetails;
    }

    public boolean returnMovie(String movieName) {
        for (Movie movie : movies) {
            if (movieName.equals(movie.getName()) && !(movie.getStatus())) {
                movie.setStatus(true);
                return true;
            }
        }
        return false;
    }
}<commit_msg>[Lipika] |#0086| Implemented toString in Library to display book details.<commit_after>package com.twu.biblioteca.model;

import java.util.ArrayList;

public class Library {
    private ArrayList<Book> books;
    private ArrayList<Movie> movies;

    public Library(ArrayList<Book> books, ArrayList<Movie> movies) {
        this.books = books;
        this.movies = movies;
    }

    public String list() {
        String bookDetails = "";
        for (Book book : books) {
            if (book.getStatus()) {
                String bookName = book.getName();
                String author = book.getAuthor();
                Integer yearPublished = book.getYearPublished();
                bookDetails += String.format("%-32s %-32s %-16s\n", bookName, author, yearPublished);
            }
        }
        return bookDetails;
    }

    public boolean checkout(String bookName) {
        for (Book book : books) {
            if (bookName.equals(book.getName()) && (book.getStatus())) {
                book.setStatus(false);
                return true;
            }
        }
        return false;
    }

    public boolean returnBook(String bookName) {
        for (Book book : books) {
            if (bookName.equals(book.getName()) && !(book.getStatus())) {
                book.setStatus(true);
                return true;
            }
        }
        return false;
    }

    public String checkedOutList() {
        String bookDetails = "";
        for (Book book : books) {
            if (!book.getStatus()) {
                bookDetails += book.toString();
            }
        }
        return bookDetails;
    }

    public String listMovies() {
        String movieDetails = "";
        for (Movie movie : movies) {
            if (movie.getStatus()) {
                String movieName = movie.getName();
                String director = movie.getDirector();
                Integer releasedYear = movie.getReleaseYear();
                Integer rating = movie.getRating();
                movieDetails += String.format("%-32s %-32s %-16s %-16s\n", movieName, director, releasedYear, rating);
            }
        }
        return movieDetails;
    }

    public boolean checkoutMovie(String movieName) {
        for (Movie movie : movies) {
            if (movieName.equals(movie.getName()) && (movie.getStatus())) {
                movie.setStatus(false);
                return true;
            }
        }
        return false;
    }

    public String checkedOutMovieList() {
        String movieDetails = "";
        for (Movie movie : movies) {
            if (!movie.getStatus()) {
                String movieName = movie.getName();
                String director = movie.getDirector();
                Integer releasedYear = movie.getReleaseYear();
                Integer rating = movie.getRating();
                movieDetails += String.format("%-32s %-32s %-16s %-16s\n", movieName, director, releasedYear, rating);
            }
        }
        return movieDetails;
    }

    public boolean returnMovie(String movieName) {
        for (Movie movie : movies) {
            if (movieName.equals(movie.getName()) && !(movie.getStatus())) {
                movie.setStatus(true);
                return true;
            }
        }
        return false;
    }
}
{'fraction_non_alphanumeric': 0.11419707490028069, 'fraction_numerical': 0.007977544689023489, 'mean_word_length': 1.6559435072577482, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2260834', 'n_tokens_mistral': 1844, 'n_tokens_neox': 1694, 'n_words': 419}