wm: java

ref: 3642ff2c921852babc8be83d5614fbadd32a8818
dir: /Bookproj/Library.java/

View raw version
package Bookproj;

import java.util.regex.Pattern;

public interface Library {
    Admin NewAdmin(String user, String pass);

    User NewUser(String user, int age);

    Book NewBook(String isbn, String name, String author, int agegroup, String abst);

    DelErr DelAdmin(Admin a);

    DelErr DelUser(User u);

    DelErr DelBook(Book b);

    boolean Login(Admin a, String pass);

    boolean Login(User u);

    void Logout(Admin a);

    void Logout(User u);

    boolean CheckAdmin(String a);

    boolean CheckUser(String u);

    boolean CheckBook(String isbn);

    Admin MatchAdmin(String un);

    User MatchUser(String un);

    Book MatchBook(String isbn);

    boolean FindAdmin(AdminAttr k, Pattern p);

    boolean FindUser(UserAttr k, Pattern p);

    boolean FindBook(BookAttr k, Pattern p);

    TakeErr TakeBook(String un, String isbn);

    TakeErr TakeBook(Admin u, Book b);

    TakeErr TakeBook(User u, Book b);

    TakeErr ReturnBook(User u);

    TakeErr ReturnBook(Admin u);

    void SaveLog(String fp, String in);

    interface UI {
        void Program();

        void LoginMenu();

        /* checks password with user, gets input from GetPassword */
        boolean AskPass(Admin u);
        // boolean AskPass(User u);

        /* different Menus, for different Users to handle */
        void Menu(Admin u);

        void Menu(User u);

        /* Gets a String, either console or scanner, checks if it's valid or not, and encrypt it */
        String GetUsername();

        String GetPassword();

        /* search foolan menu */
        void SearchAdmin();

        void SearchUser();

        void SearchBook();

        /* add foolan menu */
        void AddAdmin();

        void AddUser();

        void AddBook();

        /* remove foolan menu */
        void RemAdmin();

        void RemUser();

        void RemBook(); // maybe it's stolen

        /* list foolan menu */
        void ListAdmin();

        void ListUser();

        void ListBook();

        /* take and return book menus */
        void TakeMenu(Admin a);

        void TakeMenu(User u);

        void ReturnMenu(Admin a);

        void ReturnMenu(User u);

        /* handles result of Take/IO/Del Funcations */
        void Result(TakeErr res);

        void Result(DelErr res);
    }
}