Assignment 4
Signed-off-by: AKP <tom@tdpain.net>
This commit is contained in:
parent
51d1c5fbb5
commit
4903fd730e
14 changed files with 2589 additions and 0 deletions
59
assignment4/pom.xml
Normal file
59
assignment4/pom.xml
Normal file
|
@ -0,0 +1,59 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.akpain</groupId>
|
||||
<artifactId>assignment4</artifactId>
|
||||
<version>1.0</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
<version>20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>jdbc</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/resources/postgresql-42.6.0.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<release>11</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>0.0.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- Default configuration for running -->
|
||||
<!-- Usage: mvn clean javafx:run -->
|
||||
<id>default-cli</id>
|
||||
<configuration>
|
||||
<mainClass>net.akpain.App</mainClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
15
assignment4/query.sql
Normal file
15
assignment4/query.sql
Normal file
|
@ -0,0 +1,15 @@
|
|||
-- get library id
|
||||
select libraryid from "library" where city = 'Alexandria';
|
||||
|
||||
-- get author id
|
||||
select authorid from author where familyname = 'Tolkien';
|
||||
|
||||
-- get all books by the author
|
||||
select * from book where authorid = (select authorid from author where familyname = 'Tolkien');
|
||||
|
||||
-- get all available copies of the books from the above author in the above library
|
||||
select book.title, book.publisher, book.genre, book.rrp, count(*) as "number_available" from bookcopy join book on bookcopy.bookid = book.bookid where
|
||||
libraryid = (select libraryid from "library" where city = 'Alexandria') and
|
||||
bookcopy.bookid in (select bookid from book where authorid = (select authorid from author where familyname = 'Tolkien')) and
|
||||
(onloan = false or onloan is null)
|
||||
group by book.title, book.publisher, book.genre, book.rrp;
|
BIN
assignment4/resources/Assignment4_FullStack_v0001.pdf
Normal file
BIN
assignment4/resources/Assignment4_FullStack_v0001.pdf
Normal file
Binary file not shown.
960
assignment4/resources/books.sql
Normal file
960
assignment4/resources/books.sql
Normal file
|
@ -0,0 +1,960 @@
|
|||
--
|
||||
-- File: books.sql
|
||||
--
|
||||
-- A small database about books for Assignment 4 of modules
|
||||
-- Full Stack Application Development and Software Workshop 2
|
||||
--
|
||||
-- Authors: Carl Wilding, Pieter Joubert and Felipe Orihuela-Espina
|
||||
--
|
||||
--
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- Database creation and connection
|
||||
---------------------------------------------------------
|
||||
|
||||
DROP DATABASE IF EXISTS "FSAD2023_Books";
|
||||
CREATE DATABASE "FSAD2023_Books";
|
||||
\c FSAD2023_Books;
|
||||
|
||||
|
||||
CREATE TABLE author
|
||||
(
|
||||
authorID serial PRIMARY KEY,
|
||||
firstname varchar(50) NOT NULL,
|
||||
familyname varchar(50)
|
||||
);
|
||||
|
||||
CREATE TABLE genre
|
||||
(
|
||||
name varchar (50) PRIMARY KEY
|
||||
);
|
||||
|
||||
CREATE TABLE book
|
||||
(
|
||||
bookID serial PRIMARY KEY,
|
||||
title varchar (255) NOT NULL,
|
||||
publisher varchar (50),
|
||||
authorID int REFERENCES author(authorID) NOT NULL,
|
||||
genre varchar(50) REFERENCES genre(name),
|
||||
rrp decimal(6, 2) not null check(rrp > 0) -- Recommended retailer price
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE library
|
||||
(
|
||||
libraryID serial PRIMARY KEY,
|
||||
name varchar(50) NOT NULL,
|
||||
city varchar(30),
|
||||
country varchar(30)
|
||||
);
|
||||
|
||||
CREATE TABLE bookcopy
|
||||
(
|
||||
bookID int REFERENCES book(bookID) NOT NULL,
|
||||
libraryID int REFERENCES library(libraryID) NOT NULL,
|
||||
copyID int, -- Allows for several copies in the same library
|
||||
digital boolean DEFAULT FALSE,
|
||||
onLoan boolean DEFAULT FALSE,
|
||||
PRIMARY KEY (bookID, libraryID, copyID)
|
||||
);
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- Database population
|
||||
---------------------------------------------------------
|
||||
|
||||
|
||||
INSERT INTO author (firstname,familyname) (
|
||||
VALUES ('J.R.R.','Tolkien'),
|
||||
('J.K.','Rowling'),
|
||||
('David','Walliams'),
|
||||
('Stephen','King'),
|
||||
('Agatha','Christie'),
|
||||
('James','Patterson'),
|
||||
('Jane','Austen'),
|
||||
('Charles','Dickens'),
|
||||
('C.S.','Lewis'),
|
||||
('Dan','Brown'),
|
||||
('Tom','Clancy'),
|
||||
('George R.R.','Martin'),
|
||||
('Roald','Dahl'),
|
||||
('Ian','Fleming'),
|
||||
('Richard','Osman'),
|
||||
('Julia','Donaldson'),
|
||||
('Chris','Ryan'),
|
||||
('John','Grisham'),
|
||||
('Danielle','Steel')
|
||||
);
|
||||
|
||||
INSERT INTO genre (
|
||||
VALUES ('Fantasy'),
|
||||
('Childrens'),
|
||||
('Mystery'),
|
||||
('Crime'),
|
||||
('Horror'),
|
||||
('Contemporary'),
|
||||
('Romance'),
|
||||
('Military Fiction'),
|
||||
('Victorian Literature'),
|
||||
('Espionage'),
|
||||
('Thriller')
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO book (authorID, title, publisher, genre, rrp)
|
||||
(
|
||||
VALUES (1, 'The Hobbit', 'Harper Collins', 'Fantasy', 7.99),
|
||||
(1, 'The Silmarillion', 'Harper Collins', 'Fantasy', 6.99),
|
||||
(1, 'Letters from Father Christmas', 'Harper Collins', 'Fantasy', 10.99),
|
||||
(1, 'The Fall of Gondolin', 'Harper Collins', 'Fantasy', 9.99),
|
||||
(1, 'Unfinished Tales', 'Harper Collins', 'Fantasy', 4.99),
|
||||
(1, 'The Children of Hurin', 'Harper Collins', 'Fantasy', 9.99),
|
||||
(1, 'Beren and Luthien', 'Harper Collins', 'Fantasy', 5.99),
|
||||
(1, 'The Lord of the Rings: The Fellowship of the Ring', 'Harper Collins', 'Fantasy', 7.99),
|
||||
(1, 'The Lord of the Rings: The Two Towers', 'Harper Collins', 'Fantasy', 4.99),
|
||||
(1, 'The Lord of the Rings: The Return of the King', 'Harper Collins', 'Fantasy', 4.99),
|
||||
(2, 'Harry Potter and the Philosophers Stone', 'Bloomsbury', 'Childrens', 5.99),
|
||||
(2, 'Harry Potter and the Chamber of Secrets', 'Bloomsbury', 'Childrens', 9.99),
|
||||
(2, 'Harry Potter and the Prisoner of Azkaban', 'Bloomsbury', 'Childrens', 8.99),
|
||||
(2, 'Harry Potter and the Goblet of Fire', 'Bloomsbury', 'Childrens', 5.99),
|
||||
(2, 'Harry Potter and the Order of the Phoenix', 'Bloomsbury', 'Childrens', 9.99),
|
||||
(2, 'Harry Potter and the Half-Blood Prince', 'Bloomsbury', 'Childrens', 5.99),
|
||||
(2, 'Harry Potter and the Deathly Hallows', 'Bloomsbury', 'Childrens', 4.99),
|
||||
(3, 'Gangsta Granny', 'Harper Collins', 'Childrens', 4.99),
|
||||
(3, 'Mr Stink', 'Harper Collins', 'Childrens', 7.99),
|
||||
(3, 'Billionaire Boy', 'Harper Collins', 'Childrens', 9.99),
|
||||
(3, 'The Boy in the Dress', 'Harper Collins', 'Childrens', 7.99),
|
||||
(4, 'IT', 'Hodder & Stoughton', 'Horror', 4.99),
|
||||
(5, 'Murder on the Orient Express', 'Harper Collins', 'Mystery', 5.99),
|
||||
(6, 'Stalking Jack the Ripper', 'Little, Brown & Company', 'Horror', 4.99),
|
||||
(7, 'Pride and Prejudice', 'Penguin Books', 'Romance', 8.99),
|
||||
(8, 'A Christmas Carol', 'Dover Publications', 'Victorian Literature', 7.99),
|
||||
(9, 'The Lion, the Witch and the Wardrobe', 'Zonderkidz', 'Fantasy', 10.99),
|
||||
(10, 'Inferno', 'Transworld', 'Mystery', 8.99),
|
||||
(10, 'Origin', 'Transworld', 'Mystery', 11.99),
|
||||
(11, 'Rainbow Six', 'Penguin', 'Thriller', 12.99),
|
||||
(11, 'The Hunt for Red October', 'Harper Collins', 'Military Fiction', 15.99),
|
||||
(12, 'A Game of Thrones', 'Harper Collins', 'Fantasy', 21.99),
|
||||
(13, 'Charlie and the Chocoolate Factory', 'Penguin', 'Childrens', 12.99),
|
||||
(13, 'Matilda', 'Penguin', 'Childrens', 15.79),
|
||||
(14, 'Casino Royale', 'Vintage Publishing', 'Espionage', 11.79),
|
||||
(15, 'The Man Who Died Twice ', 'Penguin', 'Crime', 12.99),
|
||||
(16, 'The Gruffalo', 'Penguin', 'Childrens', 13.79),
|
||||
(17, 'Deadfall', 'Penguin', 'Thriller', 17.80),
|
||||
(18, 'The Whistler', 'Hodder & Stoughton', 'Thriller', 18.79),
|
||||
(19, 'Golden Moments', 'Little, Brown Book Group', 'Contemporary', 19.79),
|
||||
(19, 'Answered Prayers', 'Transworld', 'Contemporary', 20.79),
|
||||
(19, 'Blessing in Disguise', 'Pan Macmillan', 'Romance', 22.55)
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO library (name, city, country) (
|
||||
VALUES ('Abbey library of Saint Gall', 'St. Gallen','Switzerland'),
|
||||
('British Library', 'London','United Kingdom'),
|
||||
('Biblioteca Palafoxiana','Puebla','Mexico'),
|
||||
('Bibliothèque nationale de France','Paris','France'),
|
||||
('Bodleian Library', 'Oxford','United Kingdom'),
|
||||
('Library of Birmingham', 'Birmingham','United Kingdom'),
|
||||
('The library of Alexandria', 'Alexandria','Egypt'),
|
||||
('The library of the congress of the USA', 'Washington','USA'),
|
||||
('Vatican Library', 'Rome','Italy')
|
||||
);
|
||||
|
||||
|
||||
|
||||
INSERT INTO bookcopy (bookID,libraryID,copyID,digital,onloan) (
|
||||
VALUES (1,1,1,FALSE,FALSE),
|
||||
(1,1,2,FALSE,FALSE),
|
||||
(1,1,3,FALSE,FALSE),
|
||||
(1,2,1,FALSE,TRUE),
|
||||
(1,3,1,FALSE,FALSE),
|
||||
(1,4,1,FALSE,FALSE),
|
||||
(1,4,2,FALSE,FALSE),
|
||||
--
|
||||
(2,2,1,FALSE,FALSE),
|
||||
(2,2,2,FALSE,FALSE),
|
||||
(2,3,1,FALSE,FALSE),
|
||||
(2,4,1,FALSE,TRUE),
|
||||
(2,5,1,FALSE,FALSE),
|
||||
(2,6,1,FALSE,FALSE),
|
||||
(2,6,2,FALSE,TRUE),
|
||||
(2,8,1,FALSE,FALSE),
|
||||
--
|
||||
(3,1,1,FALSE,FALSE),
|
||||
(3,1,2,FALSE,FALSE),
|
||||
(3,1,3,FALSE,FALSE),
|
||||
(3,1,4,FALSE,FALSE),
|
||||
(3,2,1,FALSE,FALSE),
|
||||
(3,2,2,FALSE,TRUE),
|
||||
(3,3,1,FALSE,FALSE),
|
||||
(3,4,1,FALSE,TRUE),
|
||||
(3,4,2,FALSE,FALSE),
|
||||
(3,4,3,FALSE,FALSE),
|
||||
(3,5,1,FALSE,NULL),
|
||||
(3,5,2,NULL,NULL),
|
||||
(3,6,1,NULL,FALSE),
|
||||
(3,6,2,FALSE,FALSE),
|
||||
(3,7,2,FALSE,FALSE),
|
||||
(3,8,2,FALSE,FALSE),
|
||||
(3,8,3,FALSE,TRUE),
|
||||
(3,9,1,FALSE,FALSE),
|
||||
(3,9,2,FALSE,FALSE),
|
||||
--
|
||||
(4,1,1,FALSE,FALSE),
|
||||
(4,1,3,FALSE,FALSE),
|
||||
(4,2,1,FALSE,FALSE),
|
||||
(4,2,3,FALSE,TRUE),
|
||||
(4,3,1,FALSE,FALSE),
|
||||
(4,3,2,FALSE,FALSE),
|
||||
(4,4,1,FALSE,FALSE),
|
||||
(4,4,2,FALSE,FALSE),
|
||||
(4,4,3,FALSE,FALSE),
|
||||
(4,6,1,FALSE,FALSE),
|
||||
(4,6,2,FALSE,FALSE),
|
||||
(4,6,3,FALSE,FALSE),
|
||||
(4,7,1,FALSE,FALSE),
|
||||
(4,7,2,FALSE,FALSE),
|
||||
(4,7,3,FALSE,TRUE),
|
||||
(4,8,2,FALSE,FALSE),
|
||||
(4,9,1,FALSE,FALSE),
|
||||
(4,9,3,FALSE,FALSE),
|
||||
--
|
||||
(5,2,1,FALSE,TRUE),
|
||||
(5,3,1,FALSE,FALSE),
|
||||
(5,3,2,FALSE,FALSE),
|
||||
(5,3,3,FALSE,FALSE),
|
||||
(5,4,2,FALSE,FALSE),
|
||||
(5,5,1,FALSE,TRUE),
|
||||
(5,5,2,FALSE,FALSE),
|
||||
(5,5,3,FALSE,FALSE),
|
||||
(5,6,1,FALSE,FALSE),
|
||||
(5,6,3,FALSE,FALSE),
|
||||
(5,7,1,FALSE,FALSE),
|
||||
(5,7,2,FALSE,FALSE),
|
||||
(5,7,3,FALSE,FALSE),
|
||||
(5,8,1,FALSE,FALSE),
|
||||
(5,8,2,FALSE,FALSE),
|
||||
(5,8,3,FALSE,TRUE),
|
||||
(5,9,1,FALSE,FALSE),
|
||||
(5,9,2,FALSE,FALSE),
|
||||
--
|
||||
(6,1,1,FALSE,FALSE),
|
||||
(6,1,2,FALSE,FALSE),
|
||||
(6,2,1,FALSE,FALSE),
|
||||
(6,3,1,FALSE,FALSE),
|
||||
(6,4,1,FALSE,FALSE),
|
||||
(6,4,2,FALSE,FALSE),
|
||||
(6,4,3,FALSE,TRUE),
|
||||
(6,5,1,FALSE,FALSE),
|
||||
(6,5,2,FALSE,FALSE),
|
||||
(6,6,1,FALSE,TRUE),
|
||||
(6,7,3,FALSE,FALSE),
|
||||
(6,9,3,FALSE,TRUE),
|
||||
--
|
||||
(7,1,1,FALSE,TRUE),
|
||||
(7,1,2,FALSE,FALSE),
|
||||
(7,2,2,FALSE,FALSE),
|
||||
(7,3,1,FALSE,FALSE),
|
||||
(7,3,3,FALSE,FALSE),
|
||||
(7,4,3,FALSE,FALSE),
|
||||
(7,5,2,FALSE,FALSE),
|
||||
(7,5,3,FALSE,FALSE),
|
||||
(7,6,1,FALSE,FALSE),
|
||||
(7,6,3,NULL,FALSE),
|
||||
(7,7,1,FALSE,FALSE),
|
||||
(7,7,2,FALSE,FALSE),
|
||||
(7,7,3,FALSE,FALSE),
|
||||
(7,8,1,FALSE,NULL),
|
||||
(7,8,2,FALSE,NULL),
|
||||
(7,9,1,FALSE,FALSE),
|
||||
(7,9,2,FALSE,FALSE),
|
||||
(7,9,3,FALSE,TRUE),
|
||||
--
|
||||
(8,1,1,FALSE,TRUE),
|
||||
(8,1,2,FALSE,FALSE),
|
||||
(8,2,1,FALSE,FALSE),
|
||||
(8,2,2,FALSE,FALSE),
|
||||
(8,2,3,FALSE,FALSE),
|
||||
(8,3,1,FALSE,FALSE),
|
||||
(8,3,2,FALSE,FALSE),
|
||||
(8,4,2,FALSE,FALSE),
|
||||
(8,4,3,FALSE,FALSE),
|
||||
(8,5,1,FALSE,TRUE),
|
||||
(8,5,3,FALSE,FALSE),
|
||||
(8,6,1,FALSE,FALSE),
|
||||
(8,6,2,FALSE,FALSE),
|
||||
(8,6,3,FALSE,TRUE),
|
||||
(8,7,1,FALSE,TRUE),
|
||||
(8,7,2,FALSE,FALSE),
|
||||
(8,8,1,FALSE,FALSE),
|
||||
(8,8,2,FALSE,TRUE),
|
||||
(8,9,2,FALSE,FALSE),
|
||||
(8,9,3,FALSE,FALSE),
|
||||
--
|
||||
(9,1,1,FALSE,FALSE),
|
||||
(9,1,2,FALSE,FALSE),
|
||||
(9,1,3,FALSE,FALSE),
|
||||
(9,2,1,FALSE,FALSE),
|
||||
(9,5,3,FALSE,FALSE),
|
||||
(9,6,1,FALSE,FALSE),
|
||||
(9,6,2,FALSE,TRUE),
|
||||
(9,6,3,FALSE,FALSE),
|
||||
(9,7,2,FALSE,FALSE),
|
||||
(9,8,1,FALSE,TRUE),
|
||||
(9,8,2,FALSE,TRUE),
|
||||
(9,8,3,FALSE,FALSE),
|
||||
(9,8,4,FALSE,TRUE),
|
||||
(9,8,5,FALSE,FALSE),
|
||||
(9,8,6,FALSE,FALSE),
|
||||
--
|
||||
(10,1,1,FALSE,FALSE),
|
||||
(10,1,2,FALSE,FALSE),
|
||||
(10,1,3,FALSE,TRUE),
|
||||
(10,2,1,NULL,FALSE),
|
||||
(10,2,2,FALSE,TRUE),
|
||||
(10,2,3,FALSE,FALSE),
|
||||
(10,3,1,FALSE,FALSE),
|
||||
(10,3,2,FALSE,FALSE),
|
||||
(10,3,3,FALSE,FALSE),
|
||||
(10,4,1,NULL,FALSE),
|
||||
(10,4,2,FALSE,FALSE),
|
||||
(10,4,3,FALSE,FALSE),
|
||||
(10,5,1,FALSE,FALSE),
|
||||
(10,5,2,FALSE,FALSE),
|
||||
(10,5,3,FALSE,FALSE),
|
||||
(10,6,1,FALSE,FALSE),
|
||||
(10,6,2,FALSE,TRUE),
|
||||
(10,6,3,FALSE,FALSE),
|
||||
(10,7,1,FALSE,FALSE),
|
||||
(10,7,2,FALSE,FALSE),
|
||||
(10,7,3,FALSE,FALSE),
|
||||
(10,8,1,FALSE,FALSE),
|
||||
(10,8,2,FALSE,FALSE),
|
||||
(10,8,3,FALSE,FALSE),
|
||||
(10,9,1,FALSE,FALSE),
|
||||
(10,9,2,NULL,FALSE),
|
||||
(10,9,3,FALSE,FALSE),
|
||||
--
|
||||
(11,1,1,FALSE,TRUE),
|
||||
(11,1,2,FALSE,TRUE),
|
||||
(11,1,3,FALSE,TRUE),
|
||||
(11,2,1,FALSE,TRUE),
|
||||
(11,3,1,FALSE,TRUE),
|
||||
(11,4,1,FALSE,FALSE),
|
||||
(11,4,2,FALSE,FALSE),
|
||||
--
|
||||
(12,2,1,FALSE,FALSE),
|
||||
(12,2,2,FALSE,FALSE),
|
||||
(12,3,1,FALSE,FALSE),
|
||||
(12,4,1,FALSE,FALSE),
|
||||
(12,6,1,FALSE,FALSE),
|
||||
(12,6,2,FALSE,FALSE),
|
||||
(12,6,3,FALSE,FALSE),
|
||||
(12,6,4,FALSE,FALSE),
|
||||
(12,6,5,FALSE,FALSE),
|
||||
(12,6,6,FALSE,FALSE),
|
||||
--
|
||||
(13,3,2,FALSE,FALSE),
|
||||
(13,3,3,FALSE,FALSE),
|
||||
(13,4,3,FALSE,FALSE),
|
||||
(13,5,2,FALSE,FALSE),
|
||||
(13,5,3,FALSE,FALSE),
|
||||
(13,6,1,FALSE,FALSE),
|
||||
(13,6,2,FALSE,FALSE),
|
||||
(13,6,3,FALSE,FALSE),
|
||||
(13,7,1,FALSE,FALSE),
|
||||
(13,7,2,FALSE,FALSE),
|
||||
(13,7,3,FALSE,FALSE),
|
||||
(13,8,2,FALSE,FALSE),
|
||||
(13,8,3,FALSE,FALSE),
|
||||
(13,9,1,FALSE,FALSE),
|
||||
(13,9,3,FALSE,FALSE),
|
||||
--
|
||||
(14,1,1,FALSE,FALSE),
|
||||
(14,1,2,FALSE,FALSE),
|
||||
(14,1,3,FALSE,FALSE),
|
||||
(14,2,1,FALSE,FALSE),
|
||||
(14,2,2,FALSE,FALSE),
|
||||
(14,2,3,FALSE,FALSE),
|
||||
(14,3,1,FALSE,FALSE),
|
||||
(14,3,2,FALSE,FALSE),
|
||||
(14,3,3,FALSE,FALSE),
|
||||
(14,3,4,FALSE,FALSE),
|
||||
(14,4,1,FALSE,FALSE),
|
||||
(14,4,2,FALSE,FALSE),
|
||||
(14,4,3,FALSE,FALSE),
|
||||
(14,5,1,FALSE,FALSE),
|
||||
(14,5,2,FALSE,FALSE),
|
||||
(14,5,3,FALSE,FALSE),
|
||||
(14,5,4,FALSE,FALSE),
|
||||
(14,6,1,FALSE,FALSE),
|
||||
(14,6,2,FALSE,TRUE),
|
||||
(14,6,3,FALSE,FALSE),
|
||||
(14,7,1,FALSE,FALSE),
|
||||
(14,7,2,FALSE,FALSE),
|
||||
(14,7,3,FALSE,TRUE),
|
||||
(14,7,4,FALSE,FALSE),
|
||||
(14,7,5,FALSE,FALSE),
|
||||
(14,8,1,FALSE,FALSE),
|
||||
(14,8,2,FALSE,FALSE),
|
||||
(14,8,3,FALSE,TRUE),
|
||||
(14,9,1,FALSE,TRUE),
|
||||
(14,9,2,FALSE,FALSE),
|
||||
(14,9,3,FALSE,FALSE),
|
||||
--
|
||||
(15,1,1,FALSE,FALSE),
|
||||
(15,1,2,FALSE,FALSE),
|
||||
(15,1,3,FALSE,FALSE),
|
||||
(15,2,1,FALSE,FALSE),
|
||||
(15,2,2,FALSE,FALSE),
|
||||
(15,2,3,FALSE,FALSE),
|
||||
(15,3,1,FALSE,FALSE),
|
||||
(15,3,2,FALSE,FALSE),
|
||||
(15,3,3,FALSE,FALSE),
|
||||
(15,4,1,FALSE,FALSE),
|
||||
(15,4,2,FALSE,FALSE),
|
||||
(15,4,3,FALSE,FALSE),
|
||||
(15,5,1,FALSE,FALSE),
|
||||
(15,5,2,FALSE,FALSE),
|
||||
(15,5,3,FALSE,FALSE),
|
||||
(15,6,1,FALSE,FALSE),
|
||||
(15,6,2,FALSE,FALSE),
|
||||
(15,6,3,FALSE,FALSE),
|
||||
(15,7,1,FALSE,FALSE),
|
||||
(15,7,2,FALSE,FALSE),
|
||||
(15,8,1,FALSE,FALSE),
|
||||
(15,9,1,FALSE,FALSE),
|
||||
(15,9,2,FALSE,FALSE),
|
||||
(15,9,3,FALSE,FALSE),
|
||||
--
|
||||
(16,1,1,FALSE,FALSE),
|
||||
(16,1,2,FALSE,FALSE),
|
||||
(16,1,3,FALSE,FALSE),
|
||||
(16,2,1,FALSE,TRUE),
|
||||
(16,2,2,FALSE,FALSE),
|
||||
(16,2,3,FALSE,FALSE),
|
||||
(16,3,1,FALSE,FALSE),
|
||||
(16,3,2,FALSE,FALSE),
|
||||
(16,3,3,FALSE,TRUE),
|
||||
(16,4,1,FALSE,FALSE),
|
||||
(16,4,2,FALSE,FALSE),
|
||||
(16,4,3,FALSE,FALSE),
|
||||
(16,5,1,FALSE,FALSE),
|
||||
(16,6,3,FALSE,FALSE),
|
||||
(16,7,1,FALSE,FALSE),
|
||||
(16,7,2,FALSE,FALSE),
|
||||
(16,8,1,FALSE,FALSE),
|
||||
(16,8,2,FALSE,FALSE),
|
||||
(16,9,1,FALSE,FALSE),
|
||||
(16,9,2,FALSE,FALSE),
|
||||
(16,9,3,FALSE,FALSE),
|
||||
--
|
||||
(17,1,1,FALSE,FALSE),
|
||||
(17,1,2,FALSE,TRUE),
|
||||
(17,1,3,FALSE,FALSE),
|
||||
(17,1,4,FALSE,FALSE),
|
||||
(17,1,5,FALSE,FALSE),
|
||||
(17,3,1,TRUE,TRUE),
|
||||
(17,3,2,FALSE,FALSE),
|
||||
(17,3,3,FALSE,FALSE),
|
||||
(17,4,1,FALSE,FALSE),
|
||||
(17,4,2,TRUE,FALSE),
|
||||
(17,4,3,FALSE,FALSE),
|
||||
(17,6,1,FALSE,FALSE),
|
||||
(17,6,2,TRUE,FALSE),
|
||||
(17,6,3,FALSE,TRUE),
|
||||
(17,8,1,FALSE,TRUE),
|
||||
(17,8,2,FALSE,FALSE),
|
||||
(17,9,1,FALSE,FALSE),
|
||||
(17,9,2,FALSE,FALSE),
|
||||
(17,9,3,FALSE,FALSE),
|
||||
--
|
||||
(18,1,1,FALSE,FALSE),
|
||||
(18,1,2,FALSE,FALSE),
|
||||
(18,1,3,FALSE,FALSE),
|
||||
(18,2,1,FALSE,FALSE),
|
||||
(18,2,2,FALSE,FALSE),
|
||||
(18,3,1,FALSE,FALSE),
|
||||
(18,3,2,FALSE,FALSE),
|
||||
(18,3,3,FALSE,FALSE),
|
||||
(18,4,1,FALSE,FALSE),
|
||||
(18,4,2,FALSE,TRUE),
|
||||
(18,5,1,FALSE,FALSE),
|
||||
(18,5,2,FALSE,FALSE),
|
||||
(18,5,3,FALSE,TRUE),
|
||||
(18,6,1,FALSE,FALSE),
|
||||
(18,6,2,FALSE,FALSE),
|
||||
(18,7,1,FALSE,FALSE),
|
||||
(18,7,2,FALSE,FALSE),
|
||||
(18,7,3,FALSE,FALSE),
|
||||
(18,8,1,FALSE,FALSE),
|
||||
(18,8,2,FALSE,FALSE),
|
||||
(18,8,3,FALSE,TRUE),
|
||||
(18,9,1,FALSE,TRUE),
|
||||
(18,9,2,FALSE,FALSE),
|
||||
(18,9,3,FALSE,FALSE),
|
||||
--
|
||||
(19,1,1,FALSE,FALSE),
|
||||
(19,1,2,FALSE,FALSE),
|
||||
(19,1,3,FALSE,FALSE),
|
||||
(19,2,1,FALSE,FALSE),
|
||||
(19,2,2,FALSE,FALSE),
|
||||
(19,2,3,FALSE,FALSE),
|
||||
(19,3,1,FALSE,FALSE),
|
||||
(19,3,2,FALSE,FALSE),
|
||||
(19,3,3,FALSE,FALSE),
|
||||
(19,4,1,FALSE,FALSE),
|
||||
(19,4,2,FALSE,FALSE),
|
||||
(19,4,3,FALSE,FALSE),
|
||||
(19,4,4,FALSE,FALSE),
|
||||
(19,4,5,FALSE,FALSE),
|
||||
(19,4,6,FALSE,FALSE),
|
||||
(19,4,7,FALSE,FALSE),
|
||||
(19,6,1,FALSE,FALSE),
|
||||
(19,6,2,FALSE,FALSE),
|
||||
(19,6,3,FALSE,FALSE),
|
||||
(19,7,1,FALSE,FALSE),
|
||||
(19,7,2,FALSE,FALSE),
|
||||
(19,7,3,FALSE,FALSE),
|
||||
(19,8,1,FALSE,FALSE),
|
||||
(19,8,2,FALSE,FALSE),
|
||||
(19,8,3,FALSE,FALSE),
|
||||
(19,9,1,FALSE,FALSE),
|
||||
(19,9,2,FALSE,FALSE),
|
||||
(19,9,3,FALSE,FALSE),
|
||||
--
|
||||
(20,1,1,FALSE,FALSE),
|
||||
(20,2,1,FALSE,FALSE),
|
||||
(20,3,1,FALSE,FALSE),
|
||||
(20,4,1,FALSE,TRUE),
|
||||
(20,5,1,FALSE,FALSE),
|
||||
(20,6,1,FALSE,TRUE),
|
||||
(20,7,1,FALSE,FALSE),
|
||||
(20,8,1,FALSE,TRUE),
|
||||
(20,9,1,FALSE,TRUE),
|
||||
--
|
||||
(21,1,1,FALSE,FALSE),
|
||||
(21,1,2,FALSE,FALSE),
|
||||
(21,2,1,FALSE,FALSE),
|
||||
(21,3,1,FALSE,FALSE),
|
||||
(21,4,1,FALSE,FALSE),
|
||||
(21,7,2,FALSE,FALSE),
|
||||
--
|
||||
(22,2,1,FALSE,FALSE),
|
||||
(22,2,2,FALSE,FALSE),
|
||||
(22,3,1,FALSE,FALSE),
|
||||
(22,4,1,FALSE,FALSE),
|
||||
(22,5,1,FALSE,FALSE),
|
||||
(22,6,1,FALSE,FALSE),
|
||||
(22,6,2,FALSE,FALSE),
|
||||
(22,7,1,FALSE,FALSE),
|
||||
(22,7,2,FALSE,FALSE),
|
||||
(22,7,3,FALSE,FALSE),
|
||||
(22,7,4,FALSE,FALSE),
|
||||
(22,8,1,FALSE,FALSE),
|
||||
--
|
||||
(23,6,1,TRUE,FALSE),
|
||||
(23,6,2,TRUE,FALSE),
|
||||
--
|
||||
(24,1,1,FALSE,FALSE),
|
||||
(24,2,1,FALSE,FALSE),
|
||||
(24,2,2,FALSE,FALSE),
|
||||
(24,3,1,FALSE,FALSE),
|
||||
(24,3,2,FALSE,TRUE),
|
||||
(24,3,3,FALSE,FALSE),
|
||||
(24,4,1,FALSE,FALSE),
|
||||
(24,4,2,FALSE,FALSE),
|
||||
(24,5,1,FALSE,FALSE),
|
||||
(24,5,2,FALSE,FALSE),
|
||||
(24,5,3,FALSE,FALSE),
|
||||
(24,6,1,FALSE,FALSE),
|
||||
(24,6,2,FALSE,TRUE),
|
||||
(24,6,3,FALSE,TRUE),
|
||||
(24,7,1,FALSE,FALSE),
|
||||
(24,8,1,FALSE,FALSE),
|
||||
(24,8,2,FALSE,FALSE),
|
||||
(24,8,3,FALSE,FALSE),
|
||||
(24,9,1,FALSE,FALSE),
|
||||
--
|
||||
(25,1,1,FALSE,FALSE),
|
||||
(25,1,2,FALSE,FALSE),
|
||||
(25,1,3,FALSE,FALSE),
|
||||
(25,2,1,FALSE,FALSE),
|
||||
(25,2,2,FALSE,FALSE),
|
||||
(25,2,3,FALSE,FALSE),
|
||||
(25,3,1,FALSE,FALSE),
|
||||
(25,3,2,FALSE,FALSE),
|
||||
(25,4,1,FALSE,FALSE),
|
||||
(25,4,2,FALSE,FALSE),
|
||||
(25,4,3,FALSE,FALSE),
|
||||
(25,5,1,FALSE,FALSE),
|
||||
(25,6,1,FALSE,FALSE),
|
||||
(25,7,1,FALSE,FALSE),
|
||||
(25,7,2,FALSE,FALSE),
|
||||
(25,7,3,FALSE,FALSE),
|
||||
(25,8,1,FALSE,FALSE),
|
||||
(25,8,2,FALSE,FALSE),
|
||||
(25,8,3,FALSE,FALSE),
|
||||
(25,9,1,FALSE,FALSE),
|
||||
(25,9,3,FALSE,FALSE),
|
||||
--
|
||||
(26,1,1,FALSE,FALSE),
|
||||
(26,1,2,FALSE,FALSE),
|
||||
(26,2,3,FALSE,FALSE),
|
||||
(26,3,1,FALSE,FALSE),
|
||||
(26,3,2,FALSE,FALSE),
|
||||
(26,3,3,FALSE,FALSE),
|
||||
(26,4,1,FALSE,FALSE),
|
||||
(26,4,2,FALSE,FALSE),
|
||||
(26,5,2,FALSE,FALSE),
|
||||
(26,5,3,FALSE,FALSE),
|
||||
(26,6,1,FALSE,FALSE),
|
||||
(26,7,1,FALSE,FALSE),
|
||||
(26,7,2,FALSE,FALSE),
|
||||
(26,7,3,FALSE,FALSE),
|
||||
(26,8,1,FALSE,FALSE),
|
||||
(26,8,2,FALSE,FALSE),
|
||||
(26,8,3,FALSE,FALSE),
|
||||
(26,9,2,FALSE,FALSE),
|
||||
(26,9,3,FALSE,FALSE),
|
||||
--
|
||||
(27,1,1,FALSE,FALSE),
|
||||
(27,1,2,TRUE,FALSE),
|
||||
(27,1,3,FALSE,FALSE),
|
||||
(27,2,1,FALSE,FALSE),
|
||||
(27,2,2,FALSE,FALSE),
|
||||
(27,2,3,FALSE,FALSE),
|
||||
(27,3,2,FALSE,TRUE),
|
||||
(27,3,3,FALSE,FALSE),
|
||||
(27,4,1,FALSE,FALSE),
|
||||
(27,4,3,FALSE,TRUE),
|
||||
(27,5,1,FALSE,FALSE),
|
||||
(27,5,2,FALSE,FALSE),
|
||||
(27,5,3,TRUE,FALSE),
|
||||
(27,6,1,FALSE,FALSE),
|
||||
(27,6,2,FALSE,FALSE),
|
||||
(27,6,3,FALSE,FALSE),
|
||||
(27,7,2,FALSE,TRUE),
|
||||
(27,7,3,FALSE,FALSE),
|
||||
(27,8,3,FALSE,FALSE),
|
||||
(27,9,1,FALSE,FALSE),
|
||||
(27,9,2,FALSE,FALSE),
|
||||
(27,9,3,FALSE,FALSE),
|
||||
--
|
||||
(28,1,1,FALSE,FALSE),
|
||||
(28,1,2,FALSE,FALSE),
|
||||
(28,1,3,FALSE,FALSE),
|
||||
(28,2,3,FALSE,FALSE),
|
||||
(28,3,3,FALSE,TRUE),
|
||||
(28,4,1,FALSE,FALSE),
|
||||
(28,4,2,FALSE,TRUE),
|
||||
(28,4,3,FALSE,FALSE),
|
||||
(28,5,1,FALSE,TRUE),
|
||||
(28,5,2,FALSE,FALSE),
|
||||
(28,5,3,FALSE,FALSE),
|
||||
(28,6,1,FALSE,FALSE),
|
||||
(28,6,2,FALSE,FALSE),
|
||||
(28,7,1,FALSE,TRUE),
|
||||
(28,7,2,FALSE,TRUE),
|
||||
(28,7,3,FALSE,TRUE),
|
||||
(28,8,1,FALSE,TRUE),
|
||||
(28,8,2,FALSE,FALSE),
|
||||
(28,8,3,FALSE,FALSE),
|
||||
(28,9,1,FALSE,FALSE),
|
||||
(28,9,2,FALSE,TRUE),
|
||||
(28,9,3,FALSE,FALSE),
|
||||
--
|
||||
(29,1,1,FALSE,FALSE),
|
||||
(29,1,2,FALSE,FALSE),
|
||||
(29,1,3,FALSE,FALSE),
|
||||
(29,2,1,FALSE,FALSE),
|
||||
(29,2,2,FALSE,FALSE),
|
||||
(29,2,3,FALSE,TRUE),
|
||||
(29,3,1,FALSE,FALSE),
|
||||
(29,3,2,FALSE,FALSE),
|
||||
(29,4,1,FALSE,FALSE),
|
||||
(29,4,3,FALSE,FALSE),
|
||||
(29,5,1,FALSE,FALSE),
|
||||
(29,5,2,FALSE,FALSE),
|
||||
(29,5,3,FALSE,FALSE),
|
||||
(29,6,1,FALSE,FALSE),
|
||||
(29,6,2,FALSE,FALSE),
|
||||
(29,6,3,TRUE,FALSE),
|
||||
(29,7,1,FALSE,FALSE),
|
||||
(29,7,2,FALSE,FALSE),
|
||||
(29,7,3,FALSE,TRUE),
|
||||
(29,8,1,FALSE,FALSE),
|
||||
(29,8,2,FALSE,FALSE),
|
||||
(29,8,3,FALSE,TRUE),
|
||||
(29,9,1,FALSE,FALSE),
|
||||
(29,9,2,FALSE,FALSE),
|
||||
(29,9,3,FALSE,FALSE),
|
||||
--
|
||||
(30,2,1,FALSE,FALSE),
|
||||
(30,2,2,FALSE,TRUE),
|
||||
(30,2,3,FALSE,FALSE),
|
||||
(30,3,1,FALSE,FALSE),
|
||||
(30,3,2,FALSE,FALSE),
|
||||
(30,3,3,FALSE,FALSE),
|
||||
(30,4,1,FALSE,FALSE),
|
||||
(30,4,2,FALSE,FALSE),
|
||||
(30,4,3,TRUE,FALSE),
|
||||
(30,5,1,TRUE,FALSE),
|
||||
(30,5,2,TRUE,TRUE),
|
||||
(30,5,3,TRUE,FALSE),
|
||||
(30,6,1,FALSE,FALSE),
|
||||
(30,6,2,FALSE,FALSE),
|
||||
(30,6,3,FALSE,FALSE),
|
||||
(30,7,1,FALSE,FALSE),
|
||||
(30,7,2,FALSE,FALSE),
|
||||
(30,7,3,FALSE,FALSE),
|
||||
(30,8,1,FALSE,FALSE),
|
||||
(30,8,2,FALSE,FALSE),
|
||||
(30,8,3,FALSE,FALSE),
|
||||
(30,9,1,FALSE,FALSE),
|
||||
(30,9,2,FALSE,FALSE),
|
||||
--
|
||||
(31,1,1,TRUE,TRUE),
|
||||
(31,1,2,TRUE,TRUE),
|
||||
(31,1,3,TRUE,TRUE),
|
||||
(31,2,1,TRUE,TRUE),
|
||||
(31,3,1,TRUE,TRUE),
|
||||
(31,4,1,TRUE,TRUE),
|
||||
(31,4,2,TRUE,TRUE),
|
||||
--
|
||||
(32,2,1,FALSE,FALSE),
|
||||
(32,2,2,FALSE,FALSE),
|
||||
(32,3,1,FALSE,FALSE),
|
||||
(32,4,1,FALSE,FALSE),
|
||||
(32,5,1,FALSE,FALSE),
|
||||
(32,6,1,FALSE,FALSE),
|
||||
(32,6,2,FALSE,FALSE),
|
||||
(32,8,1,FALSE,FALSE),
|
||||
(32,8,2,FALSE,FALSE),
|
||||
(32,8,3,FALSE,FALSE),
|
||||
(32,9,1,FALSE,FALSE),
|
||||
(32,9,2,FALSE,FALSE),
|
||||
--
|
||||
(33,1,1,FALSE,FALSE),
|
||||
(33,1,2,FALSE,FALSE),
|
||||
(33,1,3,FALSE,FALSE),
|
||||
(33,2,1,FALSE,FALSE),
|
||||
(33,2,2,FALSE,FALSE),
|
||||
(33,2,3,FALSE,FALSE),
|
||||
(33,3,1,FALSE,FALSE),
|
||||
(33,3,2,FALSE,FALSE),
|
||||
(33,3,3,FALSE,FALSE),
|
||||
(33,4,1,FALSE,FALSE),
|
||||
(33,4,2,FALSE,FALSE),
|
||||
(33,4,3,FALSE,FALSE),
|
||||
(33,5,1,FALSE,FALSE),
|
||||
(33,5,2,FALSE,FALSE),
|
||||
(33,5,3,FALSE,FALSE),
|
||||
(33,6,1,FALSE,FALSE),
|
||||
(33,7,1,FALSE,FALSE),
|
||||
(33,7,2,FALSE,FALSE),
|
||||
(33,7,3,FALSE,FALSE),
|
||||
(33,8,1,FALSE,FALSE),
|
||||
(33,8,2,FALSE,FALSE),
|
||||
(33,9,1,FALSE,FALSE),
|
||||
(33,9,2,FALSE,FALSE),
|
||||
--
|
||||
(34,1,1,FALSE,FALSE),
|
||||
(34,1,2,FALSE,FALSE),
|
||||
(34,2,1,FALSE,FALSE),
|
||||
(34,2,2,FALSE,FALSE),
|
||||
(34,3,1,FALSE,FALSE),
|
||||
(34,3,2,FALSE,FALSE),
|
||||
(34,4,1,FALSE,FALSE),
|
||||
(34,4,2,FALSE,FALSE),
|
||||
(34,5,1,FALSE,FALSE),
|
||||
(34,5,2,FALSE,FALSE),
|
||||
(34,6,1,FALSE,FALSE),
|
||||
(34,6,2,FALSE,FALSE),
|
||||
(34,7,1,FALSE,FALSE),
|
||||
(34,7,2,FALSE,FALSE),
|
||||
(34,8,1,FALSE,FALSE),
|
||||
(34,8,2,FALSE,FALSE),
|
||||
(34,9,1,FALSE,FALSE),
|
||||
(34,9,2,FALSE,FALSE),
|
||||
--
|
||||
(35,1,1,FALSE,TRUE),
|
||||
(35,2,1,FALSE,TRUE),
|
||||
(35,3,1,FALSE,TRUE),
|
||||
(35,4,1,FALSE,TRUE),
|
||||
(35,5,1,FALSE,TRUE),
|
||||
(35,6,1,FALSE,TRUE),
|
||||
(35,7,1,FALSE,TRUE),
|
||||
(35,8,1,FALSE,TRUE),
|
||||
(35,9,1,FALSE,TRUE),
|
||||
--
|
||||
(36,1,1,FALSE,FALSE),
|
||||
(36,1,2,FALSE,TRUE),
|
||||
(36,1,3,FALSE,FALSE),
|
||||
(36,2,1,FALSE,FALSE),
|
||||
(36,2,2,FALSE,FALSE),
|
||||
(36,2,3,FALSE,FALSE),
|
||||
(36,3,1,FALSE,FALSE),
|
||||
(36,3,2,FALSE,TRUE),
|
||||
(36,3,3,FALSE,FALSE),
|
||||
(36,4,1,FALSE,FALSE),
|
||||
(36,4,3,FALSE,TRUE),
|
||||
(36,5,1,FALSE,FALSE),
|
||||
(36,5,2,FALSE,FALSE),
|
||||
(36,5,3,FALSE,FALSE),
|
||||
(36,6,2,FALSE,FALSE),
|
||||
(36,6,3,FALSE,FALSE),
|
||||
(36,7,1,FALSE,FALSE),
|
||||
(36,7,3,FALSE,FALSE),
|
||||
(36,8,1,FALSE,FALSE),
|
||||
(36,8,2,FALSE,FALSE),
|
||||
(36,8,3,FALSE,FALSE),
|
||||
(36,9,2,FALSE,FALSE),
|
||||
(36,9,3,FALSE,FALSE),
|
||||
--
|
||||
(37,1,1,FALSE,FALSE),
|
||||
(37,1,2,FALSE,FALSE),
|
||||
(37,1,3,FALSE,FALSE),
|
||||
(37,2,1,FALSE,FALSE),
|
||||
(37,2,2,FALSE,FALSE),
|
||||
(37,2,3,FALSE,TRUE),
|
||||
(37,3,1,FALSE,TRUE),
|
||||
(37,3,2,FALSE,FALSE),
|
||||
(37,5,1,FALSE,FALSE),
|
||||
(37,5,2,FALSE,FALSE),
|
||||
(37,5,3,FALSE,TRUE),
|
||||
(37,6,1,FALSE,FALSE),
|
||||
(37,6,2,FALSE,FALSE),
|
||||
(37,6,3,FALSE,TRUE),
|
||||
(37,7,1,FALSE,FALSE),
|
||||
(37,7,3,FALSE,FALSE),
|
||||
(37,9,2,FALSE,FALSE),
|
||||
(37,9,3,FALSE,FALSE),
|
||||
--
|
||||
(38,1,1,FALSE,FALSE),
|
||||
(38,1,2,FALSE,FALSE),
|
||||
(38,1,3,FALSE,FALSE),
|
||||
(38,2,1,FALSE,FALSE),
|
||||
(38,5,1,FALSE,FALSE),
|
||||
(38,5,2,FALSE,FALSE),
|
||||
(38,5,3,FALSE,FALSE),
|
||||
(38,6,1,FALSE,FALSE),
|
||||
(38,8,1,FALSE,FALSE),
|
||||
(38,8,2,FALSE,FALSE),
|
||||
(38,8,3,FALSE,FALSE),
|
||||
--
|
||||
(39,1,1,FALSE,FALSE),
|
||||
(39,1,2,FALSE,FALSE),
|
||||
(39,1,3,TRUE,FALSE),
|
||||
(39,2,1,FALSE,FALSE),
|
||||
(39,2,2,FALSE,FALSE),
|
||||
(39,2,3,FALSE,FALSE),
|
||||
(39,2,4,FALSE,FALSE),
|
||||
(39,2,5,FALSE,FALSE),
|
||||
(39,2,6,FALSE,FALSE),
|
||||
(39,3,1,FALSE,FALSE),
|
||||
(39,3,2,FALSE,FALSE),
|
||||
(39,3,3,FALSE,FALSE),
|
||||
(39,4,1,FALSE,FALSE),
|
||||
(39,4,2,FALSE,FALSE),
|
||||
(39,4,3,FALSE,FALSE),
|
||||
(39,5,1,FALSE,FALSE),
|
||||
(39,5,2,FALSE,FALSE),
|
||||
(39,5,3,FALSE,FALSE),
|
||||
(39,5,4,FALSE,FALSE),
|
||||
(39,5,5,FALSE,FALSE),
|
||||
(39,5,6,FALSE,FALSE),
|
||||
(39,6,1,FALSE,FALSE),
|
||||
(39,6,2,FALSE,FALSE),
|
||||
(39,6,3,FALSE,TRUE),
|
||||
(39,6,4,TRUE,TRUE),
|
||||
(39,6,5,TRUE,FALSE),
|
||||
(39,7,1,FALSE,FALSE),
|
||||
(39,7,2,FALSE,FALSE),
|
||||
(39,7,3,FALSE,FALSE),
|
||||
(39,8,1,FALSE,FALSE),
|
||||
(39,8,2,FALSE,TRUE),
|
||||
(39,8,3,FALSE,FALSE),
|
||||
(39,9,1,FALSE,FALSE),
|
||||
(39,9,2,FALSE,FALSE),
|
||||
(39,9,3,FALSE,FALSE),
|
||||
(39,9,4,FALSE,FALSE),
|
||||
(39,9,5,FALSE,FALSE),
|
||||
--
|
||||
(40,1,1,FALSE,FALSE),
|
||||
(40,1,2,FALSE,FALSE),
|
||||
(40,1,3,FALSE,FALSE),
|
||||
(40,1,4,FALSE,FALSE),
|
||||
(40,2,1,FALSE,FALSE),
|
||||
(40,2,2,FALSE,FALSE),
|
||||
(40,2,3,FALSE,FALSE),
|
||||
(40,3,1,FALSE,FALSE),
|
||||
(40,3,2,FALSE,FALSE),
|
||||
(40,3,3,FALSE,FALSE),
|
||||
(40,4,1,FALSE,FALSE),
|
||||
(40,4,2,FALSE,FALSE),
|
||||
(40,4,3,FALSE,FALSE),
|
||||
(40,5,1,FALSE,FALSE),
|
||||
(40,5,2,FALSE,FALSE),
|
||||
(40,5,3,FALSE,FALSE),
|
||||
(40,6,1,FALSE,FALSE),
|
||||
(40,6,2,FALSE,FALSE),
|
||||
(40,6,3,FALSE,FALSE),
|
||||
(40,6,4,FALSE,FALSE),
|
||||
(40,7,1,FALSE,FALSE),
|
||||
(40,7,2,FALSE,FALSE),
|
||||
(40,8,1,FALSE,FALSE),
|
||||
(40,8,2,FALSE,FALSE),
|
||||
(40,8,3,FALSE,FALSE),
|
||||
(40,8,4,FALSE,FALSE),
|
||||
(40,9,1,FALSE,FALSE),
|
||||
(40,9,2,FALSE,FALSE),
|
||||
(40,9,3,FALSE,FALSE),
|
||||
--
|
||||
(41,1,1,FALSE,FALSE),
|
||||
(41,1,2,FALSE,FALSE),
|
||||
(41,1,3,FALSE,FALSE),
|
||||
(41,2,1,FALSE,FALSE),
|
||||
(41,2,2,FALSE,FALSE),
|
||||
(41,2,3,FALSE,FALSE),
|
||||
(41,3,1,FALSE,FALSE),
|
||||
(41,3,2,FALSE,FALSE),
|
||||
(41,3,3,FALSE,FALSE),
|
||||
(41,4,1,FALSE,FALSE),
|
||||
(41,4,2,TRUE,FALSE),
|
||||
(41,4,3,TRUE,FALSE),
|
||||
(41,5,1,TRUE,FALSE),
|
||||
(41,5,2,FALSE,FALSE),
|
||||
(41,5,3,TRUE,FALSE),
|
||||
(41,5,4,FALSE,FALSE),
|
||||
(41,6,1,FALSE,FALSE),
|
||||
(41,9,1,FALSE,FALSE),
|
||||
(41,9,2,FALSE,FALSE),
|
||||
(41,9,3,FALSE,FALSE),
|
||||
--
|
||||
(42,1,1,FALSE,FALSE),
|
||||
(42,1,2,FALSE,FALSE),
|
||||
(42,1,3,FALSE,FALSE),
|
||||
(42,2,1,FALSE,FALSE),
|
||||
(42,2,2,FALSE,FALSE),
|
||||
(42,2,3,FALSE,FALSE),
|
||||
(42,3,1,FALSE,FALSE),
|
||||
(42,3,2,TRUE,TRUE),
|
||||
(42,3,3,TRUE,TRUE),
|
||||
(42,4,2,FALSE,TRUE),
|
||||
(42,4,3,FALSE,FALSE),
|
||||
(42,5,1,FALSE,FALSE),
|
||||
(42,5,2,FALSE,FALSE),
|
||||
(42,5,3,FALSE,FALSE),
|
||||
(42,6,1,FALSE,FALSE),
|
||||
(42,7,1,FALSE,FALSE),
|
||||
(42,7,2,FALSE,FALSE),
|
||||
(42,7,3,FALSE,FALSE),
|
||||
(42,8,1,FALSE,FALSE),
|
||||
(42,8,2,FALSE,FALSE),
|
||||
(42,8,3,FALSE,FALSE),
|
||||
(42,9,1,FALSE,TRUE),
|
||||
(42,9,2,FALSE,FALSE),
|
||||
(42,9,3,FALSE,FALSE)
|
||||
);
|
10
assignment4/setup/boostrap.sh
Normal file
10
assignment4/setup/boostrap.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
docker run --rm -d --name pg -v $(pwd)/sql:/run/sql -p 5432:5432 -e POSTGRES_PASSWORD=password postgres
|
||||
|
||||
sleep 2
|
||||
|
||||
docker exec -it pg psql --username=postgres --file /run/sql/1_db.sql
|
||||
docker exec -it pg psql --username=postgres --dbname=FSAD2023_Books --file /run/sql/2_tables.sql
|
2
assignment4/setup/sql/1_db.sql
Normal file
2
assignment4/setup/sql/1_db.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
DROP DATABASE IF EXISTS "FSAD2023_Books";
|
||||
CREATE DATABASE "FSAD2023_Books";
|
940
assignment4/setup/sql/2_tables.sql
Normal file
940
assignment4/setup/sql/2_tables.sql
Normal file
|
@ -0,0 +1,940 @@
|
|||
CREATE TABLE author
|
||||
(
|
||||
authorID serial PRIMARY KEY,
|
||||
firstname varchar(50) NOT NULL,
|
||||
familyname varchar(50)
|
||||
);
|
||||
|
||||
CREATE TABLE genre
|
||||
(
|
||||
name varchar (50) PRIMARY KEY
|
||||
);
|
||||
|
||||
CREATE TABLE book
|
||||
(
|
||||
bookID serial PRIMARY KEY,
|
||||
title varchar (255) NOT NULL,
|
||||
publisher varchar (50),
|
||||
authorID int REFERENCES author(authorID) NOT NULL,
|
||||
genre varchar(50) REFERENCES genre(name),
|
||||
rrp decimal(6, 2) not null check(rrp > 0) -- Recommended retailer price
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE library
|
||||
(
|
||||
libraryID serial PRIMARY KEY,
|
||||
name varchar(50) NOT NULL,
|
||||
city varchar(30),
|
||||
country varchar(30)
|
||||
);
|
||||
|
||||
CREATE TABLE bookcopy
|
||||
(
|
||||
bookID int REFERENCES book(bookID) NOT NULL,
|
||||
libraryID int REFERENCES library(libraryID) NOT NULL,
|
||||
copyID int, -- Allows for several copies in the same library
|
||||
digital boolean DEFAULT FALSE,
|
||||
onLoan boolean DEFAULT FALSE,
|
||||
PRIMARY KEY (bookID, libraryID, copyID)
|
||||
);
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
-- Database population
|
||||
---------------------------------------------------------
|
||||
|
||||
|
||||
INSERT INTO author (firstname,familyname) (
|
||||
VALUES ('J.R.R.','Tolkien'),
|
||||
('J.K.','Rowling'),
|
||||
('David','Walliams'),
|
||||
('Stephen','King'),
|
||||
('Agatha','Christie'),
|
||||
('James','Patterson'),
|
||||
('Jane','Austen'),
|
||||
('Charles','Dickens'),
|
||||
('C.S.','Lewis'),
|
||||
('Dan','Brown'),
|
||||
('Tom','Clancy'),
|
||||
('George R.R.','Martin'),
|
||||
('Roald','Dahl'),
|
||||
('Ian','Fleming'),
|
||||
('Richard','Osman'),
|
||||
('Julia','Donaldson'),
|
||||
('Chris','Ryan'),
|
||||
('John','Grisham'),
|
||||
('Danielle','Steel')
|
||||
);
|
||||
|
||||
INSERT INTO genre (
|
||||
VALUES ('Fantasy'),
|
||||
('Childrens'),
|
||||
('Mystery'),
|
||||
('Crime'),
|
||||
('Horror'),
|
||||
('Contemporary'),
|
||||
('Romance'),
|
||||
('Military Fiction'),
|
||||
('Victorian Literature'),
|
||||
('Espionage'),
|
||||
('Thriller')
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO book (authorID, title, publisher, genre, rrp)
|
||||
(
|
||||
VALUES (1, 'The Hobbit', 'Harper Collins', 'Fantasy', 7.99),
|
||||
(1, 'The Silmarillion', 'Harper Collins', 'Fantasy', 6.99),
|
||||
(1, 'Letters from Father Christmas', 'Harper Collins', 'Fantasy', 10.99),
|
||||
(1, 'The Fall of Gondolin', 'Harper Collins', 'Fantasy', 9.99),
|
||||
(1, 'Unfinished Tales', 'Harper Collins', 'Fantasy', 4.99),
|
||||
(1, 'The Children of Hurin', 'Harper Collins', 'Fantasy', 9.99),
|
||||
(1, 'Beren and Luthien', 'Harper Collins', 'Fantasy', 5.99),
|
||||
(1, 'The Lord of the Rings: The Fellowship of the Ring', 'Harper Collins', 'Fantasy', 7.99),
|
||||
(1, 'The Lord of the Rings: The Two Towers', 'Harper Collins', 'Fantasy', 4.99),
|
||||
(1, 'The Lord of the Rings: The Return of the King', 'Harper Collins', 'Fantasy', 4.99),
|
||||
(2, 'Harry Potter and the Philosophers Stone', 'Bloomsbury', 'Childrens', 5.99),
|
||||
(2, 'Harry Potter and the Chamber of Secrets', 'Bloomsbury', 'Childrens', 9.99),
|
||||
(2, 'Harry Potter and the Prisoner of Azkaban', 'Bloomsbury', 'Childrens', 8.99),
|
||||
(2, 'Harry Potter and the Goblet of Fire', 'Bloomsbury', 'Childrens', 5.99),
|
||||
(2, 'Harry Potter and the Order of the Phoenix', 'Bloomsbury', 'Childrens', 9.99),
|
||||
(2, 'Harry Potter and the Half-Blood Prince', 'Bloomsbury', 'Childrens', 5.99),
|
||||
(2, 'Harry Potter and the Deathly Hallows', 'Bloomsbury', 'Childrens', 4.99),
|
||||
(3, 'Gangsta Granny', 'Harper Collins', 'Childrens', 4.99),
|
||||
(3, 'Mr Stink', 'Harper Collins', 'Childrens', 7.99),
|
||||
(3, 'Billionaire Boy', 'Harper Collins', 'Childrens', 9.99),
|
||||
(3, 'The Boy in the Dress', 'Harper Collins', 'Childrens', 7.99),
|
||||
(4, 'IT', 'Hodder & Stoughton', 'Horror', 4.99),
|
||||
(5, 'Murder on the Orient Express', 'Harper Collins', 'Mystery', 5.99),
|
||||
(6, 'Stalking Jack the Ripper', 'Little, Brown & Company', 'Horror', 4.99),
|
||||
(7, 'Pride and Prejudice', 'Penguin Books', 'Romance', 8.99),
|
||||
(8, 'A Christmas Carol', 'Dover Publications', 'Victorian Literature', 7.99),
|
||||
(9, 'The Lion, the Witch and the Wardrobe', 'Zonderkidz', 'Fantasy', 10.99),
|
||||
(10, 'Inferno', 'Transworld', 'Mystery', 8.99),
|
||||
(10, 'Origin', 'Transworld', 'Mystery', 11.99),
|
||||
(11, 'Rainbow Six', 'Penguin', 'Thriller', 12.99),
|
||||
(11, 'The Hunt for Red October', 'Harper Collins', 'Military Fiction', 15.99),
|
||||
(12, 'A Game of Thrones', 'Harper Collins', 'Fantasy', 21.99),
|
||||
(13, 'Charlie and the Chocoolate Factory', 'Penguin', 'Childrens', 12.99),
|
||||
(13, 'Matilda', 'Penguin', 'Childrens', 15.79),
|
||||
(14, 'Casino Royale', 'Vintage Publishing', 'Espionage', 11.79),
|
||||
(15, 'The Man Who Died Twice ', 'Penguin', 'Crime', 12.99),
|
||||
(16, 'The Gruffalo', 'Penguin', 'Childrens', 13.79),
|
||||
(17, 'Deadfall', 'Penguin', 'Thriller', 17.80),
|
||||
(18, 'The Whistler', 'Hodder & Stoughton', 'Thriller', 18.79),
|
||||
(19, 'Golden Moments', 'Little, Brown Book Group', 'Contemporary', 19.79),
|
||||
(19, 'Answered Prayers', 'Transworld', 'Contemporary', 20.79),
|
||||
(19, 'Blessing in Disguise', 'Pan Macmillan', 'Romance', 22.55)
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO library (name, city, country) (
|
||||
VALUES ('Abbey library of Saint Gall', 'St. Gallen','Switzerland'),
|
||||
('British Library', 'London','United Kingdom'),
|
||||
('Biblioteca Palafoxiana','Puebla','Mexico'),
|
||||
('Bibliothèque nationale de France','Paris','France'),
|
||||
('Bodleian Library', 'Oxford','United Kingdom'),
|
||||
('Library of Birmingham', 'Birmingham','United Kingdom'),
|
||||
('The library of Alexandria', 'Alexandria','Egypt'),
|
||||
('The library of the congress of the USA', 'Washington','USA'),
|
||||
('Vatican Library', 'Rome','Italy')
|
||||
);
|
||||
|
||||
|
||||
|
||||
INSERT INTO bookcopy (bookID,libraryID,copyID,digital,onloan) (
|
||||
VALUES (1,1,1,FALSE,FALSE),
|
||||
(1,1,2,FALSE,FALSE),
|
||||
(1,1,3,FALSE,FALSE),
|
||||
(1,2,1,FALSE,TRUE),
|
||||
(1,3,1,FALSE,FALSE),
|
||||
(1,4,1,FALSE,FALSE),
|
||||
(1,4,2,FALSE,FALSE),
|
||||
--
|
||||
(2,2,1,FALSE,FALSE),
|
||||
(2,2,2,FALSE,FALSE),
|
||||
(2,3,1,FALSE,FALSE),
|
||||
(2,4,1,FALSE,TRUE),
|
||||
(2,5,1,FALSE,FALSE),
|
||||
(2,6,1,FALSE,FALSE),
|
||||
(2,6,2,FALSE,TRUE),
|
||||
(2,8,1,FALSE,FALSE),
|
||||
--
|
||||
(3,1,1,FALSE,FALSE),
|
||||
(3,1,2,FALSE,FALSE),
|
||||
(3,1,3,FALSE,FALSE),
|
||||
(3,1,4,FALSE,FALSE),
|
||||
(3,2,1,FALSE,FALSE),
|
||||
(3,2,2,FALSE,TRUE),
|
||||
(3,3,1,FALSE,FALSE),
|
||||
(3,4,1,FALSE,TRUE),
|
||||
(3,4,2,FALSE,FALSE),
|
||||
(3,4,3,FALSE,FALSE),
|
||||
(3,5,1,FALSE,NULL),
|
||||
(3,5,2,NULL,NULL),
|
||||
(3,6,1,NULL,FALSE),
|
||||
(3,6,2,FALSE,FALSE),
|
||||
(3,7,2,FALSE,FALSE),
|
||||
(3,8,2,FALSE,FALSE),
|
||||
(3,8,3,FALSE,TRUE),
|
||||
(3,9,1,FALSE,FALSE),
|
||||
(3,9,2,FALSE,FALSE),
|
||||
--
|
||||
(4,1,1,FALSE,FALSE),
|
||||
(4,1,3,FALSE,FALSE),
|
||||
(4,2,1,FALSE,FALSE),
|
||||
(4,2,3,FALSE,TRUE),
|
||||
(4,3,1,FALSE,FALSE),
|
||||
(4,3,2,FALSE,FALSE),
|
||||
(4,4,1,FALSE,FALSE),
|
||||
(4,4,2,FALSE,FALSE),
|
||||
(4,4,3,FALSE,FALSE),
|
||||
(4,6,1,FALSE,FALSE),
|
||||
(4,6,2,FALSE,FALSE),
|
||||
(4,6,3,FALSE,FALSE),
|
||||
(4,7,1,FALSE,FALSE),
|
||||
(4,7,2,FALSE,FALSE),
|
||||
(4,7,3,FALSE,TRUE),
|
||||
(4,8,2,FALSE,FALSE),
|
||||
(4,9,1,FALSE,FALSE),
|
||||
(4,9,3,FALSE,FALSE),
|
||||
--
|
||||
(5,2,1,FALSE,TRUE),
|
||||
(5,3,1,FALSE,FALSE),
|
||||
(5,3,2,FALSE,FALSE),
|
||||
(5,3,3,FALSE,FALSE),
|
||||
(5,4,2,FALSE,FALSE),
|
||||
(5,5,1,FALSE,TRUE),
|
||||
(5,5,2,FALSE,FALSE),
|
||||
(5,5,3,FALSE,FALSE),
|
||||
(5,6,1,FALSE,FALSE),
|
||||
(5,6,3,FALSE,FALSE),
|
||||
(5,7,1,FALSE,FALSE),
|
||||
(5,7,2,FALSE,FALSE),
|
||||
(5,7,3,FALSE,FALSE),
|
||||
(5,8,1,FALSE,FALSE),
|
||||
(5,8,2,FALSE,FALSE),
|
||||
(5,8,3,FALSE,TRUE),
|
||||
(5,9,1,FALSE,FALSE),
|
||||
(5,9,2,FALSE,FALSE),
|
||||
--
|
||||
(6,1,1,FALSE,FALSE),
|
||||
(6,1,2,FALSE,FALSE),
|
||||
(6,2,1,FALSE,FALSE),
|
||||
(6,3,1,FALSE,FALSE),
|
||||
(6,4,1,FALSE,FALSE),
|
||||
(6,4,2,FALSE,FALSE),
|
||||
(6,4,3,FALSE,TRUE),
|
||||
(6,5,1,FALSE,FALSE),
|
||||
(6,5,2,FALSE,FALSE),
|
||||
(6,6,1,FALSE,TRUE),
|
||||
(6,7,3,FALSE,FALSE),
|
||||
(6,9,3,FALSE,TRUE),
|
||||
--
|
||||
(7,1,1,FALSE,TRUE),
|
||||
(7,1,2,FALSE,FALSE),
|
||||
(7,2,2,FALSE,FALSE),
|
||||
(7,3,1,FALSE,FALSE),
|
||||
(7,3,3,FALSE,FALSE),
|
||||
(7,4,3,FALSE,FALSE),
|
||||
(7,5,2,FALSE,FALSE),
|
||||
(7,5,3,FALSE,FALSE),
|
||||
(7,6,1,FALSE,FALSE),
|
||||
(7,6,3,NULL,FALSE),
|
||||
(7,7,1,FALSE,FALSE),
|
||||
(7,7,2,FALSE,FALSE),
|
||||
(7,7,3,FALSE,FALSE),
|
||||
(7,8,1,FALSE,NULL),
|
||||
(7,8,2,FALSE,NULL),
|
||||
(7,9,1,FALSE,FALSE),
|
||||
(7,9,2,FALSE,FALSE),
|
||||
(7,9,3,FALSE,TRUE),
|
||||
--
|
||||
(8,1,1,FALSE,TRUE),
|
||||
(8,1,2,FALSE,FALSE),
|
||||
(8,2,1,FALSE,FALSE),
|
||||
(8,2,2,FALSE,FALSE),
|
||||
(8,2,3,FALSE,FALSE),
|
||||
(8,3,1,FALSE,FALSE),
|
||||
(8,3,2,FALSE,FALSE),
|
||||
(8,4,2,FALSE,FALSE),
|
||||
(8,4,3,FALSE,FALSE),
|
||||
(8,5,1,FALSE,TRUE),
|
||||
(8,5,3,FALSE,FALSE),
|
||||
(8,6,1,FALSE,FALSE),
|
||||
(8,6,2,FALSE,FALSE),
|
||||
(8,6,3,FALSE,TRUE),
|
||||
(8,7,1,FALSE,TRUE),
|
||||
(8,7,2,FALSE,FALSE),
|
||||
(8,8,1,FALSE,FALSE),
|
||||
(8,8,2,FALSE,TRUE),
|
||||
(8,9,2,FALSE,FALSE),
|
||||
(8,9,3,FALSE,FALSE),
|
||||
--
|
||||
(9,1,1,FALSE,FALSE),
|
||||
(9,1,2,FALSE,FALSE),
|
||||
(9,1,3,FALSE,FALSE),
|
||||
(9,2,1,FALSE,FALSE),
|
||||
(9,5,3,FALSE,FALSE),
|
||||
(9,6,1,FALSE,FALSE),
|
||||
(9,6,2,FALSE,TRUE),
|
||||
(9,6,3,FALSE,FALSE),
|
||||
(9,7,2,FALSE,FALSE),
|
||||
(9,8,1,FALSE,TRUE),
|
||||
(9,8,2,FALSE,TRUE),
|
||||
(9,8,3,FALSE,FALSE),
|
||||
(9,8,4,FALSE,TRUE),
|
||||
(9,8,5,FALSE,FALSE),
|
||||
(9,8,6,FALSE,FALSE),
|
||||
--
|
||||
(10,1,1,FALSE,FALSE),
|
||||
(10,1,2,FALSE,FALSE),
|
||||
(10,1,3,FALSE,TRUE),
|
||||
(10,2,1,NULL,FALSE),
|
||||
(10,2,2,FALSE,TRUE),
|
||||
(10,2,3,FALSE,FALSE),
|
||||
(10,3,1,FALSE,FALSE),
|
||||
(10,3,2,FALSE,FALSE),
|
||||
(10,3,3,FALSE,FALSE),
|
||||
(10,4,1,NULL,FALSE),
|
||||
(10,4,2,FALSE,FALSE),
|
||||
(10,4,3,FALSE,FALSE),
|
||||
(10,5,1,FALSE,FALSE),
|
||||
(10,5,2,FALSE,FALSE),
|
||||
(10,5,3,FALSE,FALSE),
|
||||
(10,6,1,FALSE,FALSE),
|
||||
(10,6,2,FALSE,TRUE),
|
||||
(10,6,3,FALSE,FALSE),
|
||||
(10,7,1,FALSE,FALSE),
|
||||
(10,7,2,FALSE,FALSE),
|
||||
(10,7,3,FALSE,FALSE),
|
||||
(10,8,1,FALSE,FALSE),
|
||||
(10,8,2,FALSE,FALSE),
|
||||
(10,8,3,FALSE,FALSE),
|
||||
(10,9,1,FALSE,FALSE),
|
||||
(10,9,2,NULL,FALSE),
|
||||
(10,9,3,FALSE,FALSE),
|
||||
--
|
||||
(11,1,1,FALSE,TRUE),
|
||||
(11,1,2,FALSE,TRUE),
|
||||
(11,1,3,FALSE,TRUE),
|
||||
(11,2,1,FALSE,TRUE),
|
||||
(11,3,1,FALSE,TRUE),
|
||||
(11,4,1,FALSE,FALSE),
|
||||
(11,4,2,FALSE,FALSE),
|
||||
--
|
||||
(12,2,1,FALSE,FALSE),
|
||||
(12,2,2,FALSE,FALSE),
|
||||
(12,3,1,FALSE,FALSE),
|
||||
(12,4,1,FALSE,FALSE),
|
||||
(12,6,1,FALSE,FALSE),
|
||||
(12,6,2,FALSE,FALSE),
|
||||
(12,6,3,FALSE,FALSE),
|
||||
(12,6,4,FALSE,FALSE),
|
||||
(12,6,5,FALSE,FALSE),
|
||||
(12,6,6,FALSE,FALSE),
|
||||
--
|
||||
(13,3,2,FALSE,FALSE),
|
||||
(13,3,3,FALSE,FALSE),
|
||||
(13,4,3,FALSE,FALSE),
|
||||
(13,5,2,FALSE,FALSE),
|
||||
(13,5,3,FALSE,FALSE),
|
||||
(13,6,1,FALSE,FALSE),
|
||||
(13,6,2,FALSE,FALSE),
|
||||
(13,6,3,FALSE,FALSE),
|
||||
(13,7,1,FALSE,FALSE),
|
||||
(13,7,2,FALSE,FALSE),
|
||||
(13,7,3,FALSE,FALSE),
|
||||
(13,8,2,FALSE,FALSE),
|
||||
(13,8,3,FALSE,FALSE),
|
||||
(13,9,1,FALSE,FALSE),
|
||||
(13,9,3,FALSE,FALSE),
|
||||
--
|
||||
(14,1,1,FALSE,FALSE),
|
||||
(14,1,2,FALSE,FALSE),
|
||||
(14,1,3,FALSE,FALSE),
|
||||
(14,2,1,FALSE,FALSE),
|
||||
(14,2,2,FALSE,FALSE),
|
||||
(14,2,3,FALSE,FALSE),
|
||||
(14,3,1,FALSE,FALSE),
|
||||
(14,3,2,FALSE,FALSE),
|
||||
(14,3,3,FALSE,FALSE),
|
||||
(14,3,4,FALSE,FALSE),
|
||||
(14,4,1,FALSE,FALSE),
|
||||
(14,4,2,FALSE,FALSE),
|
||||
(14,4,3,FALSE,FALSE),
|
||||
(14,5,1,FALSE,FALSE),
|
||||
(14,5,2,FALSE,FALSE),
|
||||
(14,5,3,FALSE,FALSE),
|
||||
(14,5,4,FALSE,FALSE),
|
||||
(14,6,1,FALSE,FALSE),
|
||||
(14,6,2,FALSE,TRUE),
|
||||
(14,6,3,FALSE,FALSE),
|
||||
(14,7,1,FALSE,FALSE),
|
||||
(14,7,2,FALSE,FALSE),
|
||||
(14,7,3,FALSE,TRUE),
|
||||
(14,7,4,FALSE,FALSE),
|
||||
(14,7,5,FALSE,FALSE),
|
||||
(14,8,1,FALSE,FALSE),
|
||||
(14,8,2,FALSE,FALSE),
|
||||
(14,8,3,FALSE,TRUE),
|
||||
(14,9,1,FALSE,TRUE),
|
||||
(14,9,2,FALSE,FALSE),
|
||||
(14,9,3,FALSE,FALSE),
|
||||
--
|
||||
(15,1,1,FALSE,FALSE),
|
||||
(15,1,2,FALSE,FALSE),
|
||||
(15,1,3,FALSE,FALSE),
|
||||
(15,2,1,FALSE,FALSE),
|
||||
(15,2,2,FALSE,FALSE),
|
||||
(15,2,3,FALSE,FALSE),
|
||||
(15,3,1,FALSE,FALSE),
|
||||
(15,3,2,FALSE,FALSE),
|
||||
(15,3,3,FALSE,FALSE),
|
||||
(15,4,1,FALSE,FALSE),
|
||||
(15,4,2,FALSE,FALSE),
|
||||
(15,4,3,FALSE,FALSE),
|
||||
(15,5,1,FALSE,FALSE),
|
||||
(15,5,2,FALSE,FALSE),
|
||||
(15,5,3,FALSE,FALSE),
|
||||
(15,6,1,FALSE,FALSE),
|
||||
(15,6,2,FALSE,FALSE),
|
||||
(15,6,3,FALSE,FALSE),
|
||||
(15,7,1,FALSE,FALSE),
|
||||
(15,7,2,FALSE,FALSE),
|
||||
(15,8,1,FALSE,FALSE),
|
||||
(15,9,1,FALSE,FALSE),
|
||||
(15,9,2,FALSE,FALSE),
|
||||
(15,9,3,FALSE,FALSE),
|
||||
--
|
||||
(16,1,1,FALSE,FALSE),
|
||||
(16,1,2,FALSE,FALSE),
|
||||
(16,1,3,FALSE,FALSE),
|
||||
(16,2,1,FALSE,TRUE),
|
||||
(16,2,2,FALSE,FALSE),
|
||||
(16,2,3,FALSE,FALSE),
|
||||
(16,3,1,FALSE,FALSE),
|
||||
(16,3,2,FALSE,FALSE),
|
||||
(16,3,3,FALSE,TRUE),
|
||||
(16,4,1,FALSE,FALSE),
|
||||
(16,4,2,FALSE,FALSE),
|
||||
(16,4,3,FALSE,FALSE),
|
||||
(16,5,1,FALSE,FALSE),
|
||||
(16,6,3,FALSE,FALSE),
|
||||
(16,7,1,FALSE,FALSE),
|
||||
(16,7,2,FALSE,FALSE),
|
||||
(16,8,1,FALSE,FALSE),
|
||||
(16,8,2,FALSE,FALSE),
|
||||
(16,9,1,FALSE,FALSE),
|
||||
(16,9,2,FALSE,FALSE),
|
||||
(16,9,3,FALSE,FALSE),
|
||||
--
|
||||
(17,1,1,FALSE,FALSE),
|
||||
(17,1,2,FALSE,TRUE),
|
||||
(17,1,3,FALSE,FALSE),
|
||||
(17,1,4,FALSE,FALSE),
|
||||
(17,1,5,FALSE,FALSE),
|
||||
(17,3,1,TRUE,TRUE),
|
||||
(17,3,2,FALSE,FALSE),
|
||||
(17,3,3,FALSE,FALSE),
|
||||
(17,4,1,FALSE,FALSE),
|
||||
(17,4,2,TRUE,FALSE),
|
||||
(17,4,3,FALSE,FALSE),
|
||||
(17,6,1,FALSE,FALSE),
|
||||
(17,6,2,TRUE,FALSE),
|
||||
(17,6,3,FALSE,TRUE),
|
||||
(17,8,1,FALSE,TRUE),
|
||||
(17,8,2,FALSE,FALSE),
|
||||
(17,9,1,FALSE,FALSE),
|
||||
(17,9,2,FALSE,FALSE),
|
||||
(17,9,3,FALSE,FALSE),
|
||||
--
|
||||
(18,1,1,FALSE,FALSE),
|
||||
(18,1,2,FALSE,FALSE),
|
||||
(18,1,3,FALSE,FALSE),
|
||||
(18,2,1,FALSE,FALSE),
|
||||
(18,2,2,FALSE,FALSE),
|
||||
(18,3,1,FALSE,FALSE),
|
||||
(18,3,2,FALSE,FALSE),
|
||||
(18,3,3,FALSE,FALSE),
|
||||
(18,4,1,FALSE,FALSE),
|
||||
(18,4,2,FALSE,TRUE),
|
||||
(18,5,1,FALSE,FALSE),
|
||||
(18,5,2,FALSE,FALSE),
|
||||
(18,5,3,FALSE,TRUE),
|
||||
(18,6,1,FALSE,FALSE),
|
||||
(18,6,2,FALSE,FALSE),
|
||||
(18,7,1,FALSE,FALSE),
|
||||
(18,7,2,FALSE,FALSE),
|
||||
(18,7,3,FALSE,FALSE),
|
||||
(18,8,1,FALSE,FALSE),
|
||||
(18,8,2,FALSE,FALSE),
|
||||
(18,8,3,FALSE,TRUE),
|
||||
(18,9,1,FALSE,TRUE),
|
||||
(18,9,2,FALSE,FALSE),
|
||||
(18,9,3,FALSE,FALSE),
|
||||
--
|
||||
(19,1,1,FALSE,FALSE),
|
||||
(19,1,2,FALSE,FALSE),
|
||||
(19,1,3,FALSE,FALSE),
|
||||
(19,2,1,FALSE,FALSE),
|
||||
(19,2,2,FALSE,FALSE),
|
||||
(19,2,3,FALSE,FALSE),
|
||||
(19,3,1,FALSE,FALSE),
|
||||
(19,3,2,FALSE,FALSE),
|
||||
(19,3,3,FALSE,FALSE),
|
||||
(19,4,1,FALSE,FALSE),
|
||||
(19,4,2,FALSE,FALSE),
|
||||
(19,4,3,FALSE,FALSE),
|
||||
(19,4,4,FALSE,FALSE),
|
||||
(19,4,5,FALSE,FALSE),
|
||||
(19,4,6,FALSE,FALSE),
|
||||
(19,4,7,FALSE,FALSE),
|
||||
(19,6,1,FALSE,FALSE),
|
||||
(19,6,2,FALSE,FALSE),
|
||||
(19,6,3,FALSE,FALSE),
|
||||
(19,7,1,FALSE,FALSE),
|
||||
(19,7,2,FALSE,FALSE),
|
||||
(19,7,3,FALSE,FALSE),
|
||||
(19,8,1,FALSE,FALSE),
|
||||
(19,8,2,FALSE,FALSE),
|
||||
(19,8,3,FALSE,FALSE),
|
||||
(19,9,1,FALSE,FALSE),
|
||||
(19,9,2,FALSE,FALSE),
|
||||
(19,9,3,FALSE,FALSE),
|
||||
--
|
||||
(20,1,1,FALSE,FALSE),
|
||||
(20,2,1,FALSE,FALSE),
|
||||
(20,3,1,FALSE,FALSE),
|
||||
(20,4,1,FALSE,TRUE),
|
||||
(20,5,1,FALSE,FALSE),
|
||||
(20,6,1,FALSE,TRUE),
|
||||
(20,7,1,FALSE,FALSE),
|
||||
(20,8,1,FALSE,TRUE),
|
||||
(20,9,1,FALSE,TRUE),
|
||||
--
|
||||
(21,1,1,FALSE,FALSE),
|
||||
(21,1,2,FALSE,FALSE),
|
||||
(21,2,1,FALSE,FALSE),
|
||||
(21,3,1,FALSE,FALSE),
|
||||
(21,4,1,FALSE,FALSE),
|
||||
(21,7,2,FALSE,FALSE),
|
||||
--
|
||||
(22,2,1,FALSE,FALSE),
|
||||
(22,2,2,FALSE,FALSE),
|
||||
(22,3,1,FALSE,FALSE),
|
||||
(22,4,1,FALSE,FALSE),
|
||||
(22,5,1,FALSE,FALSE),
|
||||
(22,6,1,FALSE,FALSE),
|
||||
(22,6,2,FALSE,FALSE),
|
||||
(22,7,1,FALSE,FALSE),
|
||||
(22,7,2,FALSE,FALSE),
|
||||
(22,7,3,FALSE,FALSE),
|
||||
(22,7,4,FALSE,FALSE),
|
||||
(22,8,1,FALSE,FALSE),
|
||||
--
|
||||
(23,6,1,TRUE,FALSE),
|
||||
(23,6,2,TRUE,FALSE),
|
||||
--
|
||||
(24,1,1,FALSE,FALSE),
|
||||
(24,2,1,FALSE,FALSE),
|
||||
(24,2,2,FALSE,FALSE),
|
||||
(24,3,1,FALSE,FALSE),
|
||||
(24,3,2,FALSE,TRUE),
|
||||
(24,3,3,FALSE,FALSE),
|
||||
(24,4,1,FALSE,FALSE),
|
||||
(24,4,2,FALSE,FALSE),
|
||||
(24,5,1,FALSE,FALSE),
|
||||
(24,5,2,FALSE,FALSE),
|
||||
(24,5,3,FALSE,FALSE),
|
||||
(24,6,1,FALSE,FALSE),
|
||||
(24,6,2,FALSE,TRUE),
|
||||
(24,6,3,FALSE,TRUE),
|
||||
(24,7,1,FALSE,FALSE),
|
||||
(24,8,1,FALSE,FALSE),
|
||||
(24,8,2,FALSE,FALSE),
|
||||
(24,8,3,FALSE,FALSE),
|
||||
(24,9,1,FALSE,FALSE),
|
||||
--
|
||||
(25,1,1,FALSE,FALSE),
|
||||
(25,1,2,FALSE,FALSE),
|
||||
(25,1,3,FALSE,FALSE),
|
||||
(25,2,1,FALSE,FALSE),
|
||||
(25,2,2,FALSE,FALSE),
|
||||
(25,2,3,FALSE,FALSE),
|
||||
(25,3,1,FALSE,FALSE),
|
||||
(25,3,2,FALSE,FALSE),
|
||||
(25,4,1,FALSE,FALSE),
|
||||
(25,4,2,FALSE,FALSE),
|
||||
(25,4,3,FALSE,FALSE),
|
||||
(25,5,1,FALSE,FALSE),
|
||||
(25,6,1,FALSE,FALSE),
|
||||
(25,7,1,FALSE,FALSE),
|
||||
(25,7,2,FALSE,FALSE),
|
||||
(25,7,3,FALSE,FALSE),
|
||||
(25,8,1,FALSE,FALSE),
|
||||
(25,8,2,FALSE,FALSE),
|
||||
(25,8,3,FALSE,FALSE),
|
||||
(25,9,1,FALSE,FALSE),
|
||||
(25,9,3,FALSE,FALSE),
|
||||
--
|
||||
(26,1,1,FALSE,FALSE),
|
||||
(26,1,2,FALSE,FALSE),
|
||||
(26,2,3,FALSE,FALSE),
|
||||
(26,3,1,FALSE,FALSE),
|
||||
(26,3,2,FALSE,FALSE),
|
||||
(26,3,3,FALSE,FALSE),
|
||||
(26,4,1,FALSE,FALSE),
|
||||
(26,4,2,FALSE,FALSE),
|
||||
(26,5,2,FALSE,FALSE),
|
||||
(26,5,3,FALSE,FALSE),
|
||||
(26,6,1,FALSE,FALSE),
|
||||
(26,7,1,FALSE,FALSE),
|
||||
(26,7,2,FALSE,FALSE),
|
||||
(26,7,3,FALSE,FALSE),
|
||||
(26,8,1,FALSE,FALSE),
|
||||
(26,8,2,FALSE,FALSE),
|
||||
(26,8,3,FALSE,FALSE),
|
||||
(26,9,2,FALSE,FALSE),
|
||||
(26,9,3,FALSE,FALSE),
|
||||
--
|
||||
(27,1,1,FALSE,FALSE),
|
||||
(27,1,2,TRUE,FALSE),
|
||||
(27,1,3,FALSE,FALSE),
|
||||
(27,2,1,FALSE,FALSE),
|
||||
(27,2,2,FALSE,FALSE),
|
||||
(27,2,3,FALSE,FALSE),
|
||||
(27,3,2,FALSE,TRUE),
|
||||
(27,3,3,FALSE,FALSE),
|
||||
(27,4,1,FALSE,FALSE),
|
||||
(27,4,3,FALSE,TRUE),
|
||||
(27,5,1,FALSE,FALSE),
|
||||
(27,5,2,FALSE,FALSE),
|
||||
(27,5,3,TRUE,FALSE),
|
||||
(27,6,1,FALSE,FALSE),
|
||||
(27,6,2,FALSE,FALSE),
|
||||
(27,6,3,FALSE,FALSE),
|
||||
(27,7,2,FALSE,TRUE),
|
||||
(27,7,3,FALSE,FALSE),
|
||||
(27,8,3,FALSE,FALSE),
|
||||
(27,9,1,FALSE,FALSE),
|
||||
(27,9,2,FALSE,FALSE),
|
||||
(27,9,3,FALSE,FALSE),
|
||||
--
|
||||
(28,1,1,FALSE,FALSE),
|
||||
(28,1,2,FALSE,FALSE),
|
||||
(28,1,3,FALSE,FALSE),
|
||||
(28,2,3,FALSE,FALSE),
|
||||
(28,3,3,FALSE,TRUE),
|
||||
(28,4,1,FALSE,FALSE),
|
||||
(28,4,2,FALSE,TRUE),
|
||||
(28,4,3,FALSE,FALSE),
|
||||
(28,5,1,FALSE,TRUE),
|
||||
(28,5,2,FALSE,FALSE),
|
||||
(28,5,3,FALSE,FALSE),
|
||||
(28,6,1,FALSE,FALSE),
|
||||
(28,6,2,FALSE,FALSE),
|
||||
(28,7,1,FALSE,TRUE),
|
||||
(28,7,2,FALSE,TRUE),
|
||||
(28,7,3,FALSE,TRUE),
|
||||
(28,8,1,FALSE,TRUE),
|
||||
(28,8,2,FALSE,FALSE),
|
||||
(28,8,3,FALSE,FALSE),
|
||||
(28,9,1,FALSE,FALSE),
|
||||
(28,9,2,FALSE,TRUE),
|
||||
(28,9,3,FALSE,FALSE),
|
||||
--
|
||||
(29,1,1,FALSE,FALSE),
|
||||
(29,1,2,FALSE,FALSE),
|
||||
(29,1,3,FALSE,FALSE),
|
||||
(29,2,1,FALSE,FALSE),
|
||||
(29,2,2,FALSE,FALSE),
|
||||
(29,2,3,FALSE,TRUE),
|
||||
(29,3,1,FALSE,FALSE),
|
||||
(29,3,2,FALSE,FALSE),
|
||||
(29,4,1,FALSE,FALSE),
|
||||
(29,4,3,FALSE,FALSE),
|
||||
(29,5,1,FALSE,FALSE),
|
||||
(29,5,2,FALSE,FALSE),
|
||||
(29,5,3,FALSE,FALSE),
|
||||
(29,6,1,FALSE,FALSE),
|
||||
(29,6,2,FALSE,FALSE),
|
||||
(29,6,3,TRUE,FALSE),
|
||||
(29,7,1,FALSE,FALSE),
|
||||
(29,7,2,FALSE,FALSE),
|
||||
(29,7,3,FALSE,TRUE),
|
||||
(29,8,1,FALSE,FALSE),
|
||||
(29,8,2,FALSE,FALSE),
|
||||
(29,8,3,FALSE,TRUE),
|
||||
(29,9,1,FALSE,FALSE),
|
||||
(29,9,2,FALSE,FALSE),
|
||||
(29,9,3,FALSE,FALSE),
|
||||
--
|
||||
(30,2,1,FALSE,FALSE),
|
||||
(30,2,2,FALSE,TRUE),
|
||||
(30,2,3,FALSE,FALSE),
|
||||
(30,3,1,FALSE,FALSE),
|
||||
(30,3,2,FALSE,FALSE),
|
||||
(30,3,3,FALSE,FALSE),
|
||||
(30,4,1,FALSE,FALSE),
|
||||
(30,4,2,FALSE,FALSE),
|
||||
(30,4,3,TRUE,FALSE),
|
||||
(30,5,1,TRUE,FALSE),
|
||||
(30,5,2,TRUE,TRUE),
|
||||
(30,5,3,TRUE,FALSE),
|
||||
(30,6,1,FALSE,FALSE),
|
||||
(30,6,2,FALSE,FALSE),
|
||||
(30,6,3,FALSE,FALSE),
|
||||
(30,7,1,FALSE,FALSE),
|
||||
(30,7,2,FALSE,FALSE),
|
||||
(30,7,3,FALSE,FALSE),
|
||||
(30,8,1,FALSE,FALSE),
|
||||
(30,8,2,FALSE,FALSE),
|
||||
(30,8,3,FALSE,FALSE),
|
||||
(30,9,1,FALSE,FALSE),
|
||||
(30,9,2,FALSE,FALSE),
|
||||
--
|
||||
(31,1,1,TRUE,TRUE),
|
||||
(31,1,2,TRUE,TRUE),
|
||||
(31,1,3,TRUE,TRUE),
|
||||
(31,2,1,TRUE,TRUE),
|
||||
(31,3,1,TRUE,TRUE),
|
||||
(31,4,1,TRUE,TRUE),
|
||||
(31,4,2,TRUE,TRUE),
|
||||
--
|
||||
(32,2,1,FALSE,FALSE),
|
||||
(32,2,2,FALSE,FALSE),
|
||||
(32,3,1,FALSE,FALSE),
|
||||
(32,4,1,FALSE,FALSE),
|
||||
(32,5,1,FALSE,FALSE),
|
||||
(32,6,1,FALSE,FALSE),
|
||||
(32,6,2,FALSE,FALSE),
|
||||
(32,8,1,FALSE,FALSE),
|
||||
(32,8,2,FALSE,FALSE),
|
||||
(32,8,3,FALSE,FALSE),
|
||||
(32,9,1,FALSE,FALSE),
|
||||
(32,9,2,FALSE,FALSE),
|
||||
--
|
||||
(33,1,1,FALSE,FALSE),
|
||||
(33,1,2,FALSE,FALSE),
|
||||
(33,1,3,FALSE,FALSE),
|
||||
(33,2,1,FALSE,FALSE),
|
||||
(33,2,2,FALSE,FALSE),
|
||||
(33,2,3,FALSE,FALSE),
|
||||
(33,3,1,FALSE,FALSE),
|
||||
(33,3,2,FALSE,FALSE),
|
||||
(33,3,3,FALSE,FALSE),
|
||||
(33,4,1,FALSE,FALSE),
|
||||
(33,4,2,FALSE,FALSE),
|
||||
(33,4,3,FALSE,FALSE),
|
||||
(33,5,1,FALSE,FALSE),
|
||||
(33,5,2,FALSE,FALSE),
|
||||
(33,5,3,FALSE,FALSE),
|
||||
(33,6,1,FALSE,FALSE),
|
||||
(33,7,1,FALSE,FALSE),
|
||||
(33,7,2,FALSE,FALSE),
|
||||
(33,7,3,FALSE,FALSE),
|
||||
(33,8,1,FALSE,FALSE),
|
||||
(33,8,2,FALSE,FALSE),
|
||||
(33,9,1,FALSE,FALSE),
|
||||
(33,9,2,FALSE,FALSE),
|
||||
--
|
||||
(34,1,1,FALSE,FALSE),
|
||||
(34,1,2,FALSE,FALSE),
|
||||
(34,2,1,FALSE,FALSE),
|
||||
(34,2,2,FALSE,FALSE),
|
||||
(34,3,1,FALSE,FALSE),
|
||||
(34,3,2,FALSE,FALSE),
|
||||
(34,4,1,FALSE,FALSE),
|
||||
(34,4,2,FALSE,FALSE),
|
||||
(34,5,1,FALSE,FALSE),
|
||||
(34,5,2,FALSE,FALSE),
|
||||
(34,6,1,FALSE,FALSE),
|
||||
(34,6,2,FALSE,FALSE),
|
||||
(34,7,1,FALSE,FALSE),
|
||||
(34,7,2,FALSE,FALSE),
|
||||
(34,8,1,FALSE,FALSE),
|
||||
(34,8,2,FALSE,FALSE),
|
||||
(34,9,1,FALSE,FALSE),
|
||||
(34,9,2,FALSE,FALSE),
|
||||
--
|
||||
(35,1,1,FALSE,TRUE),
|
||||
(35,2,1,FALSE,TRUE),
|
||||
(35,3,1,FALSE,TRUE),
|
||||
(35,4,1,FALSE,TRUE),
|
||||
(35,5,1,FALSE,TRUE),
|
||||
(35,6,1,FALSE,TRUE),
|
||||
(35,7,1,FALSE,TRUE),
|
||||
(35,8,1,FALSE,TRUE),
|
||||
(35,9,1,FALSE,TRUE),
|
||||
--
|
||||
(36,1,1,FALSE,FALSE),
|
||||
(36,1,2,FALSE,TRUE),
|
||||
(36,1,3,FALSE,FALSE),
|
||||
(36,2,1,FALSE,FALSE),
|
||||
(36,2,2,FALSE,FALSE),
|
||||
(36,2,3,FALSE,FALSE),
|
||||
(36,3,1,FALSE,FALSE),
|
||||
(36,3,2,FALSE,TRUE),
|
||||
(36,3,3,FALSE,FALSE),
|
||||
(36,4,1,FALSE,FALSE),
|
||||
(36,4,3,FALSE,TRUE),
|
||||
(36,5,1,FALSE,FALSE),
|
||||
(36,5,2,FALSE,FALSE),
|
||||
(36,5,3,FALSE,FALSE),
|
||||
(36,6,2,FALSE,FALSE),
|
||||
(36,6,3,FALSE,FALSE),
|
||||
(36,7,1,FALSE,FALSE),
|
||||
(36,7,3,FALSE,FALSE),
|
||||
(36,8,1,FALSE,FALSE),
|
||||
(36,8,2,FALSE,FALSE),
|
||||
(36,8,3,FALSE,FALSE),
|
||||
(36,9,2,FALSE,FALSE),
|
||||
(36,9,3,FALSE,FALSE),
|
||||
--
|
||||
(37,1,1,FALSE,FALSE),
|
||||
(37,1,2,FALSE,FALSE),
|
||||
(37,1,3,FALSE,FALSE),
|
||||
(37,2,1,FALSE,FALSE),
|
||||
(37,2,2,FALSE,FALSE),
|
||||
(37,2,3,FALSE,TRUE),
|
||||
(37,3,1,FALSE,TRUE),
|
||||
(37,3,2,FALSE,FALSE),
|
||||
(37,5,1,FALSE,FALSE),
|
||||
(37,5,2,FALSE,FALSE),
|
||||
(37,5,3,FALSE,TRUE),
|
||||
(37,6,1,FALSE,FALSE),
|
||||
(37,6,2,FALSE,FALSE),
|
||||
(37,6,3,FALSE,TRUE),
|
||||
(37,7,1,FALSE,FALSE),
|
||||
(37,7,3,FALSE,FALSE),
|
||||
(37,9,2,FALSE,FALSE),
|
||||
(37,9,3,FALSE,FALSE),
|
||||
--
|
||||
(38,1,1,FALSE,FALSE),
|
||||
(38,1,2,FALSE,FALSE),
|
||||
(38,1,3,FALSE,FALSE),
|
||||
(38,2,1,FALSE,FALSE),
|
||||
(38,5,1,FALSE,FALSE),
|
||||
(38,5,2,FALSE,FALSE),
|
||||
(38,5,3,FALSE,FALSE),
|
||||
(38,6,1,FALSE,FALSE),
|
||||
(38,8,1,FALSE,FALSE),
|
||||
(38,8,2,FALSE,FALSE),
|
||||
(38,8,3,FALSE,FALSE),
|
||||
--
|
||||
(39,1,1,FALSE,FALSE),
|
||||
(39,1,2,FALSE,FALSE),
|
||||
(39,1,3,TRUE,FALSE),
|
||||
(39,2,1,FALSE,FALSE),
|
||||
(39,2,2,FALSE,FALSE),
|
||||
(39,2,3,FALSE,FALSE),
|
||||
(39,2,4,FALSE,FALSE),
|
||||
(39,2,5,FALSE,FALSE),
|
||||
(39,2,6,FALSE,FALSE),
|
||||
(39,3,1,FALSE,FALSE),
|
||||
(39,3,2,FALSE,FALSE),
|
||||
(39,3,3,FALSE,FALSE),
|
||||
(39,4,1,FALSE,FALSE),
|
||||
(39,4,2,FALSE,FALSE),
|
||||
(39,4,3,FALSE,FALSE),
|
||||
(39,5,1,FALSE,FALSE),
|
||||
(39,5,2,FALSE,FALSE),
|
||||
(39,5,3,FALSE,FALSE),
|
||||
(39,5,4,FALSE,FALSE),
|
||||
(39,5,5,FALSE,FALSE),
|
||||
(39,5,6,FALSE,FALSE),
|
||||
(39,6,1,FALSE,FALSE),
|
||||
(39,6,2,FALSE,FALSE),
|
||||
(39,6,3,FALSE,TRUE),
|
||||
(39,6,4,TRUE,TRUE),
|
||||
(39,6,5,TRUE,FALSE),
|
||||
(39,7,1,FALSE,FALSE),
|
||||
(39,7,2,FALSE,FALSE),
|
||||
(39,7,3,FALSE,FALSE),
|
||||
(39,8,1,FALSE,FALSE),
|
||||
(39,8,2,FALSE,TRUE),
|
||||
(39,8,3,FALSE,FALSE),
|
||||
(39,9,1,FALSE,FALSE),
|
||||
(39,9,2,FALSE,FALSE),
|
||||
(39,9,3,FALSE,FALSE),
|
||||
(39,9,4,FALSE,FALSE),
|
||||
(39,9,5,FALSE,FALSE),
|
||||
--
|
||||
(40,1,1,FALSE,FALSE),
|
||||
(40,1,2,FALSE,FALSE),
|
||||
(40,1,3,FALSE,FALSE),
|
||||
(40,1,4,FALSE,FALSE),
|
||||
(40,2,1,FALSE,FALSE),
|
||||
(40,2,2,FALSE,FALSE),
|
||||
(40,2,3,FALSE,FALSE),
|
||||
(40,3,1,FALSE,FALSE),
|
||||
(40,3,2,FALSE,FALSE),
|
||||
(40,3,3,FALSE,FALSE),
|
||||
(40,4,1,FALSE,FALSE),
|
||||
(40,4,2,FALSE,FALSE),
|
||||
(40,4,3,FALSE,FALSE),
|
||||
(40,5,1,FALSE,FALSE),
|
||||
(40,5,2,FALSE,FALSE),
|
||||
(40,5,3,FALSE,FALSE),
|
||||
(40,6,1,FALSE,FALSE),
|
||||
(40,6,2,FALSE,FALSE),
|
||||
(40,6,3,FALSE,FALSE),
|
||||
(40,6,4,FALSE,FALSE),
|
||||
(40,7,1,FALSE,FALSE),
|
||||
(40,7,2,FALSE,FALSE),
|
||||
(40,8,1,FALSE,FALSE),
|
||||
(40,8,2,FALSE,FALSE),
|
||||
(40,8,3,FALSE,FALSE),
|
||||
(40,8,4,FALSE,FALSE),
|
||||
(40,9,1,FALSE,FALSE),
|
||||
(40,9,2,FALSE,FALSE),
|
||||
(40,9,3,FALSE,FALSE),
|
||||
--
|
||||
(41,1,1,FALSE,FALSE),
|
||||
(41,1,2,FALSE,FALSE),
|
||||
(41,1,3,FALSE,FALSE),
|
||||
(41,2,1,FALSE,FALSE),
|
||||
(41,2,2,FALSE,FALSE),
|
||||
(41,2,3,FALSE,FALSE),
|
||||
(41,3,1,FALSE,FALSE),
|
||||
(41,3,2,FALSE,FALSE),
|
||||
(41,3,3,FALSE,FALSE),
|
||||
(41,4,1,FALSE,FALSE),
|
||||
(41,4,2,TRUE,FALSE),
|
||||
(41,4,3,TRUE,FALSE),
|
||||
(41,5,1,TRUE,FALSE),
|
||||
(41,5,2,FALSE,FALSE),
|
||||
(41,5,3,TRUE,FALSE),
|
||||
(41,5,4,FALSE,FALSE),
|
||||
(41,6,1,FALSE,FALSE),
|
||||
(41,9,1,FALSE,FALSE),
|
||||
(41,9,2,FALSE,FALSE),
|
||||
(41,9,3,FALSE,FALSE),
|
||||
--
|
||||
(42,1,1,FALSE,FALSE),
|
||||
(42,1,2,FALSE,FALSE),
|
||||
(42,1,3,FALSE,FALSE),
|
||||
(42,2,1,FALSE,FALSE),
|
||||
(42,2,2,FALSE,FALSE),
|
||||
(42,2,3,FALSE,FALSE),
|
||||
(42,3,1,FALSE,FALSE),
|
||||
(42,3,2,TRUE,TRUE),
|
||||
(42,3,3,TRUE,TRUE),
|
||||
(42,4,2,FALSE,TRUE),
|
||||
(42,4,3,FALSE,FALSE),
|
||||
(42,5,1,FALSE,FALSE),
|
||||
(42,5,2,FALSE,FALSE),
|
||||
(42,5,3,FALSE,FALSE),
|
||||
(42,6,1,FALSE,FALSE),
|
||||
(42,7,1,FALSE,FALSE),
|
||||
(42,7,2,FALSE,FALSE),
|
||||
(42,7,3,FALSE,FALSE),
|
||||
(42,8,1,FALSE,FALSE),
|
||||
(42,8,2,FALSE,FALSE),
|
||||
(42,8,3,FALSE,FALSE),
|
||||
(42,9,1,FALSE,TRUE),
|
||||
(42,9,2,FALSE,FALSE),
|
||||
(42,9,3,FALSE,FALSE)
|
||||
);
|
9
assignment4/src/main/java/module-info.java
Normal file
9
assignment4/src/main/java/module-info.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
module net.akpain {
|
||||
requires javafx.controls;
|
||||
requires javafx.fxml;
|
||||
requires java.sql;
|
||||
requires java.sql.rowset;
|
||||
|
||||
opens net.akpain to javafx.fxml;
|
||||
exports net.akpain;
|
||||
}
|
301
assignment4/src/main/java/net/akpain/BooksDatabaseClient.java
Normal file
301
assignment4/src/main/java/net/akpain/BooksDatabaseClient.java
Normal file
|
@ -0,0 +1,301 @@
|
|||
package net.akpain;/*
|
||||
* Client.java
|
||||
*
|
||||
* A client for accessing the books database
|
||||
* A naive JavaFX for connecting to the database server and interact
|
||||
* with the database.
|
||||
*
|
||||
* author: 2430671
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import java.io.*;
|
||||
import java.net.InetAddress;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.lang.ClassNotFoundException;
|
||||
import java.lang.IndexOutOfBoundsException;
|
||||
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
import javax.sql.rowset.CachedRowSet;
|
||||
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.ColumnConstraints;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
|
||||
|
||||
public class BooksDatabaseClient extends Application {
|
||||
|
||||
public static BooksDatabaseClient me; //Get the application instance in javafx
|
||||
public static Stage thePrimaryStage; //Get the application primary scene in javafx
|
||||
private Socket clientSocket = null;
|
||||
|
||||
private String userCommand = null; //The user command
|
||||
private CachedRowSet serviceOutcome = null; //The service outcome
|
||||
|
||||
|
||||
//Convenient to populate the TableView
|
||||
public class MyTableRecord {
|
||||
private StringProperty title;
|
||||
private StringProperty publisher;
|
||||
private StringProperty genre;
|
||||
private StringProperty rrp;
|
||||
private StringProperty copyID;
|
||||
|
||||
public void setTitle(String value) { titleProperty().set(value); }
|
||||
public String getTitle() { return titleProperty().get(); }
|
||||
public void setPublisher(String value) { publisherProperty().set(value); }
|
||||
public String getPublisher() { return publisherProperty().get(); }
|
||||
public void setGenre(String value) { genreProperty().set(value); }
|
||||
public String getGenre() { return genreProperty().get(); }
|
||||
public void setRrp(String value) { rrpProperty().set(value); }
|
||||
public String getRrp() { return rrpProperty().get(); }
|
||||
public void setCopyID(String value) { copyIDProperty().set(value); }
|
||||
public String getCopyID() { return copyIDProperty().get(); }
|
||||
|
||||
|
||||
public StringProperty titleProperty() {
|
||||
if (title == null)
|
||||
title = new SimpleStringProperty(this, "");
|
||||
return title;
|
||||
}
|
||||
public StringProperty publisherProperty() {
|
||||
if (publisher == null)
|
||||
publisher = new SimpleStringProperty(this, "");
|
||||
return publisher;
|
||||
}
|
||||
public StringProperty genreProperty() {
|
||||
if (genre == null)
|
||||
genre = new SimpleStringProperty(this, "");
|
||||
return genre;
|
||||
}
|
||||
public StringProperty rrpProperty() {
|
||||
if (rrp == null)
|
||||
rrp = new SimpleStringProperty(this, "");
|
||||
return rrp;
|
||||
}
|
||||
public StringProperty copyIDProperty() {
|
||||
if (copyID == null)
|
||||
copyID = new SimpleStringProperty(this, "");
|
||||
return copyID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Class Constructor
|
||||
public BooksDatabaseClient(){
|
||||
|
||||
me=this;
|
||||
}
|
||||
|
||||
|
||||
//Initializes the client socket using the credentials from class Credentials.
|
||||
public void initializeSocket(){
|
||||
try {
|
||||
clientSocket = new Socket(InetAddress.getByName(Credentials.HOST), Credentials.PORT);
|
||||
} catch (Exception e) {
|
||||
System.err.println("cannot open socket: " + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void requestService() {
|
||||
try {
|
||||
System.out.println("Client: Requesting books database service for user command\n" + this.userCommand +"\n");
|
||||
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
|
||||
out.print(userCommand + "#");
|
||||
out.flush();
|
||||
}catch(IOException e){
|
||||
System.out.println("Client: I/O error. " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void reportServiceOutcome() {
|
||||
try {
|
||||
ObjectInputStream outcomeStreamReader = new ObjectInputStream(clientSocket.getInputStream());
|
||||
serviceOutcome = (CachedRowSet) outcomeStreamReader.readObject();
|
||||
|
||||
LinkedList<MyTableRecord> r = new LinkedList<>();
|
||||
while (serviceOutcome.next()) {
|
||||
MyTableRecord tr = new MyTableRecord();
|
||||
|
||||
tr.setTitle(serviceOutcome.getString(1));
|
||||
tr.setPublisher(serviceOutcome.getString(2));
|
||||
tr.setGenre(serviceOutcome.getString(3));
|
||||
tr.setRrp(serviceOutcome.getString(4));
|
||||
tr.setCopyID(serviceOutcome.getString(5));
|
||||
|
||||
r.add(tr);
|
||||
}
|
||||
|
||||
TableView<MyTableRecord> view = (TableView<MyTableRecord>) ((GridPane) thePrimaryStage.getScene().getRoot()).getChildren().get(5);
|
||||
view.setItems(FXCollections.observableList(r));
|
||||
|
||||
System.out.println(r +"\n====================================\n");
|
||||
}catch(IOException e){
|
||||
System.out.println("Client: I/O error. " + e);
|
||||
}catch(ClassNotFoundException e){
|
||||
System.out.println("Client: Unable to cast read object to CachedRowSet. " + e);
|
||||
}catch(SQLException e){
|
||||
System.out.println("Client: Can't retrieve requested attribute from result set. " + e);
|
||||
}
|
||||
}
|
||||
|
||||
//Execute client
|
||||
public void execute(){
|
||||
GridPane grid = (GridPane) thePrimaryStage.getScene().getRoot();
|
||||
ObservableList<Node> childrens = grid.getChildren();
|
||||
TextField authorInputBox = (TextField) childrens.get(1);
|
||||
TextField libraryInputBox = (TextField) childrens.get(3);
|
||||
|
||||
//Build user message command
|
||||
userCommand = authorInputBox.getText() + ";" + libraryInputBox.getText();
|
||||
|
||||
//Request service
|
||||
try{
|
||||
|
||||
//Initializes the socket
|
||||
this.initializeSocket();
|
||||
|
||||
//Request service
|
||||
this.requestService();
|
||||
|
||||
//Report user outcome of service
|
||||
this.reportServiceOutcome();
|
||||
|
||||
//Close the connection with the server
|
||||
this.clientSocket.close();
|
||||
|
||||
}catch(Exception e)
|
||||
{// Raised if connection is refused or other technical issue
|
||||
System.out.println("Client: Exception " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
primaryStage.setTitle("Books Database Client");
|
||||
|
||||
//Create a GridPane container
|
||||
GridPane grid = new GridPane();
|
||||
grid.setPadding(new Insets(10, 10, 10, 10));
|
||||
grid.setVgap(5);
|
||||
grid.setHgap(5);
|
||||
|
||||
|
||||
//Add the input boxes
|
||||
Label authorLabel = new Label("Author's Surname:");
|
||||
GridPane.setConstraints(authorLabel, 0, 0);
|
||||
grid.getChildren().add(authorLabel);
|
||||
|
||||
TextField authorInputBox = new TextField ();
|
||||
authorInputBox.setPromptText("Author's Surname:");
|
||||
authorInputBox.setPrefColumnCount(30);
|
||||
GridPane.setConstraints(authorInputBox, 1, 0);
|
||||
grid.getChildren().add(authorInputBox);
|
||||
|
||||
Label libraryLabel = new Label("Library's city:");
|
||||
GridPane.setConstraints(libraryLabel, 0, 1);
|
||||
grid.getChildren().add(libraryLabel);
|
||||
|
||||
TextField libraryInputBox = new TextField ();
|
||||
libraryInputBox.setPromptText("Library's city:");
|
||||
libraryInputBox.setPrefColumnCount(30);
|
||||
GridPane.setConstraints(libraryInputBox, 1, 1);
|
||||
grid.getChildren().add(libraryInputBox);
|
||||
|
||||
//Add the service request button
|
||||
Button btn = new Button();
|
||||
btn.setText("Request Books Database Service");
|
||||
btn.setOnAction(new EventHandler<ActionEvent>() {
|
||||
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
me.execute();
|
||||
}
|
||||
});
|
||||
GridPane.setConstraints(btn, 0, 2, 2, 1);
|
||||
grid.getChildren().add(btn);
|
||||
|
||||
//Add the output box
|
||||
TableView<MyTableRecord> outputBox = new TableView<MyTableRecord>();
|
||||
TableColumn<MyTableRecord,String> titleCol = new TableColumn<MyTableRecord,String>("Title");
|
||||
TableColumn<MyTableRecord,String> publisherCol = new TableColumn<MyTableRecord,String>("Publisher");
|
||||
TableColumn<MyTableRecord,String> genreCol = new TableColumn<MyTableRecord,String>("Genre");
|
||||
TableColumn<MyTableRecord,String> rrpCol = new TableColumn<MyTableRecord,String>("RRP");
|
||||
TableColumn<MyTableRecord,String> copyIDCol = new TableColumn<MyTableRecord,String>("Num. Copies");
|
||||
titleCol.setCellValueFactory(new PropertyValueFactory("title"));
|
||||
publisherCol.setCellValueFactory(new PropertyValueFactory("publisher"));
|
||||
genreCol.setCellValueFactory(new PropertyValueFactory("genre"));
|
||||
rrpCol.setCellValueFactory(new PropertyValueFactory("rrp"));
|
||||
copyIDCol.setCellValueFactory(new PropertyValueFactory("copyID"));
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked") ObservableList<TableColumn<MyTableRecord,?>> tmp = outputBox.getColumns();
|
||||
tmp.addAll(titleCol, publisherCol, genreCol, rrpCol, copyIDCol);
|
||||
//Leaving this type unchecked by now... It may be convenient to compile with -Xlint:unchecked for details.
|
||||
|
||||
GridPane.setConstraints(outputBox, 0, 3, 2, 1);
|
||||
grid.getChildren().add(outputBox);
|
||||
|
||||
//Adjust gridPane's columns width
|
||||
ColumnConstraints col1 = new ColumnConstraints();
|
||||
col1.setPercentWidth(25);
|
||||
ColumnConstraints col2 = new ColumnConstraints();
|
||||
col2.setPercentWidth(75);
|
||||
grid.getColumnConstraints().addAll( col1, col2);
|
||||
|
||||
primaryStage.setScene(new Scene(grid, 505, 505));
|
||||
primaryStage.show();
|
||||
|
||||
|
||||
thePrimaryStage = primaryStage;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main (String[] args) {
|
||||
launch(args);
|
||||
System.out.println("Client: Finished.");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package net.akpain;/*
|
||||
* BooksDatabaseServer.java
|
||||
*
|
||||
* The server main class.
|
||||
* This server provides a service to access the Books database.
|
||||
*
|
||||
* author: 2430671
|
||||
*
|
||||
*/
|
||||
|
||||
import java.net.Socket;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.InetAddress;
|
||||
|
||||
|
||||
|
||||
public class BooksDatabaseServer {
|
||||
|
||||
private int thePort = 0;
|
||||
private String theIPAddress = null;
|
||||
private ServerSocket serverSocket = null;
|
||||
|
||||
//Support for closing the server
|
||||
//private boolean keypressedFlag = false;
|
||||
|
||||
|
||||
//Class constructor
|
||||
public BooksDatabaseServer(){
|
||||
//Initialize the TCP socket
|
||||
thePort = Credentials.PORT;
|
||||
theIPAddress = Credentials.HOST;
|
||||
|
||||
//Initialize the socket and runs the service loop
|
||||
System.out.println("Server: Initializing server socket at " + theIPAddress + " with listening port " + thePort);
|
||||
System.out.println("Server: Exit server application by pressing Ctrl+C (Windows or Linux) or Opt-Cmd-Shift-Esc (Mac OSX)." );
|
||||
try {
|
||||
//Initialize the socket
|
||||
serverSocket = new ServerSocket(thePort, 1, InetAddress.getByName(theIPAddress));
|
||||
System.out.println("Server: Server at " + theIPAddress + " is listening on port : " + thePort);
|
||||
} catch (Exception e){
|
||||
//The creation of the server socket can cause several exceptions;
|
||||
//See https://docs.oracle.com/javase/7/docs/api/java/net/ServerSocket.html
|
||||
System.out.println(e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
//Runs the service loop
|
||||
public void executeServiceLoop()
|
||||
{
|
||||
System.out.println("Server: Start service loop.");
|
||||
try {
|
||||
//Service loop
|
||||
while (true) {
|
||||
Socket sock = serverSocket.accept();
|
||||
new BooksDatabaseService(sock);
|
||||
}
|
||||
} catch (Exception e){
|
||||
//The creation of the server socket can cause several exceptions;
|
||||
//See https://docs.oracle.com/javase/7/docs/api/java/net/ServerSocket.html
|
||||
System.out.println(e);
|
||||
}
|
||||
System.out.println("Server: Finished service loop.");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@Override
|
||||
protected void finalize() {
|
||||
//If this server has to be killed by the launcher with destroyForcibly
|
||||
//make sure we also kill the service threads.
|
||||
System.exit(0);
|
||||
}
|
||||
*/
|
||||
|
||||
public static void main(String[] args){
|
||||
//Run the server
|
||||
BooksDatabaseServer server=new BooksDatabaseServer(); //inc. Initializing the socket
|
||||
server.executeServiceLoop();
|
||||
System.out.println("Server: Finished.");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
|
||||
}
|
165
assignment4/src/main/java/net/akpain/BooksDatabaseService.java
Normal file
165
assignment4/src/main/java/net/akpain/BooksDatabaseService.java
Normal file
|
@ -0,0 +1,165 @@
|
|||
package net.akpain;/*
|
||||
* BooksDatabaseService.java
|
||||
*
|
||||
* The service threads for the books database server.
|
||||
* This class implements the database access service, i.e. opens a JDBC connection
|
||||
* to the database, makes and retrieves the query, and sends back the result.
|
||||
*
|
||||
* author: 2430671
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
//import java.io.OutputStreamWriter;
|
||||
|
||||
import java.net.Socket;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import java.sql.*;
|
||||
import javax.sql.rowset.*;
|
||||
//Direct import of the classes CachedRowSet and CachedRowSetImpl will fail becuase
|
||||
//these clasess are not exported by the module. Instead, one needs to impor
|
||||
//javax.sql.rowset.* as above.
|
||||
|
||||
|
||||
|
||||
public class BooksDatabaseService extends Thread{
|
||||
|
||||
private Socket serviceSocket = null;
|
||||
private String[] requestStr = new String[2]; //One slot for author's name and one for library's name.
|
||||
private ResultSet outcome = null;
|
||||
|
||||
//JDBC connection
|
||||
private String USERNAME = Credentials.USERNAME;
|
||||
private String PASSWORD = Credentials.PASSWORD;
|
||||
private String URL = Credentials.URL;
|
||||
|
||||
|
||||
|
||||
//Class constructor
|
||||
public BooksDatabaseService(Socket aSocket){
|
||||
serviceSocket = aSocket;
|
||||
this.start();
|
||||
}
|
||||
|
||||
|
||||
//Retrieve the request from the socket
|
||||
public String[] retrieveRequest()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try {
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(serviceSocket.getInputStream()));
|
||||
int c = 0;
|
||||
while (c != '#') {
|
||||
c = in.read();
|
||||
if (c == 0) {
|
||||
System.out.println("reading null bytes");
|
||||
System.exit(1);
|
||||
}
|
||||
sb.append((char) c);
|
||||
}
|
||||
}catch(IOException e){
|
||||
System.out.println("Service thread " + this.getId() + ": " + e);
|
||||
}
|
||||
|
||||
String inp = sb.toString();
|
||||
this.requestStr = inp.substring(0, inp.length() - 1).split(";");
|
||||
|
||||
// returns [0]: author, [1]: city
|
||||
return this.requestStr;
|
||||
}
|
||||
|
||||
|
||||
//Parse the request command and execute the query
|
||||
public boolean attendRequest()
|
||||
{
|
||||
boolean flagRequestAttended = true;
|
||||
|
||||
this.outcome = null;
|
||||
|
||||
String sql = "select book.title, book.publisher, book.genre, book.rrp, count(*) as \"number_available\" from bookcopy join book on bookcopy.bookid = book.bookid where\n" +
|
||||
"\tlibraryid = (select libraryid from \"library\" where city = ?) and\n" +
|
||||
"\tbookcopy.bookid in (select bookid from book where authorid = (select authorid from author where familyname = ?)) and\n" +
|
||||
"\t(onloan = false or onloan is null)\n" +
|
||||
"group by book.title, book.publisher, book.genre, book.rrp;";
|
||||
// city then author name
|
||||
|
||||
try {
|
||||
//Connet to the database
|
||||
Properties connectionProps = new Properties();
|
||||
connectionProps.put("user", USERNAME);
|
||||
connectionProps.put("password", PASSWORD);
|
||||
Connection conn = DriverManager.getConnection(URL, connectionProps);
|
||||
|
||||
//Make the query
|
||||
PreparedStatement q = conn.prepareStatement(sql);
|
||||
q.setString(1, this.requestStr[1]); // city
|
||||
q.setString(2, this.requestStr[0]); // author surname
|
||||
|
||||
//Process query
|
||||
ResultSet res = q.executeQuery();
|
||||
RowSetFactory aFactory = RowSetProvider.newFactory() ;
|
||||
CachedRowSet crs = aFactory.createCachedRowSet();
|
||||
crs.populate(res);
|
||||
outcome = crs;
|
||||
|
||||
//Clean up
|
||||
res.close();
|
||||
q.close();
|
||||
conn.close();
|
||||
|
||||
} catch (Exception e)
|
||||
{ System.out.println(e); }
|
||||
|
||||
return flagRequestAttended;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Wrap and return service outcome
|
||||
public void returnServiceOutcome(){
|
||||
try {
|
||||
//Return outcome
|
||||
ObjectOutputStream output = new ObjectOutputStream(serviceSocket.getOutputStream());
|
||||
output.writeObject(outcome);
|
||||
|
||||
System.out.println("Service thread " + this.getId() + ": Service outcome returned; " + this.outcome);
|
||||
|
||||
//Terminating connection of the service socket
|
||||
output.close();
|
||||
serviceSocket.close();
|
||||
}catch (IOException e){
|
||||
System.out.println("Service thread " + this.getId() + ": " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//The service thread run() method
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
System.out.println("\n============================================\n");
|
||||
//Retrieve the service request from the socket
|
||||
this.retrieveRequest();
|
||||
System.out.println("Service thread " + this.getId() + ": Request retrieved: "
|
||||
+ "author->" + this.requestStr[0] + "; library->" + this.requestStr[1]);
|
||||
|
||||
//Attend the request
|
||||
boolean tmp = this.attendRequest();
|
||||
|
||||
//Send back the outcome of the request
|
||||
if (!tmp)
|
||||
System.out.println("Service thread " + this.getId() + ": Unable to provide service.");
|
||||
this.returnServiceOutcome();
|
||||
|
||||
}catch (Exception e){
|
||||
System.out.println("Service thread " + this.getId() + ": " + e);
|
||||
}
|
||||
//Terminate service thread (by exiting run() method)
|
||||
System.out.println("Service thread " + this.getId() + ": Finished service.");
|
||||
}
|
||||
|
||||
}
|
11
assignment4/src/main/java/net/akpain/Credentials.java
Normal file
11
assignment4/src/main/java/net/akpain/Credentials.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package net.akpain;
|
||||
|
||||
public class Credentials {
|
||||
//JDBC connection
|
||||
public static final String USERNAME = "postgres";
|
||||
public static final String PASSWORD = "password";
|
||||
public static final String URL = "jdbc:postgresql://localhost:5432/FSAD2023_Books";
|
||||
//Client-server connection
|
||||
public static final String HOST = "127.0.0.1"; //localhost
|
||||
public static final int PORT = 9994; //This is NOT the port in postgres, but the port at which the BooksDatabaseServer is listening
|
||||
}
|
16
assignment4/src/main/resources/net/akpain/primary.fxml
Normal file
16
assignment4/src/main/resources/net/akpain/primary.fxml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
|
||||
<VBox alignment="CENTER" spacing="20.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="net.akpain.PrimaryController">
|
||||
<children>
|
||||
<Label text="Primary View" />
|
||||
<Button fx:id="primaryButton" text="Switch to Secondary View" onAction="#switchToSecondary"/>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
|
||||
</padding>
|
||||
</VBox>
|
16
assignment4/src/main/resources/net/akpain/secondary.fxml
Normal file
16
assignment4/src/main/resources/net/akpain/secondary.fxml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
|
||||
<VBox alignment="CENTER" spacing="20.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="net.akpain.SecondaryController">
|
||||
<children>
|
||||
<Label text="Secondary View" />
|
||||
<Button fx:id="secondaryButton" text="Switch to Primary View" onAction="#switchToPrimary" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
|
||||
</padding>
|
||||
</VBox>
|
Reference in a new issue