mobi_reader/MobiReader/src/mobireader/Book.java

90 lines
2.0 KiB
Java

package mobireader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.joda.time.DateTime;
/**
*
* @author att
*/
public class Book {
String title;
Author author;
DateTime timestamp;
String content = "";
String pathToContent = "";
Boolean isContentFetched = false;
public Book(String title, Author author, DateTime timestamp)
{
this.title = title;
this.author = author;
this.timestamp = timestamp;
}
public Book(String title, Author author)
{
this.title = title;
this.author = author;
this.timestamp = new DateTime();
}
public Book(String title, Author author, String pathToContent)
{
this.title = title;
this.author = author;
this.timestamp = new DateTime();
this.pathToContent = pathToContent;
}
public String getContent()
{
return this.content;
}
public String getPathToContent()
{
return this.pathToContent;
}
public Boolean isContentAvailable()
{
return isContentFetched;
}
public String getTitle()
{
return this.title;
}
public Author getAuthor()
{
return this.author;
}
public DateTime getTimestamp()
{
return this.timestamp;
}
static public Book exemplaryBook()
{
return new Book("Hakuna Matata",
new Author("Mr. Elephant", "Hakuna Matata"));
}
static public ArrayList<Book> createSomeExamples()
{
ArrayList<Book> books = new ArrayList<>();
books.add(new Book("Hakuna Matata", new Author("Mr. Elephant", "Hakuna Matata")));
books.add(new Book("Life of a star", new Author("Elvis Presley","Life of a star")));
String[] titles = {"Real physics", "Kartofle"};
books.add(new Book("Real physics", new Author("Wise old physicist",
new ArrayList<String>(Arrays.asList(titles)))));
return books;
}
}